Commit 0ced9a3c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port foreach to for(...:..)

parent f7c595ca
......@@ -267,7 +267,8 @@ static int startApp(QCommandLineParser &p)
p.showHelp(1);
}
}
foreach (const QString &arg, p.positionalArguments()) {
const auto positionalArguments = p.positionalArguments();
for (const QString &arg : positionalArguments) {
command += ' ';
command += QFile::encodeName(KShell::quoteArg(arg));
}
......
......@@ -406,7 +406,8 @@ void MimeTypeData::syncServices()
// Clean out any kde-mimeapps.list which would take precedence any cancel our changes.
const QString desktops = QString::fromLocal8Bit(qgetenv("XDG_CURRENT_DESKTOP"));
foreach (const QString &desktop, desktops.split(QLatin1Char(':'), Qt::SkipEmptyParts)) {
const auto desktopsSplit = desktops.split(QLatin1Char(':'), Qt::SkipEmptyParts);
for (const QString &desktop : desktopsSplit) {
const QString file =
QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + desktop.toLower() + QLatin1String("-mimeapps.list");
if (QFileInfo::exists(file)) {
......
......@@ -98,7 +98,7 @@ bool MimeTypeWriter::write()
writer.writeStartElement(nsUri, QStringLiteral("glob-deleteall"));
writer.writeEndElement(); // glob-deleteall
foreach (const QString &pattern, d->m_patterns) {
for (const QString &pattern : qAsConst(d->m_patterns)) {
writer.writeStartElement(nsUri, QStringLiteral("glob"));
writer.writeAttribute(QStringLiteral("pattern"), pattern);
writer.writeEndElement(); // glob
......
......@@ -41,7 +41,7 @@ static QUrl makeURL(const QString &urlArg)
static QList<QUrl> makeUrls(const QStringList &urlArgs)
{
QList<QUrl> ret;
foreach (const QString &url, urlArgs) {
for (const QString &url : urlArgs) {
ret += makeURL(url);
}
return ret;
......
Supports Markdown
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