2 * SPDX-FileCopyrightText: 2007-2011 Peter Penz <peter.penz19@gmail.com>
3 * SPDX-FileCopyrightText: 2007 David Faure <faure@kde.org>
5 * SPDX-License-Identifier: GPL-2.0-or-later
8 #ifndef DRAGANDDROPHELPER_H
9 #define DRAGANDDROPHELPER_H
11 #include "dolphin_export.h"
20 namespace KIO
{ class DropJob
; }
22 class DOLPHIN_EXPORT DragAndDropHelper
26 * Handles the dropping of URLs to the given destination. A context menu
27 * with the options 'Move Here', 'Copy Here', 'Link Here' and 'Cancel' is
28 * offered to the user. The drag destination must represent a directory or
29 * a desktop-file, otherwise the dropping gets ignored.
31 * @param destUrl URL of the item destination. Is used only if destItem::isNull()
33 * @param event Drop event.
34 * @param window Widget where the drop happened, will be used as parent of the drop menu.
35 * @return KIO::DropJob pointer or null in case the destUrl is contained
36 * in the mimeData url list.
38 static KIO::DropJob
* dropUrls(const QUrl
& destUrl
,
43 * @return True if destUrl is contained in the urls parameter.
45 static bool urlListMatchesUrl(const QList
<QUrl
>& urls
, const QUrl
& destUrl
);
48 * @return True if mimeData contains Ark's drag and drop mime types.
50 static bool isArkDndMimeType(const QMimeData
*mimeData
);
51 static QString
arkDndServiceMimeType() { return QStringLiteral("application/x-kde-ark-dndextract-service"); }
52 static QString
arkDndPathMimeType() { return QStringLiteral("application/x-kde-ark-dndextract-path"); }
55 * clear the internal cache.
57 static void clearUrlListMatchesUrlCache();
60 * Stores the results of the expensive checks made in urlListMatchesUrl.
62 static QHash
<QUrl
, bool> m_urlListMatchesUrlCache
;