Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package kglobalaccel for openSUSE:Factory 
checked in at 2022-08-15 19:57:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/kglobalaccel (Old)
 and      /work/SRC/openSUSE:Factory/.kglobalaccel.new.1521 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kglobalaccel"

Mon Aug 15 19:57:20 2022 rev:110 rq:994973 version:5.97.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/kglobalaccel/kglobalaccel.changes        
2022-07-11 19:09:59.503660500 +0200
+++ /work/SRC/openSUSE:Factory/.kglobalaccel.new.1521/kglobalaccel.changes      
2022-08-15 19:59:19.149243967 +0200
@@ -1,0 +2,13 @@
+Sun Aug  7 22:27:24 UTC 2022 - Christophe Giboudeaux <christo...@krop.fr>
+
+- Update to 5.97.0
+  * New feature release
+  * For more details please see:
+  * https://kde.org/announcements/frameworks/5/5.97.0
+- Changes since 5.96.0:
+  * Add a clang-format commit to blame ignore file
+  * Minor code optimisation
+  * GlobalShortcutsRegistry: don't use a QHash for a couple of elements
+  * General code cleanup
+
+-------------------------------------------------------------------

Old:
----
  kglobalaccel-5.96.0.tar.xz
  kglobalaccel-5.96.0.tar.xz.sig

New:
----
  kglobalaccel-5.97.0.tar.xz
  kglobalaccel-5.97.0.tar.xz.sig

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ kglobalaccel.spec ++++++
--- /var/tmp/diff_new_pack.7aGB45/_old  2022-08-15 19:59:19.597245216 +0200
+++ /var/tmp/diff_new_pack.7aGB45/_new  2022-08-15 19:59:19.601245227 +0200
@@ -17,14 +17,14 @@
 
 
 %define lname   libKF5GlobalAccel5
-%define _tar_path 5.96
+%define _tar_path 5.97
 # Full KF5 version (e.g. 5.33.0)
 %{!?_kf5_version: %global _kf5_version %{version}}
 # Last major and minor KF5 version (e.g. 5.33)
 %{!?_kf5_bugfix_version: %define _kf5_bugfix_version %(echo %{_kf5_version} | 
awk -F. '{print $1"."$2}')}
 %bcond_without released
 Name:           kglobalaccel
-Version:        5.96.0
+Version:        5.97.0
 Release:        0
 Summary:        Global desktop keyboard shortcuts
 License:        LGPL-2.1-or-later


++++++ kglobalaccel-5.96.0.tar.xz -> kglobalaccel-5.97.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kglobalaccel-5.96.0/.git-blame-ignore-revs 
new/kglobalaccel-5.97.0/.git-blame-ignore-revs
--- old/kglobalaccel-5.96.0/.git-blame-ignore-revs      2022-07-02 
17:52:05.000000000 +0200
+++ new/kglobalaccel-5.97.0/.git-blame-ignore-revs      2022-08-07 
15:24:11.000000000 +0200
@@ -1,2 +1,5 @@
 #clang-tidy
 9be9b195a8cda0e9b55f76289a417310fd8da3d0
+
+#clang-format
+522f4f65b80ab4e3dc5f6e116ac9aa5ddd91dc59
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kglobalaccel-5.96.0/CMakeLists.txt 
new/kglobalaccel-5.97.0/CMakeLists.txt
--- old/kglobalaccel-5.96.0/CMakeLists.txt      2022-07-02 17:52:05.000000000 
+0200
+++ new/kglobalaccel-5.97.0/CMakeLists.txt      2022-08-07 15:24:11.000000000 
+0200
@@ -1,12 +1,12 @@
 cmake_minimum_required(VERSION 3.16)
 
-set(KF_VERSION "5.96.0") # handled by release scripts
-set(KF_DEP_VERSION "5.96.0") # handled by release scripts
+set(KF_VERSION "5.97.0") # handled by release scripts
+set(KF_DEP_VERSION "5.97.0") # handled by release scripts
 project(KGlobalAccel VERSION ${KF_VERSION})
 
 # ECM setup
 include(FeatureSummary)
-find_package(ECM 5.96.0  NO_MODULE)
+find_package(ECM 5.97.0  NO_MODULE)
 set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake 
Modules." URL "https://commits.kde.org/extra-cmake-modules";)
 feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND 
FATAL_ON_MISSING_REQUIRED_PACKAGES)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kglobalaccel-5.96.0/po/se/kglobalaccel5_qt.po 
new/kglobalaccel-5.97.0/po/se/kglobalaccel5_qt.po
--- old/kglobalaccel-5.96.0/po/se/kglobalaccel5_qt.po   2022-07-02 
17:52:05.000000000 +0200
+++ new/kglobalaccel-5.97.0/po/se/kglobalaccel5_qt.po   2022-08-07 
15:24:11.000000000 +0200
@@ -20,13 +20,13 @@
 "X-Text-Markup: qtrich\n"
 "X-Qt-Contexts: true\n"
 
