Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.3:Rings:2-TestDVD
plasma5-workspace
0044-Activation-support-in-appmenu.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0044-Activation-support-in-appmenu.patch of Package plasma5-workspace
From 7d10d0b2ff1fe3c3738c838554cc192ac34de7ef Mon Sep 17 00:00:00 2001 From: Fabian Vogt <fabian@ritter-vogt.de> Date: Thu, 23 Mar 2017 10:34:50 +0100 Subject: [PATCH 44/44] Activation support in appmenu Based off d_ed's experiment. Seems to work, but not tested well enough yet. --- applets/appmenu/package/contents/ui/main.qml | 11 ++++++++++- applets/appmenu/plugin/appmenumodel.cpp | 7 +++++++ applets/appmenu/plugin/appmenumodel.h | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/applets/appmenu/package/contents/ui/main.qml b/applets/appmenu/package/contents/ui/main.qml index 5799b4bb..f2eb5ce8 100644 --- a/applets/appmenu/package/contents/ui/main.qml +++ b/applets/appmenu/package/contents/ui/main.qml @@ -80,7 +80,6 @@ Item { Connections { target: plasmoid.nativeInterface onRequestActivateIndex: { - var idx = Math.max(0, Math.min(buttonRepeater.count - 1, index)) var button = buttonRepeater.itemAt(index) if (button) { button.clicked() @@ -88,6 +87,16 @@ Item { } } + Connections { + target: appMenuModel + onModelItemActivated: { + var button = buttonRepeater.itemAt(row) + if (button) { + button.clicked() + } + } + } + Repeater { id: buttonRepeater model: appMenuModel diff --git a/applets/appmenu/plugin/appmenumodel.cpp b/applets/appmenu/plugin/appmenumodel.cpp index 62f6e80d..08cae4c7 100644 --- a/applets/appmenu/plugin/appmenumodel.cpp +++ b/applets/appmenu/plugin/appmenumodel.cpp @@ -243,6 +243,13 @@ void AppMenuModel::updateApplicationMenu(const QString &serviceName, const QStri m_importer = new KDBusMenuImporter(serviceName, menuObjectPath, this); QMetaObject::invokeMethod(m_importer, "updateMenu", Qt::QueuedConnection); + connect(m_importer.data(), &DBusMenuImporter::actionActivationRequested, this, [=](QAction *action) { + int idx = m_activeActions.indexOf(action); + if (idx >= 0) { + emit modelItemActivated(idx); + } + }); + connect(m_importer.data(), &DBusMenuImporter::menuUpdated, this, [=](QMenu *menu) { m_menu = m_importer->menu(); if (m_menu.isNull() || menu != m_menu) { diff --git a/applets/appmenu/plugin/appmenumodel.h b/applets/appmenu/plugin/appmenumodel.h index 77ad5e9d..565ea931 100644 --- a/applets/appmenu/plugin/appmenumodel.h +++ b/applets/appmenu/plugin/appmenumodel.h @@ -60,6 +60,7 @@ private Q_SLOTS: signals: void menuAvailableChanged(); void modelNeedsUpdate(); + void modelItemActivated(int row); private: bool m_menuAvailable; -- 2.12.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor