forked from pool/kdelibs4support
This commit is contained in:
parent
aa685deb36
commit
3195a77bd3
@ -1,8 +1,38 @@
|
|||||||
|
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
|
diff --git a/src/kdeui/kapplication.cpp b/src/kdeui/kapplication.cpp
|
||||||
index 6ffaf6e..dc73b12 100644
|
index d78212a..54fd1de 100644
|
||||||
--- a/src/kdeui/kapplication.cpp
|
--- a/src/kdeui/kapplication.cpp
|
||||||
+++ b/src/kdeui/kapplication.cpp
|
+++ b/src/kdeui/kapplication.cpp
|
||||||
@@ -472,6 +472,12 @@ void KApplicationPrivate::init(bool GUIenabled)
|
@@ -380,6 +380,9 @@ void KApplicationPrivate::init(bool GUIenabled)
|
||||||
|
parseCommandLine();
|
||||||
|
|
||||||
|
QGuiApplication::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->connect(KToolInvocation::self(), SIGNAL(kapplication_hook(QStringList&,QByteArray&)),
|
||||||
q, SLOT(_k_slot_KToolInvocation_hook(QStringList&,QByteArray&)));
|
q, SLOT(_k_slot_KToolInvocation_hook(QStringList&,QByteArray&)));
|
||||||
|
|
||||||
@ -15,16 +45,7 @@ index 6ffaf6e..dc73b12 100644
|
|||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
// This is a QSystemTrayIcon instead of K* because we can't be sure q is a QWidget
|
// This is a QSystemTrayIcon instead of K* because we can't be sure q is a QWidget
|
||||||
QSystemTrayIcon *trayIcon; //krazy:exclude=qclasses
|
QSystemTrayIcon *trayIcon; //krazy:exclude=qclasses
|
||||||
@@ -550,6 +556,8 @@ void KApplication::commitData(QSessionManager &sm)
|
@@ -577,11 +586,13 @@ void KApplication::commitData(QSessionManager &sm)
|
||||||
d->session_save = true;
|
|
||||||
bool canceled = false;
|
|
||||||
|
|
||||||
+ sm.setAutoCloseWindowsEnabled(false);
|
|
||||||
+
|
|
||||||
foreach (KSessionManager *it, KSessionManager::sessionClients()) {
|
|
||||||
if ((canceled = !it->commitData(sm))) {
|
|
||||||
break;
|
|
||||||
@@ -577,11 +585,13 @@ void KApplication::commitData(QSessionManager &sm)
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +60,7 @@ index 6ffaf6e..dc73b12 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
donelist.append(w);
|
donelist.append(w);
|
||||||
@@ -597,6 +607,10 @@ void KApplication::commitData(QSessionManager &sm)
|
@@ -597,6 +608,10 @@ void KApplication::commitData(QSessionManager &sm)
|
||||||
} else {
|
} else {
|
||||||
sm.setRestartHint(QSessionManager::RestartIfRunning);
|
sm.setRestartHint(QSessionManager::RestartIfRunning);
|
||||||
}
|
}
|
||||||
@ -50,19 +71,6 @@ index 6ffaf6e..dc73b12 100644
|
|||||||
d->session_save = false;
|
d->session_save = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -638,6 +652,7 @@ static void checkRestartVersion(QSessionManager &sm)
|
|
||||||
void KApplication::saveState(QSessionManager &sm)
|
|
||||||
{
|
|
||||||
d->session_save = true;
|
|
||||||
+ sm.setAutoCloseWindowsEnabled(false);
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#warning TODO: QSessionManager::handle() is gone in Qt5!
|
|
||||||
#endif
|
|
||||||
@@ -988,4 +1003,3 @@ void KApplicationPrivate::_k_slot_KToolInvocation_hook(QStringList &envs, QByteA
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "moc_kapplication.cpp"
|
|
||||||
-
|
|
||||||
diff --git a/src/kdeui/kapplication.h b/src/kdeui/kapplication.h
|
diff --git a/src/kdeui/kapplication.h b/src/kdeui/kapplication.h
|
||||||
index 2231084..c9b1cb6 100644
|
index 2231084..c9b1cb6 100644
|
||||||
--- a/src/kdeui/kapplication.h
|
--- a/src/kdeui/kapplication.h
|
||||||
@ -110,3 +118,6 @@ index 2231084..c9b1cb6 100644
|
|||||||
// D-Bus Q_SLOTS:
|
// D-Bus Q_SLOTS:
|
||||||
Q_SCRIPTABLE void reparseConfiguration();
|
Q_SCRIPTABLE void reparseConfiguration();
|
||||||
Q_SCRIPTABLE void quit();
|
Q_SCRIPTABLE void quit();
|
||||||
|
--
|
||||||
|
2.6.2
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user