diff --git a/0001-Add-session-management-for-KMainWindow.patch b/0001-Add-session-management-for-KMainWindow.patch new file mode 100644 index 0000000..d1de8e6 --- /dev/null +++ b/0001-Add-session-management-for-KMainWindow.patch @@ -0,0 +1,56 @@ +From c36189b575bef885aeb005f3f1c472ec8e48aacf Mon Sep 17 00:00:00 2001 +From: Stefan Becker +Date: Sat, 9 May 2015 17:17:25 +0300 +Subject: [PATCH] Add session management for KMainWindow + +- replace the KConfig object in KConfigGui with a new one using the + session id and key from the QSessionManager object +- make sure that the data is stored after the application has update it +- if the KConfig object is represented by a local file then add a + discard command to the session manager object + +BUG: 346768 +REVIEW: 123706 +--- + src/kmainwindow.cpp | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +diff --git a/src/kmainwindow.cpp b/src/kmainwindow.cpp +index 15eecb7..7c86841 100644 +--- a/src/kmainwindow.cpp ++++ b/src/kmainwindow.cpp +@@ -127,8 +127,10 @@ KMWSessionManager::~KMWSessionManager() + { + } + +-bool KMWSessionManager::saveState(QSessionManager &) ++bool KMWSessionManager::saveState(QSessionManager &sm) + { ++ KConfigGui::setSessionConfig(sm.sessionId(), sm.sessionKey()); ++ + KConfig *config = KConfigGui::sessionConfig(); + if (KMainWindow::memberList().count()) { + // According to Jochen Wilhelmy , this +@@ -144,6 +146,19 @@ bool KMWSessionManager::saveState(QSessionManager &) + + KConfigGroup group(config, "Number"); + group.writeEntry("NumberOfWindows", n); ++ ++ // store new status to disk ++ config->sync(); ++ ++ // generate discard command for new file ++ QString localFilePath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + config->name(); ++ if (QFile::exists(localFilePath)) { ++ QStringList discard; ++ discard << QLatin1String("rm"); ++ discard << localFilePath; ++ sm.setDiscardCommand(discard); ++ } ++ + return true; + } + +-- +2.4.0 + diff --git a/Forward-QSessionManager-to-KConfigGui.patch b/Forward-QSessionManager-to-KConfigGui.patch deleted file mode 100644 index f19d8a2..0000000 --- a/Forward-QSessionManager-to-KConfigGui.patch +++ /dev/null @@ -1,76 +0,0 @@ -From bf8b2f52392c97bc6acf1a5b5aedb735b9380655 Mon Sep 17 00:00:00 2001 -From: Stefan Becker -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 , 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 - diff --git a/kf5-kxmlgui.spec b/kf5-kxmlgui.spec index 2728946..4178733 100644 --- a/kf5-kxmlgui.spec +++ b/kf5-kxmlgui.spec @@ -2,7 +2,7 @@ Name: kf5-%{framework} Version: 5.10.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: KDE Frameworks 5 Tier 3 solution for user-configurable main windows License: GPLv2+ and LGPLv2+ @@ -17,9 +17,8 @@ URL: http://www.kde.org %endif Source0: http://download.kde.org/%{stable}/frameworks/%{versiondir}/%{framework}-%{version}.tar.xz -## upstreamable patches -# Candidate session management fixes -# https://bugs.kde.org/show_bug.cgi?id=346768 +## upstream patches +Patch1: 0001-Add-session-management-for-KMainWindow.patch BuildRequires: libX11-devel @@ -100,6 +99,9 @@ make install/fast DESTDIR=%{buildroot} -C %{_target_platform} %changelog +* Mon May 11 2015 Rex Dieter 5.10.0-2 +- pull in reviewed/upstream session management fixes (kde#346768) + * Mon May 11 2015 Daniel Vrátil - 5.10.0-1 - KDE Frameworks 5.10.0