[krunner] Avoid reparsing the config load on start

Reviewers: #plasma, apol

Reviewed By: apol

Subscribers: apol, plasma-devel

Tags: #plasma

CCBUG: 416145

Differential Revision: https://phabricator.kde.org/D28365
wilder-portage-prov
David Edmundson 6 years ago
parent 23534a3b4f
commit 1c48e351c6
  1. 15
      krunner/view.cpp
  2. 2
      krunner/view.h

@ -63,7 +63,7 @@ View::View(QWindow *)
m_config = KConfigGroup(KSharedConfig::openConfig(QStringLiteral("krunnerrc")), "General");
setFreeFloating(m_config.readEntry("FreeFloating", false));
reloadConfig();
loadConfig();
new AppAdaptor(this);
QDBusConnection::sessionBus().registerObject(QStringLiteral("/App"), this);
@ -107,8 +107,14 @@ View::View(QWindow *)
KDirWatch::self()->addFile(m_config.name());
// Catch both, direct changes to the config file ...
connect(KDirWatch::self(), &KDirWatch::dirty, this, &View::reloadConfig);
connect(KDirWatch::self(), &KDirWatch::created, this, &View::reloadConfig);
connect(KDirWatch::self(), &KDirWatch::dirty, this, [this]() {
m_config.config()->reparseConfiguration();
loadConfig();
});
connect(KDirWatch::self(), &KDirWatch::created, this, [this]() {
m_config.config()->reparseConfiguration();
loadConfig();
});
if (m_floating) {
setLocation(Plasma::Types::Floating);
@ -158,9 +164,8 @@ void View::setFreeFloating(bool floating)
positionOnScreen();
}
void View::reloadConfig()
void View::loadConfig()
{
m_config.config()->reparseConfiguration();
setFreeFloating(m_config.readEntry("FreeFloating", false));
const QStringList history = m_config.readEntry("history", QStringList());

@ -86,7 +86,7 @@ protected Q_SLOTS:
void screenGeometryChanged();
void resetScreenPos();
void displayOrHide();
void reloadConfig();
void loadConfig();
void objectIncubated();
void slotFocusWindowChanged();

Loading…
Cancel
Save