aboutsummaryrefslogtreecommitdiff
path: root/src/core/kconfigwatcher.cpp
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2021-02-22 17:38:09 +0200
committerAhmad Samir <a.samirh78@gmail.com>2021-02-22 17:38:09 +0200
commit8bed00ab34e31f2b9c70026d418d923913325798 (patch)
treef289c15575415a36bc19c047a2037998e9b11ce8 /src/core/kconfigwatcher.cpp
parent186755fd56b58dc97250846c5305ef89f9487f86 (diff)
downloadkconfig-8bed00ab34e31f2b9c70026d418d923913325798.tar.gz
kconfig-8bed00ab34e31f2b9c70026d418d923913325798.tar.bz2
Run clang-format on all cpp/h files
NO_CHANGELOG
Diffstat (limited to 'src/core/kconfigwatcher.cpp')
-rw-r--r--src/core/kconfigwatcher.cpp28
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());
}
}
-