krunner: Store pinned state in krunnerstaterc and not in config

wilder-5.22
Alexander Lohnau 5 years ago
parent 9c97ee51e6
commit ffa24a94b7
  1. 8
      krunner/view.cpp
  2. 1
      krunner/view.h

@ -62,6 +62,10 @@ View::View(QWindow *)
setTitle(i18n("KRunner")); setTitle(i18n("KRunner"));
m_config = KConfigGroup(KSharedConfig::openConfig(), "General"); m_config = KConfigGroup(KSharedConfig::openConfig(), "General");
m_stateData = KSharedConfig::openConfig(QStringLiteral("krunnerstaterc"), //
KConfig::NoGlobals,
QStandardPaths::GenericDataLocation)
->group("General");
m_configWatcher = KConfigWatcher::create(KSharedConfig::openConfig()); m_configWatcher = KConfigWatcher::create(KSharedConfig::openConfig());
connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) { connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) {
Q_UNUSED(names); Q_UNUSED(names);
@ -156,7 +160,7 @@ void View::setFreeFloating(bool floating)
void View::loadConfig() void View::loadConfig()
{ {
setFreeFloating(m_config.readEntry("FreeFloating", false)); setFreeFloating(m_config.readEntry("FreeFloating", false));
setPinned(m_config.readEntry("Pinned", false)); setPinned(m_stateData.readEntry("Pinned", false));
} }
bool View::event(QEvent *event) bool View::event(QEvent *event)
@ -375,7 +379,7 @@ void View::setPinned(bool pinned)
{ {
if (m_pinned != pinned) { if (m_pinned != pinned) {
m_pinned = pinned; m_pinned = pinned;
m_config.writeEntry("Pinned", pinned); m_stateData.writeEntry("Pinned", pinned);
Q_EMIT pinnedChanged(); Q_EMIT pinnedChanged();
} }
} }

@ -99,6 +99,7 @@ private:
QPoint m_customPos; QPoint m_customPos;
KDeclarative::QmlObject *m_qmlObj; KDeclarative::QmlObject *m_qmlObj;
KConfigGroup m_config; KConfigGroup m_config;
KConfigGroup m_stateData;
KConfigWatcher::Ptr m_configWatcher; KConfigWatcher::Ptr m_configWatcher;
qreal m_offset; qreal m_offset;
bool m_floating : 1; bool m_floating : 1;

Loading…
Cancel
Save