Changeset View
Changeset View
Standalone View
Standalone View
src/core/kconfigwatcher.cpp
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Line(s) | 64 | #if KCONFIG_USE_DBUS | |||
---|---|---|---|---|---|
87 | } | 87 | } | ||
88 | #else | 88 | #else | ||
89 | qCWarning(KCONFIG_CORE_LOG) << "Use of KConfigWatcher without DBus support. You will not receive updates"; | 89 | qCWarning(KCONFIG_CORE_LOG) << "Use of KConfigWatcher without DBus support. You will not receive updates"; | ||
90 | #endif | 90 | #endif | ||
91 | } | 91 | } | ||
92 | 92 | | |||
93 | KConfigWatcher::~KConfigWatcher() = default; | 93 | KConfigWatcher::~KConfigWatcher() = default; | ||
94 | 94 | | |||
95 | KSharedConfig::Ptr KConfigWatcher::config() const | ||||
96 | { | ||||
97 | return d->m_config; | ||||
98 | } | ||||
99 | | ||||
95 | void KConfigWatcher::onConfigChangeNotification(const QHash<QString, QByteArrayList> &changes) | 100 | void KConfigWatcher::onConfigChangeNotification(const QHash<QString, QByteArrayList> &changes) | ||
96 | { | 101 | { | ||
97 | //should we ever need it we can determine the file changed with QDbusContext::message().path(), but it doesn't seem too useful | 102 | //should we ever need it we can determine the file changed with QDbusContext::message().path(), but it doesn't seem too useful | ||
98 | 103 | | |||
99 | d->m_config->reparseConfiguration(); | 104 | d->m_config->reparseConfiguration(); | ||
100 | 105 | | |||
101 | for(auto it = changes.constBegin(); it != changes.constEnd(); it++) { | 106 | for(auto it = changes.constBegin(); it != changes.constEnd(); it++) { | ||
102 | KConfigGroup group = d->m_config->group(QString());//top level group | 107 | KConfigGroup group = d->m_config->group(QString());//top level group | ||
103 | const auto parts = it.key().split(QLatin1Char('\x1d')); //magic char, see KConfig | 108 | const auto parts = it.key().split(QLatin1Char('\x1d')); //magic char, see KConfig | ||
104 | for(const QString &groupName: parts) { | 109 | for(const QString &groupName: parts) { | ||
105 | group = group.group(groupName); | 110 | group = group.group(groupName); | ||
106 | } | 111 | } | ||
107 | emit configChanged(group, it.value()); | 112 | emit configChanged(group, it.value()); | ||
108 | } | 113 | } | ||
109 | } | 114 | } | ||
110 | 115 | |