aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/kconfigini.cpp2
-rw-r--r--src/gui/kconfiggroupgui.cpp10
-rw-r--r--src/gui/kconfiggui.cpp2
-rw-r--r--src/gui/kwindowconfig.cpp10
-rw-r--r--src/kconfig_compiler/kconfig_compiler.cpp2
-rw-r--r--src/kreadconfig/kreadconfig.cpp12
-rw-r--r--src/kreadconfig/kwriteconfig.cpp12
7 files changed, 28 insertions, 22 deletions
diff --git a/src/core/kconfigini.cpp b/src/core/kconfigini.cpp
index f47310d0..dd24a959 100644
--- a/src/core/kconfigini.cpp
+++ b/src/core/kconfigini.cpp
@@ -44,6 +44,8 @@ static QByteArray lookup(const KConfigIniBackend::BufferFragment fragment, QHash
QString KConfigIniBackend::warningProlog(const QFile &file, int line)
{
+ // %2 then %1 i.e. int before QString, so that the QString is last
+ // This avoids a wrong substitution if the fileName itself contains %1
return QStringLiteral("KConfigIni: In file %2, line %1: ").arg(line).arg(file.fileName());
}
diff --git a/src/gui/kconfiggroupgui.cpp b/src/gui/kconfiggroupgui.cpp
index 09c31590..ab0c268f 100644
--- a/src/gui/kconfiggroupgui.cpp
+++ b/src/gui/kconfiggroupgui.cpp
@@ -54,8 +54,9 @@ static bool readEntryGui(const QByteArray &data, const char *key, const QVariant
const int count = list.count();
if (count != 3 && count != 4) {
- const QString formatError = QStringLiteral(" (wrong format: expected '%1' items, read '%2')");
- qCritical() << qPrintable(errString()) << qPrintable(formatError.arg(QStringLiteral("3' or '4")).arg(count));
+ qCritical() //
+ << qPrintable(errString()) //
+ << qPrintable(QStringLiteral(" (wrong format: expected '%1' items, read '%2')").arg(QStringLiteral("3' or '4")).arg(count));
return true; // return default
}
@@ -70,9 +71,10 @@ static bool readEntryGui(const QByteArray &data, const char *key, const QVariant
}
if (j < 0 || j > 255) {
static const char *const components[] = {"red", "green", "blue", "alpha"};
- const QString boundsError = QStringLiteral(" (bounds error: %1 component %2)");
qCritical() << qPrintable(errString())
- << qPrintable(boundsError.arg(QLatin1String(components[i])).arg(j < 0 ? QStringLiteral("< 0") : QStringLiteral("> 255")));
+ << qPrintable(QStringLiteral(" (bounds error: %1 component %2)")
+ .arg(QLatin1String(components[i]), //
+ j < 0 ? QStringLiteral("< 0") : QStringLiteral("> 255")));
return true; // return default
}
}
diff --git a/src/gui/kconfiggui.cpp b/src/gui/kconfiggui.cpp
index 938fbd93..cafe061d 100644
--- a/src/gui/kconfiggui.cpp
+++ b/src/gui/kconfiggui.cpp
@@ -13,7 +13,7 @@
static QString configName(const QString &id, const QString &key)
{
- return (QLatin1String("session/") + QGuiApplication::applicationName() + QLatin1Char('_') + id + QLatin1Char('_') + key);
+ return QLatin1String("session/%1_%2_%3").arg(QGuiApplication::applicationName(), id, key);
}
static KConfig *s_sessionConfig = nullptr;
diff --git a/src/gui/kwindowconfig.cpp b/src/gui/kwindowconfig.cpp
index a7697782..019e1aa2 100644
--- a/src/gui/kwindowconfig.cpp
+++ b/src/gui/kwindowconfig.cpp
@@ -37,7 +37,7 @@ static QString allConnectedScreens()
static QString configFileString(const QRect &desk, const QString &key)
{
// We include resolution data to also save data on a per-resolution basis
- const QString returnString = QStringLiteral("%1 %2 %3x%4").arg(allConnectedScreens()).arg(key).arg(desk.width()).arg(desk.height());
+ const QString returnString = QStringLiteral("%1 %2 %3x%4").arg(allConnectedScreens(), key, QString::number(desk.width()), QString::number(desk.height()));
return returnString;
}
@@ -136,7 +136,7 @@ void KWindowConfig::saveWindowPosition(const QWindow *window, KConfigGroup &conf
{
// On Wayland, the compositor is solely responsible for window positioning,
// So this needs to be a no-op
- if (!window || QGuiApplication::platformName() == QStringLiteral("wayland")) {
+ if (!window || QGuiApplication::platformName() == QLatin1String{"wayland"}) {
return;
}
@@ -149,7 +149,7 @@ void KWindowConfig::restoreWindowPosition(QWindow *window, const KConfigGroup &c
{
// On Wayland, the compositor is solely responsible for window positioning,
// So this needs to be a no-op
- if (!window || QGuiApplication::platformName() == QStringLiteral("wayland")) {
+ if (!window || QGuiApplication::platformName() == QLatin1String{"wayland"}) {
return;
}
@@ -166,8 +166,8 @@ void KWindowConfig::restoreWindowPosition(QWindow *window, const KConfigGroup &c
// per-resolution information is not
// TODO: Remove in KF6 or maybe even KF5.85 or something. It really only needs
// to be here to transition existing users once they upgrade from 5.78 -> 5.79
- const int fallbackXPosition = config.readEntry(QStringLiteral("%1 XPosition %2").arg(allConnectedScreens()).arg(desk.width()), -1);
- const int fallbackYPosition = config.readEntry(QStringLiteral("%1 YPosition %2").arg(allConnectedScreens()).arg(desk.height()), -1);
+ const int fallbackXPosition = config.readEntry(QStringLiteral("%1 XPosition %2").arg(allConnectedScreens(), QString::number(desk.width())), -1);
+ const int fallbackYPosition = config.readEntry(QStringLiteral("%1 YPosition %2").arg(allConnectedScreens(), QString::number(desk.height())), -1);
const int xPos = config.readEntry(windowXPositionString(desk), fallbackXPosition);
const int yPos = config.readEntry(windowYPositionString(desk), fallbackYPosition);
diff --git a/src/kconfig_compiler/kconfig_compiler.cpp b/src/kconfig_compiler/kconfig_compiler.cpp
index 3c226d5f..50c54f8f 100644
--- a/src/kconfig_compiler/kconfig_compiler.cpp
+++ b/src/kconfig_compiler/kconfig_compiler.cpp
@@ -114,7 +114,7 @@ QString setFunction(const QString &n, const QString &className)
QString changeSignalName(const QString &n)
{
- return n + QStringLiteral("Changed");
+ return n + QLatin1String{"Changed"};
}
QString getDefaultFunction(const QString &n, const QString &className)
diff --git a/src/kreadconfig/kreadconfig.cpp b/src/kreadconfig/kreadconfig.cpp
index 444f3bde..f0fb3518 100644
--- a/src/kreadconfig/kreadconfig.cpp
+++ b/src/kreadconfig/kreadconfig.cpp
@@ -74,21 +74,23 @@ int main(int argc, char **argv)
configMustDeleted = true;
}
KConfigGroup cfgGroup = konfig->group(QString());
- for (const QString &grp : groups)
+ for (const QString &grp : groups) {
cfgGroup = cfgGroup.group(grp);
- if (type == QStringLiteral("bool")) {
+ }
+
+ if (type == QLatin1String{"bool"}) {
dflt = dflt.toLower();
- bool def = (dflt == QStringLiteral("true") || dflt == QStringLiteral("on") || dflt == QStringLiteral("yes") || dflt == QStringLiteral("1"));
+ bool def = (dflt == QLatin1String{"true"} || dflt == QLatin1String{"on"} || dflt == QLatin1String{"yes"} || dflt == QLatin1String{"1"});
bool retValue = !cfgGroup.readEntry(key, def);
if (configMustDeleted)
delete konfig;
return retValue;
- } else if ((type == QStringLiteral("num")) || (type == QStringLiteral("int"))) {
+ } else if (type == QLatin1String{"num"} || type == QLatin1String{"int"}) {
int retValue = cfgGroup.readEntry(key, dflt.toInt());
if (configMustDeleted)
delete konfig;
return retValue;
- } else if (type == QStringLiteral("path")) {
+ } else if (type == QLatin1String{"path"}) {
fprintf(stdout, "%s\n", cfgGroup.readPathEntry(key, dflt).toLocal8Bit().data());
if (configMustDeleted)
delete konfig;
diff --git a/src/kreadconfig/kwriteconfig.cpp b/src/kreadconfig/kwriteconfig.cpp
index a8a1ee4e..67d9637e 100644
--- a/src/kreadconfig/kwriteconfig.cpp
+++ b/src/kreadconfig/kwriteconfig.cpp
@@ -69,15 +69,15 @@ int main(int argc, char **argv)
if (del) {
cfgGroup.deleteEntry(key);
- } else if (type == QStringLiteral("bool")) {
+ } else if (type == QLatin1String{"bool"}) {
// For symmetry with kreadconfig we accept a wider range of values as true than Qt
/* clang-format off */
- bool boolvalue = value == QStringLiteral("true")
- || value == QStringLiteral("on")
- || value == QStringLiteral("yes")
- || value == QStringLiteral("1"); /* clang-format on */
+ bool boolvalue = value == QLatin1String{"true"}
+ || value == QLatin1String{"on"}
+ || value == QLatin1String{"yes"}
+ || value == QLatin1String{"1"}; /* clang-format on */
cfgGroup.writeEntry(key, boolvalue);
- } else if (type == QStringLiteral("path")) {
+ } else if (type == QLatin1String{"path"}) {
cfgGroup.writePathEntry(key, value);
} else {
cfgGroup.writeEntry(key, value);