Hrvoje Senjan 2016-03-06 10:01:26 +00:00 committed by Git OBS Bridge
parent 721e1186f0
commit 95f4d8ae9a
3 changed files with 2 additions and 124 deletions

View File

@ -1,123 +0,0 @@
From 58e49487aece3de19aae90bbb9b80cd5aab94d04 Mon Sep 17 00:00:00 2001
From: Andreas Hartmetz <ahartmetz@gmail.com>
Date: Fri, 19 Feb 2016 19:49:01 +0100
Subject: [PATCH 2/2] Fix session management for KApplication based
applications.
- Call QGuiApplication::setFallbackSessionManagementEnabled(false)
to prevent premature application exit
- Wire up the saveStateRequest() and commitDataRequest() signals
to the appropriate methods that had to be turned into slots first.
Those methods were never even called, they were not ported properly.
- Cancel logout when the user decides to do that. A comment in the
code was not sufficient to do that. (?!?!)
CCBUG: 354724
---
src/kdeui/kapplication.cpp | 17 ++++++++++++++++-
src/kdeui/kapplication.h | 29 +++++++++++++++--------------
2 files changed, 31 insertions(+), 15 deletions(-)
diff --git a/src/kdeui/kapplication.cpp b/src/kdeui/kapplication.cpp
index d78212a..54fd1de 100644
--- a/src/kdeui/kapplication.cpp
+++ b/src/kdeui/kapplication.cpp
@@ -380,6 +380,9 @@ void KApplicationPrivate::init(bool GUIenabled)
parseCommandLine();
QApplication::setDesktopSettingsAware(false);
+#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
+ QGuiApplication::setFallbackSessionManagementEnabled(false);
+#endif
#if HAVE_X11
isX11 = (QGuiApplication::platformName() == QStringLiteral("xcb"));
@@ -472,6 +475,12 @@ void KApplicationPrivate::init(bool GUIenabled)
q->connect(KToolInvocation::self(), SIGNAL(kapplication_hook(QStringList&,QByteArray&)),
q, SLOT(_k_slot_KToolInvocation_hook(QStringList&,QByteArray&)));
+ q->connect(q, SIGNAL(commitDataRequest(QSessionManager&)),
+ q, SLOT(commitData(QSessionManager&)));
+ q->connect(q, SIGNAL(saveStateRequest(QSessionManager&)),
+ q, SLOT(saveState(QSessionManager&)));
+
+
#ifdef Q_OS_MAC
// This is a QSystemTrayIcon instead of K* because we can't be sure q is a QWidget
QSystemTrayIcon *trayIcon; //krazy:exclude=qclasses
@@ -577,11 +586,13 @@ void KApplication::commitData(QSessionManager &sm)
continue;
}
+ // leave KMainWindows alone because they are handled by KMWSessionManager
if (!w->isHidden() && !w->inherits("KMainWindow")) {
QCloseEvent e;
sendEvent(w, &e);
if (!e.isAccepted()) {
- break; //canceled
+ canceled = true;
+ break;
}
donelist.append(w);
@@ -597,6 +608,10 @@ void KApplication::commitData(QSessionManager &sm)
} else {
sm.setRestartHint(QSessionManager::RestartIfRunning);
}
+
+ if (canceled) {
+ sm.cancel();
+ }
d->session_save = false;
}
diff --git a/src/kdeui/kapplication.h b/src/kdeui/kapplication.h
index 2231084..c9b1cb6 100644
--- a/src/kdeui/kapplication.h
+++ b/src/kdeui/kapplication.h
@@ -155,20 +155,6 @@ public:
void enableSessionManagement();
/**
- * Reimplemented for internal purposes, mainly the highlevel
- * handling of session management with KSessionManager.
- * @internal
- */
- void commitData(QSessionManager &sm);
-
- /**
- * Reimplemented for internal purposes, mainly the highlevel
- * handling of session management with KSessionManager.
- * @internal
- */
- void saveState(QSessionManager &sm);
-
- /**
* @deprecated since 5.0, use QGuiApplication::isSavingSession()
*
* Returns true if the application is currently saving its session
@@ -359,6 +345,21 @@ public Q_SLOTS:
*/
Q_SCRIPTABLE void updateUserTimestamp(int time = 0);
+ /**
+ * Slot connected to QGuiApplication::commitDataRequest() to implement highlevel
+ * handling of session management with KSessionManager.
+ * @internal
+ */
+ void commitData(QSessionManager &sm);
+
+ /**
+ * Slot connected to QGuiApplication::saveStateRequest() to implement highlevel
+ * handling of session management with KSessionManager.
+ * @internal
+ */
+ void saveState(QSessionManager &sm);
+
+
// D-Bus Q_SLOTS:
Q_SCRIPTABLE void reparseConfiguration();
Q_SCRIPTABLE void quit();
--
2.6.2

View File

@ -4,6 +4,7 @@ Sun Mar 6 09:56:08 UTC 2016 - hrvoje.senjan@gmail.com
- Update to 5.20.0
* For more details please see:
https://www.kde.org/announcements/kde-frameworks-5.20.0.php
- Drop upstreamed fix-session-saving.patch
-------------------------------------------------------------------
Fri Feb 26 14:59:32 UTC 2016 - wbauer@tmo.at

View File

@ -5,7 +5,7 @@ index 54fd1de..631dc2b 100644
@@ -380,7 +380,7 @@ void KApplicationPrivate::init(bool GUIenabled)
parseCommandLine();
QApplication::setDesktopSettingsAware(false);
QGuiApplication::setDesktopSettingsAware(false);
-#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
+#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 1)
QGuiApplication::setFallbackSessionManagementEnabled(false);