-public:
- DragAndDropHelper instance;
-};
-K_GLOBAL_STATIC(DragAndDropHelperSingleton, s_dragAndDropHelper)
-
-DragAndDropHelper& DragAndDropHelper::instance()
-{
- return s_dragAndDropHelper->instance;
-}
-
-bool DragAndDropHelper::isMimeDataSupported(const QMimeData* mimeData) const
-{
- return mimeData->hasUrls() || mimeData->hasFormat("application/x-kde-dndextract");
-}
-
-void DragAndDropHelper::startDrag(QAbstractItemView* itemView,
- Qt::DropActions supportedActions,
- DolphinViewController* dolphinViewController)
-{
- // Do not start a new drag until the previous one has been finished.
- // This is a (possibly temporary) fix for bug #187884.
- static bool isDragging = false;
- if (isDragging) {
- return;
- }
- isDragging = true;
-
- const QModelIndexList indexes = itemView->selectionModel()->selectedIndexes();
- if (!indexes.isEmpty()) {
- QMimeData *data = itemView->model()->mimeData(indexes);
- if (data == 0) {
- return;
- }
-
- if (dolphinViewController != 0) {
- dolphinViewController->requestToolTipHiding();
- }
-
- QDrag* drag = new QDrag(itemView);
- drag->setPixmap(createDragPixmap(itemView));
- drag->setMimeData(data);
-
- m_dragSource = itemView;
- drag->exec(supportedActions, Qt::IgnoreAction);
- m_dragSource = 0;
- }
- isDragging = false;
+ return std::find_if(urls.constBegin(), urls.constEnd(), [destUrl](const QUrl& url) {
+ return url.matches(destUrl, QUrl::StripTrailingSlash);
+ }) != urls.constEnd();