Commit 2fe1ffa9 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

execute: port foreach -> range-based for

parent 7539b176
......@@ -287,8 +287,10 @@ void NativeAppConfigType::configureLaunchFromCmdLineArguments ( KConfigGroup cfg
QList<KDevelop::ProjectTargetItem*> targetsInFolder(KDevelop::ProjectFolderItem* folder)
{
QList<KDevelop::ProjectTargetItem*> ret;
foreach(KDevelop::ProjectFolderItem* f, folder->folderList())
const auto folders = folder->folderList();
for (KDevelop::ProjectFolderItem* f : folders) {
ret += targetsInFolder(f);
}
ret += folder->targetList();
return ret;
......@@ -334,12 +336,13 @@ QMenu* NativeAppConfigType::launcherSuggestions()
QList<QAction*> separateActions;
QList<QMenu*> submenus;
foreach(KDevelop::ProjectBaseItem* folder, targetsContainer.keys()) {
QList<QAction*> actions = targetsContainer.value(folder);
for (auto it = targetsContainer.constBegin(), end = targetsContainer.constEnd(); it != end; ++it) {
KDevelop::ProjectBaseItem* folder = it.key();
QList<QAction*> actions = it.value();
if(actions.size()==1 || !folder->parent()) {
separateActions.append(actions);
} else {
foreach(QAction* a, actions) {
for (QAction* a : qAsConst(actions)) {
a->setText(a->property("name").toString());
}
QStringList path = model->pathFromIndex(folder->index());
......@@ -352,8 +355,9 @@ QMenu* NativeAppConfigType::launcherSuggestions()
}
std::sort(separateActions.begin(), separateActions.end(), actionLess);
std::sort(submenus.begin(), submenus.end(), menuLess);
foreach(QMenu* m, submenus)
for (QMenu* m : qAsConst(submenus)) {
projectMenu->addMenu(m);
}
projectMenu->addActions(separateActions);
projectMenu->setEnabled(!projectMenu->isEmpty());
......
......@@ -72,13 +72,15 @@ void ProjectTargetsComboBox::setBaseItem(ProjectFolderItem* item, bool exec)
}
ExecutablePathsVisitor walker(exec);
foreach(ProjectFolderItem* item, items) {
for (ProjectFolderItem* item : qAsConst(items)) {
walker.visit(item);
}
walker.sort();
foreach(const QString& item, walker.paths())
const auto executableItems = walker.paths();
for (const QString& item : executableItems) {
addItem(QIcon::fromTheme(QStringLiteral("system-run")), item);
}
}
......
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