diff options
Diffstat (limited to 'src/core/kconfigwatcher.cpp')
-rw-r--r-- | src/core/kconfigwatcher.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/core/kconfigwatcher.cpp b/src/core/kconfigwatcher.cpp index c5aa6205..3da2d535 100644 --- a/src/core/kconfigwatcher.cpp +++ b/src/core/kconfigwatcher.cpp @@ -16,17 +16,18 @@ #endif #include <QDebug> -#include <QThreadStorage> #include <QHash> +#include <QThreadStorage> -class KConfigWatcherPrivate { +class KConfigWatcherPrivate +{ public: KSharedConfig::Ptr m_config; }; KConfigWatcher::Ptr KConfigWatcher::create(const KSharedConfig::Ptr &config) { - static QThreadStorage<QHash<KSharedConfig*, QWeakPointer<KConfigWatcher>>> watcherList; + static QThreadStorage<QHash<KSharedConfig *, QWeakPointer<KConfigWatcher>>> watcherList; auto c = config.data(); KConfigWatcher::Ptr watcher; @@ -43,9 +44,9 @@ KConfigWatcher::Ptr KConfigWatcher::create(const KSharedConfig::Ptr &config) return watcherList.localData().value(c).toStrongRef(); } -KConfigWatcher::KConfigWatcher(const KSharedConfig::Ptr &config): - QObject (nullptr), - d(new KConfigWatcherPrivate) +KConfigWatcher::KConfigWatcher(const KSharedConfig::Ptr &config) + : QObject(nullptr) + , d(new KConfigWatcherPrivate) { Q_ASSERT(config); #if KCONFIG_USE_DBUS @@ -65,13 +66,13 @@ KConfigWatcher::KConfigWatcher(const KSharedConfig::Ptr &config): watchedPaths << QStringLiteral("/kdeglobals"); } - for(const QString &path: qAsConst(watchedPaths)) { + for (const QString &path : qAsConst(watchedPaths)) { QDBusConnection::sessionBus().connect(QString(), path, QStringLiteral("org.kde.kconfig.notify"), QStringLiteral("ConfigChanged"), this, - SLOT(onConfigChangeNotification(QHash<QString,QByteArrayList>))); + SLOT(onConfigChangeNotification(QHash<QString, QByteArrayList>))); } #else qCWarning(KCONFIG_CORE_LOG) << "Use of KConfigWatcher without DBus support. You will not receive updates"; @@ -87,17 +88,16 @@ KSharedConfig::Ptr KConfigWatcher::config() const void KConfigWatcher::onConfigChangeNotification(const QHash<QString, QByteArrayList> &changes) { - //should we ever need it we can determine the file changed with QDbusContext::message().path(), but it doesn't seem too useful + // should we ever need it we can determine the file changed with QDbusContext::message().path(), but it doesn't seem too useful d->m_config->reparseConfiguration(); - for(auto it = changes.constBegin(); it != changes.constEnd(); it++) { - KConfigGroup group = d->m_config->group(QString());//top level group - const auto parts = it.key().split(QLatin1Char('\x1d')); //magic char, see KConfig - for(const QString &groupName: parts) { + for (auto it = changes.constBegin(); it != changes.constEnd(); it++) { + KConfigGroup group = d->m_config->group(QString()); // top level group + const auto parts = it.key().split(QLatin1Char('\x1d')); // magic char, see KConfig + for (const QString &groupName : parts) { group = group.group(groupName); } Q_EMIT configChanged(group, it.value()); } } - |