diff options
| author | David Faure <[email protected]> | 2014-12-26 08:57:42 +0100 |
|---|---|---|
| committer | David Faure <[email protected]> | 2015-01-05 09:07:10 +0100 |
| commit | 7bd5bec21977c733dd3e1fc70f5afd66dda3ab97 (patch) | |
| tree | c05c3ecc54e25320dbd609ae65b6afdc23d07c0d /src/views/dolphinview.cpp | |
| parent | 119f7a3fce241efddc7e7f9eef8e729cf9ad35c2 (diff) | |
Dolphin: port from KonqOperations::doDrop to the new KIO::DropJob
REVIEW: 121678
Diffstat (limited to 'src/views/dolphinview.cpp')
| -rw-r--r-- | src/views/dolphinview.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index cb25c6555..32e182ce7 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -51,13 +51,13 @@ #include <KIO/JobUiDelegate> #include <KIO/NetAccess> #include <KIO/PreviewJob> +#include <KIO/DropJob> #include <KIO/PasteJob> #include <KIO/Paste> #include <KJob> #include <QMenu> #include <KMessageBox> #include <KJobWidgets> -#include <konq_operations.h> #include <QUrl> #include "dolphinnewfilemenuobserver.h" @@ -1039,22 +1039,22 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even event->mimeData(), event->buttons(), event->modifiers()); + dropUrls(destUrl, &dropEvent); - QString error; - KonqOperations* job = DragAndDropHelper::dropUrls(destItem, destUrl, &dropEvent, error); - if (!error.isEmpty()) { - emit infoMessage(error); - } + setActive(true); +} + +void DolphinView::dropUrls(const QUrl &destUrl, QDropEvent *dropEvent) +{ + KIO::DropJob* job = DragAndDropHelper::dropUrls(destUrl, dropEvent, this); if (job && destUrl == url()) { // Mark the dropped urls as selected. m_clearSelectionBeforeSelectingNewItems = true; m_markFirstNewlySelectedItemAsCurrent = true; - connect(job, &KonqOperations::itemCreated, this, &DolphinView::slotItemCreated); - //connect(job, &KIO::InteractiveDropJob::result, this, &DolphinView::slotPasteJobResult); + connect(job, &KIO::DropJob::itemCreated, this, &DolphinView::slotItemCreated); + connect(job, &KIO::DropJob::result, this, &DolphinView::slotPasteJobResult); } - - setActive(true); } void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* previous) @@ -1096,8 +1096,11 @@ void DolphinView::slotItemCreated(const QUrl& url) m_selectedUrls << url; } -void DolphinView::slotPasteJobResult(KJob *) +void DolphinView::slotPasteJobResult(KJob *job) { + if (job->error()) { + emit errorMessage(job->errorString()); + } if (!m_selectedUrls.isEmpty()) { m_selectedUrls << KDirModel::simplifiedUrlList(m_selectedUrls); } |
