diff --git a/libdbusmenuqt/dbusmenuimporter.cpp b/libdbusmenuqt/dbusmenuimporter.cpp index 1473b2d5f..1173692aa 100644 --- a/libdbusmenuqt/dbusmenuimporter.cpp +++ b/libdbusmenuqt/dbusmenuimporter.cpp @@ -148,7 +148,7 @@ public: */ void updateAction(QAction *action, const QVariantMap &map, const QStringList &requestedProperties) { - Q_FOREACH (const QString &key, requestedProperties) { + for (const QString &key : requestedProperties) { updateActionProperty(action, key, map.value(key)); } } @@ -308,9 +308,9 @@ void DBusMenuImporter::slotLayoutUpdated(uint revision, int parentId) void DBusMenuImporter::processPendingLayoutUpdates() { - QSet ids = d->m_pendingLayoutUpdates; + const QSet ids = d->m_pendingLayoutUpdates; d->m_pendingLayoutUpdates.clear(); - Q_FOREACH (int id, ids) { + for (int id : ids) { d->refresh(id); } } @@ -325,7 +325,7 @@ QMenu *DBusMenuImporter::menu() const void DBusMenuImporterPrivate::slotItemsPropertiesUpdated(const DBusMenuItemList &updatedList, const DBusMenuItemKeysList &removedList) { - Q_FOREACH (const DBusMenuItem &item, updatedList) { + for (const DBusMenuItem &item : updatedList) { QAction *action = m_actionForId.value(item.id); if (!action) { // We don't know this action. It probably is in a menu we haven't fetched yet. @@ -338,14 +338,15 @@ void DBusMenuImporterPrivate::slotItemsPropertiesUpdated(const DBusMenuItemList } } - Q_FOREACH (const DBusMenuItemKeys &item, removedList) { + for (const DBusMenuItemKeys &item : removedList) { QAction *action = m_actionForId.value(item.id); if (!action) { // We don't know this action. It probably is in a menu we haven't fetched yet. continue; } - Q_FOREACH (const QString &key, item.properties) { + const auto properties{item.properties}; + for (const QString &key : properties) { updateActionProperty(action, key, QVariant()); } } @@ -435,9 +436,9 @@ void DBusMenuImporter::slotGetLayoutFinished(QDBusPendingCallWatcher *watcher) } else { action = *it; QStringList filteredKeys = dbusMenuItem.properties.keys(); - filteredKeys.removeOne("type"); - filteredKeys.removeOne("toggle-type"); - filteredKeys.removeOne("children-display"); + filteredKeys.removeOne(QStringLiteral("type")); + filteredKeys.removeOne(QStringLiteral("toggle-type")); + filteredKeys.removeOne(QStringLiteral("children-display")); d->updateAction(*it, dbusMenuItem.properties, filteredKeys); // Move the action to the tail so we can keep the order same as the dbus request. menu->removeAction(action); diff --git a/libkworkspace/kworkspace.cpp b/libkworkspace/kworkspace.cpp index 8dd295e81..7be6b6309 100644 --- a/libkworkspace/kworkspace.cpp +++ b/libkworkspace/kworkspace.cpp @@ -85,9 +85,9 @@ void propagateSessionManager() // strip the screen number from the display display.remove(QRegularExpression(QStringLiteral("\\.\\d+$"))); int i; - while ((i = display.indexOf(':')) >= 0) + while ((i = display.indexOf(QLatin1Char(':'))) >= 0) display[i] = '_'; - while ((i = display.indexOf('/')) >= 0) + while ((i = display.indexOf(QLatin1Char('/'))) >= 0) display[i] = '_'; fName += '_'; diff --git a/libkworkspace/sessionmanagementbackend.cpp b/libkworkspace/sessionmanagementbackend.cpp index f79c0a332..675489709 100644 --- a/libkworkspace/sessionmanagementbackend.cpp +++ b/libkworkspace/sessionmanagementbackend.cpp @@ -45,7 +45,7 @@ SessionBackend *SessionBackend::self() SessionBackend::SessionBackend() { - m_kserverConfig = KConfigWatcher::create(KSharedConfig::openConfig("ksmserverrc")); + m_kserverConfig = KConfigWatcher::create(KSharedConfig::openConfig(QStringLiteral("ksmserverrc"))); } bool SessionBackend::confirmLogout() const diff --git a/libkworkspace/updatelaunchenvjob.cpp b/libkworkspace/updatelaunchenvjob.cpp index 9667d4f07..d072a4777 100644 --- a/libkworkspace/updatelaunchenvjob.cpp +++ b/libkworkspace/updatelaunchenvjob.cpp @@ -130,11 +130,11 @@ bool UpdateLaunchEnvJob::Private::isPosixName(const QString &name) // Ensure systemd compat by only allowing alphanumerics and _ in names. bool first = true; for (const QChar c : name) { - if (first && !c.isLetter() && c != QChar('_')) { + if (first && !c.isLetter() && c != QLatin1Char('_')) { return false; } else if (first) { first = false; - } else if (!c.isLetterOrNumber() && c != QChar('_')) { + } else if (!c.isLetterOrNumber() && c != QLatin1Char('_')) { return false; } } diff --git a/libtaskmanager/waylandtasksmodel.cpp b/libtaskmanager/waylandtasksmodel.cpp index 54dcd235e..fd026e4d8 100644 --- a/libtaskmanager/waylandtasksmodel.cpp +++ b/libtaskmanager/waylandtasksmodel.cpp @@ -90,7 +90,7 @@ void WaylandTasksModel::Private::init() rulesConfig = KSharedConfig::openConfig(QStringLiteral("taskmanagerrulesrc")); configWatcher = new KDirWatch(q); - foreach (const QString &location, QStandardPaths::standardLocations(QStandardPaths::ConfigLocation)) { + for (const QString &location : QStandardPaths::standardLocations(QStandardPaths::ConfigLocation)) { configWatcher->addFile(location + QLatin1String("/taskmanagerrulesrc")); }