diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp --- a/src/dolphintabwidget.cpp +++ b/src/dolphintabwidget.cpp @@ -284,7 +284,7 @@ { if (index >= 0) { DolphinView* view = tabPageAt(index)->activeViewContainer()->view(); - view->dropUrls(view->url(), event); + view->dropUrls(view->url(), event, view); } } diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -135,8 +136,14 @@ this, &DolphinViewContainer::slotUrlNavigatorLocationChanged); connect(m_urlNavigator, &KUrlNavigator::returnPressed, this, &DolphinViewContainer::slotReturnPressed); - connect(m_urlNavigator, &KUrlNavigator::urlsDropped, - m_view, &DolphinView::dropUrls); + connect(m_urlNavigator, &KUrlNavigator::urlsDropped, this, [=](const QUrl &destination, QDropEvent *event) { +#if KIO_VERSION >= QT_VERSION_CHECK(5, 37, 0) + m_view->dropUrls(destination, event, m_urlNavigator->dropWidget()); +#else + // TODO: remove as soon as we can hard-depend of KF5 >= 5.37 + m_view->dropUrls(destination, event, m_view); +#endif + }); // Initialize status bar m_statusBar = new DolphinStatusBar(this); diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -363,9 +363,9 @@ void pasteIntoFolder(); /** - * Handles a drop of @p dropEvent onto @p destUrl + * Handles a drop of @p dropEvent onto widget @p dropWidget and destination @p destUrl */ - void dropUrls(const QUrl &destUrl, QDropEvent *dropEvent); + void dropUrls(const QUrl &destUrl, QDropEvent *dropEvent, QWidget *dropWidget); void stopLoading(); diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1051,14 +1051,14 @@ event->mimeData(), event->buttons(), event->modifiers()); - dropUrls(destUrl, &dropEvent); + dropUrls(destUrl, &dropEvent, this); setActive(true); } -void DolphinView::dropUrls(const QUrl &destUrl, QDropEvent *dropEvent) +void DolphinView::dropUrls(const QUrl &destUrl, QDropEvent *dropEvent, QWidget *dropWidget) { - KIO::DropJob* job = DragAndDropHelper::dropUrls(destUrl, dropEvent, this); + KIO::DropJob* job = DragAndDropHelper::dropUrls(destUrl, dropEvent, dropWidget); if (job) { connect(job, &KIO::DropJob::result, this, &DolphinView::slotPasteJobResult); diff --git a/src/views/draganddrophelper.h b/src/views/draganddrophelper.h --- a/src/views/draganddrophelper.h +++ b/src/views/draganddrophelper.h @@ -41,7 +41,7 @@ * @param destUrl URL of the item destination. Is used only if destItem::isNull() * is true. * @param event Drop event. - * @param window Associated widget. + * @param window Widget where the drop happened, will be used as parent of the drop menu. * @return KIO::DropJob pointer */ static KIO::DropJob* dropUrls(const QUrl& destUrl,