parent
b99a0994bc
commit
169bf2eea9
@ -0,0 +1,76 @@
|
|||||||
|
From bf8b2f52392c97bc6acf1a5b5aedb735b9380655 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Stefan Becker <chemobejk@gmail.com>
|
||||||
|
Date: Sat, 9 May 2015 17:17:25 +0300
|
||||||
|
Subject: [PATCH] Forward QSessionManager to KConfigGui
|
||||||
|
|
||||||
|
Get a KConfig object that corresponds to the QSessionManager object that
|
||||||
|
is passed in with the saveStateRequest signal.
|
||||||
|
|
||||||
|
To make sure that the data is stored to disk we have to call sync() on
|
||||||
|
the object after the application has updated it. As the session manager
|
||||||
|
always emits a saveStateRequest after starting the application we need
|
||||||
|
to skip the sync() for the first request.
|
||||||
|
|
||||||
|
BUG: 346768
|
||||||
|
---
|
||||||
|
src/kmainwindow.cpp | 14 ++++++++++++--
|
||||||
|
src/kmainwindow_p.h | 3 +++
|
||||||
|
2 files changed, 15 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/kmainwindow.cpp b/src/kmainwindow.cpp
|
||||||
|
index 15eecb7..95b01fd 100644
|
||||||
|
--- a/src/kmainwindow.cpp
|
||||||
|
+++ b/src/kmainwindow.cpp
|
||||||
|
@@ -119,6 +119,7 @@ bool DockResizeListener::eventFilter(QObject *watched, QEvent *event)
|
||||||
|
|
||||||
|
KMWSessionManager::KMWSessionManager()
|
||||||
|
{
|
||||||
|
+ initial = true;
|
||||||
|
connect(qApp, SIGNAL(saveStateRequest(QSessionManager&)),
|
||||||
|
this, SLOT(saveState(QSessionManager&)));
|
||||||
|
}
|
||||||
|
@@ -127,9 +128,10 @@ KMWSessionManager::~KMWSessionManager()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
-bool KMWSessionManager::saveState(QSessionManager &)
|
||||||
|
+bool KMWSessionManager::saveState(QSessionManager &sm)
|
||||||
|
{
|
||||||
|
- KConfig *config = KConfigGui::sessionConfig();
|
||||||
|
+ KConfig *config = KConfigGui::sessionConfig(sm);
|
||||||
|
+
|
||||||
|
if (KMainWindow::memberList().count()) {
|
||||||
|
// According to Jochen Wilhelmy <digisnap@cs.tu-berlin.de>, this
|
||||||
|
// hook is useful for better document orientation
|
||||||
|
@@ -144,6 +146,14 @@ bool KMWSessionManager::saveState(QSessionManager &)
|
||||||
|
|
||||||
|
KConfigGroup group(config, "Number");
|
||||||
|
group.writeEntry("NumberOfWindows", n);
|
||||||
|
+
|
||||||
|
+ // The session manager emits a saveStateRequest after application start.
|
||||||
|
+ // Skip storing data collected from this initial request.
|
||||||
|
+ if (!initial) {
|
||||||
|
+ config->sync();
|
||||||
|
+ }
|
||||||
|
+ initial = false;
|
||||||
|
+
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/kmainwindow_p.h b/src/kmainwindow_p.h
|
||||||
|
index 8204ce1..2c90bf4 100644
|
||||||
|
--- a/src/kmainwindow_p.h
|
||||||
|
+++ b/src/kmainwindow_p.h
|
||||||
|
@@ -80,6 +80,9 @@ public:
|
||||||
|
KMWSessionManager();
|
||||||
|
~KMWSessionManager();
|
||||||
|
|
||||||
|
+private:
|
||||||
|
+ bool initial;
|
||||||
|
+
|
||||||
|
private Q_SLOTS:
|
||||||
|
bool saveState(QSessionManager &);
|
||||||
|
};
|
||||||
|
--
|
||||||
|
2.4.0
|
||||||
|
|
Loading…
Reference in new issue