Hello community, here is the log from the commit of package kglobalaccel for openSUSE:Factory checked in at 2019-04-19 21:25:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kglobalaccel (Old) and /work/SRC/openSUSE:Factory/.kglobalaccel.new.5536 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kglobalaccel" Fri Apr 19 21:25:51 2019 rev:68 rq:695732 version:5.57.0 Changes: -------- --- /work/SRC/openSUSE:Factory/kglobalaccel/kglobalaccel.changes 2019-03-21 09:45:35.682907294 +0100 +++ /work/SRC/openSUSE:Factory/.kglobalaccel.new.5536/kglobalaccel.changes 2019-04-19 21:25:55.775992319 +0200 @@ -1,0 +2,22 @@ +Thu Apr 18 13:17:34 UTC 2019 - Fabian Vogt <[email protected]> + +- Add patch to fix another possible crash: + * 0001-Copy-container-in-Component-cleanUp-before-interatin.patch + +------------------------------------------------------------------- +Tue Apr 16 13:33:12 UTC 2019 - [email protected] + +- Add Dont-use-qAsConst-over-a-temporary-variable.patch to fix a + possible crash (kde#406426) + +------------------------------------------------------------------- +Sun Apr 14 20:21:43 UTC 2019 - [email protected] + +- Update to 5.57.0 + * New feature release + * For more details please see: + * https://www.kde.org/announcements/kde-frameworks-5.57.0.php +- Changes since 5.56.0: + * [kglobalaccel] Make it compile without foreach + +------------------------------------------------------------------- Old: ---- kglobalaccel-5.56.0.tar.xz New: ---- 0001-Copy-container-in-Component-cleanUp-before-interatin.patch Dont-use-qAsConst-over-a-temporary-variable.patch kglobalaccel-5.57.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kglobalaccel.spec ++++++ --- /var/tmp/diff_new_pack.FrFTnT/_old 2019-04-19 21:25:57.511994530 +0200 +++ /var/tmp/diff_new_pack.FrFTnT/_new 2019-04-19 21:25:57.539994566 +0200 @@ -17,14 +17,14 @@ %define lname libKF5GlobalAccel5 -%define _tar_path 5.56 +%define _tar_path 5.57 # 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 lang Name: kglobalaccel -Version: 5.56.0 +Version: 5.57.0 Release: 0 Summary: Global desktop keyboard shortcuts License: LGPL-2.1-or-later @@ -32,6 +32,9 @@ URL: https://www.kde.org Source: http://download.kde.org/stable/frameworks/%{_tar_path}/%{name}-%{version}.tar.xz Source1: baselibs.conf +# PATCH-FIX-UPSTREAM +Patch0: Dont-use-qAsConst-over-a-temporary-variable.patch +Patch1: 0001-Copy-container-in-Component-cleanUp-before-interatin.patch BuildRequires: cmake >= 3.0 BuildRequires: extra-cmake-modules >= %{_kf5_bugfix_version} BuildRequires: fdupes @@ -112,6 +115,7 @@ %if 0%{?suse_version} == 1500 sed -i -e "s/^set *(REQUIRED_QT_VERSION 5.10.0)$/set(REQUIRED_QT_VERSION 5.9.0)/" CMakeLists.txt %endif +%autopatch -p1 %build %cmake_kf5 -d build -- -Dlconvert_executable=%{_kf5_libdir}/qt5/bin/lconvert ++++++ 0001-Copy-container-in-Component-cleanUp-before-interatin.patch ++++++ >From 78a711361db3a5156f511eab89ff7ebbc86b9125 Mon Sep 17 00:00:00 2001 From: Fabian Vogt <[email protected]> Date: Thu, 18 Apr 2019 14:32:11 +0200 Subject: [PATCH] Copy container in Component::cleanUp before interating Summary: Crash was reported: Thread 1 (Thread 0x7fdc95c68800 (LWP 6402)): [KCrash Handler] #6 QHashData::nextNode (node=node@entry=0x562f53ffbd10) at tools/qhash.cpp:598 #7 0x00007fdc95a1fbab in QHash<QString, GlobalShortcut*>::const_iterator::operator++ (this=<synthetic pointer>) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qhash.h:395 #8 KdeDGlobalAccel::Component::cleanUp (this=0x562f53ffb040) at ./src/runtime/component.cpp:163 Apparently the container is modified while iterating over it. That does not work with the range-for as it does not detach, as opposed to Q_FOREACH. Test Plan: @lbeltrame saw valgrind errors before applying this, but those disappeared with this patch. Reviewers: #frameworks, davidedmundson Reviewed By: davidedmundson Subscribers: lbeltrame, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D20659 --- src/runtime/component.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Index: kglobalaccel-5.57.0/src/runtime/component.cpp =================================================================== --- kglobalaccel-5.57.0.orig/src/runtime/component.cpp +++ kglobalaccel-5.57.0/src/runtime/component.cpp @@ -160,7 +160,8 @@ bool Component::cleanUp() { bool changed = false;; - for (GlobalShortcut *shortcut : qAsConst(_current->_actions)) + const auto actions = _current->_actions; + for (GlobalShortcut *shortcut : actions) { qCDebug(KGLOBALACCELD) << _current->_actions.size(); if (!shortcut->isPresent()) ++++++ Dont-use-qAsConst-over-a-temporary-variable.patch ++++++ >From abe32ec599397bda0ce73471519410bee2c16059 Mon Sep 17 00:00:00 2001 From: Laurent Montel <[email protected]> Date: Sun, 14 Apr 2019 20:15:31 +0200 Subject: Don't use qAsConst over a temporary variable Summary: BUG: 406426 Reviewers: dfaure Reviewed By: dfaure Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D20555 --- src/runtime/component.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/runtime/component.cpp b/src/runtime/component.cpp index ce276b9..669df67 100644 --- a/src/runtime/component.cpp +++ b/src/runtime/component.cpp @@ -330,7 +330,8 @@ bool Component::isShortcutAvailable( // context if (component==uniqueName()) { - for (GlobalShortcut *sc : qAsConst(shortcutContext(context)->_actions)) + const auto actions = shortcutContext(context)->_actions; + for (GlobalShortcut *sc : actions) { if (sc->keys().contains(key)) return false; } -- cgit v1.1 ++++++ kglobalaccel-5.56.0.tar.xz -> kglobalaccel-5.57.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kglobalaccel-5.56.0/.gitignore new/kglobalaccel-5.57.0/.gitignore --- old/kglobalaccel-5.56.0/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/kglobalaccel-5.57.0/.gitignore 2019-04-07 09:27:50.000000000 +0200 @@ -0,0 +1,21 @@ +# Ignore the following files +*~ +*.[oa] +*.diff +*.kate-swp +*.kdev4 +.kdev_include_paths +*.kdevelop.pcs +*.moc +*.moc.cpp +*.orig +*.user +.*.swp +.swp.* +Doxyfile +Makefile +avail +random_seed +/build*/ +CMakeLists.txt.user* +*.unc-backup* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kglobalaccel-5.56.0/CMakeLists.txt new/kglobalaccel-5.57.0/CMakeLists.txt --- old/kglobalaccel-5.56.0/CMakeLists.txt 2019-03-02 14:39:55.000000000 +0100 +++ new/kglobalaccel-5.57.0/CMakeLists.txt 2019-04-07 09:27:50.000000000 +0200 @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.5) -set(KF5_VERSION "5.56.0") # handled by release scripts -set(KF5_DEP_VERSION "5.56.0") # handled by release scripts +set(KF5_VERSION "5.57.0") # handled by release scripts +set(KF5_DEP_VERSION "5.57.0") # handled by release scripts project(KGlobalAccel VERSION ${KF5_VERSION}) # ECM setup include(FeatureSummary) -find_package(ECM 5.56.0 NO_MODULE) +find_package(ECM 5.57.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) @@ -69,6 +69,7 @@ if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po") ecm_install_po_files_as_qm(po) endif() +add_definitions(-DQT_NO_FOREACH) add_subdirectory(src) if (BUILD_TESTING) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kglobalaccel-5.56.0/po/id/kglobalaccel5_qt.po new/kglobalaccel-5.57.0/po/id/kglobalaccel5_qt.po --- old/kglobalaccel-5.56.0/po/id/kglobalaccel5_qt.po 2019-03-02 14:39:55.000000000 +0100 +++ new/kglobalaccel-5.57.0/po/id/kglobalaccel5_qt.po 2019-04-07 09:27:50.000000000 +0200 @@ -16,7 +16,7 @@ "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Lokalize 2.0\n" "X-Qt-Contexts: true\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kglobalaccel-5.56.0/po/te/kglobalaccel5_qt.po new/kglobalaccel-5.57.0/po/te/kglobalaccel5_qt.po --- old/kglobalaccel-5.56.0/po/te/kglobalaccel5_qt.po 2019-03-02 14:39:55.000000000 +0100 +++ new/kglobalaccel-5.57.0/po/te/kglobalaccel5_qt.po 2019-04-07 09:27:50.000000000 +0200 @@ -22,8 +22,7 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Lokalize 1.5\n" -"Plural-Forms: nplurals=5; plural=n==1 ? 0 : n==2 ? 1 : n<7 ? 2 : n<11 ? 3 : " -"4;\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" "X-Qt-Contexts: true\n" #: kglobalaccel.cpp:556 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kglobalaccel-5.56.0/po/zh_CN/kglobalaccel5_qt.po new/kglobalaccel-5.57.0/po/zh_CN/kglobalaccel5_qt.po --- old/kglobalaccel-5.56.0/po/zh_CN/kglobalaccel5_qt.po 2019-03-02 14:39:55.000000000 +0100 +++ new/kglobalaccel-5.57.0/po/zh_CN/kglobalaccel5_qt.po 2019-04-07 09:27:50.000000000 +0200 @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: kdeorg\n" -"PO-Revision-Date: 2019-02-20 23:15\n" +"PO-Revision-Date: 2019-03-07 09:22\n" "Last-Translator: guoyunhe <[email protected]>\n" "Language-Team: Chinese Simplified\n" "Language: zh_CN\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kglobalaccel-5.56.0/src/kglobalaccel.cpp new/kglobalaccel-5.57.0/src/kglobalaccel.cpp --- old/kglobalaccel-5.56.0/src/kglobalaccel.cpp 2019-03-02 14:39:55.000000000 +0100 +++ new/kglobalaccel-5.57.0/src/kglobalaccel.cpp 2019-04-07 09:27:50.000000000 +0200 @@ -379,7 +379,7 @@ QList<int> KGlobalAccelPrivate::intListFromShortcut(const QList<QKeySequence> &cut) { QList<int> ret; - Q_FOREACH (const QKeySequence &sequence, cut) { + for (const QKeySequence &sequence : cut) { ret.append(sequence[0]); } while (!ret.isEmpty() && ret.last() == 0) { @@ -391,7 +391,7 @@ QList<QKeySequence> KGlobalAccelPrivate::shortcutFromIntList(const QList<int> &list) { QList<QKeySequence> ret; - Q_FOREACH (int i, list) { + for (int i : list) { ret.append(i); } return ret; @@ -436,8 +436,8 @@ qlonglong timestamp) { QAction *action = nullptr; - QList<QAction *> candidates = nameToAction.values(actionUnique); - Q_FOREACH (QAction *const a, candidates) { + const QList<QAction *> candidates = nameToAction.values(actionUnique); + for (QAction *const a : candidates) { if (componentUniqueForAction(a) == componentUnique) { action = a; } @@ -503,10 +503,10 @@ //shortcut was changed but the kded side died before it got the message so //autoloading will now assign an old shortcut to the action. Particularly //picky apps might assert or misbehave. - QSet<QAction *> allActions = actions; + const QSet<QAction *> allActions = actions; nameToAction.clear(); actions.clear(); - Q_FOREACH (QAction *const action, allActions) { + for (QAction *const action : allActions) { if (doRegister(action)) { updateGlobalShortcut(action, ActiveShortcut, KGlobalAccel::Autoloading); } @@ -590,7 +590,7 @@ .arg(seq.toString(), component, shortcuts[0].friendlyName()); } else { QString actionList; - Q_FOREACH (const KGlobalShortcutInfo &info, shortcuts) { + for (const KGlobalShortcutInfo &info : shortcuts) { actionList += tr("In context '%1' for action '%2'\n") .arg(info.contextFriendlyName(), info.friendlyName()); } @@ -631,7 +631,7 @@ { // protect against garbage keycode -1 that Qt sometimes produces for exotic keys; // at the moment (~mid 2008) Multimedia PlayPause is one of those keys. - Q_FOREACH (const QKeySequence &sequence, shortcut) { + for (const QKeySequence &sequence : shortcut) { for (int i = 0; i < 4; i++) { if (sequence[i] == -1) { qWarning() << "Encountered garbage keycode (keycode = -1) in input, not doing anything."; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kglobalaccel-5.56.0/src/kglobalshortcutinfo_dbus.cpp new/kglobalaccel-5.57.0/src/kglobalshortcutinfo_dbus.cpp --- old/kglobalaccel-5.56.0/src/kglobalshortcutinfo_dbus.cpp 2019-03-02 14:39:55.000000000 +0100 +++ new/kglobalaccel-5.57.0/src/kglobalshortcutinfo_dbus.cpp 2019-04-07 09:27:50.000000000 +0200 @@ -29,12 +29,12 @@ << shortcut.contextUniqueName() << shortcut.contextFriendlyName(); argument.beginArray(qMetaTypeId<int>()); - Q_FOREACH (const QKeySequence &key, shortcut.keys()) { + for (const QKeySequence &key : shortcut.keys()) { argument << key[0]; } argument.endArray(); argument.beginArray(qMetaTypeId<int>()); - Q_FOREACH (const QKeySequence &key, shortcut.defaultKeys()) { + for (const QKeySequence &key : shortcut.defaultKeys()) { argument << key[0]; } argument.endArray(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kglobalaccel-5.56.0/src/runtime/component.cpp new/kglobalaccel-5.57.0/src/runtime/component.cpp --- old/kglobalaccel-5.56.0/src/runtime/component.cpp 2019-03-02 14:39:55.000000000 +0100 +++ new/kglobalaccel-5.57.0/src/runtime/component.cpp 2019-04-07 09:27:50.000000000 +0200 @@ -40,7 +40,7 @@ return ret; } const QStringList strList = str.split('\t'); - foreach (const QString &s, strList) { + for (const QString &s : strList) { int key = QKeySequence(s)[0]; if (key != -1) { //sanity check just in case ret.append(key); @@ -56,7 +56,7 @@ return QStringLiteral("none"); } QString ret; - foreach (int key, keys) { + for (int key : keys) { ret.append(QKeySequence(key).toString()); ret.append('\t'); } @@ -123,7 +123,7 @@ void Component::activateShortcuts() { - Q_FOREACH (GlobalShortcut *shortcut, _current->_actions) + for (GlobalShortcut *shortcut : qAsConst(_current->_actions)) { shortcut->setActive(); } @@ -160,7 +160,7 @@ { bool changed = false;; - Q_FOREACH (GlobalShortcut *shortcut, _current->_actions) + for (GlobalShortcut *shortcut : qAsConst(_current->_actions)) { qCDebug(KGLOBALACCELD) << _current->_actions.size(); if (!shortcut->isPresent()) @@ -216,7 +216,7 @@ void Component::deactivateShortcuts(bool temporarily) { - Q_FOREACH (GlobalShortcut *shortcut, _current->_actions) + for (GlobalShortcut *shortcut : qAsConst(_current->_actions)) { if (temporarily && uniqueName() == QLatin1String("kwin") @@ -281,7 +281,7 @@ QList<GlobalShortcut *> Component::getShortcutsByKey(int key) const { QList <GlobalShortcut *> rc; - Q_FOREACH(GlobalShortcutContext *context, _contexts) + for (GlobalShortcutContext *context : qAsConst(_contexts)) { GlobalShortcut *sc = context->getShortcutByKey(key); if (sc) rc.append(sc); @@ -311,7 +311,7 @@ { // The component is active if at least one of it's global shortcuts is // present. - Q_FOREACH (GlobalShortcut *shortcut, _current->_actions) + for (GlobalShortcut *shortcut : qAsConst(_current->_actions)) { if (shortcut->isPresent()) return true; } @@ -330,16 +330,16 @@ // context if (component==uniqueName()) { - Q_FOREACH(GlobalShortcut *sc, shortcutContext(context)->_actions) + for (GlobalShortcut *sc : qAsConst(shortcutContext(context)->_actions)) { if (sc->keys().contains(key)) return false; } } else { - Q_FOREACH(GlobalShortcutContext *ctx, _contexts) + for (GlobalShortcutContext *ctx : qAsConst(_contexts)) { - Q_FOREACH(GlobalShortcut *sc, ctx->_actions) + for (GlobalShortcut *sc : qAsConst(ctx->_actions)) { if (sc->keys().contains(key)) return false; } @@ -356,11 +356,11 @@ friendlyName, currentContext()); - QList<int> keys = keysFromString(shortcutString); + const QList<int> keys = keysFromString(shortcutString); shortcut->setDefaultKeys(keysFromString(defaultShortcutString)); shortcut->setIsFresh(false); - - Q_FOREACH (int key, keys) + QList<int> newKeys = keys; + for (int key : keys) { if (key != 0) { @@ -368,7 +368,7 @@ { // The shortcut is already used. The config file is // broken. Ignore the request. - keys.removeAll(key); + newKeys.removeAll(key); qCWarning(KGLOBALACCELD) << "Shortcut found twice in kglobalshortcutsrc."<<key; } } @@ -381,7 +381,8 @@ void Component::loadSettings(KConfigGroup &configGroup) { // GlobalShortcutsRegistry::loadSettings handles contexts. - Q_FOREACH (const QString &confKey, configGroup.keyList()) + const auto listKeys = configGroup.keyList(); + for (const QString &confKey : listKeys) { const QStringList entry = configGroup.readEntry(confKey, QStringList()); if (entry.size() != 3) @@ -436,7 +437,7 @@ void Component::unregisterShortcut(const QString &uniqueName) { // Now wrote all contexts - Q_FOREACH( GlobalShortcutContext *context, _contexts) + for( GlobalShortcutContext *context : qAsConst(_contexts)) { if (context->_actions.value(uniqueName)) { @@ -454,7 +455,7 @@ // Now write all contexts - Q_FOREACH( GlobalShortcutContext *context, _contexts) + for( GlobalShortcutContext *context : qAsConst(_contexts)) { KConfigGroup contextGroup; @@ -473,7 +474,7 @@ // qCDebug(KGLOBALACCELD) << "writing group " << _uniqueName << ":" << context->uniqueName(); - Q_FOREACH(const GlobalShortcut *shortcut, context->_actions) + for (const GlobalShortcut *shortcut : qAsConst(context->_actions)) { // qCDebug(KGLOBALACCELD) << "writing" << shortcut->uniqueName(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kglobalaccel-5.56.0/src/runtime/globalshortcut.cpp new/kglobalaccel-5.57.0/src/runtime/globalshortcut.cpp --- old/kglobalaccel-5.56.0/src/runtime/globalshortcut.cpp 2019-03-02 14:39:55.000000000 +0100 +++ new/kglobalaccel-5.57.0/src/runtime/globalshortcut.cpp 2019-04-07 09:27:50.000000000 +0200 @@ -77,11 +77,11 @@ info.d->contextFriendlyName = context()->friendlyName(); info.d->componentUniqueName = context()->component()->uniqueName(); info.d->componentFriendlyName = context()->component()->friendlyName(); - Q_FOREACH (int key, _keys) + for (int key : qAsConst(_keys)) { info.d->keys.append(QKeySequence(key)); } - Q_FOREACH (int key, _defaultKeys) + for (int key : qAsConst(_defaultKeys)) { info.d->defaultKeys.append(QKeySequence(key)); } @@ -181,7 +181,7 @@ _keys = QList<int>(); - Q_FOREACH(int key, newKeys) + for(int key : qAsConst(newKeys)) { if (key!=0 && !GlobalShortcutsRegistry::self()->getShortcutByKey(key)) { @@ -222,7 +222,7 @@ return; } - Q_FOREACH( int key, _keys) + for( int key : qAsConst(_keys)) { if (key != 0 && !GlobalShortcutsRegistry::self()->registerKey(key, this)) { @@ -242,7 +242,7 @@ return; } - Q_FOREACH( int key, _keys) + for( int key : qAsConst(_keys)) { if (key != 0 && !GlobalShortcutsRegistry::self()->unregisterKey(key, this)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kglobalaccel-5.56.0/src/runtime/globalshortcutcontext.cpp new/kglobalaccel-5.57.0/src/runtime/globalshortcutcontext.cpp --- old/kglobalaccel-5.56.0/src/runtime/globalshortcutcontext.cpp 2019-03-02 14:39:55.000000000 +0100 +++ new/kglobalaccel-5.57.0/src/runtime/globalshortcutcontext.cpp 2019-04-07 09:27:50.000000000 +0200 @@ -49,7 +49,7 @@ QList<KGlobalShortcutInfo> GlobalShortcutContext::allShortcutInfos() const { QList<KGlobalShortcutInfo> rc; - Q_FOREACH (GlobalShortcut *shortcut, _actions) + for (GlobalShortcut *shortcut : qAsConst(_actions)) { rc.append(static_cast<KGlobalShortcutInfo>(*shortcut)); } @@ -84,7 +84,7 @@ if ((keyMod & Qt::SHIFT) && (keySym == Qt::Key_Backtab || keySym == Qt::Key_Tab)) { - Q_FOREACH(GlobalShortcut *sc, _actions) + for (GlobalShortcut *sc : qAsConst(_actions)) { if (sc->keys().contains(keyMod | Qt::Key_Tab) || sc->keys().contains(keyMod | Qt::Key_Backtab)) @@ -93,7 +93,7 @@ } else { - Q_FOREACH(GlobalShortcut *sc, _actions) + for (GlobalShortcut *sc : qAsConst(_actions)) { if (sc->keys().contains(key)) return sc; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kglobalaccel-5.56.0/src/runtime/globalshortcutsregistry.cpp new/kglobalaccel-5.57.0/src/runtime/globalshortcutsregistry.cpp --- old/kglobalaccel-5.56.0/src/runtime/globalshortcutsregistry.cpp 2019-03-02 14:39:55.000000000 +0100 +++ new/kglobalaccel-5.57.0/src/runtime/globalshortcutsregistry.cpp 2019-04-07 09:27:50.000000000 +0200 @@ -44,7 +44,7 @@ if (platformName.isEmpty()) { platformName = QGuiApplication::platformName(); } - foreach (const KPluginMetaData &candidate, candidates) { + for (const KPluginMetaData &candidate : candidates) { const QJsonArray platforms = candidate.rawData().value(QStringLiteral("platforms")).toArray(); for (auto it = platforms.begin(); it != platforms.end(); ++it) { if (QString::compare(platformName, (*it).toString(), Qt::CaseInsensitive) == 0) { @@ -81,7 +81,8 @@ // Ungrab all keys. We don't go over GlobalShortcuts because // GlobalShortcutsRegistry::self() doesn't work anymore. - Q_FOREACH (const int key, _active_keys.keys()) + const auto listKeys = _active_keys.keys(); + for (const int key : listKeys) { _manager->grabKey(key, false); } @@ -111,7 +112,7 @@ void GlobalShortcutsRegistry::activateShortcuts() { - Q_FOREACH (KdeDGlobalAccel::Component *component, _components) + for (KdeDGlobalAccel::Component *component : qAsConst(_components)) { component->activateShortcuts(); } @@ -126,7 +127,7 @@ void GlobalShortcutsRegistry::clear() { - Q_FOREACH(KdeDGlobalAccel::Component *component, _components) + for (KdeDGlobalAccel::Component *component : qAsConst(_components)) { delete component; } @@ -145,7 +146,7 @@ void GlobalShortcutsRegistry::deactivateShortcuts(bool temporarily) { - Q_FOREACH (KdeDGlobalAccel::Component *component, _components) + for (KdeDGlobalAccel::Component *component : qAsConst(_components)) { component->deactivateShortcuts(temporarily); } @@ -166,7 +167,7 @@ GlobalShortcut *GlobalShortcutsRegistry::getShortcutByKey(int key) const { - Q_FOREACH (KdeDGlobalAccel::Component *component, _components) + for (KdeDGlobalAccel::Component *component : qAsConst(_components)) { GlobalShortcut *rc = component->getShortcutByKey(key); if (rc) return rc; @@ -179,7 +180,7 @@ { QList<GlobalShortcut *> rc; - Q_FOREACH (KdeDGlobalAccel::Component *component, _components) + for (KdeDGlobalAccel::Component *component : qAsConst(_components)) { rc = component->getShortcutsByKey(key); if (!rc.isEmpty()) return rc; @@ -193,7 +194,7 @@ const QString &componentName, const QString &contextName) const { - Q_FOREACH (KdeDGlobalAccel::Component *component, _components) + for (KdeDGlobalAccel::Component *component : qAsConst(_components)) { if (!component->isShortcutAvailable(shortcut, componentName, contextName)) return false; @@ -261,7 +262,8 @@ void GlobalShortcutsRegistry::loadSettings() { - foreach (const QString &groupName, _config.groupList()) + const auto groupList = _config.groupList(); + for (const QString &groupName : groupList) { qCDebug(KGLOBALACCELD) << "Loading group " << groupName; @@ -292,7 +294,8 @@ } // Now load the contexts - Q_FOREACH(const QString& context, configGroup.groupList()) + const auto groupList = configGroup.groupList(); + for (const QString& context : groupList) { // Skip the friendly name group if (context==QLatin1String("Friendly Name")) continue; @@ -311,13 +314,14 @@ // Load the configured KServiceActions const QStringList desktopPaths = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("kglobalaccel"), QStandardPaths::LocateDirectory); - foreach (const QString &path, desktopPaths) { + for (const QString &path : desktopPaths) { QDir dir(path); if (!dir.exists()) { continue; } const QStringList patterns = {QStringLiteral("*.desktop")}; - foreach (const QString &desktopFile, dir.entryList(patterns)) { + const auto lstDesktopFiles = dir.entryList(patterns); + for (const QString &desktopFile : lstDesktopFiles) { if (_components.contains(desktopFile)) { continue; } @@ -417,9 +421,10 @@ void GlobalShortcutsRegistry::writeSettings() const { - Q_FOREACH( - const KdeDGlobalAccel::Component *component, - 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.56.0/src/runtime/kglobalacceld.cpp new/kglobalaccel-5.57.0/src/runtime/kglobalacceld.cpp --- old/kglobalaccel-5.56.0/src/runtime/kglobalacceld.cpp 2019-03-02 14:39:55.000000000 +0100 +++ new/kglobalaccel-5.57.0/src/runtime/kglobalacceld.cpp 2019-04-07 09:27:50.000000000 +0200 @@ -295,7 +295,8 @@ partialId.append(component->friendlyName()); //ComponentFriendly partialId.append(QString()); //ActionFriendly - foreach (const GlobalShortcut *const shortcut, component->allShortcuts()) { + const auto listShortcuts = component->allShortcuts(); + for (const GlobalShortcut *const shortcut : listShortcuts) { if (shortcut->isFresh()) { // isFresh is only an intermediate state, not to be reported outside. continue; @@ -338,8 +339,9 @@ { QList<QDBusObjectPath> allComp; - Q_FOREACH (const KdeDGlobalAccel::Component *component, - GlobalShortcutsRegistry::self()->allMainComponents()) + const auto lstMainComponents = GlobalShortcutsRegistry::self()->allMainComponents(); + for (const KdeDGlobalAccel::Component *component : + lstMainComponents) { allComp.append(component->dbusPath()); } @@ -435,11 +437,11 @@ #ifdef KDEDGLOBALACCEL_TRACE qCDebug(KGLOBALACCELD) << key; #endif - QList<GlobalShortcut*> shortcuts = + const QList<GlobalShortcut*> shortcuts = GlobalShortcutsRegistry::self()->getShortcutsByKey(key); QList<KGlobalShortcutInfo> rc; - Q_FOREACH(const GlobalShortcut *sc, shortcuts) + for (const GlobalShortcut *sc : shortcuts) { #ifdef KDEDGLOBALACCEL_TRACE qCDebug(KGLOBALACCELD) << sc->context()->uniqueName() << sc->uniqueName(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kglobalaccel-5.56.0/src/runtime/kserviceactioncomponent.cpp new/kglobalaccel-5.57.0/src/runtime/kserviceactioncomponent.cpp --- old/kglobalaccel-5.56.0/src/runtime/kserviceactioncomponent.cpp 2019-03-02 14:39:55.000000000 +0100 +++ new/kglobalaccel-5.57.0/src/runtime/kserviceactioncomponent.cpp 2019-04-07 09:27:50.000000000 +0200 @@ -75,7 +75,8 @@ } return; } - foreach (const QString &action, m_desktopFile.readActions()) { + const auto lstActions = m_desktopFile.readActions(); + for (const QString &action : lstActions) { if (action == shortcut.uniqueName()) { QStringList parts = m_desktopFile.actionGroup(action).readEntry(QStringLiteral("Exec"), QString()).split(QChar(' ')); @@ -119,8 +120,8 @@ GlobalShortcut *shortcut = registerShortcut(QStringLiteral("_launch"), m_desktopFile.readName(), shortcutString, shortcutString); shortcut->setIsPresent(true); - - foreach(const QString &action, m_desktopFile.readActions()) + const auto lstActions = m_desktopFile.readActions(); + for (const QString &action : lstActions) { shortcuts = m_desktopFile.actionGroup(action).readEntry(QStringLiteral("X-KDE-Shortcuts"), QString()).split(QChar(',')); if (!shortcuts.isEmpty()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kglobalaccel-5.56.0/src/runtime/plugins/osx/kglobalaccel_mac.cpp new/kglobalaccel-5.57.0/src/runtime/plugins/osx/kglobalaccel_mac.cpp --- old/kglobalaccel-5.56.0/src/runtime/plugins/osx/kglobalaccel_mac.cpp 2019-03-02 14:39:55.000000000 +0100 +++ new/kglobalaccel-5.57.0/src/runtime/plugins/osx/kglobalaccel_mac.cpp 2019-04-07 09:27:50.000000000 +0200 @@ -94,7 +94,7 @@ KKeyServer::keyQtToModMac( keyQt, mod ); qCDebug(KGLOBALACCELD) << "keyQt: " << keyQt << " mod: " << mod; - foreach (uint keyCode, keyCodes) { + for (uint keyCode : qAsConst(keyCodes)) { qCDebug(KGLOBALACCELD) << " keyCode: " << keyCode; } @@ -102,7 +102,7 @@ ehkid.signature = 'Kgai'; ehkid.id = keyQt; QList<EventHotKeyRef> hotkeys; - foreach (uint keyCode, keyCodes) { + for (uint keyCode : qAsConst(keyCodes)) { EventHotKeyRef ref; if (RegisterEventHotKey(keyCode, mod, ehkid, m_eventTarget, 0, &ref) != noErr) { qCWarning(KGLOBALACCELD) << "RegisterEventHotKey failed!"; @@ -113,7 +113,8 @@ } else { qCDebug(KGLOBALACCELD) << "Ungrabbing key " << keyQt; if (refs->count(keyQt) == 0) qCWarning(KGLOBALACCELD) << "Trying to ungrab a key thas is not grabbed"; - foreach (const EventHotKeyRef &ref, refs->value(keyQt)) { + const auto lstRef = refs->value(keyQt); + for (const EventHotKeyRef &ref : lstRef) { if (UnregisterEventHotKey(ref) != noErr) { qCWarning(KGLOBALACCELD) << "UnregisterEventHotKey should not fail!"; } @@ -149,7 +150,7 @@ grabKey(key, false); } // Now re-grab all the keys - foreach (int key, keys) { + for (int key : qAsConst(keys)) { grabKey(key, true); } }
