diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/views/dolphinview.cpp | 12 | ||||
| -rw-r--r-- | src/views/draganddrophelper.cpp | 4 | ||||
| -rw-r--r-- | src/views/draganddrophelper.h | 17 |
3 files changed, 23 insertions, 10 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 7e01b9a93..b01833d69 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -36,6 +36,7 @@ #include <KDesktopFile> #include <KDirModel> #include <KFileItemListProperties> +#include <KFilePlacesView> #include <KFormat> #include <KIO/CopyJob> #include <KIO/DeleteOrTrashJob> @@ -1426,7 +1427,16 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent *even void DolphinView::dropUrls(const QUrl &destUrl, QDropEvent *dropEvent, QWidget *dropWidget) { - KIO::DropJob *job = DragAndDropHelper::dropUrls(destUrl, dropEvent, dropWidget); + KIO::DropJobFlags dropjobFlags; +#if KIO_VERSION >= QT_VERSION_CHECK(6, 23, 0) + if (qobject_cast<KFilePlacesView *>(dropEvent->source())) { + // this drop comes from Places View so we want to avoid + // potentially destructive Move-like plugins actions + dropjobFlags |= KIO::DropJobFlag::ExcludePluginsActions; + } +#endif + + KIO::DropJob *job = DragAndDropHelper::dropUrls(destUrl, dropEvent, dropWidget, dropjobFlags); if (job) { connect(job, &KIO::DropJob::result, this, &DolphinView::slotJobResult); diff --git a/src/views/draganddrophelper.cpp b/src/views/draganddrophelper.cpp index a98483a79..125e4e79c 100644 --- a/src/views/draganddrophelper.cpp +++ b/src/views/draganddrophelper.cpp @@ -34,7 +34,7 @@ bool DragAndDropHelper::urlListMatchesUrl(const QList<QUrl> &urls, const QUrl &d return *m_urlListMatchesUrlCache.insert(destUrl, destUrlMatches); } -KIO::DropJob *DragAndDropHelper::dropUrls(const QUrl &destUrl, QDropEvent *event, QWidget *window) +KIO::DropJob *DragAndDropHelper::dropUrls(const QUrl &destUrl, QDropEvent *event, QWidget *window, KIO::DropJobFlags dropjobFlags) { const QMimeData *mimeData = event->mimeData(); if (isArkDndMimeType(mimeData)) { @@ -53,7 +53,7 @@ KIO::DropJob *DragAndDropHelper::dropUrls(const QUrl &destUrl, QDropEvent *event } // Drop into a directory or a desktop-file - KIO::DropJob *job = KIO::drop(event, destUrl); + KIO::DropJob *job = KIO::drop(event, destUrl, dropjobFlags); KJobWidgets::setWindow(job, window); return job; } diff --git a/src/views/draganddrophelper.h b/src/views/draganddrophelper.h index 73043febc..45f7e5dc9 100644 --- a/src/views/draganddrophelper.h +++ b/src/views/draganddrophelper.h @@ -11,6 +11,7 @@ #include "dolphin_export.h" #include <KFileItem> +#include <KIO/DropJob> #include <QList> #include <QString> @@ -33,14 +34,16 @@ public: * offered to the user. The drag destination must represent a directory or * a desktop-file, otherwise the dropping gets ignored. * - * @param destUrl URL of the item destination. Is used only if destItem::isNull() - * is true. - * @param event Drop event. - * @param window Widget where the drop happened, will be used as parent of the drop menu. - * @return KIO::DropJob pointer or null in case the destUrl is contained - * in the mimeData url list. + * @param destUrl URL of the item destination. Is used only if destItem::isNull() + * is true. + * @param event Drop event. + * @param window Widget where the drop happened, will be used as parent of the drop menu. + * @param dropjobFlags Additional KIO::DropJobFlags passed to KIO::drop + * @return KIO::DropJob pointer or null in case the destUrl is contained + * in the mimeData url list. */ - static KIO::DropJob *dropUrls(const QUrl &destUrl, QDropEvent *event, QWidget *window); + static KIO::DropJob * + dropUrls(const QUrl &destUrl, QDropEvent *event, QWidget *window, KIO::DropJobFlags dropjobFlags = KIO::DropJobFlag::DropJobDefaultFlags); /** * Checks if the destination supports dropping. |
