aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2021-02-22 19:25:40 +0200
committerAhmad Samir <a.samirh78@gmail.com>2021-02-22 21:28:00 +0200
commit48c132be8aa983165126b0641a083848dd5c6620 (patch)
treee86e514536a914c09c8e83c12d0ad46a369a86d2
parent8bed00ab34e31f2b9c70026d418d923913325798 (diff)
downloadkconfig-48c132be8aa983165126b0641a083848dd5c6620.tar.gz
kconfig-48c132be8aa983165126b0641a083848dd5c6620.tar.bz2
Fix formatting in a couple of places after running clang-format
NO_CHANGELOG
-rw-r--r--src/core/kauthorized.cpp17
-rw-r--r--src/core/kconfig.cpp7
-rw-r--r--src/core/kconfigdata.h8
-rw-r--r--src/core/kconfigini.cpp6
-rw-r--r--src/gui/kconfiggroupgui.cpp7
-rw-r--r--src/kconf_update/kconf_update.cpp4
-rw-r--r--src/kconfig_compiler/KConfigHeaderGenerator.cpp4
-rw-r--r--src/kconfig_compiler/kconfig_compiler.cpp8
-rw-r--r--src/kreadconfig/kwriteconfig.cpp13
9 files changed, 52 insertions, 22 deletions
diff --git a/src/core/kauthorized.cpp b/src/core/kauthorized.cpp
index a08586c5..46b33ab2 100644
--- a/src/core/kauthorized.cpp
+++ b/src/core/kauthorized.cpp
@@ -77,11 +77,14 @@ public:
bool baseMatch(const QUrl &url, const QString &protClass) const
{
if (baseProtWildCard) {
- if (!baseProt.isEmpty() && !url.scheme().startsWith(baseProt) && (protClass.isEmpty() || (protClass != baseProt))) {
+ if (!baseProt.isEmpty() //
+ && !url.scheme().startsWith(baseProt) //
+ && (protClass.isEmpty() || (protClass != baseProt))) {
return false;
}
} else {
- if ((url.scheme() != baseProt) && (protClass.isEmpty() || (protClass != baseProt))) {
+ if (url.scheme() != baseProt //
+ && (protClass.isEmpty() || (protClass != baseProt))) {
return false;
}
}
@@ -109,15 +112,19 @@ public:
bool destMatch(const QUrl &url, const QString &protClass, const QUrl &base, const QString &baseClass) const
{
if (destProtEqual) {
- if ((url.scheme() != base.scheme()) && (protClass.isEmpty() || baseClass.isEmpty() || protClass != baseClass)) {
+ if (url.scheme() != base.scheme() //
+ && (protClass.isEmpty() || baseClass.isEmpty() || protClass != baseClass)) {
return false;
}
} else if (destProtWildCard) {
- if (!destProt.isEmpty() && !url.scheme().startsWith(destProt) && (protClass.isEmpty() || (protClass != destProt))) {
+ if (!destProt.isEmpty() //
+ && !url.scheme().startsWith(destProt) //
+ && (protClass.isEmpty() || (protClass != destProt))) {
return false;
}
} else {
- if ((url.scheme() != destProt) && (protClass.isEmpty() || (protClass != destProt))) {
+ if (url.scheme() != destProt //
+ && (protClass.isEmpty() || (protClass != destProt))) {
return false;
}
}
diff --git a/src/core/kconfig.cpp b/src/core/kconfig.cpp
index 2da1dd48..ab6ac5c5 100644
--- a/src/core/kconfig.cpp
+++ b/src/core/kconfig.cpp
@@ -756,8 +756,8 @@ void KConfigPrivate::parseConfigFiles()
}
} else {
QExplicitlySharedDataPointer<KConfigBackend> backend = KConfigBackend::create(file);
- bFileImmutable = (backend->parseConfig(utf8Locale, entryMap, KConfigBackend::ParseDefaults | KConfigBackend::ParseExpansions)
- == KConfigBackend::ParseImmutable);
+ constexpr auto parseOpts = KConfigBackend::ParseDefaults | KConfigBackend::ParseExpansions;
+ bFileImmutable = backend->parseConfig(utf8Locale, entryMap, parseOpts) == KConfigBackend::ParseImmutable;
}
if (bFileImmutable) {
@@ -918,8 +918,7 @@ bool KConfig::isConfigWritable(bool warnUser)
errorMsg += QCoreApplication::translate("KConfig", "Please contact your system administrator.");
QString cmdToExec = QStandardPaths::findExecutable(QStringLiteral("kdialog"));
if (!cmdToExec.isEmpty()) {
- QProcess::execute(cmdToExec,
- QStringList() << QStringLiteral("--title") << QCoreApplication::applicationName() << QStringLiteral("--msgbox") << errorMsg);
+ QProcess::execute(cmdToExec, QStringList{QStringLiteral("--title"), QCoreApplication::applicationName(), QStringLiteral("--msgbox"), errorMsg});
}
}
diff --git a/src/core/kconfigdata.h b/src/core/kconfigdata.h
index bb9ee717..afa18877 100644
--- a/src/core/kconfigdata.h
+++ b/src/core/kconfigdata.h
@@ -79,7 +79,13 @@ struct KEntry {
// omits the dirty/notify flag from the comparison.
inline bool operator==(const KEntry &k1, const KEntry &k2)
{
- return k1.bGlobal == k2.bGlobal && k1.bImmutable == k2.bImmutable && k1.bDeleted == k2.bDeleted && k1.bExpand == k2.bExpand && k1.mValue == k2.mValue;
+ /* clang-format off */
+ return k1.bGlobal == k2.bGlobal
+ && k1.bImmutable == k2.bImmutable
+ && k1.bDeleted == k2.bDeleted
+ && k1.bExpand == k2.bExpand
+ && k1.mValue == k2.mValue;
+ /* clang-format on */
}
inline bool operator!=(const KEntry &k1, const KEntry &k2)
diff --git a/src/core/kconfigini.cpp b/src/core/kconfigini.cpp
index 6271bcd5..f47310d0 100644
--- a/src/core/kconfigini.cpp
+++ b/src/core/kconfigini.cpp
@@ -133,7 +133,11 @@ KConfigBackend::ParseInfo KConfigIniBackend::parseConfig(const QByteArray &curre
}
++end;
}
- if (end + 1 == line.length() && start + 2 == end && line.at(start) == '$' && line.at(start + 1) == 'i') {
+ /* clang-format off */
+ if (end + 1 == line.length()
+ && start + 2 == end
+ && line.at(start) == '$'
+ && line.at(start + 1) == 'i') { /* clang-format on */
if (newGroup.isEmpty()) {
fileOptionImmutable = !kde_kiosk_exception;
} else {
diff --git a/src/gui/kconfiggroupgui.cpp b/src/gui/kconfiggroupgui.cpp
index 5fbdbfad..09c31590 100644
--- a/src/gui/kconfiggroupgui.cpp
+++ b/src/gui/kconfiggroupgui.cpp
@@ -154,9 +154,12 @@ static bool writeEntryGui(KConfigGroup *cg, const char *key, const QVariant &pro
// than the former. For more details see:
// https://bugreports.qt.io/browse/QTBUG-63792
// https://bugs.kde.org/show_bug.cgi?id=378523
+ /* clang-format off */
if (f.weight() == QFont::Normal
- && (f.styleName() == QLatin1String("Regular") || f.styleName() == QLatin1String("Normal") || f.styleName() == QLatin1String("Book")
- || f.styleName() == QLatin1String("Roman"))) {
+ && (f.styleName() == QLatin1String("Regular")
+ || f.styleName() == QLatin1String("Normal")
+ || f.styleName() == QLatin1String("Book")
+ || f.styleName() == QLatin1String("Roman"))) { /* clang-format on */
f.setStyleName(QString());
}
cg->writeEntry(key, f.toString().toUtf8(), pFlags);
diff --git a/src/kconf_update/kconf_update.cpp b/src/kconf_update/kconf_update.cpp
index defe0b80..a08ecaae 100644
--- a/src/kconf_update/kconf_update.cpp
+++ b/src/kconf_update/kconf_update.cpp
@@ -199,7 +199,9 @@ QStringList KonfUpdate::findUpdateFiles(bool dirtyOnly)
KConfigGroup cg(m_config, fileName);
const QDateTime ctime = QDateTime::fromSecsSinceEpoch(cg.readEntry("ctime", 0u));
const QDateTime mtime = QDateTime::fromSecsSinceEpoch(cg.readEntry("mtime", 0u));
- if (!dirtyOnly || (ctime.isValid() && ctime != info.birthTime()) || mtime != info.lastModified()) {
+ if (!dirtyOnly //
+ || (ctime.isValid() && ctime != info.birthTime()) //
+ || mtime != info.lastModified()) {
result.append(file);
}
}
diff --git a/src/kconfig_compiler/KConfigHeaderGenerator.cpp b/src/kconfig_compiler/KConfigHeaderGenerator.cpp
index d2c7e6cf..21eb51a5 100644
--- a/src/kconfig_compiler/KConfigHeaderGenerator.cpp
+++ b/src/kconfig_compiler/KConfigHeaderGenerator.cpp
@@ -74,7 +74,9 @@ void KConfigHeaderGenerator::doClassDefinition()
}
// Member variables
- if (!cfg().memberVariables.isEmpty() && cfg().memberVariables != QLatin1String("private") && cfg().memberVariables != QLatin1String("dpointer")) {
+ if (!cfg().memberVariables.isEmpty() //
+ && cfg().memberVariables != QLatin1String("private") //
+ && cfg().memberVariables != QLatin1String("dpointer")) {
stream() << " " << cfg().memberVariables << ":\n";
}
diff --git a/src/kconfig_compiler/kconfig_compiler.cpp b/src/kconfig_compiler/kconfig_compiler.cpp
index 449d437a..3c226d5f 100644
--- a/src/kconfig_compiler/kconfig_compiler.cpp
+++ b/src/kconfig_compiler/kconfig_compiler.cpp
@@ -383,8 +383,8 @@ QString itemDeclaration(const CfgEntry *e, const KConfigParameters &cfg)
QString result;
if (!cfg.itemAccessors && !cfg.dpointer) {
- result += QLatin1String{" "} + (!e->signalList.isEmpty() ? QStringLiteral("KConfigCompilerSignallingItem") : type) + QLatin1String{" *item"} + fCap
- + argSuffix + QLatin1String{";\n"};
+ result += QLatin1String{" "} + (!e->signalList.isEmpty() ? QStringLiteral("KConfigCompilerSignallingItem") : type);
+ result += QLatin1String{" *item"} + fCap + argSuffix + QLatin1String{";\n"};
}
if (!e->signalList.isEmpty()) {
@@ -436,8 +436,8 @@ QString itemPath(const CfgEntry *e, const KConfigParameters &cfg)
QString newInnerItem(const CfgEntry *entry, const QString &key, const QString &defaultValue, const KConfigParameters &cfg, const QString &param)
{
- QString t = QLatin1String{"new "} + cfg.inherits + QLatin1String{"::Item"} + itemType(entry->type) + QLatin1String{"( currentGroup(), "} + key
- + QLatin1String{", "} + varPath(entry->name, cfg) + param;
+ QString t = QLatin1String{"new "} + cfg.inherits + QLatin1String{"::Item"} + itemType(entry->type);
+ t += QLatin1String{"( currentGroup(), "} + key + QLatin1String{", "} + varPath(entry->name, cfg) + param;
if (entry->type == QLatin1String("Enum")) {
t += QLatin1String{", values"} + entry->name;
diff --git a/src/kreadconfig/kwriteconfig.cpp b/src/kreadconfig/kwriteconfig.cpp
index ba16ec68..a8a1ee4e 100644
--- a/src/kreadconfig/kwriteconfig.cpp
+++ b/src/kreadconfig/kwriteconfig.cpp
@@ -59,16 +59,23 @@ int main(int argc, char **argv)
konfig = new KConfig(file, KConfig::NoGlobals);
KConfigGroup cfgGroup = konfig->group(QString());
- for (const QString &grp : groups)
+ for (const QString &grp : groups) {
cfgGroup = cfgGroup.group(grp);
- if (konfig->accessMode() != KConfig::ReadWrite || cfgGroup.isEntryImmutable(key))
+ }
+
+ if (konfig->accessMode() != KConfig::ReadWrite || cfgGroup.isEntryImmutable(key)) {
return 2;
+ }
if (del) {
cfgGroup.deleteEntry(key);
} else if (type == QStringLiteral("bool")) {
// For symmetry with kreadconfig we accept a wider range of values as true than Qt
- bool boolvalue = (value == QStringLiteral("true") || value == QStringLiteral("on") || value == QStringLiteral("yes") || value == QStringLiteral("1"));
+ /* clang-format off */
+ bool boolvalue = value == QStringLiteral("true")
+ || value == QStringLiteral("on")
+ || value == QStringLiteral("yes")
+ || value == QStringLiteral("1"); /* clang-format on */
cfgGroup.writeEntry(key, boolvalue);
} else if (type == QStringLiteral("path")) {
cfgGroup.writePathEntry(key, value);