Commit c0fa968c authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[SourcesModel] Check changed file name before reloading configuration

Avoid needlessly reloading configuration if something completely unrelated, such as plasma appletsrc, changed.

Differential Revision: https://phabricator.kde.org/D12870
parent cd9b4aad
......@@ -42,8 +42,8 @@ SourcesModel::SourcesModel(QObject* parent)
this, SLOT(slotMatchesChanged(QList<Plasma::QueryMatch>)));
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 @@ void SourcesModel::slotMatchAdded(const Plasma::QueryMatch& m)
m_duplicates[m.text()]++;
}
void SourcesModel::slotSettingsFileChanged(const QString &path)
{
if (!path.endsWith(QLatin1String("krunnerrc"))) {
return;
}
reloadConfiguration();
}
void SourcesModel::clear()
{
beginResetModel();
......
......@@ -103,6 +103,7 @@ private slots:
void slotMatchesChanged(const QList<Plasma::QueryMatch>& 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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment