File 0005-Route-through-an-actionId-argument.patch of Package plasma5-workspace
From 70969cb39b3482429a4973cf52625b856dec03b7 Mon Sep 17 00:00:00 2001
From: Kai Uwe Broulik <kde@privat.broulik.de>
Date: Thu, 5 Jan 2017 17:40:19 +0100
Subject: [PATCH 05/44] Route through an "actionId" argument
This way we can eventually tell KWin or the appmenu applet to highlight/open
a specific menu directly
---
appmenu/appmenu.cpp | 13 ++++---------
appmenu/appmenu.h | 4 ++--
appmenu/appmenu_dbus.cpp | 4 ++--
appmenu/appmenu_dbus.h | 6 +++---
appmenu/org.kde.kappmenu.xml | 2 ++
5 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/appmenu/appmenu.cpp b/appmenu/appmenu.cpp
index 14c3d2fe..e9d2ad18 100644
--- a/appmenu/appmenu.cpp
+++ b/appmenu/appmenu.cpp
@@ -112,7 +112,7 @@ void AppMenuModule::slotWindowRegistered(WId id, const QString &serviceName, con
#endif
}
-void AppMenuModule::slotShowMenu(int x, int y, const QString &serviceName, const QDBusObjectPath &menuObjectPath)
+void AppMenuModule::slotShowMenu(int x, int y, const QString &serviceName, const QDBusObjectPath &menuObjectPath, int actionId)
{
if (!m_menuImporter) {
return;
@@ -127,7 +127,7 @@ void AppMenuModule::slotShowMenu(int x, int y, const QString &serviceName, const
//dbus call by user (for khotkey shortcut)
if (x == -1 || y == -1) {
// We do not know kwin button position, so tell kwin to show menu
- emit showRequest(serviceName, menuObjectPath);
+ emit showRequest(serviceName, menuObjectPath, actionId);
return;
}
@@ -191,13 +191,8 @@ void AppMenuModule::hideMenu()
void AppMenuModule::itemActivationRequested(int winId, uint action)
{
- // our long-press Alt emits winid 0 and action 0
- // ignore "standard conforming" apps that send actual ids
- if (winId != 0 || action != 0) {
- return;
- }
-
- emit showRequest(message().service(), QDBusObjectPath(message().path()));
+ Q_UNUSED(winId);
+ emit showRequest(message().service(), QDBusObjectPath(message().path()), action);
}
// reload settings
diff --git a/appmenu/appmenu.h b/appmenu/appmenu.h
index 3dc93ff8..dacfd7b6 100644
--- a/appmenu/appmenu.h
+++ b/appmenu/appmenu.h
@@ -48,7 +48,7 @@ Q_SIGNALS:
/**
* We do not know where is menu decoration button, so tell kwin to show menu
*/
- void showRequest(const QString &serviceName, const QDBusObjectPath &menuObjectPath);
+ void showRequest(const QString &serviceName, const QDBusObjectPath &menuObjectPath, int actionId);
/**
* This signal is emitted whenever popup menu/menubar is shown
* Useful for decorations to know if menu button should look pressed
@@ -72,7 +72,7 @@ private Q_SLOTS:
* Show menu at QPoint(x,y) for DBus serviceName and menuObjectPath
* if x or y == -1, show in application window
*/
- void slotShowMenu(int x, int y, const QString &serviceName, const QDBusObjectPath &menuObjectPath);
+ void slotShowMenu(int x, int y, const QString &serviceName, const QDBusObjectPath &menuObjectPath, int actionId);
/**
* Reconfigure module
*/
diff --git a/appmenu/appmenu_dbus.cpp b/appmenu/appmenu_dbus.cpp
index b1420a70..1fe53431 100644
--- a/appmenu/appmenu_dbus.cpp
+++ b/appmenu/appmenu_dbus.cpp
@@ -58,9 +58,9 @@ bool AppmenuDBus::connectToBus(const QString& service, const QString& path)
return true;
}
-void AppmenuDBus::showMenu(int x, int y, const QString &serviceName, const QDBusObjectPath &menuObjectPath)
+void AppmenuDBus::showMenu(int x, int y, const QString &serviceName, const QDBusObjectPath &menuObjectPath, int actionId)
{
- emit appShowMenu(x, y, serviceName, menuObjectPath);
+ emit appShowMenu(x, y, serviceName, menuObjectPath, actionId);
}
void AppmenuDBus::reconfigure()
diff --git a/appmenu/appmenu_dbus.h b/appmenu/appmenu_dbus.h
index 7102fc6a..e1456072 100644
--- a/appmenu/appmenu_dbus.h
+++ b/appmenu/appmenu_dbus.h
@@ -49,7 +49,7 @@ public:
* DBus method showing menu at QPoint(x,y) for given DBus service name and menuObjectPath
* if x or y == -1, show in application window
*/
- void showMenu(int x, int y, const QString &serviceName, const QDBusObjectPath &menuObjectPath);
+ void showMenu(int x, int y, const QString &serviceName, const QDBusObjectPath &menuObjectPath, int actionId);
/**
* DBus method reconfiguring kded module
*/
@@ -59,7 +59,7 @@ Q_SIGNALS:
/**
* This signal is emitted on showMenu() request
*/
- void appShowMenu(int x, int y, const QString &serviceName, const QDBusObjectPath &menuObjectPath);
+ void appShowMenu(int x, int y, const QString &serviceName, const QDBusObjectPath &menuObjectPath, int actionId);
/**
* This signal is emitted on reconfigure() request
*/
@@ -70,7 +70,7 @@ Q_SIGNALS:
* This signal is emitted whenever kded want to show menu
* We do not know where is menu decoration button, so tell kwin to show menu
*/
- void showRequest(const QString &serviceName, const QDBusObjectPath &menuObjectPath);
+ void showRequest(const QString &serviceName, const QDBusObjectPath &menuObjectPath, int actionId);
/**
* This signal is emitted whenever popup menu/menubar is shown
* Useful for decorations to know if menu button should look pressed
diff --git a/appmenu/org.kde.kappmenu.xml b/appmenu/org.kde.kappmenu.xml
index 3efdc111..d29d3ee8 100644
--- a/appmenu/org.kde.kappmenu.xml
+++ b/appmenu/org.kde.kappmenu.xml
@@ -6,6 +6,7 @@
<arg name="y" type="i" direction="in"/>
<arg name="service" type="s" direction="in"/>
<arg name="objectPath" type="o" direction="in"/>
+ <arg name="actionId" type="i" direction="in"/>
</method>
<method name="reconfigure">
</method>
@@ -13,6 +14,7 @@
<signal name="showRequest">
<arg name="service" type="s" direction="out"/>
<arg name="objectPath" type="o" direction="out"/>
+ <arg name="actionId" type="i" direction="out"/>
</signal>
<signal name="menuShown">
<arg name="service" type="s" direction="out"/>
--
2.12.0