diff --git a/lib/runnerresultsmodel.h b/lib/runnerresultsmodel.h --- a/lib/runnerresultsmodel.h +++ b/lib/runnerresultsmodel.h @@ -84,6 +84,7 @@ Plasma::QueryMatch fetchMatch(const QModelIndex &idx) const; void onMatchesChanged(const QList &matches); + void onSettingsFileChanged(const QString &path); Plasma::RunnerManager *m_manager; diff --git a/lib/runnerresultsmodel.cpp b/lib/runnerresultsmodel.cpp --- a/lib/runnerresultsmodel.cpp +++ b/lib/runnerresultsmodel.cpp @@ -24,7 +24,9 @@ #include #include +#include +#include #include #include "resultsmodel.h" @@ -41,6 +43,10 @@ setQuerying(false); }); + connect(KDirWatch::self(), &KDirWatch::created, this, &RunnerResultsModel::onSettingsFileChanged); + connect(KDirWatch::self(), &KDirWatch::dirty, this, &RunnerResultsModel::onSettingsFileChanged); + KDirWatch::self()->addFile(QStandardPaths::locate(QStandardPaths::ConfigLocation, QStringLiteral("krunnerrc"))); + m_resetTimer.setSingleShot(true); m_resetTimer.setInterval(500); connect(&m_resetTimer, &QTimer::timeout, this, [this] { @@ -174,6 +180,15 @@ m_hasMatches = !m_matches.isEmpty(); } +void RunnerResultsModel::onSettingsFileChanged(const QString &path) +{ + if (!path.endsWith(QLatin1String("krunnerrc"))) { + return; + } + + m_manager->reloadConfiguration(); +} + QString RunnerResultsModel::queryString() const { return m_queryString;