[ToolTip] Check file name in KDirWatch handler
KDirWatch::self() is a singleton so we would get change events also for other files like plasma-appletsrc needlessly reloading plasmarc all the time. Differential Revision: https://phabricator.kde.org/D11326
This commit is contained in:
parent
f65393c68e
commit
77bac859bc
@ -54,8 +54,8 @@ ToolTip::ToolTip(QQuickItem *parent)
|
||||
|
||||
const QString configFile = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QStringLiteral("/plasmarc");
|
||||
KDirWatch::self()->addFile(configFile);
|
||||
QObject::connect(KDirWatch::self(), SIGNAL(created(QString)), this, SLOT(settingsChanged()));
|
||||
QObject::connect(KDirWatch::self(), SIGNAL(dirty(QString)), this, SLOT(settingsChanged()));
|
||||
QObject::connect(KDirWatch::self(), &KDirWatch::created, this, &ToolTip::settingsChanged);
|
||||
QObject::connect(KDirWatch::self(), &KDirWatch::dirty, this, &ToolTip::settingsChanged);
|
||||
}
|
||||
|
||||
ToolTip::~ToolTip()
|
||||
@ -74,8 +74,12 @@ ToolTip::~ToolTip()
|
||||
}
|
||||
}
|
||||
|
||||
void ToolTip::settingsChanged()
|
||||
void ToolTip::settingsChanged(const QString &file)
|
||||
{
|
||||
if (!file.endsWith(QLatin1String("plasmarc"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
KSharedConfig::openConfig(QStringLiteral("plasmarc"))->reparseConfiguration();
|
||||
loadSettings();
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ Q_SIGNALS:
|
||||
void interactiveChanged();
|
||||
|
||||
private Q_SLOTS:
|
||||
void settingsChanged();
|
||||
void settingsChanged(const QString &file);
|
||||
|
||||
private:
|
||||
bool isValid() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user