Merge "Do not keep reparsing plasmarc configuration"
This commit is contained in:
commit
e9d760d93b
|
@ -1,6 +1,7 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright 2013 Marco Martin <mart@kde.org> *
|
* Copyright 2013 Marco Martin <mart@kde.org> *
|
||||||
* Copyright 2014 Sebastian Kügler <sebas@kde.org> *
|
* Copyright 2014 Sebastian Kügler <sebas@kde.org> *
|
||||||
|
* Copyright 2014 David Edmundson <davidedmunsdon@kde.org> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
@ -59,8 +60,8 @@ Units::Units(QObject *parent)
|
||||||
connect(KDirWatch::self(), &KDirWatch::dirty, this, &Units::settingsFileChanged);
|
connect(KDirWatch::self(), &KDirWatch::dirty, this, &Units::settingsFileChanged);
|
||||||
// ... but also remove/recreate cycles, like KConfig does it
|
// ... but also remove/recreate cycles, like KConfig does it
|
||||||
connect(KDirWatch::self(), &KDirWatch::created, this, &Units::settingsFileChanged);
|
connect(KDirWatch::self(), &KDirWatch::created, this, &Units::settingsFileChanged);
|
||||||
// Trigger configuration read
|
// read configuration
|
||||||
settingsFileChanged(plasmarc);
|
updatePlasmaRCSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
Units::~Units()
|
Units::~Units()
|
||||||
|
@ -70,9 +71,15 @@ Units::~Units()
|
||||||
void Units::settingsFileChanged(const QString &file)
|
void Units::settingsFileChanged(const QString &file)
|
||||||
{
|
{
|
||||||
if (file.endsWith(plasmarc)) {
|
if (file.endsWith(plasmarc)) {
|
||||||
|
KSharedConfigPtr cfg = KSharedConfig::openConfig(plasmarc);
|
||||||
|
cfg->reparseConfiguration();
|
||||||
|
updatePlasmaRCSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Units::updatePlasmaRCSettings()
|
||||||
|
{
|
||||||
KConfigGroup cfg = KConfigGroup(KSharedConfig::openConfig(plasmarc), groupName);
|
KConfigGroup cfg = KConfigGroup(KSharedConfig::openConfig(plasmarc), groupName);
|
||||||
cfg.config()->reparseConfiguration();
|
|
||||||
const int longDuration = cfg.readEntry("longDuration", defaultLongDuration);
|
const int longDuration = cfg.readEntry("longDuration", defaultLongDuration);
|
||||||
|
|
||||||
if (longDuration != m_longDuration) {
|
if (longDuration != m_longDuration) {
|
||||||
|
@ -80,7 +87,7 @@ void Units::settingsFileChanged(const QString &file)
|
||||||
emit durationChanged();
|
emit durationChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Units::iconLoaderSettingsChanged()
|
void Units::iconLoaderSettingsChanged()
|
||||||
{
|
{
|
||||||
|
|
|
@ -164,11 +164,12 @@ Q_SIGNALS:
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void iconLoaderSettingsChanged();
|
void iconLoaderSettingsChanged();
|
||||||
void settingsFileChanged(const QString &settings);
|
void settingsFileChanged(const QString &file);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateDevicePixelRatio();
|
void updateDevicePixelRatio();
|
||||||
void updateSpacing();
|
void updateSpacing();
|
||||||
|
void updatePlasmaRCSettings();
|
||||||
/**
|
/**
|
||||||
* @return The dpi-adjusted size for a given icon size
|
* @return The dpi-adjusted size for a given icon size
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user