aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/bufferfragment_p.h6
-rw-r--r--src/core/kconfig.cpp2
-rw-r--r--src/core/kconfig.h2
-rw-r--r--src/core/kconfigbackend.cpp4
-rw-r--r--src/core/kconfigdata.h2
-rw-r--r--src/core/kconfiggroup.cpp26
-rw-r--r--src/core/kconfiggroup.h6
-rw-r--r--src/core/kconfigini.cpp4
-rw-r--r--src/core/kcoreconfigskeleton.h6
-rw-r--r--src/core/kemailsettings.cpp2
-rw-r--r--src/core/ksharedconfig.cpp12
11 files changed, 36 insertions, 36 deletions
diff --git a/src/core/bufferfragment_p.h b/src/core/bufferfragment_p.h
index 8d0931bc..e2154a59 100644
--- a/src/core/bufferfragment_p.h
+++ b/src/core/bufferfragment_p.h
@@ -40,7 +40,7 @@ class KConfigIniBackend::BufferFragment
public:
- BufferFragment() : d(0), len(0)
+ BufferFragment() : d(Q_NULLPTR), len(0)
{
}
@@ -103,7 +103,7 @@ public:
bool isEmpty() const
{
- return (len == 0);
+ return !len;
}
BufferFragment left(unsigned int size) const
@@ -127,7 +127,7 @@ public:
bool isNull() const
{
- return (d == 0);
+ return !d;
}
BufferFragment mid(unsigned int pos, int length = -1) const
diff --git a/src/core/kconfig.cpp b/src/core/kconfig.cpp
index ea9746c0..89e92333 100644
--- a/src/core/kconfig.cpp
+++ b/src/core/kconfig.cpp
@@ -56,7 +56,7 @@ bool KConfigPrivate::mappingsRegistered = false;
KConfigPrivate::KConfigPrivate(KConfig::OpenFlags flags,
QStandardPaths::StandardLocation resourceType)
- : openFlags(flags), resourceType(resourceType), mBackend(0),
+ : openFlags(flags), resourceType(resourceType), mBackend(Q_NULLPTR),
bDynamicBackend(true), bDirty(false), bReadDefaults(false),
bFileImmutable(false), bForceGlobal(false), bSuppressGlobal(false),
configState(KConfigBase::NoAccess)
diff --git a/src/core/kconfig.h b/src/core/kconfig.h
index d27eebe7..d7d4b7df 100644
--- a/src/core/kconfig.h
+++ b/src/core/kconfig.h
@@ -210,7 +210,7 @@ public:
*
* @return @p config if it was set, otherwise a new KConfig object
*/
- KConfig *copyTo(const QString &file, KConfig *config = 0) const;
+ KConfig *copyTo(const QString &file, KConfig *config = Q_NULLPTR) const;
/**
* Ensures that the configuration file contains a certain update.
diff --git a/src/core/kconfigbackend.cpp b/src/core/kconfigbackend.cpp
index 90655fac..bf2bc9c7 100644
--- a/src/core/kconfigbackend.cpp
+++ b/src/core/kconfigbackend.cpp
@@ -56,7 +56,7 @@ BackendPtr KConfigBackend::create(const QString &file, const QString &sys)
{
//qDebug() << "creating a backend for file" << file << "with system" << sys;
const QString system = (sys.isEmpty() ? Private::whatSystem(file) : sys);
- KConfigBackend *backend = 0;
+ KConfigBackend *backend = Q_NULLPTR;
#if 0 // TODO port to Qt5 plugin loading
if (system.compare(QLatin1String("INI"), Qt::CaseInsensitive) != 0) {
@@ -65,7 +65,7 @@ BackendPtr KConfigBackend::create(const QString &file, const QString &sys)
//qDebug() << "found" << offers.count() << "offers for KConfigBackend plugins with name" << system;
foreach (const KService::Ptr &offer, offers) {
- backend = offer->createInstance<KConfigBackend>(0);
+ backend = offer->createInstance<KConfigBackend>(Q_NULLPTR);
if (backend) {
//qDebug() << "successfully created a backend for" << system;
backend->setFilePath(file);
diff --git a/src/core/kconfigdata.h b/src/core/kconfigdata.h
index e57becb2..fdec85dc 100644
--- a/src/core/kconfigdata.h
+++ b/src/core/kconfigdata.h
@@ -194,7 +194,7 @@ public:
QString getEntry(const QByteArray &group, const QByteArray &key,
const QString &defaultValue = QString(),
SearchFlags flags = SearchFlags(),
- bool *expand = 0) const;
+ bool *expand = Q_NULLPTR) const;
bool hasEntry(const QByteArray &group, const QByteArray &key = QByteArray(),
SearchFlags flags = SearchFlags()) const;
diff --git a/src/core/kconfiggroup.cpp b/src/core/kconfiggroup.cpp
index 6f609bae..1ad79f8c 100644
--- a/src/core/kconfiggroup.cpp
+++ b/src/core/kconfiggroup.cpp
@@ -202,7 +202,7 @@ static QList<qreal> asRealList(const QByteArray &string)
static QString errString(const char *pKey, const QByteArray &value, const QVariant &aDefault)
{
- return QString::fromLatin1("\"%1\" - conversion of \"%3\" to %2 failed")
+ return QStringLiteral("\"%1\" - conversion of \"%3\" to %2 failed")
.arg(QString::fromLatin1(pKey))
.arg(QString::fromLatin1(QVariant::typeToName(aDefault.type())))
.arg(QString::fromLatin1(value));
@@ -210,7 +210,7 @@ static QString errString(const char *pKey, const QByteArray &value, const QVaria
static QString formatError(int expected, int got)
{
- return QString::fromLatin1(" (wrong format: expected %1 items, got %2)").arg(expected).arg(got);
+ return QStringLiteral(" (wrong format: expected %1 items, got %2)").arg(expected).arg(got);
}
QVariant KConfigGroup::convertToQVariant(const char *pKey, const QByteArray &value, const QVariant &aDefault)
@@ -400,11 +400,11 @@ static bool cleanHomeDirPath(QString &path, const QString &homeDir)
int len = homeDir.length();
// replace by "$HOME" if possible
if (len && (path.length() == len || path[len] == QLatin1Char('/'))) {
- path.replace(0, len, QString::fromLatin1("$HOME"));
+ path.replace(0, len, QStringLiteral("$HOME"));
return true;
- } else {
- return false;
}
+
+ return false;
}
static QString translatePath(QString path) // krazy:exclude=passbyvalue
@@ -448,19 +448,19 @@ static QString translatePath(QString path) // krazy:exclude=passbyvalue
}
if (startsWithFile) {
- path.prepend(QString::fromLatin1("file://"));
+ path.prepend(QStringLiteral("file://"));
}
return path;
}
-KConfigGroup::KConfigGroup() : d(0)
+KConfigGroup::KConfigGroup() : d()
{
}
bool KConfigGroup::isValid() const
{
- return 0 != d.constData();
+ return bool(d);
}
KConfigGroupGui _kde_internal_KConfigGroupGui;
@@ -519,13 +519,13 @@ KConfigGroup &KConfigGroup::operator=(const KConfigGroup &rhs)
}
KConfigGroup::KConfigGroup(const KConfigGroup &rhs)
- : KConfigBase(), d(rhs.d)
+ : d(rhs.d)
{
}
KConfigGroup::~KConfigGroup()
{
- d = 0;
+ d.reset();
}
KConfigGroup KConfigGroup::groupImpl(const QByteArray &aGroup)
@@ -1094,7 +1094,7 @@ void KConfigGroup::writeXdgListEntry(const char *key, const QStringList &list, W
const QStringList::ConstIterator end = list.constEnd();
for (; it != end; ++it) {
QString val(*it);
- val.replace(QLatin1Char('\\'), QLatin1String("\\\\")).replace(QLatin1Char(';'), QLatin1String("\\;"));
+ val.replace(QLatin1Char('\\'), QStringLiteral("\\\\")).replace(QLatin1Char(';'), QStringLiteral("\\;"));
value += val;
value += QLatin1Char(';');
}
@@ -1254,7 +1254,7 @@ bool KConfigGroup::isGroupImmutableImpl(const QByteArray &b) const
void KConfigGroup::copyTo(KConfigBase *other, WriteConfigFlags pFlags) const
{
Q_ASSERT_X(isValid(), "KConfigGroup::copyTo", "accessing an invalid group");
- Q_ASSERT(other != 0);
+ Q_ASSERT(other != Q_NULLPTR);
if (KConfigGroup *otherGroup = dynamic_cast<KConfigGroup *>(other)) {
config()->d_func()->copyGroup(d->fullName(), otherGroup->d->fullName(), otherGroup, pFlags);
@@ -1271,7 +1271,7 @@ void KConfigGroup::reparent(KConfigBase *parent, WriteConfigFlags pFlags)
Q_ASSERT_X(isValid(), "KConfigGroup::reparent", "accessing an invalid group");
Q_ASSERT_X(!d->bConst, "KConfigGroup::reparent", "reparenting a read-only group");
Q_ASSERT_X(!d->bImmutable, "KConfigGroup::reparent", "reparenting an immutable group");
- Q_ASSERT(parent != 0);
+ Q_ASSERT(parent != Q_NULLPTR);
KConfigGroup oldGroup(*this);
diff --git a/src/core/kconfiggroup.h b/src/core/kconfiggroup.h
index 3c4bce84..abb246e3 100644
--- a/src/core/kconfiggroup.h
+++ b/src/core/kconfiggroup.h
@@ -88,7 +88,7 @@ public:
KConfigGroup(const KSharedConfigPtr &master, const char *group);
/**
- * Creates a read-only copy of a read-only group.
+ * Creates a copy of a group.
*/
KConfigGroup(const KConfigGroup &);
KConfigGroup &operator=(const KConfigGroup &);
@@ -280,9 +280,9 @@ public:
QString readEntry(const char *key, const QString &aDefault) const;
/** Overload for readEntry(const QString&, const QString&) */
- QString readEntry(const QString &key, const char *aDefault = 0) const;
+ QString readEntry(const QString &key, const char *aDefault = Q_NULLPTR) const;
/** Overload for readEntry(const QString&, const QString&) */
- QString readEntry(const char *key, const char *aDefault = 0) const;
+ QString readEntry(const char *key, const char *aDefault = Q_NULLPTR) const;
/**
* @copydoc readEntry(const char*, const QStringList&) const
diff --git a/src/core/kconfigini.cpp b/src/core/kconfigini.cpp
index df834f57..a882ee31 100644
--- a/src/core/kconfigini.cpp
+++ b/src/core/kconfigini.cpp
@@ -51,7 +51,7 @@ QString KConfigIniBackend::warningProlog(const QFile &file, int line)
}
KConfigIniBackend::KConfigIniBackend()
- : KConfigBackend(), lockFile(NULL)
+ : KConfigBackend(), lockFile(Q_NULLPTR)
{
}
@@ -617,7 +617,7 @@ void KConfigIniBackend::unlock()
{
lockFile->unlock();
delete lockFile;
- lockFile = NULL;
+ lockFile = Q_NULLPTR;
}
bool KConfigIniBackend::isLocked() const
diff --git a/src/core/kcoreconfigskeleton.h b/src/core/kcoreconfigskeleton.h
index bb9c1cf9..f8313d1e 100644
--- a/src/core/kcoreconfigskeleton.h
+++ b/src/core/kcoreconfigskeleton.h
@@ -526,7 +526,7 @@ public:
public:
/** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem */
ItemProperty(const QString &_group, const QString &_key,
- QVariant &reference, const QVariant &defaultValue = 0);
+ QVariant &reference, const QVariant &defaultValue = QVariant());
void readConfig(KConfig *config);
void setProperty(const QVariant &p);
@@ -1004,7 +1004,7 @@ public:
* config file as returned by KSharedConfig::openConfig() is used
* @param parent the parent object (see QObject documentation)
*/
- explicit KCoreConfigSkeleton(const QString &configname = QString(), QObject *parent = 0);
+ explicit KCoreConfigSkeleton(const QString &configname = QString(), QObject *parent = Q_NULLPTR);
/**
* Constructor.
@@ -1012,7 +1012,7 @@ public:
* @param config configuration object to use
* @param parent the parent object (see QObject documentation)
*/
- explicit KCoreConfigSkeleton(KSharedConfig::Ptr config, QObject *parent = 0);
+ explicit KCoreConfigSkeleton(KSharedConfig::Ptr config, QObject *parent = Q_NULLPTR);
/**
* Destructor
diff --git a/src/core/kemailsettings.cpp b/src/core/kemailsettings.cpp
index 230c2aa4..59d5f6e3 100644
--- a/src/core/kemailsettings.cpp
+++ b/src/core/kemailsettings.cpp
@@ -32,7 +32,7 @@
class KEMailSettingsPrivate
{
public:
- KEMailSettingsPrivate() : m_pConfig(0) {}
+ KEMailSettingsPrivate() : m_pConfig(Q_NULLPTR) {}
~KEMailSettingsPrivate()
{
delete m_pConfig;
diff --git a/src/core/ksharedconfig.cpp b/src/core/ksharedconfig.cpp
index 34947065..f4b4c766 100644
--- a/src/core/ksharedconfig.cpp
+++ b/src/core/ksharedconfig.cpp
@@ -72,13 +72,13 @@ KSharedConfigPtr KSharedConfig::openConfig(const QString &_fileName,
}
if (list) {
- for (QList<KSharedConfig *>::ConstIterator it = list->constBegin(); it != list->constEnd(); ++it) {
- if ((*it)->name() == fileName &&
- (*it)->d_ptr->openFlags == flags &&
- (*it)->locationType() == resType
-// (*it)->backEnd()->type() == backEnd
+ foreach (auto cfg, *static_cast<const GlobalSharedConfigList*>(list)) {
+ if (cfg->name() == fileName &&
+ cfg->d_ptr->openFlags == flags &&
+ cfg->locationType() == resType
+// cfg->backend()->type() == backend
) {
- return KSharedConfigPtr(*it);
+ return KSharedConfigPtr(cfg);
}
}
}