From 7bd5bec21977c733dd3e1fc70f5afd66dda3ab97 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 26 Dec 2014 08:57:42 +0100 Subject: Dolphin: port from KonqOperations::doDrop to the new KIO::DropJob REVIEW: 121678 --- src/panels/folders/folderspanel.cpp | 8 ++++---- src/panels/places/placespanel.cpp | 23 ++++++----------------- 2 files changed, 10 insertions(+), 21 deletions(-) (limited to 'src/panels') diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index f56f5a139..b83e950e5 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -239,10 +240,9 @@ void FoldersPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* eve event->buttons(), event->modifiers()); - QString error; - DragAndDropHelper::dropUrls(destItem, destItem.url(), &dropEvent, error); - if (!error.isEmpty()) { - emit errorMessage(error); + KIO::DropJob *job = DragAndDropHelper::dropUrls(destItem.url(), &dropEvent, this); + if (job) { + connect(job, &KIO::DropJob::result, this, [this](KJob *job) { if (job->error()) emit errorMessage(job->errorString()); }); } } } diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index b04191f1c..631b6b69d 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -375,11 +376,7 @@ void PlacesPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even event->buttons(), event->modifiers()); - QString error; - DragAndDropHelper::dropUrls(KFileItem(), destUrl, &dropEvent, error); - if (!error.isEmpty()) { - emit errorMessage(error); - } + slotUrlsDropped(destUrl, &dropEvent, this); } void PlacesPanel::slotItemDropEventStorageSetupDone(int index, bool success) @@ -390,12 +387,7 @@ void PlacesPanel::slotItemDropEventStorageSetupDone(int index, bool success) if ((index == m_itemDropEventIndex) && m_itemDropEvent && m_itemDropEventMimeData) { if (success) { QUrl destUrl = m_model->placesItem(index)->url(); - - QString error; - DragAndDropHelper::dropUrls(KFileItem(), destUrl, m_itemDropEvent, error); - if (!error.isEmpty()) { - emit errorMessage(error); - } + slotUrlsDropped(destUrl, m_itemDropEvent, this); } delete m_itemDropEventMimeData; @@ -414,13 +406,10 @@ void PlacesPanel::slotAboveItemDropEvent(int index, QGraphicsSceneDragDropEvent* void PlacesPanel::slotUrlsDropped(const QUrl& dest, QDropEvent* event, QWidget* parent) { - Q_UNUSED(parent); - QString error; - DragAndDropHelper::dropUrls(KFileItem(), dest, event, error); - if (!error.isEmpty()) { - emit errorMessage(error); + KIO::DropJob *job = DragAndDropHelper::dropUrls(dest, event, parent); + if (job) { + connect(job, &KIO::DropJob::result, this, [this](KJob *job) { if (job->error()) emit errorMessage(job->errorString()); }); } - } void PlacesPanel::slotTrashUpdated(KJob* job) -- cgit v1.3