summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Uwe Broulik <[email protected]>2017-06-22 10:20:31 +0200
committerKai Uwe Broulik <[email protected]>2017-06-22 10:21:11 +0200
commit92a7089e9a103e5c7f93a46aaf67b01460dd8cb0 (patch)
tree950dd3889e5669d522bf5a4982915a1cb9bb9957
parentefac82ad54475bca82d259507d4fe7735ae0b671 (diff)
[AppMenu Applet] Wire up DBusMenuImporter::actionActivationRequested
Ensures that pressing e.g. Alt+F will popup the "File" menu. BUG: 376726 FIXED-IN: 5.10.3 Differential Revision: https://phabricator.kde.org/D6336
-rw-r--r--applets/appmenu/package/contents/ui/main.qml1
-rw-r--r--applets/appmenu/plugin/appmenumodel.cpp8
-rw-r--r--applets/appmenu/plugin/appmenumodel.h3
3 files changed, 12 insertions, 0 deletions
diff --git a/applets/appmenu/package/contents/ui/main.qml b/applets/appmenu/package/contents/ui/main.qml
index 5799b4b..fdb0b86 100644
--- a/applets/appmenu/package/contents/ui/main.qml
+++ b/applets/appmenu/package/contents/ui/main.qml
@@ -115,6 +115,7 @@ Item {
AppMenuPrivate.AppMenuModel {
id: appMenuModel
+ onRequestActivateIndex: plasmoid.nativeInterface.requestActivateIndex(index)
Component.onCompleted: {
plasmoid.nativeInterface.model = appMenuModel
}
diff --git a/applets/appmenu/plugin/appmenumodel.cpp b/applets/appmenu/plugin/appmenumodel.cpp
index 62f6e80..808c75f 100644
--- a/applets/appmenu/plugin/appmenumodel.cpp
+++ b/applets/appmenu/plugin/appmenumodel.cpp
@@ -259,5 +259,13 @@ void AppMenuModel::updateApplicationMenu(const QString &serviceName, const QStri
setMenuAvailable(true);
emit modelNeedsUpdate();
});
+
+ connect(m_importer.data(), &DBusMenuImporter::actionActivationRequested, this, [this](QAction *action) {
+ // TODO submenus
+ auto it = std::find(m_activeActions.constBegin(), m_activeActions.constEnd(), action);
+ if (it != m_activeActions.constEnd()) {
+ requestActivateIndex(it - m_activeActions.constBegin());
+ }
+ });
}
diff --git a/applets/appmenu/plugin/appmenumodel.h b/applets/appmenu/plugin/appmenumodel.h
index 77ad5e9..1338a71 100644
--- a/applets/appmenu/plugin/appmenumodel.h
+++ b/applets/appmenu/plugin/appmenumodel.h
@@ -53,6 +53,9 @@ public:
bool menuAvailable() const;
void setMenuAvailable(bool set);
+signals:
+ void requestActivateIndex(int index);
+
private Q_SLOTS:
void onActiveWindowChanged(WId id);
void update();