┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinviewcontainer.cpp
diff options
context:
space:
mode:
authorElvis Angelaccio <[email protected]>2017-07-12 10:40:15 +0200
committerElvis Angelaccio <[email protected]>2017-07-27 15:49:52 +0200
commitc3de867622afc7e0eaf787bf371873387a6b4451 (patch)
tree68ce2f48e8aad1973c35636f3f87c4c6685baae0 /src/dolphinviewcontainer.cpp
parentcf273cd8a90178460c29b97b115a876fbef10295 (diff)
Fix drop menu position with urlnavigator drops
Commit 1e251d2f6a in kio broke drop menus when dropping on the URL navigator (menus show up in the DolphinView rather than the URL bar). This happens because in DolphinView::dropUrls() we set `this` as the widget passed to KJobWidgets::setWindow() (in DragAndDropHelper::dropUrls()). We need to replace `this` with the actual widget that received the QDropEvent and that can mapToGlobal() the relative pos of the drop event. Unfortunately this widget is not KUrlNavigator itself, but one of its KUrlNavigatorButton children (private class, not exported). So unfortunately we need a new API in KIO that exposes this child widget. Differential Revision: https://phabricator.kde.org/D6684
Diffstat (limited to 'src/dolphinviewcontainer.cpp')
-rw-r--r--src/dolphinviewcontainer.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp
index 72ced931b..198879f37 100644
--- a/src/dolphinviewcontainer.cpp
+++ b/src/dolphinviewcontainer.cpp
@@ -29,6 +29,7 @@
#include <KFilePlacesModel>
#include <KLocalizedString>
#include <KIO/PreviewJob>
+#include <kio_version.h>
#include <KMessageWidget>
#include <KShell>
#include <QUrl>
@@ -135,8 +136,14 @@ DolphinViewContainer::DolphinViewContainer(const QUrl& url, QWidget* parent) :
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);