commit:     9277805e61e6c5580c31cad8d2cfc7de686ce692
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 28 22:04:46 2020 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Sep 29 12:45:27 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9277805e

kde-frameworks/kdeclarative: Fix assign Alt-based keyboard shortcuts

...which also trigger buttons in the KCM.

Upstream commit 88aabf069a0e454777c15227126732a04c8cb8b2

KDE-Bug: https://bugs.kde.org/show_bug.cgi?id=425979
Package-Manager: Portage-3.0.8, Repoman-3.0.1
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 ...ck-shortcuts-when-recording-key-sequences.patch | 104 +++++++++++++++++++++
 .../kdeclarative/kdeclarative-5.74.0-r1.ebuild     |  39 ++++++++
 2 files changed, 143 insertions(+)

diff --git 
a/kde-frameworks/kdeclarative/files/kdeclarative-5.74.0-block-shortcuts-when-recording-key-sequences.patch
 
b/kde-frameworks/kdeclarative/files/kdeclarative-5.74.0-block-shortcuts-when-recording-key-sequences.patch
new file mode 100644
index 00000000000..66808f910bf
--- /dev/null
+++ 
b/kde-frameworks/kdeclarative/files/kdeclarative-5.74.0-block-shortcuts-when-recording-key-sequences.patch
@@ -0,0 +1,104 @@
+From 88aabf069a0e454777c15227126732a04c8cb8b2 Mon Sep 17 00:00:00 2001
+From: David Edmundson <[email protected]>
+Date: Fri, 18 Sep 2020 00:13:07 +0100
+Subject: [PATCH] Block shortcuts when recording key sequences
+
+Otherwise you can't select alt+a as a shortcut without triggering the
+nmenomic generated shortcut on the "add application" button.
+
+Testing done:
+- clicked "Add custom shortcut", pressed alt+a, it was recorded
+successfully
+
+- focussed "Add custom shortcut", pressed alt+a, the relevant shortcut
+activated
+
+Note that isRecording was already declared, but not defined, which is
+why it looks like my diff misses something.
+
+BUG: 425979
+---
+ src/qmlcontrols/kquickcontrols/KeySequenceItem.qml        | 7 +++++++
+ .../kquickcontrols/private/keysequencehelper.cpp          | 8 +++++++-
+ .../kquickcontrols/private/keysequencehelper.h            | 7 +++++++
+ 3 files changed, 21 insertions(+), 1 deletion(-)
+
+diff --git a/src/qmlcontrols/kquickcontrols/KeySequenceItem.qml 
b/src/qmlcontrols/kquickcontrols/KeySequenceItem.qml
+index 9d8e035..d1fbc02 100644
+--- a/src/qmlcontrols/kquickcontrols/KeySequenceItem.qml
++++ b/src/qmlcontrols/kquickcontrols/KeySequenceItem.qml
+@@ -83,6 +83,13 @@ RowLayout {
+             }
+         }
+ 
++        Keys.onShortcutOverride: {
++            if (_helper.isRecording) {
++                _helper.keyPressed(event.key, event.modifiers);
++                event.accepted = true;
++            }
++        }
++
+         Keys.onPressed: {
+             _helper.keyPressed(event.key, event.modifiers);
+             event.accepted = true;
+diff --git a/src/qmlcontrols/kquickcontrols/private/keysequencehelper.cpp 
b/src/qmlcontrols/kquickcontrols/private/keysequencehelper.cpp
+index ba7ce01..26b0331 100644
+--- a/src/qmlcontrols/kquickcontrols/private/keysequencehelper.cpp
++++ b/src/qmlcontrols/kquickcontrols/private/keysequencehelper.cpp
+@@ -237,7 +237,10 @@ void 
KeySequenceHelper::setCheckAgainstShortcutTypes(KeySequenceHelper::Shortcut
+     Q_EMIT checkAgainstShortcutTypesChanged();
+ }
+ 
+-
++bool KeySequenceHelper::isRecording() const
++{
++    return d->isRecording;
++}
+ 
+ void KeySequenceHelper::clearKeySequence()
+ {
+@@ -251,6 +254,7 @@ void KeySequenceHelperPrivate::startRecording()
+     oldKeySequence = keySequence;
+     keySequence = QKeySequence();
+     isRecording = true;
++    emit q->isRecordingChanged();
+     grabbedWindow = QQuickRenderControl::renderWindowFor(q->window());
+     if (!grabbedWindow) {
+         grabbedWindow = q->window();
+@@ -265,6 +269,8 @@ void KeySequenceHelper::doneRecording()
+ {
+     d->modifierlessTimeout.stop();
+     d->isRecording = false;
++    emit isRecordingChanged();
++
+     d->stealActions.clear();
+     if (d->grabbedWindow) {
+         d->grabbedWindow->setKeyboardGrabEnabled(false);
+diff --git a/src/qmlcontrols/kquickcontrols/private/keysequencehelper.h 
b/src/qmlcontrols/kquickcontrols/private/keysequencehelper.h
+index c9068e8..daeedc5 100644
+--- a/src/qmlcontrols/kquickcontrols/private/keysequencehelper.h
++++ b/src/qmlcontrols/kquickcontrols/private/keysequencehelper.h
+@@ -51,6 +51,12 @@ class KeySequenceHelper : public QQuickItem
+         NOTIFY checkAgainstShortcutTypesChanged
+     )
+ 
++    Q_PROPERTY(
++        bool isRecording
++        READ isRecording
++        NOTIFY isRecordingChanged
++    )
++
+ public:
+ 
+     enum ShortcutType {
+@@ -116,6 +122,7 @@ Q_SIGNALS:
+     void shortcutDisplayChanged(const QString &string);
+     void captureFinished();
+     void checkAgainstShortcutTypesChanged();
++    void isRecordingChanged();
+ 
+ public Q_SLOTS:
+     void captureKeySequence();
+-- 
+GitLab
+

diff --git a/kde-frameworks/kdeclarative/kdeclarative-5.74.0-r1.ebuild 
b/kde-frameworks/kdeclarative/kdeclarative-5.74.0-r1.ebuild
new file mode 100644
index 00000000000..6e28a831ed9
--- /dev/null
+++ b/kde-frameworks/kdeclarative/kdeclarative-5.74.0-r1.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+ECM_TEST="false"
+PVCUT=$(ver_cut 1-2)
+QTMIN=5.14.2
+inherit ecm kde.org
+
+DESCRIPTION="Framework providing integration of QML and KDE work spaces"
+LICENSE="LGPL-2+"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
+IUSE=""
+
+# drop qtgui subslot operator when QT_MINIMAL >= 5.15.0
+DEPEND="
+       >=dev-qt/qtdeclarative-${QTMIN}:5
+       >=dev-qt/qtgui-${QTMIN}:5=
+       >=dev-qt/qtnetwork-${QTMIN}:5
+       >=dev-qt/qtwidgets-${QTMIN}:5
+       =kde-frameworks/kconfig-${PVCUT}*:5
+       =kde-frameworks/kcoreaddons-${PVCUT}*:5
+       =kde-frameworks/kglobalaccel-${PVCUT}*:5
+       =kde-frameworks/ki18n-${PVCUT}*:5
+       =kde-frameworks/kiconthemes-${PVCUT}*:5
+       =kde-frameworks/kio-${PVCUT}*:5
+       =kde-frameworks/knotifications-${PVCUT}*:5
+       =kde-frameworks/kpackage-${PVCUT}*:5
+       =kde-frameworks/kservice-${PVCUT}*:5
+       =kde-frameworks/kwidgetsaddons-${PVCUT}*:5
+       =kde-frameworks/kwindowsystem-${PVCUT}*:5
+       media-libs/libepoxy
+"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-block-shortcuts-when-recording-key-sequences.patch
+)

Reply via email to