diff --git a/lib/sourcesmodel.h b/lib/sourcesmodel.h --- a/lib/sourcesmodel.h +++ b/lib/sourcesmodel.h @@ -103,6 +103,7 @@ void slotMatchesChanged(const QList& list); void slotMatchAdded(const Plasma::QueryMatch& match); void slotResetTimeout(); + void slotSettingsFileChanged(const QString &path); public: // A list of all the types that are being shown diff --git a/lib/sourcesmodel.cpp b/lib/sourcesmodel.cpp --- a/lib/sourcesmodel.cpp +++ b/lib/sourcesmodel.cpp @@ -42,8 +42,8 @@ this, SLOT(slotMatchesChanged(QList))); KDirWatch* watch = KDirWatch::self(); - connect(watch, SIGNAL(created(QString)), this, SLOT(reloadConfiguration())); - connect(watch, SIGNAL(dirty(QString)), this, SLOT(reloadConfiguration())); + connect(watch, &KDirWatch::created, this, &SourcesModel::slotSettingsFileChanged); + connect(watch, &KDirWatch::dirty, this, &SourcesModel::slotSettingsFileChanged); watch->addFile(QStandardPaths::locate(QStandardPaths::ConfigLocation, "krunnerrc")); m_resetTimer.setSingleShot(true); @@ -347,6 +347,15 @@ m_duplicates[m.text()]++; } +void SourcesModel::slotSettingsFileChanged(const QString &path) +{ + if (!path.endsWith(QLatin1String("krunnerrc"))) { + return; + } + + reloadConfiguration(); +} + void SourcesModel::clear() { beginResetModel();