-#: kglobalaccel.cpp:606
+#: kglobalaccel.cpp:607
 #, fuzzy
 msgctxt "KGlobalAccel|"
 msgid "Conflict with Global Shortcut"
 msgstr "G??vdno juo glob??la njuolggob??lggisin"
 
-#: kglobalaccel.cpp:607
+#: kglobalaccel.cpp:608
 #, fuzzy, qt-format
 msgctxt "KGlobalAccel|"
 msgid ""
@@ -37,25 +37,25 @@
 "??%1?? boallokombina??uvdna geavahuvvo juo almmola?? ??%2?? doibmii 
??%3:s??.\n"
 "H??liidatgo liikk?? bidjat dan kombina??uvnna dan o????a doibmii?"
 
-#: kglobalaccel.cpp:615 kglobalaccel.cpp:648
+#: kglobalaccel.cpp:616 kglobalaccel.cpp:649
 #, fuzzy
 msgctxt "KGlobalAccel|"
 msgid "Reassign"
 msgstr "Bija o????asit"
 
-#: kglobalaccel.cpp:634
+#: kglobalaccel.cpp:635
 #, fuzzy, qt-format
 msgctxt "KGlobalAccel|"
 msgid "The '%1' key combination is registered by application %2 for action %3:"
 msgstr "??%1??-boallokombina??uvdna geavahuvvo %2-progr??mmas %3-doaimmas:"
 
-#: kglobalaccel.cpp:638
+#: kglobalaccel.cpp:639
 #, fuzzy, qt-format
 msgctxt "KGlobalAccel|"
 msgid "In context '%1' for action '%2'\n"
 msgstr "??%1??-oktavuo??as ??%2??-doibmii\n"
 
-#: kglobalaccel.cpp:640
+#: kglobalaccel.cpp:641
 #, fuzzy, qt-format
 msgctxt "KGlobalAccel|"
 msgid ""
@@ -65,7 +65,7 @@
 "??%1??-boallokombina??uvdna geavahuvvo %2-progr??mmas.\n"
 "%3"
 
-#: kglobalaccel.cpp:643
+#: kglobalaccel.cpp:644
 #, fuzzy
 msgctxt "KGlobalAccel|"
 msgid "Conflict With Registered Global Shortcut"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kglobalaccel-5.96.0/po/zh_CN/kglobalaccel5_qt.po 
new/kglobalaccel-5.97.0/po/zh_CN/kglobalaccel5_qt.po
--- old/kglobalaccel-5.96.0/po/zh_CN/kglobalaccel5_qt.po        2022-07-02 
17:52:05.000000000 +0200
+++ new/kglobalaccel-5.97.0/po/zh_CN/kglobalaccel5_qt.po        2022-08-07 
15:24:11.000000000 +0200
@@ -1,17 +1,9 @@
-# translation of kdelibs4.po to Chinese Simplified
-# Copyright (C) 2007 Free Software Foundation, Inc.
-#
-# Lie Ex <lilith...@gmail.com> 2007-2011.
-# Wang Jian <l...@linux.ustc.edu.cn>, 1998.
-# Sarah Smith <sar...@redhat.com>, 2002.
-# Xiong Jiang <jxi...@offtopic.org>, 2002,2003,2004.
-# Funda Wang <fundaw...@linux.net.cn>, 2002,2003,2004.
-# Liang Qi <cavendish...@gmail.com>, 2007.
-# Feng Chao <chaofeng...@gmail.com>, 2010, 2012, 2014.
-# Ni Hui <shuizhuyuan...@126.com>, 2010, 2011, 2012.
-# Weng Xuetian <wen...@gmail.com>, 2011, 2012, 2013, 2015.
 msgid ""
 msgstr ""
+"Project-Id-Version: kdeorg\n"
+"PO-Revision-Date: 2022-07-30 15:54\n"
+"Language-Team: Chinese Simplified\n"
+"Language: zh_CN\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
@@ -22,10 +14,6 @@
 "X-Crowdin-Language: zh-CN\n"
 "X-Crowdin-File: /kf5-trunk/messages/kglobalaccel/kglobalaccel5_qt.pot\n"
 "X-Crowdin-File-ID: 5543\n"
-"Project-Id-Version: kdeorg\n"
-"Language-Team: Chinese Simplified\n"
-"Language: zh_CN\n"
-"PO-Revision-Date: 2022-07-02 10:59\n"
 
 #: kglobalaccel.cpp:607
 msgctxt "KGlobalAccel|"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kglobalaccel-5.96.0/src/runtime/component.cpp 
