Reparse settings when they change

Change-Id: Ibb13077943330417fa08d23ce1ea60f2aff5defc
This commit is contained in:
David Edmundson 2014-12-11 01:59:51 +01:00
parent 81a494b131
commit d2707e795a
2 changed files with 7 additions and 1 deletions

View File

@ -49,7 +49,7 @@ ToolTip::ToolTip(QQuickItem *parent)
m_showTimer->setSingleShot(true); m_showTimer->setSingleShot(true);
connect(m_showTimer, &QTimer::timeout, this, &ToolTip::showToolTip); connect(m_showTimer, &QTimer::timeout, this, &ToolTip::showToolTip);
settingsChanged(); loadSettings();
const QString configFile = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + "plasmarc"; const QString configFile = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + "plasmarc";
KDirWatch::self()->addFile(configFile); KDirWatch::self()->addFile(configFile);
@ -70,6 +70,11 @@ ToolTip::~ToolTip()
} }
void ToolTip::settingsChanged() void ToolTip::settingsChanged()
{
KSharedConfig::openConfig("plasmarc")->reparseConfiguration();
}
void ToolTip::loadSettings()
{ {
KConfigGroup cfg = KConfigGroup(KSharedConfig::openConfig("plasmarc"), "PlasmaToolTips"); KConfigGroup cfg = KConfigGroup(KSharedConfig::openConfig("plasmarc"), "PlasmaToolTips");
m_interval = cfg.readEntry("Delay", 700); m_interval = cfg.readEntry("Delay", 700);

View File

@ -180,6 +180,7 @@ private Q_SLOTS:
void settingsChanged(); void settingsChanged();
private: private:
void loadSettings();
bool m_tooltipsEnabledGlobally; bool m_tooltipsEnabledGlobally;
bool m_containsMouse; bool m_containsMouse;
Plasma::Types::Location m_location; Plasma::Types::Location m_location;