]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix knewstuff popup menu position on wayland
authorElvis Angelaccio <elvis.angelaccio@kde.org>
Wed, 12 Jul 2017 10:33:54 +0000 (12:33 +0200)
committerElvis Angelaccio <elvis.angelaccio@kde.org>
Thu, 13 Jul 2017 15:30:36 +0000 (17:30 +0200)
On Wayland we need to pass a parent to popup menus.
See https://community.kde.org/Guidelines_and_HOWTOs/Wayland_Porting_Notes#Popup_Menus

So we use the new setParentWidget() method from KNewStuff (introduced in
Frameworks 5.37).

src/statusbar/statusbarspaceinfo.cpp

index 03ab247caa338e77bef205b798a74a988d0eec25..f364fcf5bc3d9ee28d2248ae85422a7e90da9021 100644 (file)
@@ -27,7 +27,7 @@
 #include <KLocalizedString>
 #include <KNS3/KMoreToolsMenuFactory>
 #include <KIO/Job>
-
+#include <knewstuff_version.h>
 
 StatusBarSpaceInfo::StatusBarSpaceInfo(QWidget* parent) :
     KCapacityBar(KCapacityBar::DrawTextInline, parent),
@@ -78,6 +78,9 @@ void StatusBarSpaceInfo::mousePressEvent(QMouseEvent* event)
         // Note that this object must live long enough in case the user opens
         // the "Configure..." dialog
         KMoreToolsMenuFactory menuFactory(QStringLiteral("dolphin/statusbar-diskspace-menu"));
+#if KNEWSTUFF_VERSION >= QT_VERSION_CHECK(5, 37, 0)
+        menuFactory.setParentWidget(this);
+#endif
         auto menu = menuFactory.createMenuFromGroupingNames(
             { "disk-usage", "more:", "disk-partitions" }, m_url);