[arch-commits] Commit in kxmlgui/trunk (PKGBUILD session-restore.patch)

Antonio Rojas arojas at archlinux.org
Sat May 16 07:47:08 UTC 2015


    Date: Saturday, May 16, 2015 @ 09:47:08
  Author: arojas
Revision: 239437

Fix session restore for KF5 applications (KDEBUG#346768)

Added:
  kxmlgui/trunk/session-restore.patch
Modified:
  kxmlgui/trunk/PKGBUILD

-----------------------+
 PKGBUILD              |   12 ++++++++--
 session-restore.patch |   54 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2015-05-16 07:40:28 UTC (rev 239436)
+++ PKGBUILD	2015-05-16 07:47:08 UTC (rev 239437)
@@ -4,7 +4,7 @@
 
 pkgname=kxmlgui
 pkgver=5.10.0
-pkgrel=1
+pkgrel=2
 pkgdesc='User configurable main windows'
 arch=('i686' 'x86_64')
 url='https://projects.kde.org/projects/frameworks/kxmlgui'
@@ -12,11 +12,17 @@
 depends=('kglobalaccel' 'ktextwidgets' 'attica-qt5')
 makedepends=('extra-cmake-modules' 'python')
 groups=('kf5')
-source=("http://download.kde.org/stable/frameworks/${pkgver%.*}/${pkgname}-${pkgver}.tar.xz")
-md5sums=('35b8161e519fc6a2a466330a9f24c05f')
+source=("http://download.kde.org/stable/frameworks/${pkgver%.*}/${pkgname}-${pkgver}.tar.xz" 
+'session-restore.patch')
+md5sums=('35b8161e519fc6a2a466330a9f24c05f'
+         '4dc0c7ec892840d27cacb99085219991')
 
 prepare() {
   mkdir -p build
+
+# Fix session restore for KF5 applications https://bugs.kde.org/show_bug.cgi?id=346768
+  cd $pkgname-$pkgver
+  patch -p1 -i "$srcdir"/session-restore.patch
 }
 
 build() {

Added: session-restore.patch
===================================================================
--- session-restore.patch	                        (rev 0)
+++ session-restore.patch	2015-05-16 07:47:08 UTC (rev 239437)
@@ -0,0 +1,54 @@
+From: Stefan Becker <chemobejk at gmail.com>
+Date: Sat, 09 May 2015 14:17:25 +0000
+Subject: Add session management for KMainWindow
+X-Git-Url: http://quickgit.kde.org/?p=kxmlgui.git&a=commitdiff&h=fa86f6e4afd4a4f32d297f271d3daececc6c0ba4
+---
+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
+---
+
+
+--- a/src/kmainwindow.cpp
++++ b/src/kmainwindow.cpp
+@@ -127,8 +127,10 @@
+ {
+ }
+ 
+-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 <digisnap at cs.tu-berlin.de>, this
+@@ -144,6 +146,19 @@
+ 
+     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;
+ }
+ 
+



More information about the arch-commits mailing list