diff --git a/krunner/view.h b/krunner/view.h --- a/krunner/view.h +++ b/krunner/view.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -95,6 +96,7 @@ QPoint m_customPos; KDeclarative::QmlObject *m_qmlObj; KConfigGroup m_config; + KConfigWatcher::Ptr m_configWatcher; qreal m_offset; bool m_floating : 1; bool m_requestedVisible = false; diff --git a/krunner/view.cpp b/krunner/view.cpp --- a/krunner/view.cpp +++ b/krunner/view.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include @@ -60,7 +59,15 @@ //used only by screen readers setTitle(i18n("KRunner")); + m_config = KConfigGroup(KSharedConfig::openConfig(), "General"); + m_configWatcher = KConfigWatcher::create(KSharedConfig::openConfig()); + connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) { + Q_UNUSED(names); + if (group.name() == QLatin1String("General")) { + loadConfig(); + } + }); loadConfig(); @@ -103,18 +110,6 @@ connect(KWindowSystem::self(), &KWindowSystem::workAreaChanged, this, &View::resetScreenPos); - KDirWatch::self()->addFile(m_config.name()); - - // Catch both, direct changes to the config file ... - connect(KDirWatch::self(), &KDirWatch::dirty, this, [this]() { - m_config.config()->reparseConfiguration(); - loadConfig(); - }); - connect(KDirWatch::self(), &KDirWatch::created, this, [this]() { - m_config.config()->reparseConfiguration(); - loadConfig(); - }); - connect(qGuiApp, &QGuiApplication::focusWindowChanged, this, &View::slotFocusWindowChanged); }