new/kglobalaccel-5.97.0/src/runtime/component.cpp
--- old/kglobalaccel-5.96.0/src/runtime/component.cpp   2022-07-02 
17:52:05.000000000 +0200
+++ new/kglobalaccel-5.97.0/src/runtime/component.cpp   2022-08-07 
15:24:11.000000000 +0200
@@ -103,7 +103,7 @@
 
 void Component::activateShortcuts()
 {
-    for (GlobalShortcut *shortcut : std::as_const(_current->_actions)) {
+    for (GlobalShortcut *shortcut : std::as_const(_current->_actionsMap)) {
         shortcut->setActive();
     }
 }
@@ -111,30 +111,22 @@
 QList<GlobalShortcut *> Component::allShortcuts(const QString &contextName) 
const
 {
     GlobalShortcutContext *context = _contexts.value(contextName);
-    if (context) {
-        return context->_actions.values();
-    } else {
-        return QList<GlobalShortcut *>();
-    }
+    return context ? context->_actionsMap.values() : QList<GlobalShortcut *>{};
 }
 
 QList<KGlobalShortcutInfo> Component::allShortcutInfos(const QString 
&contextName) const
 {
     GlobalShortcutContext *context = _contexts.value(contextName);
-    if (!context) {
-        return QList<KGlobalShortcutInfo>();
-    }
-
-    return context->allShortcutInfos();
+    return context ? context->allShortcutInfos() : 
QList<KGlobalShortcutInfo>{};
 }
 
 bool Component::cleanUp()
 {
     bool changed = false;
 
-    const auto actions = _current->_actions;
+    const auto actions = _current->_actionsMap;
     for (GlobalShortcut *shortcut : actions) {
-        qCDebug(KGLOBALACCELD) << _current->_actions.size();
+        qCDebug(KGLOBALACCELD) << _current->_actionsMap.size();
         if (!shortcut->isPresent()) {
             changed = true;
             shortcut->unRegister();
@@ -176,14 +168,14 @@
         }
     }
     // QDBusObjectPath could be a little bit easier to handle :-)
-    return QDBusObjectPath(_registry->dbusPath().path() + "component/" + 
dbusPath);
+    return QDBusObjectPath(_registry->dbusPath().path() + 
QLatin1String("component/") + dbusPath);
 }
 
 void Component::deactivateShortcuts(bool temporarily)
 {
-    for (GlobalShortcut *shortcut : std::as_const(_current->_actions)) {
+    for (GlobalShortcut *shortcut : std::as_const(_current->_actionsMap)) {
         if (temporarily //
-            && uniqueName() == QLatin1String("kwin") //
+            && _uniqueName == QLatin1String("kwin") //
             && shortcut->uniqueName() == QLatin1String("Block Global 
Shortcuts")) {
             continue;
         }
@@ -195,7 +187,7 @@
 {
 #if HAVE_X11
     // pass X11 timestamp
-    long timestamp = QX11Info::appTime();
+    const long timestamp = QX11Info::appTime();
     // Make sure kglobalacceld has ungrabbed the keyboard after receiving the
     // keypress, otherwise actions in application that try to grab the
     // keyboard (e.g. in kwin) may fail to do so. There is still a small race
@@ -204,7 +196,7 @@
         _registry->_manager->syncWindowingSystem();
     }
 #else
-    long timestamp = 0;
+    const long timestamp = 0;
 #endif
 
     if (shortcut.context()->component() != this) {
@@ -218,7 +210,7 @@
 {
 #if HAVE_X11
     // pass X11 timestamp
-    long timestamp = QX11Info::appTime();
+    const long timestamp = QX11Info::appTime();
     // Make sure kglobalacceld has ungrabbed the keyboard after receiving the
     // keypress, otherwise actions in application that try to grab the
     // keyboard (e.g. in kwin) may fail to do so. There is still a small race
@@ -227,7 +219,7 @@
         _registry->_manager->syncWindowingSystem();
     }
 #else
-    long timestamp = 0;
+    const long timestamp = 0;
 #endif
 
     if (shortcut.context()->component() != this) {
@@ -247,10 +239,7 @@
 
 QString Component::friendlyName() const
 {
-    if (_friendlyName.isEmpty()) {
-        return _uniqueName;
-    }
-    return _friendlyName;
+    return !_friendlyName.isEmpty() ? _friendlyName : _uniqueName;
 }
 
 GlobalShortcut *Component::getShortcutByKey(const QKeySequence &key, 
KGlobalAccel::MatchType type) const
@@ -272,11 +261,8 @@
 
 GlobalShortcut *Component::getShortcutByName(const QString &uniqueName, const 
QString &context) const
 {
-    if (!_contexts.value(context)) {
-        return nullptr;
-    }
-
-    return _contexts.value(context)->_actions.value(uniqueName);
+    const GlobalShortcutContext *shortcutContext = _contexts.value(context);
+    return shortcutContext ? shortcutContext->_actionsMap.value(uniqueName) : 
nullptr;
 }
 
 QStringList Component::getShortcutContexts() const
@@ -288,7 +274,7 @@
 {
     // The component is active if at least one of it's global shortcuts is
     // present.
-    for (GlobalShortcut *shortcut : std::as_const(_current->_actions)) {
+    for (GlobalShortcut *shortcut : std::as_const(_current->_actionsMap)) {
         if (shortcut->isPresent()) {
             return true;
         }
@@ -303,18 +289,12 @@
     // if this component asks for the key. only check the keys in the same
     // context
     if (component == uniqueName()) {
-        const auto actions = shortcutContext(context)->_actions;
-        for (GlobalShortcut *sc : actions) {
-            if (matchSequences(key, sc->keys())) {
-                return false;
-            }
-        }
+        return shortcutContext(context)->isShortcutAvailable(key);
     } else {
-        for (GlobalShortcutContext *ctx : std::as_const(_contexts)) {
-            for (GlobalShortcut *sc : std::as_const(ctx->_actions)) {
-                if (matchSequences(key, sc->keys())) {
-                    return false;
-                }
+        for (auto it = _contexts.cbegin(), endIt = _contexts.cend(); it != 
endIt; ++it) {
+            const GlobalShortcutContext *ctx = it.value();
+            if (!ctx->isShortcutAvailable(key)) {
+                return false;
             }
         }
     }
@@ -379,12 +359,8 @@
 
 QStringList Component::shortcutNames(const QString &contextName) const
 {
-    GlobalShortcutContext *context = _contexts.value(contextName);
-    if (!context) {
-        return QStringList();
-    }
-
-    return context->_actions.keys();
+    const GlobalShortcutContext *context = _contexts.value(contextName);
+    return context ? context->_actionsMap.keys() : QStringList{};
 }
 
 QString Component::uniqueName() const
@@ -396,8 +372,8 @@
 {
     // Now wrote all contexts
     for (GlobalShortcutContext *context : std::as_const(_contexts)) {
-        if (context->_actions.value(uniqueName)) {
-            delete context->takeShortcut(context->_actions.value(uniqueName));
+        if (context->_actionsMap.value(uniqueName)) {
+            delete 
context->takeShortcut(context->_actionsMap.value(uniqueName));
         }
     }
 }
@@ -424,7 +400,7 @@
 
         // qCDebug(KGLOBALACCELD) << "writing group " << _uniqueName << ":" << 
context->uniqueName();
 
-        for (const GlobalShortcut *shortcut : 
std::as_const(context->_actions)) {
+        for (const GlobalShortcut *shortcut : 
std::as_const(context->_actionsMap)) {
             // qCDebug(KGLOBALACCELD) << "writing" << shortcut->uniqueName();
 
             // We do not write fresh shortcuts.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kglobalaccel-5.96.0/src/runtime/globalshortcut.cpp 
new/kglobalaccel-5.97.0/src/runtime/globalshortcut.cpp
--- old/kglobalaccel-5.96.0/src/runtime/globalshortcut.cpp      2022-07-02 
17:52:05.000000000 +0200
+++ new/kglobalaccel-5.97.0/src/runtime/globalshortcut.cpp      2022-08-07 
15:24:11.000000000 +0200
@@ -19,11 +19,6 @@
     : _isPresent(false)
     , _isRegistered(false)
     , _isFresh(true)
-    , _context(nullptr)
-    , _uniqueName()
-    , _friendlyName()
-    , _keys()
-    , _defaultKeys()
 {
 }
 
@@ -34,8 +29,6 @@
     , _context(context)
     , _uniqueName(uniqueName)
     , _friendlyName(friendlyName)
-    , _keys()
-    , _defaultKeys()
 {
     context->addShortcut(this);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kglobalaccel-5.96.0/src/runtime/globalshortcut.h 
new/kglobalaccel-5.97.0/src/runtime/globalshortcut.h
--- old/kglobalaccel-5.96.0/src/runtime/globalshortcut.h        2022-07-02 
17:52:05.000000000 +0200
+++ new/kglobalaccel-5.97.0/src/runtime/globalshortcut.h        2022-08-07 
15:24:11.000000000 +0200
@@ -92,7 +92,7 @@
     bool _isFresh : 1;
 
     //! The context the shortcut belongs too
-    GlobalShortcutContext *_context;
+    GlobalShortcutContext *_context = nullptr;
 
     QString _uniqueName;
     QString _friendlyName; // usually localized
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kglobalaccel-5.96.0/src/runtime/globalshortcutcontext.cpp 
new/kglobalaccel-5.97.0/src/runtime/globalshortcutcontext.cpp
--- old/kglobalaccel-5.96.0/src/runtime/globalshortcutcontext.cpp       
2022-07-02 17:52:05.000000000 +0200
+++ new/kglobalaccel-5.97.0/src/runtime/globalshortcutcontext.cpp       
2022-08-07 15:24:11.000000000 +0200
@@ -16,25 +16,24 @@
     : _uniqueName(uniqueName)
     , _friendlyName(friendlyName)
     , _component(component)
-    , _actions()
 {
 }
 
 GlobalShortcutContext::~GlobalShortcutContext()
 {
-    qDeleteAll(_actions);
-    _actions.clear();
+    qDeleteAll(_actionsMap);
+    _actionsMap.clear();
 }
 
 void GlobalShortcutContext::addShortcut(GlobalShortcut *shortcut)
 {
-    _actions.insert(shortcut->uniqueName(), shortcut);
+    _actionsMap.insert(shortcut->uniqueName(), shortcut);
 }
 
 QList<KGlobalShortcutInfo> GlobalShortcutContext::allShortcutInfos() const
 {
     QList<KGlobalShortcutInfo> rc;
-    for (GlobalShortcut *shortcut : std::as_const(_actions)) {
+    for (GlobalShortcut *shortcut : std::as_const(_actionsMap)) {
         rc.append(static_cast<KGlobalShortcutInfo>(*shortcut));
     }
     return rc;
@@ -61,7 +60,7 @@
         return nullptr;
     }
     QKeySequence keyMangled = mangleKey(key);
-    for (GlobalShortcut *sc : std::as_const(_actions)) {
+    for (GlobalShortcut *sc : std::as_const(_actionsMap)) {
         const auto keys = sc->keys();
         for (const QKeySequence &other : keys) {
             QKeySequence otherMangled = mangleKey(other);
@@ -91,10 +90,21 @@
 {
     // Try to take the shortcut. Result could be nullptr if the shortcut 
doesn't
     // belong to this component.
-    return _actions.take(shortcut->uniqueName());
+    return _actionsMap.take(shortcut->uniqueName());
 }
 
 QString GlobalShortcutContext::uniqueName() const
 {
     return _uniqueName;
 }
+
+bool GlobalShortcutContext::isShortcutAvailable(const QKeySequence &key) const
+{
+    for (auto it = _actionsMap.cbegin(), endIt = _actionsMap.cend(); it != 
endIt; ++it) {
+        const GlobalShortcut *sc = it.value();
+        if (matchSequences(key, sc->keys())) {
+            return false;
+        }
+    }
+    return true;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kglobalaccel-5.96.0/src/runtime/globalshortcutcontext.h 
new/kglobalaccel-5.97.0/src/runtime/globalshortcutcontext.h
--- old/kglobalaccel-5.96.0/src/runtime/globalshortcutcontext.h 2022-07-02 
17:52:05.000000000 +0200
+++ new/kglobalaccel-5.97.0/src/runtime/globalshortcutcontext.h 2022-08-07 
15:24:11.000000000 +0200
@@ -58,6 +58,10 @@
     //! Remove @p shortcut from the context. The shortcut is not deleted.
     GlobalShortcut *takeShortcut(GlobalShortcut *shortcut);
 
+    // Returns true if key is not used by any global shortcuts in this context,
+    // otherwise returns false
+    bool isShortcutAvailable(const QKeySequence &key) const;
+
 private:
     friend class KdeDGlobalAccel::Component;
 
@@ -67,11 +71,11 @@
     //! The unique name for this context
     QString _friendlyName;
 
-    //! The component the context belongs too
-    KdeDGlobalAccel::Component *_component;
+    //! The component the context belongs to
+    KdeDGlobalAccel::Component *_component = nullptr;
 
     //! The actions associated with this context
-    QHash<QString, GlobalShortcut *> _actions;
+    QHash<QString, GlobalShortcut *> _actionsMap;
 };
 
 #endif /* #ifndef GLOBALSHORTCUTCONTEXT_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kglobalaccel-5.96.0/src/runtime/globalshortcutsregistry.cpp 
new/kglobalaccel-5.97.0/src/runtime/globalshortcutsregistry.cpp
--- old/kglobalaccel-5.96.0/src/runtime/globalshortcutsregistry.cpp     
2022-07-02 17:52:05.000000000 +0200
+++ new/kglobalaccel-5.97.0/src/runtime/globalshortcutsregistry.cpp     
2022-08-07 15:24:11.000000000 +0200
@@ -74,9 +74,6 @@
 
 GlobalShortcutsRegistry::GlobalShortcutsRegistry()
     : QObject()
-    , _active_keys()
-    , _active_sequence()
-    , _components()
     , _manager(loadPlugin(this))
     , _config(qEnvironmentVariableIsSet("KGLOBALACCEL_TEST_MODE") ? QString() 
: QStringLiteral("kglobalshortcutsrc"), KConfig::SimpleConfig)
 {
@@ -107,14 +104,22 @@
     _keys_count.clear();
 }
 
+static std::vector<KdeDGlobalAccel::Component *>::const_iterator 
findByName(const std::vector<KdeDGlobalAccel::Component *> &components, const 
QString &name)
+{
+    return std::find_if(components.cbegin(), components.cend(), [&name](const 
KdeDGlobalAccel::Component *comp) {
+        return comp->uniqueName() == name;
+    });
+}
+
 KdeDGlobalAccel::Component 
*GlobalShortcutsRegistry::addComponent(KdeDGlobalAccel::Component *component)
 {
-    if (_components.value(component->uniqueName())) {
-        Q_ASSERT_X(false, "GlobalShortcutsRegistry::addComponent", "component 
already registered?!?!");
-        return _components.value(component->uniqueName());
+    auto it = findByName(m_components, component->uniqueName());
+    if (it != m_components.cend()) {
+        Q_ASSERT_X(false, "GlobalShortcutsRegistry::addComponent", "component 
already registered");
+        return *it;
     }
 
-    _components.insert(component->uniqueName(), component);
+    m_components.push_back(component);
     QDBusConnection conn(QDBusConnection::sessionBus());
 
     conn.registerObject(component->dbusPath().path(), component, 
QDBusConnection::ExportScriptableContents);
@@ -123,22 +128,20 @@
 
 void GlobalShortcutsRegistry::activateShortcuts()
 {
-    for (KdeDGlobalAccel::Component *component : std::as_const(_components)) {
+    for (KdeDGlobalAccel::Component *component : m_components) {
         component->activateShortcuts();
     }
 }
 
-QList<KdeDGlobalAccel::Component *> 
GlobalShortcutsRegistry::allMainComponents() const
+const std::vector<KdeDGlobalAccel::Component *> 
&GlobalShortcutsRegistry::allMainComponents() const
 {
-    return _components.values();
+    return m_components;
 }
 
 void GlobalShortcutsRegistry::clear()
 {
-    for (KdeDGlobalAccel::Component *component : std::as_const(_components)) {
-        delete component;
-    }
-    _components.clear();
+    qDeleteAll(m_components);
+    m_components.clear();
 
     // The shortcuts should have deregistered themselves
     Q_ASSERT(_active_keys.isEmpty());
@@ -151,19 +154,20 @@
 
 void GlobalShortcutsRegistry::deactivateShortcuts(bool temporarily)
 {
-    for (KdeDGlobalAccel::Component *component : std::as_const(_components)) {
+    for (KdeDGlobalAccel::Component *component : m_components) {
         component->deactivateShortcuts(temporarily);
     }
 }
 
 KdeDGlobalAccel::Component *GlobalShortcutsRegistry::getComponent(const 
QString &uniqueName)
 {
-    return _components.value(uniqueName);
+    auto it = findByName(m_components, uniqueName);
+    return it != m_components.cend() ? *it : nullptr;
 }
 
 GlobalShortcut *GlobalShortcutsRegistry::getShortcutByKey(const QKeySequence 
&key, KGlobalAccel::MatchType type) const
 {
-    for (KdeDGlobalAccel::Component *component : std::as_const(_components)) {
+    for (KdeDGlobalAccel::Component *component : m_components) {
         GlobalShortcut *rc = component->getShortcutByKey(key, type);
         if (rc) {
             return rc;
@@ -175,24 +179,20 @@
 QList<GlobalShortcut *> GlobalShortcutsRegistry::getShortcutsByKey(const 
QKeySequence &key, KGlobalAccel::MatchType type) const
 {
     QList<GlobalShortcut *> rc;
-
-    for (KdeDGlobalAccel::Component *component : std::as_const(_components)) {
+    for (KdeDGlobalAccel::Component *component : m_components) {
         rc = component->getShortcutsByKey(key, type);
         if (!rc.isEmpty()) {
             return rc;
         }
     }
-    return rc;
+    return {};
 }
 
 bool GlobalShortcutsRegistry::isShortcutAvailable(const QKeySequence 
&shortcut, const QString &componentName, const QString &contextName) const
 {
-    for (KdeDGlobalAccel::Component *component : std::as_const(_components)) {
-        if (!component->isShortcutAvailable(shortcut, componentName, 
contextName)) {
-            return false;
-        }
-    }
-    return true;
+    return std::all_of(m_components.cbegin(), m_components.cend(), [&shortcut, 
&componentName, &contextName](const KdeDGlobalAccel::Component *component) {
+        return component->isShortcutAvailable(shortcut, componentName, 
contextName);
+    });
 }
 
 Q_GLOBAL_STATIC(GlobalShortcutsRegistry, _self)
@@ -370,7 +370,8 @@
         const QStringList patterns = {QStringLiteral("*.desktop")};
         const auto lstDesktopFiles = dir.entryList(patterns);
         for (const QString &desktopFile : lstDesktopFiles) {
-            if (_components.contains(desktopFile)) {
+            auto it = findByName(m_components, desktopFile);
+            if (it != m_components.cend()) {
                 continue;
             }
 
@@ -465,7 +466,14 @@
 {
     QDBusConnection conn(QDBusConnection::sessionBus());
     conn.unregisterObject(component->dbusPath().path());
-    return _components.take(component->uniqueName());
+
+    KdeDGlobalAccel::Component *retComponent = nullptr;
+    auto it = findByName(m_components, component->uniqueName());
+    if (it != m_components.cend()) {
+        retComponent = *it;
+        m_components.erase(it);
+    }
+    return retComponent;
 }
 
 void GlobalShortcutsRegistry::ungrabKeys()
@@ -524,7 +532,7 @@
 
 void GlobalShortcutsRegistry::writeSettings() const
 {
-    const auto lst = GlobalShortcutsRegistry::self()->allMainComponents();
+    const auto &lst = GlobalShortcutsRegistry::self()->allMainComponents();
     for (const KdeDGlobalAccel::Component *component : lst) {
         KConfigGroup configGroup(&_config, component->uniqueName());
         if (component->allShortcuts().isEmpty()) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kglobalaccel-5.96.0/src/runtime/globalshortcutsregistry.h 
new/kglobalaccel-5.97.0/src/runtime/globalshortcutsregistry.h
--- old/kglobalaccel-5.96.0/src/runtime/globalshortcutsregistry.h       
2022-07-02 17:52:05.000000000 +0200
+++ new/kglobalaccel-5.97.0/src/runtime/globalshortcutsregistry.h       
2022-08-07 15:24:11.000000000 +0200
@@ -62,7 +62,7 @@
     /**
      * Return a list of all main components
      */
-    QList<KdeDGlobalAccel::Component *> allMainComponents() const;
+    const std::vector<KdeDGlobalAccel::Component *> &allMainComponents() const;
 
     /**
      * Return the root dbus path for the registry.
@@ -143,9 +143,9 @@
     QHash<QKeySequence, GlobalShortcut *> _active_keys;
     QKeySequence _active_sequence;
     QHash<int, int> _keys_count;
-    QHash<QString, KdeDGlobalAccel::Component *> _components;
+    std::vector<KdeDGlobalAccel::Component *> m_components;
 
-    KGlobalAccelInterface *_manager;
+    KGlobalAccelInterface *_manager = nullptr;
 
     mutable KConfig _config;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kglobalaccel-5.96.0/src/runtime/kglobalaccel_interface.cpp 
new/kglobalaccel-5.97.0/src/runtime/kglobalaccel_interface.cpp
--- old/kglobalaccel-5.96.0/src/runtime/kglobalaccel_interface.cpp      
2022-07-02 17:52:05.000000000 +0200
+++ new/kglobalaccel-5.97.0/src/runtime/kglobalaccel_interface.cpp      
2022-08-07 15:24:11.000000000 +0200
@@ -24,9 +24,7 @@
 {
 }
 
-KGlobalAccelInterface::~KGlobalAccelInterface()
-{
-}
+KGlobalAccelInterface::~KGlobalAccelInterface() = default;
 
 void KGlobalAccelInterface::setRegistry(GlobalShortcutsRegistry *registry)
 {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kglobalaccel-5.96.0/src/runtime/kglobalacceld.cpp 
new/kglobalaccel-5.97.0/src/runtime/kglobalacceld.cpp
--- old/kglobalaccel-5.96.0/src/runtime/kglobalacceld.cpp       2022-07-02 
17:52:05.000000000 +0200
+++ new/kglobalaccel-5.97.0/src/runtime/kglobalacceld.cpp       2022-08-07 
15:24:11.000000000 +0200
@@ -43,11 +43,11 @@
     void splitComponent(QString &component, QString &context) const
     {
         context = QStringLiteral("default");
-        if (component.indexOf('|') != -1) {
-            QStringList tmp = component.split('|');
-            Q_ASSERT(tmp.size() == 2);
-            component = tmp.at(0);
-            context = tmp.at(1);
+        const int index = component.indexOf('|');
+        if (index != -1) {
+            Q_ASSERT(component.indexOf('|', index + 1) == -1); // Only one '|' 
character
+            context = component.mid(index + 1);
+            component.truncate(index);
         }
     }
 
@@ -130,15 +130,8 @@
     Q_ASSERT(actionId.size() >= 4);
 
     QString componentUnique = actionId.at(KGlobalAccel::ComponentUnique);
-
-    QString contextUnique = QStringLiteral("default");
-
-    if (componentUnique.indexOf('|') != -1) {
-        QStringList tmp = componentUnique.split('|');
-        Q_ASSERT(tmp.size() == 2);
-        componentUnique = tmp.at(0);
-        contextUnique = tmp.at(1);
-    }
+    QString contextUnique;
+    splitComponent(componentUnique, contextUnique);
 
     QStringList actionIdTmp = actionId;
     actionIdTmp.replace(KGlobalAccel::ComponentUnique, componentUnique);
@@ -218,7 +211,7 @@
         emptyList.append(QString());
     }
 
-    const auto components = 
GlobalShortcutsRegistry::self()->allMainComponents();
+    const auto &components = 
GlobalShortcutsRegistry::self()->allMainComponents();
     ret.reserve(components.size() * 4);
     for (const KdeDGlobalAccel::Component *component : components) {
         QStringList actionId(emptyList);
@@ -292,7 +285,7 @@
 {
     QList<QDBusObjectPath> allComp;
 
-    const auto lstMainComponents = 
GlobalShortcutsRegistry::self()->allMainComponents();
+    const auto &lstMainComponents = 
GlobalShortcutsRegistry::self()->allMainComponents();
     for (const KdeDGlobalAccel::Component *component : lstMainComponents) {
         allComp.append(component->dbusPath());
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kglobalaccel-5.96.0/src/runtime/kserviceactioncomponent.cpp 
new/kglobalaccel-5.97.0/src/runtime/kserviceactioncomponent.cpp
--- old/kglobalaccel-5.96.0/src/runtime/kserviceactioncomponent.cpp     
2022-07-02 17:52:05.000000000 +0200
+++ new/kglobalaccel-5.97.0/src/runtime/kserviceactioncomponent.cpp     
2022-08-07 15:24:11.000000000 +0200
@@ -22,33 +22,30 @@
 KServiceActionComponent::KServiceActionComponent(const QString 
&serviceStorageId, const QString &friendlyName, GlobalShortcutsRegistry 
*registry)
     : Component(serviceStorageId, friendlyName, registry)
     , m_serviceStorageId(serviceStorageId)
-    , m_desktopFile(nullptr)
 {
-    auto fileName = 
QStandardPaths::locate(QStandardPaths::GenericDataLocation, 
QStringLiteral("kglobalaccel/") + serviceStorageId);
-    if (fileName.isEmpty()) {
-        // Fallback to applications data dir
-        // for custom shortcut for instance
-        fileName = QStandardPaths::locate(QStandardPaths::GenericDataLocation, 
QStringLiteral("applications/") + serviceStorageId);
+    QString filePath = 
QStandardPaths::locate(QStandardPaths::GenericDataLocation, 
QStringLiteral("kglobalaccel/") + serviceStorageId);
+    if (filePath.isEmpty()) {
+        // Fallback to applications data dir for custom shortcut for instance
+        filePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, 
QStringLiteral("applications/") + serviceStorageId);
         m_isInApplicationsDir = true;
     } else {
-        QFileInfo info(fileName);
+        QFileInfo info(filePath);
         if (info.isSymLink()) {
-            auto fileName2 = 
QStandardPaths::locate(QStandardPaths::GenericDataLocation, 
QStringLiteral("applications/") + serviceStorageId);
-            if (info.symLinkTarget() == fileName2) {
-                fileName = fileName2;
+            const QString filePath2 = 
QStandardPaths::locate(QStandardPaths::GenericDataLocation, 
QStringLiteral("applications/") + serviceStorageId);
+            if (info.symLinkTarget() == filePath2) {
+                filePath = filePath2;
                 m_isInApplicationsDir = true;
             }
         }
     }
-    if (fileName.isEmpty()) {
+
+    if (filePath.isEmpty()) {
         qCWarning(KGLOBALACCELD) << "No desktop file found for service " << 
serviceStorageId;
     }
-    m_desktopFile.reset(new KDesktopFile(fileName));
+    m_desktopFile.reset(new KDesktopFile(filePath));
 }
 
-KServiceActionComponent::~KServiceActionComponent()
-{
-}
+KServiceActionComponent::~KServiceActionComponent() = default;
 
 void KServiceActionComponent::runProcess(const KConfigGroup &group, const 
QString &token)
 {
@@ -57,7 +54,7 @@
         return;
     }
     // sometimes entries have an %u for command line parameters
-    if (args.last().contains(QChar('%'))) {
+    if (args.last().contains(QLatin1Char('%'))) {
         args.pop_back();
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kglobalaccel-5.96.0/src/runtime/kserviceactioncomponent.h 
new/kglobalaccel-5.97.0/src/runtime/kserviceactioncomponent.h
--- old/kglobalaccel-5.96.0/src/runtime/kserviceactioncomponent.h       
2022-07-02 17:52:05.000000000 +0200
+++ new/kglobalaccel-5.97.0/src/runtime/kserviceactioncomponent.h       
2022-08-07 15:24:11.000000000 +0200
@@ -12,6 +12,8 @@
 
 #include <KDesktopFile>
 
+#include <memory>
+
 namespace KdeDGlobalAccel
 {
 /**
@@ -37,7 +39,7 @@
     void runProcess(const KConfigGroup &group, const QString &token);
 
     QString m_serviceStorageId;
-    QScopedPointer<KDesktopFile> m_desktopFile;
+    std::unique_ptr<KDesktopFile> m_desktopFile;
     bool m_isInApplicationsDir = false;
 };
 

Reply via email to