From 169bf2eea94c7b34fef4b4a60eb5081c7d9baef0 Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Sat, 9 May 2015 12:11:43 -0500 Subject: [PATCH] Candidate session management fixes (kde#346768) --- Forward-QSessionManager-to-KConfigGui.patch | 76 +++++++++++++++++++++ kf5-kxmlgui.spec | 20 ++++-- 2 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 Forward-QSessionManager-to-KConfigGui.patch diff --git a/Forward-QSessionManager-to-KConfigGui.patch b/Forward-QSessionManager-to-KConfigGui.patch new file mode 100644 index 0000000..f19d8a2 --- /dev/null +++ b/Forward-QSessionManager-to-KConfigGui.patch @@ -0,0 +1,76 @@ +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 2295f52..cfce0dc 100644 --- a/kf5-kxmlgui.spec +++ b/kf5-kxmlgui.spec @@ -2,7 +2,7 @@ Name: kf5-%{framework} Version: 5.9.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: KDE Frameworks 5 Tier 3 solution for user-configurable main windows License: GPLv2+ and LGPLv2+ @@ -17,6 +17,11 @@ 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 +Patch50: Forward-QSessionManager-to-KConfigGui.patch + BuildRequires: libX11-devel BuildRequires: kf5-rpm-macros @@ -24,7 +29,9 @@ BuildRequires: extra-cmake-modules BuildRequires: qt5-qtbase-devel BuildRequires: kf5-kitemviews-devel -BuildRequires: kf5-kconfig-devel +# session mangement patch needs new api +BuildRequires: kf5-kconfig-devel >= 5.9.0-3 +Requires: kf5-kconfig-core%{?_isa} >= 5.9.0-3 BuildRequires: kf5-kglobalaccel-devel BuildRequires: kf5-kconfigwidgets-devel BuildRequires: kf5-ki18n-devel @@ -58,16 +65,18 @@ developing applications that use %{name}. %prep -%setup -q -n %{framework}-%{version} +%autosetup -n %{framework}-%{version} -p1 + %build -mkdir -p %{_target_platform} +mkdir %{_target_platform} pushd %{_target_platform} %{cmake_kf5} .. popd make %{?_smp_mflags} -C %{_target_platform} + %install make install/fast DESTDIR=%{buildroot} -C %{_target_platform} %find_lang kxmlgui5_qt --with-qt --all-name @@ -92,6 +101,9 @@ make install/fast DESTDIR=%{buildroot} -C %{_target_platform} %changelog +* Sat May 09 2015 Rex Dieter 5.9.0-3 +- Candidate session management fixes (kde#346768) + * Sat May 02 2015 Kalev Lember - 5.9.0-2 - Rebuilt for GCC 5 C++11 ABI change