summaryrefslogtreecommitdiff
path: root/kde-frameworks/kxmlgui/files/kxmlgui-5.54.0-kcheckaccelerators.patch
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-01-31 16:00:27 +0000
committerV3n3RiX <venerix@redcorelinux.org>2019-01-31 16:00:27 +0000
commit1db00cc6e94b90c08090bb5b8c406622946c4ae5 (patch)
treec34bf820c2809fb7e08ed5564df2a25cf759516f /kde-frameworks/kxmlgui/files/kxmlgui-5.54.0-kcheckaccelerators.patch
parent693cc9b6e847a01c1bb692153021aaf9fb0fab25 (diff)
gentoo resync 31.01.2019
Diffstat (limited to 'kde-frameworks/kxmlgui/files/kxmlgui-5.54.0-kcheckaccelerators.patch')
-rw-r--r--kde-frameworks/kxmlgui/files/kxmlgui-5.54.0-kcheckaccelerators.patch79
1 files changed, 79 insertions, 0 deletions
diff --git a/kde-frameworks/kxmlgui/files/kxmlgui-5.54.0-kcheckaccelerators.patch b/kde-frameworks/kxmlgui/files/kxmlgui-5.54.0-kcheckaccelerators.patch
new file mode 100644
index 000000000000..0882d5f09f9c
--- /dev/null
+++ b/kde-frameworks/kxmlgui/files/kxmlgui-5.54.0-kcheckaccelerators.patch
@@ -0,0 +1,79 @@
+From 02b523bad09aab062355e46771889b0f3709692f Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aacid@kde.org>
+Date: Sat, 12 Jan 2019 18:39:33 +0100
+Subject: Make KCheckAccelerators less invasive for apps that don't directly
+ link to KXmlGui
+
+Summary: BUGS: 337491
+
+Test Plan:
+Ran qtcreator and it no longer has the & in Details
+Added some debug and checked that okular still gets the code called
+
+Reviewers: anthonyfieroni
+
+Reviewed By: anthonyfieroni
+
+Subscribers: davidedmundson, anthonyfieroni, kde-frameworks-devel
+
+Tags: #frameworks
+
+Differential Revision: https://phabricator.kde.org/D18204
+---
+ src/kcheckaccelerators.cpp | 38 ++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 36 insertions(+), 2 deletions(-)
+
+diff --git a/src/kcheckaccelerators.cpp b/src/kcheckaccelerators.cpp
+index 13fc012..e08447d 100644
+--- a/src/kcheckaccelerators.cpp
++++ b/src/kcheckaccelerators.cpp
+@@ -80,10 +80,44 @@ public Q_SLOTS:
+
+ static void startupFunc()
+ {
+- // Call initiateIfNeeded once we're in the event loop
+- // This is to prevent using KSharedConfig before main() can set the app name
++ // Static because in some cases this is called multiple times
++ // but if an application had any of the bad cases we always want
++ // to skip the check
++ static bool doCheckAccelerators = true;
++
++ if (!doCheckAccelerators) {
++ return;
++ }
++
+ QCoreApplication *app = QCoreApplication::instance();
++ if (!app) {
++ // We're being loaded by something that doesn't have a QCoreApplication
++ // this would probably crash at some later point since we do use qApp->
++ // quite a lot, so skip the magic
++ doCheckAccelerators = false;
++ return;
++ }
++
++ if (!QCoreApplication::startingUp()) {
++ // If the app has already started, this means we're not being run as part of
++ // qt_call_pre_routines, which most probably means that we're being run as part
++ // of KXmlGui being loaded as part of some plugin of the app, so don't
++ // do any magic
++ doCheckAccelerators = false;
++ return;
++ }
++
++ if (!QCoreApplication::eventDispatcher()) {
++ // We are called with event dispatcher being null when KXmlGui is being loaded
++ // through plasma-integration instead of being linked to the app (i.e. QtCreator vs Okular)
++ // For apps that don't link directly to KXmlGui do not do the accelerator magic
++ doCheckAccelerators = false;
++ return;
++ }
++
+ KCheckAcceleratorsInitializer *initializer = new KCheckAcceleratorsInitializer(app);
++ // Call initiateIfNeeded once we're in the event loop
++ // This is to prevent using KSharedConfig before main() can set the app name
+ QMetaObject::invokeMethod(initializer, "initiateIfNeeded", Qt::QueuedConnection);
+ }
+
+--
+cgit v1.1
+