Commit 0b09fe1b authored by Alexander Lohnau's avatar Alexander Lohnau 💬

Solve clazy warnings about range based for loops

parent ff9f6c8c
......@@ -259,7 +259,7 @@ QVariantList systemSettingsActions()
return list;
}
for (const QString &id : ids) {
for (const QString &id : qAsConst(ids)) {
KService::Ptr service = KService::serviceByStorageId(id);
if (!service || !service->isValid()) {
continue;
......
......@@ -416,7 +416,7 @@ public:
{
QStringList ids;
for (const auto& item: m_items) {
for (const auto& item: qAsConst(m_items)) {
ids << item.value();
}
......
......@@ -481,7 +481,7 @@ void AppletsLayout::componentComplete()
m_layoutManager->parseLayout(m_containment->config().readEntry(m_configKey, ""));
}
QList <QObject*> appletObjects = m_containmentItem->property("applets").value<QList <QObject*> >();
const QList <QObject*> appletObjects = m_containmentItem->property("applets").value<QList <QObject*> >();
for (auto *obj : appletObjects) {
PlasmaQuick::AppletQuickItem *appletItem = qobject_cast<PlasmaQuick::AppletQuickItem *>(obj);
......
......@@ -53,7 +53,7 @@ QString GridLayoutManager::serializeLayout() const
void GridLayoutManager::parseLayout(const QString &savedLayout)
{
m_parsedConfig.clear();
QStringList itemsConfigs = savedLayout.split(QLatin1Char(';'));
const QStringList itemsConfigs = savedLayout.split(QLatin1Char(';'));
for (const auto &itemString : itemsConfigs) {
QStringList itemConfig = itemString.split(QLatin1Char(':'));
......@@ -153,7 +153,7 @@ void GridLayoutManager::resetLayoutFromConfig()
}
}
for (auto *item : missingItems) {
for (auto *item : qAsConst(missingItems)) {
// NOTE: do not use positionItemAndAssign here, because we do not want to emit layoutNeedsSaving, to not save after resize
positionItem(item);
assignSpaceImpl(item);
......
......@@ -409,7 +409,7 @@ void ItemContainer::componentComplete()
syncChildItemsGeometry(size());
}
for (auto *o : m_contentData) {
for (auto *o : qAsConst(m_contentData)) {
QQuickItem *item = qobject_cast<QQuickItem *>(o);
if (item) {
item->setParentItem(m_contentItem);
......
......@@ -377,7 +377,7 @@ void InteractiveConsole::populateTemplatesMenu()
return left.name() < right.name();
});
KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LayoutTemplate"));
for (const auto &templateMetaData : templates){
for (const auto &templateMetaData : qAsConst(templates)){
package.setPath(templateMetaData.pluginId());
const QString scriptFile = package.filePath("mainscript");
if (!scriptFile.isEmpty()) {
......
......@@ -141,7 +141,7 @@ bool PlasmaAppletItem::matches(const QString &pattern) const
const QString keywordsList = KPluginMetaData::readTranslatedString(m_info.rawData(), QStringLiteral("Keywords"));
const auto keywords = keywordsList.splitRef(QLatin1Char(';'), Qt::SkipEmptyParts);
for (const auto keyword : keywords) {
for (const auto &keyword : keywords) {
if (keyword.startsWith(pattern, Qt::CaseInsensitive)) {
return true;
}
......
......@@ -90,7 +90,7 @@ void Menu::start(uint id)
const bool hadMenu = !m_menus.isEmpty();
const auto menus = reply.value();
for (auto menu : menus) {
for (const auto &menu : menus) {
m_menus[menu.id].append(menus);
}
......
......@@ -61,7 +61,7 @@ Feedback::Feedback(QObject *parent, const QVariantList &args)
QStringLiteral("1.0"), i18n("Configure user feedback settings"), KAboutLicense::LGPL));
QVector<QProcess*> processes;
for (const auto exec: s_programs.keys()) {
for (const auto &exec: s_programs.keys()) {
QProcess* p = new QProcess(this);
p->setProgram(exec);
p->setArguments({QStringLiteral("--feedback")});
......
......@@ -134,8 +134,8 @@ QStringList GtkThemesModel::possiblePathsToThemes()
QStandardPaths::LocateDirectory);
themesLocationsPaths << QDir::homePath() + QStringLiteral("/.themes");
for (const QString& themesLocationPath : themesLocationsPaths) {
QStringList possibleThemesDirectoriesNames = QDir(themesLocationPath).entryList(QDir::NoDotAndDotDot | QDir::AllDirs);
for (const QString& themesLocationPath : qAsConst(themesLocationsPaths)) {
const QStringList possibleThemesDirectoriesNames = QDir(themesLocationPath).entryList(QDir::NoDotAndDotDot | QDir::AllDirs);
for (const QString &possibleThemeDirectoryName : possibleThemesDirectoriesNames) {
possibleThemesPaths += themesLocationPath + '/' + possibleThemeDirectoryName;
}
......
......@@ -404,7 +404,7 @@ void DBusMenuImporter::slotGetLayoutFinished(QDBusPendingCallWatcher *watcher)
//remove outdated actions
QSet<int> newDBusMenuItemIds;
newDBusMenuItemIds.reserve(rootItem.children.count());
for (const DBusMenuLayoutItem &item: rootItem.children) {
for (const DBusMenuLayoutItem &item: qAsConst(rootItem.children)) {
newDBusMenuItemIds << item.id;
}
for (QAction *action: menu->actions()) {
......@@ -422,7 +422,7 @@ void DBusMenuImporter::slotGetLayoutFinished(QDBusPendingCallWatcher *watcher)
}
//insert or update new actions into our menu
for (const DBusMenuLayoutItem &dbusMenuItem: rootItem.children) {
for (const DBusMenuLayoutItem &dbusMenuItem: qAsConst(rootItem.children)) {
DBusMenuImporterPrivate::ActionForId::Iterator it = d->m_actionForId.find(dbusMenuItem.id);
QAction *action = nullptr;
if (it == d->m_actionForId.end()) {
......
......@@ -32,7 +32,7 @@ int main(int argc, char** argv)
asN.setPhase(phase);
cout << "phase: " << phase << '\n';
bool foundThings = true;
for (auto asi : asN.startList()) {
for (const auto &asi : asN.startList()) {
foundThings = false;
cout << "- " << asi.name << ' ' << asi.service;
if (!asi.startAfter.isEmpty())
......
......@@ -476,7 +476,7 @@ void waitForKonqi()
services = allServices(QLatin1String("org.kde.drkonqi-"));
if (wait_drkonqi_counter.elapsed() >= wait_drkonqi_timeout) {
// ask remaining drkonqis to die in a graceful way
for (const auto &service: services) {
for (const auto &service: qAsConst(services)) {
QDBusInterface iface(service, QStringLiteral("/MainApplication"));
iface.call(QStringLiteral("quit"));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment