X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/d0f0f1f2e2644e3738c03374d062dab9acc61eaf..c725848709:/src/views/dolphinview.cpp diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 00281af73..4129cc217 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -51,13 +51,13 @@ #include #include #include +#include #include #include #include #include #include #include -#include #include #include "dolphinnewfilemenuobserver.h" @@ -1039,22 +1039,25 @@ 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); +} - 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); - } +void DolphinView::dropUrls(const QUrl &destUrl, QDropEvent *dropEvent) +{ + KIO::DropJob* job = DragAndDropHelper::dropUrls(destUrl, dropEvent, this); - setActive(true); + if (job) { + connect(job, &KIO::DropJob::result, this, &DolphinView::slotPasteJobResult); + + if (destUrl == url()) { + // Mark the dropped urls as selected. + m_clearSelectionBeforeSelectingNewItems = true; + m_markFirstNewlySelectedItemAsCurrent = true; + connect(job, &KIO::DropJob::itemCreated, this, &DolphinView::slotItemCreated); + } + } } void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* previous) @@ -1096,8 +1099,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); } @@ -1698,7 +1704,8 @@ void DolphinView::updateWritableState() if (item.isNull()) { // Try to find out if the URL is writable even if the "root item" is // null, see https://bugs.kde.org/show_bug.cgi?id=330001 - item = KFileItem(KFileItem::Unknown, KFileItem::Unknown, url(), true); + item = KFileItem(url()); + item.setDelayedMimeTypes(true); } KFileItemListProperties capabilities(KFileItemList() << item);