Port some foreach + add QStringLiteral

wilder-5.25
Laurent Montel 4 years ago
parent 1305fe0a87
commit d6b0c0a046
  1. 19
      libdbusmenuqt/dbusmenuimporter.cpp
  2. 4
      libkworkspace/kworkspace.cpp
  3. 2
      libkworkspace/sessionmanagementbackend.cpp
  4. 4
      libkworkspace/updatelaunchenvjob.cpp
  5. 2
      libtaskmanager/waylandtasksmodel.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<int> ids = d->m_pendingLayoutUpdates;
const QSet<int> 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);

@ -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 += '_';

@ -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

@ -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;
}
}

@ -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"));
}

Loading…
Cancel
Save