commit:     be8d5d31fabe30019827aba39e50153a58a3f395
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 29 19:35:11 2022 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Wed Jun 29 19:53:17 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=be8d5d31

kde-frameworks/kglobalaccel: Fix D-Bus de/marshalling MatchType

Upstream commit 1a8e8cb00cda5807926a90ae8e5d5597354f3541
KDE-bug: https://bugs.kde.org/show_bug.cgi?id=454704

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 ...accel-5.95.0-fix-shortcut-conflict-dialog.patch | 151 +++++++++++++++++++++
 .../kglobalaccel/kglobalaccel-5.95.0-r1.ebuild     |  46 +++++++
 2 files changed, 197 insertions(+)

diff --git 
a/kde-frameworks/kglobalaccel/files/kglobalaccel-5.95.0-fix-shortcut-conflict-dialog.patch
 
b/kde-frameworks/kglobalaccel/files/kglobalaccel-5.95.0-fix-shortcut-conflict-dialog.patch
new file mode 100644
index 000000000000..c39f30d86d3c
--- /dev/null
+++ 
b/kde-frameworks/kglobalaccel/files/kglobalaccel-5.95.0-fix-shortcut-conflict-dialog.patch
@@ -0,0 +1,151 @@
+From 1a8e8cb00cda5807926a90ae8e5d5597354f3541 Mon Sep 17 00:00:00 2001
+From: Ahmad Samir <a.samir...@gmail.com>
+Date: Sat, 4 Jun 2022 23:00:15 +0200
+Subject: [PATCH] Fix D-Bus de/marshalling KGlobalAccel::MatchType
+
+Otherwise the globalShortcutsByKey() method is silently skipped, and isn't
+visible on the org.kde.KGlobalAccel D-Bus interface.
+
+It turns out that to test changes made in kglobalaccel d-bus interface, you
+need to kill the system /usr/bin/kglobalaccel process (be careful as that
+breaks the most basic shortcuts, e.g. Alt+Tab), and run the one from the
+build-dir, otherwise the session d-bus won't pick up your changes.
+
+To test:
+- List all methods on the interface:
+  `qdbus org.kde.kglobalaccel /kglobalaccel`
+- The followin messages are printed in the system log/journal:
+Skipped method "globalShortcutsByKey" : Unregistered input type in parameter 
list: KGlobalAccel::MatchType
+Skipped method "globalShortcutsByKey" : Unregistered input type in parameter 
list: KGlobalAccel::MatchType
+
+To see the behaviour mentioned in the bug report:
+- Create a global shortcut of some kind (e.g. F4 to start some app)
+- open the shortcut editor in e.g. Dolphin, and try to assign that same
+  shortcut to some other action the conflict shortcut message dialog should
+  show a message similar to the one in the attached screenshot at:
+  https://bugs.kde.org/show_bug.cgi?id=454704#c0
+The list of GlobalShortcutInfo returned by globalShortcutsByKey() is empty
+because the method couldn't be found on the d-bus interface.
+
+After applying patch:
+- kill the system /usr/bin/kglobalaccel and start the one from the build
+  dir
+- Start Dolphin with the libs from the build-dir e.g.:
+  LD_LIBRARY_PATH=build-dir/bin/ dolphin
+- The info about the global shortcut should be shown in the message dialog
+
+BUG: 454704
+FIXED-IN: 5.95
+---
+ src/kglobalaccel.cpp          | 19 +++++++++++++++++++
+ src/kglobalaccel.h            |  3 +++
+ src/kglobalshortcutinfo_p.h   |  1 +
+ src/org.kde.KGlobalAccel.xml  |  3 ++-
+ src/runtime/kglobalacceld.cpp |  4 ++--
+ 5 files changed, 27 insertions(+), 3 deletions(-)
+
+diff --git a/src/kglobalaccel.cpp b/src/kglobalaccel.cpp
+index d0d2932..ef51b56 100644
+--- a/src/kglobalaccel.cpp
++++ b/src/kglobalaccel.cpp
+@@ -147,6 +147,7 @@ KGlobalAccel::KGlobalAccel()
+     qDBusRegisterMetaType<QList<QStringList>>();
+     qDBusRegisterMetaType<KGlobalShortcutInfo>();
+     qDBusRegisterMetaType<QList<KGlobalShortcutInfo>>();
++    qDBusRegisterMetaType<KGlobalAccel::MatchType>();
+ }
+ 
+ KGlobalAccel::~KGlobalAccel()
+@@ -785,4 +786,22 @@ bool KGlobalAccelPrivate::setShortcutWithDefault(QAction 
*action, const QList<QK
+     return true;
+ }
+ 
++QDBusArgument &operator<<(QDBusArgument &argument, const 
KGlobalAccel::MatchType &type)
++{
++    argument.beginStructure();
++    argument << static_cast<int>(type);
++    argument.endStructure();
++    return argument;
++}
++
++const QDBusArgument &operator>>(const QDBusArgument &argument, 
KGlobalAccel::MatchType &type)
++{
++    argument.beginStructure();
++    int arg;
++    argument >> arg;
++    type = static_cast<KGlobalAccel::MatchType>(arg);
++    argument.endStructure();
++    return argument;
++}
++
+ #include "moc_kglobalaccel.cpp"
+diff --git a/src/kglobalaccel.h b/src/kglobalaccel.h
+index 563278b..a74a311 100644
+--- a/src/kglobalaccel.h
++++ b/src/kglobalaccel.h
+@@ -400,4 +400,7 @@ private:
+     friend class KGlobalAccelSingleton;
+ };
+ 
++KGLOBALACCEL_EXPORT QDBusArgument &operator<<(QDBusArgument &argument, const 
KGlobalAccel::MatchType &type);
++KGLOBALACCEL_EXPORT const QDBusArgument &operator>>(const QDBusArgument 
&argument, KGlobalAccel::MatchType &type);
++
+ #endif // _KGLOBALACCEL_H_
+diff --git a/src/kglobalshortcutinfo_p.h b/src/kglobalshortcutinfo_p.h
+index 4b9146f..b3fa620 100644
+--- a/src/kglobalshortcutinfo_p.h
++++ b/src/kglobalshortcutinfo_p.h
+@@ -13,6 +13,7 @@
+ 
+ static const int maxSequenceLength = 4;
+ 
++#include "kglobalaccel.h"
+ #include "kglobalshortcutinfo.h"
+ 
+ class KGlobalShortcutInfoPrivate
+diff --git a/src/org.kde.KGlobalAccel.xml b/src/org.kde.KGlobalAccel.xml
+index 65f93b8..d48ce87 100644
+--- a/src/org.kde.KGlobalAccel.xml
++++ b/src/org.kde.KGlobalAccel.xml
+@@ -121,7 +121,8 @@
+       <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" 
value="QList&lt;KGlobalShortcutInfo&gt;"/>
+       <arg name="key" type="ai" direction="in"/>
+       <annotation name="org.qtproject.QtDBus.QtTypeName.In0" 
value="QKeySequence"/>
+-      <arg name="type" type="i" direction="in"/>
++      <arg name="matchType" type="KGlobalAccel::MatchType" direction="in"/>
++      <annotation name="org.qtproject.QtDBus.QtTypeName.In1" 
value="KGlobalAccel::MatchType"/>
+     </method>
+     <method name="globalShortcutAvailable">
+       <arg type="b" direction="out"/>
+diff --git a/src/runtime/kglobalacceld.cpp b/src/runtime/kglobalacceld.cpp
+index cf22d26..e14d419 100644
+--- a/src/runtime/kglobalacceld.cpp
++++ b/src/runtime/kglobalacceld.cpp
+@@ -13,6 +13,7 @@
+ #include "globalshortcut.h"
+ #include "globalshortcutcontext.h"
+ #include "globalshortcutsregistry.h"
++#include "kglobalaccel.h"
+ #include "kserviceactioncomponent.h"
+ #include "logging_p.h"
+ 
+@@ -21,8 +22,6 @@
+ #include <QMetaMethod>
+ #include <QTimer>
+ 
+-#include "kglobalaccel.h"
+-
+ struct KGlobalAccelDPrivate {
+     KGlobalAccelDPrivate(KGlobalAccelD *qq)
+         : q(qq)
+@@ -175,6 +174,7 @@ bool KGlobalAccelD::init()
+     qDBusRegisterMetaType<QStringList>();
+     qDBusRegisterMetaType<KGlobalShortcutInfo>();
+     qDBusRegisterMetaType<QList<KGlobalShortcutInfo>>();
++    qDBusRegisterMetaType<KGlobalAccel::MatchType>();
+ 
+     GlobalShortcutsRegistry *reg = GlobalShortcutsRegistry::self();
+     Q_ASSERT(reg);
+-- 
+GitLab
+

diff --git a/kde-frameworks/kglobalaccel/kglobalaccel-5.95.0-r1.ebuild 
b/kde-frameworks/kglobalaccel/kglobalaccel-5.95.0-r1.ebuild
new file mode 100644
index 000000000000..28733db44c48
--- /dev/null
+++ b/kde-frameworks/kglobalaccel/kglobalaccel-5.95.0-r1.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PVCUT=$(ver_cut 1-2)
+QTMIN=5.15.3
+VIRTUALX_REQUIRED="test"
+inherit ecm kde.org
+
+DESCRIPTION="Framework to handle global shortcuts"
+
+LICENSE="LGPL-2+"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86"
+IUSE="nls"
+
+# requires installed instance
+RESTRICT="test"
+
+RDEPEND="
+       >=dev-qt/qtdbus-${QTMIN}:5
+       >=dev-qt/qtgui-${QTMIN}:5
+       >=dev-qt/qtwidgets-${QTMIN}:5
+       >=dev-qt/qtx11extras-${QTMIN}:5
+       =kde-frameworks/kconfig-${PVCUT}*:5
+       =kde-frameworks/kcoreaddons-${PVCUT}*:5
+       =kde-frameworks/kcrash-${PVCUT}*:5
+       =kde-frameworks/kdbusaddons-${PVCUT}*:5
+       =kde-frameworks/kwindowsystem-${PVCUT}*:5[X]
+       x11-libs/libxcb
+       x11-libs/xcb-util-keysyms
+"
+DEPEND="${RDEPEND}
+       test? (
+               >=dev-qt/qtdeclarative-${QTMIN}:5
+               >=dev-qt/qtquickcontrols2-${QTMIN}:5
+               =kde-frameworks/kdeclarative-${PVCUT}*:5
+       )
+"
+BDEPEND="nls? ( >=dev-qt/linguist-tools-${QTMIN}:5 )"
+
+PATCHES=( "${FILESDIR}/${P}-fix-shortcut-conflict-dialog.patch" )
+
+src_test() {
+       XDG_CURRENT_DESKTOP="KDE" ecm_src_test # bug 789342
+}

Reply via email to