aboutsummaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kconfiggroupgui.cpp12
-rw-r--r--src/gui/kconfiggui.cpp4
-rw-r--r--src/gui/kconfigloader.cpp24
-rw-r--r--src/gui/kconfigloader.h6
-rw-r--r--src/gui/kconfigskeleton.h4
5 files changed, 24 insertions, 26 deletions
diff --git a/src/gui/kconfiggroupgui.cpp b/src/gui/kconfiggroupgui.cpp
index a14c204c..e2eb950f 100644
--- a/src/gui/kconfiggroupgui.cpp
+++ b/src/gui/kconfiggroupgui.cpp
@@ -38,11 +38,11 @@
static bool readEntryGui(const QByteArray &data, const char *key, const QVariant &input,
QVariant &output)
{
- const QString errString = QString::fromLatin1("\"%1\" - conversion from \"%3\" to %2 failed")
+ const QString errString = QStringLiteral("\"%1\" - conversion from \"%3\" to %2 failed")
.arg(QLatin1String(key))
.arg(QLatin1String(QVariant::typeToName(input.type())))
.arg(QLatin1String(data.constData()));
- const QString formatError = QString::fromLatin1(" (wrong format: expected '%1' items, read '%2')");
+ const QString formatError = QStringLiteral(" (wrong format: expected '%1' items, read '%2')");
// set in case of failure
output = input;
@@ -70,7 +70,7 @@ static bool readEntryGui(const QByteArray &data, const char *key, const QVariant
const int count = list.count();
if (count != 3 && count != 4) {
- qCritical() << qPrintable(errString) << qPrintable(formatError.arg(QLatin1String("3' or '4")).arg(count));
+ qCritical() << qPrintable(errString) << qPrintable(formatError.arg(QStringLiteral("3' or '4")).arg(count));
return true; // return default
}
@@ -84,12 +84,12 @@ static bool readEntryGui(const QByteArray &data, const char *key, const QVariant
return true; // return default
}
if (j < 0 || j > 255) {
- static const char *const components[6] = {
+ static const char *const components[] = {
"red", "green", "blue", "alpha"
};
- const QString boundsError = QLatin1String(" (bounds error: %1 component %2)");
+ const QString boundsError = QStringLiteral(" (bounds error: %1 component %2)");
qCritical() << qPrintable(errString)
- << qPrintable(boundsError.arg(QLatin1String(components[i])).arg(j < 0 ? QLatin1String("< 0") : QLatin1String("> 255")));
+ << qPrintable(boundsError.arg(QLatin1String(components[i])).arg(j < 0 ? QStringLiteral("< 0") : QStringLiteral("> 255")));
return true; // return default
}
}
diff --git a/src/gui/kconfiggui.cpp b/src/gui/kconfiggui.cpp
index 1eee8ce5..0048c60a 100644
--- a/src/gui/kconfiggui.cpp
+++ b/src/gui/kconfiggui.cpp
@@ -25,7 +25,7 @@
#include <kconfig.h>
-static KConfig *s_sessionConfig = 0;
+static KConfig *s_sessionConfig = Q_NULLPTR;
KConfig *KConfigGui::sessionConfig()
{
@@ -37,7 +37,7 @@ KConfig *KConfigGui::sessionConfig()
bool KConfigGui::hasSessionConfig()
{
- return s_sessionConfig != 0;
+ return s_sessionConfig != Q_NULLPTR;
}
QString KConfigGui::sessionConfigName()
diff --git a/src/gui/kconfigloader.cpp b/src/gui/kconfigloader.cpp
index 1dd9e7fc..52ac6d17 100644
--- a/src/gui/kconfigloader.cpp
+++ b/src/gui/kconfigloader.cpp
@@ -76,7 +76,7 @@ bool ConfigLoaderHandler::startElement(const QString &namespaceURI, const QStrin
} else {
d->groups.append(group);
if (!d->baseGroup.isEmpty()) {
- group = d->baseGroup + QStringLiteral("\x1d") + group;
+ group = d->baseGroup + QLatin1Char('\x1d') + group;
}
}
@@ -194,9 +194,9 @@ void ConfigLoaderHandler::addItem()
m_name = m_key;
}
- m_name.remove(QStringLiteral(" "));
+ m_name.remove(QLatin1Char(' '));
- KConfigSkeletonItem *item = 0;
+ KConfigSkeletonItem *item = Q_NULLPTR;
if (m_type == QStringLiteral("bool")) {
bool defaultValue = m_default.toLower() == QStringLiteral("true");
@@ -239,7 +239,7 @@ void ConfigLoaderHandler::addItem()
} else if (m_type == QStringLiteral("stringlist")) {
//FIXME: the split() is naive and will break on lists with ,'s in them
item = m_config->addItemStringList(m_name, *d->newStringList(),
- m_default.split(QStringLiteral(",")), m_key);
+ m_default.split(QLatin1Char(',')), m_key);
} else if (m_type == QStringLiteral("uint")) {
KConfigSkeleton::ItemUInt *uintItem =
m_config->addItemUInt(m_name, *d->newUint(), m_default.toUInt(), m_key);
@@ -269,7 +269,7 @@ void ConfigLoaderHandler::addItem()
}
item = doubleItem;
} else if (m_type == QStringLiteral("intlist")) {
- QStringList tmpList = m_default.split(QStringLiteral(","));
+ QStringList tmpList = m_default.split(QLatin1Char(','));
QList<int> defaultList;
foreach (const QString &tmp, tmpList) {
defaultList.append(tmp.toInt());
@@ -292,7 +292,7 @@ void ConfigLoaderHandler::addItem()
*/
} else if (m_type == QStringLiteral("point")) {
QPoint defaultPoint;
- QStringList tmpList = m_default.split(QStringLiteral(","));
+ QStringList tmpList = m_default.split(QLatin1Char(','));
if (tmpList.size() >= 2) {
defaultPoint.setX(tmpList[0].toInt());
defaultPoint.setY(tmpList[1].toInt());
@@ -300,7 +300,7 @@ void ConfigLoaderHandler::addItem()
item = m_config->addItemPoint(m_name, *d->newPoint(), defaultPoint, m_key);
} else if (m_type == QStringLiteral("rect")) {
QRect defaultRect;
- QStringList tmpList = m_default.split(QStringLiteral(","));
+ QStringList tmpList = m_default.split(QLatin1Char(','));
if (tmpList.size() >= 4) {
defaultRect.setCoords(tmpList[0].toInt(), tmpList[1].toInt(),
tmpList[2].toInt(), tmpList[3].toInt());
@@ -308,7 +308,7 @@ void ConfigLoaderHandler::addItem()
item = m_config->addItemRect(m_name, *d->newRect(), defaultRect, m_key);
} else if (m_type == QStringLiteral("size")) {
QSize defaultSize;
- QStringList tmpList = m_default.split(QStringLiteral(","));
+ QStringList tmpList = m_default.split(QLatin1Char(','));
if (tmpList.size() >= 2) {
defaultSize.setWidth(tmpList[0].toInt());
defaultSize.setHeight(tmpList[1].toInt());
@@ -382,7 +382,7 @@ KConfigLoader::KConfigLoader(const KConfigGroup &config, QIODevice *xml, QObject
KConfigGroup group = config.parent();
d->baseGroup = config.name();
while (group.isValid() && group.name() != QStringLiteral("<default>")) {
- d->baseGroup = group.name() + QStringLiteral("\x1d") + d->baseGroup;
+ d->baseGroup = group.name() + QLatin1Char('\x1d') + d->baseGroup;
group = group.parent();
}
d->parse(this, xml);
@@ -427,10 +427,8 @@ QStringList KConfigLoader::groupList() const
bool KConfigLoader::usrWriteConfig()
{
if (d->saveDefaults) {
- KConfigSkeletonItem::List itemList = items();
- for (int i = 0; i < itemList.size(); i++) {
- KConfigGroup cg(config(), itemList.at(i)->group());
- cg.writeEntry(itemList.at(i)->key(), "");
+ foreach (const auto& item, items()) {
+ config()->group(item->group()).writeEntry(item->key(), "");
}
}
return true;
diff --git a/src/gui/kconfigloader.h b/src/gui/kconfigloader.h
index 36eb182f..0fb51421 100644
--- a/src/gui/kconfigloader.h
+++ b/src/gui/kconfigloader.h
@@ -107,7 +107,7 @@ public:
* @param xml the xml data; must be valid KConfigXT data
* @param parent optional QObject parent
**/
- KConfigLoader(const QString &configFile, QIODevice *xml, QObject *parent = 0);
+ KConfigLoader(const QString &configFile, QIODevice *xml, QObject *parent = Q_NULLPTR);
/**
* Creates a KConfigSkeleton populated using the definition found in
@@ -117,7 +117,7 @@ public:
* @param xml the xml data; must be valid KConfigXT data
* @param parent optional QObject parent
**/
- KConfigLoader(KSharedConfigPtr config, QIODevice *xml, QObject *parent = 0);
+ KConfigLoader(KSharedConfigPtr config, QIODevice *xml, QObject *parent = Q_NULLPTR);
/**
* Creates a KConfigSkeleton populated using the definition found in
@@ -127,7 +127,7 @@ public:
* @param xml the xml data; must be valid KConfigXT data
* @param parent optional QObject parent
**/
- KConfigLoader(const KConfigGroup &config, QIODevice *xml, QObject *parent = 0);
+ KConfigLoader(const KConfigGroup &config, QIODevice *xml, QObject *parent = Q_NULLPTR);
~KConfigLoader();
diff --git a/src/gui/kconfigskeleton.h b/src/gui/kconfigskeleton.h
index f87eef6e..4cd8d140 100644
--- a/src/gui/kconfigskeleton.h
+++ b/src/gui/kconfigskeleton.h
@@ -95,14 +95,14 @@ public:
* @param configname name of config file. If no name is given, the default
* config file as returned by KSharedConfig::openConfig() is used.
*/
- explicit KConfigSkeleton(const QString &configname = QString(), QObject *parent = 0);
+ explicit KConfigSkeleton(const QString &configname = QString(), QObject *parent = Q_NULLPTR);
/**
* Constructor.
*
* @param config configuration object to use.
*/
- explicit KConfigSkeleton(KSharedConfig::Ptr config, QObject *parent = 0);
+ explicit KConfigSkeleton(KSharedConfig::Ptr config, QObject *parent = Q_NULLPTR);
/**
* Register an item of type QColor.