0a13522eeb
- Added 0001-Fix-exclusion-of-anonymous-ciphers.patch from upstream to disable exp-adh and aecdh ciphers. - Added disable-rc4-ciphers-bnc865241.diff to disable RC4 based ciphers which are now considered insecure (bnc#865241) - Added Add-option-to-disable-session-management-by-closing-windows.patch API adition to QSessionManager as first step in resolving kde#354724 and boo#955280 - Update to 5.5.1 (boo#954149) OBS-URL: https://build.opensuse.org/request/show/358747 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=50
181 lines
7.0 KiB
Diff
181 lines
7.0 KiB
Diff
From 2722dd7bb544949ff8ca9fe2cfb7b41ceaaddc56 Mon Sep 17 00:00:00 2001
|
|
From: Andreas Hartmetz <ahartmetz@gmail.com>
|
|
Date: Tue, 19 Jan 2016 14:30:18 +0100
|
|
Subject: [PATCH 1/1] Add option to disable "session management by closing
|
|
windows".
|
|
|
|
That feature is a poor man's session management for applications
|
|
that do not implement any specific session management features.
|
|
It badly interferes with proper session management support, so
|
|
applications must be able to disable it.
|
|
|
|
This fixes some KDE applications dying too early, before they are
|
|
enumerated for the list of applications to restart on session
|
|
restore, thus preventing them from being restored. See
|
|
https://bugs.kde.org/show_bug.cgi?id=354724
|
|
|
|
Task-number: QTBUG-49667
|
|
Change-Id: Ib22e58c9c64351dea8b7e2a74db91d26dd7ab7aa
|
|
---
|
|
.../code/src_gui_kernel_qguiapplication.cpp | 1 +
|
|
src/gui/kernel/qguiapplication.cpp | 14 +++++-
|
|
src/gui/kernel/qsessionmanager.cpp | 55 +++++++++++++++++++++-
|
|
src/gui/kernel/qsessionmanager.h | 3 ++
|
|
src/gui/kernel/qsessionmanager_p.h | 1 +
|
|
5 files changed, 71 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp b/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp
|
|
index 4ddf8c8..3006d19 100644
|
|
--- a/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp
|
|
+++ b/src/gui/doc/snippets/code/src_gui_kernel_qguiapplication.cpp
|
|
@@ -58,6 +58,7 @@ MyMainWidget::MyMainWidget(QWidget *parent)
|
|
|
|
void MyMainWidget::commitData(QSessionManager& manager)
|
|
{
|
|
+ manager.setAutoCloseWindowsEnabled(false);
|
|
if (manager.allowsInteraction()) {
|
|
int ret = QMessageBox::warning(
|
|
mainWindow,
|
|
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
|
|
index 770f847..40f2d5f 100644
|
|
--- a/src/gui/kernel/qguiapplication.cpp
|
|
+++ b/src/gui/kernel/qguiapplication.cpp
|
|
@@ -3087,6 +3087,12 @@ void QGuiApplicationPrivate::setApplicationState(Qt::ApplicationState state, boo
|
|
the session manager may or may not do this afterwards, depending on the
|
|
context.
|
|
|
|
+ When you connect to this signal to ask the user for permission to close
|
|
+ the application and / or commit application data, you should also call
|
|
+ QSessionManager::setAutoCloseWindowsEnabled(false) on \a manager to disable
|
|
+ a feature that helps applications that do not support full session
|
|
+ management, but hurts applications that do.
|
|
+
|
|
\warning Within this signal, no user interaction is possible, \e
|
|
unless you ask the \a manager for explicit permission. See
|
|
QSessionManager::allowsInteraction() and
|
|
@@ -3095,7 +3101,8 @@ void QGuiApplicationPrivate::setApplicationState(Qt::ApplicationState state, boo
|
|
|
|
\note You should use Qt::DirectConnection when connecting to this signal.
|
|
|
|
- \sa isSessionRestored(), sessionId(), saveStateRequest(), {Session Management}
|
|
+ \sa QSessionManager::setAutoCloseWindowsEnabled(), isSessionRestored(),
|
|
+ sessionId(), saveStateRequest(), {Session Management}
|
|
*/
|
|
|
|
/*!
|
|
@@ -3225,9 +3232,12 @@ void QGuiApplicationPrivate::commitData()
|
|
{
|
|
Q_Q(QGuiApplication);
|
|
is_saving_session = true;
|
|
+
|
|
emit q->commitDataRequest(*session_manager);
|
|
- if (session_manager->allowsInteraction() && !tryCloseAllWindows())
|
|
+ if (session_manager->autoCloseWindowsEnabled() && session_manager->allowsInteraction()
|
|
+ && !tryCloseAllWindows())
|
|
session_manager->cancel();
|
|
+
|
|
is_saving_session = false;
|
|
}
|
|
|
|
diff --git a/src/gui/kernel/qsessionmanager.cpp b/src/gui/kernel/qsessionmanager.cpp
|
|
index f4b56fd..4d140f9 100644
|
|
--- a/src/gui/kernel/qsessionmanager.cpp
|
|
+++ b/src/gui/kernel/qsessionmanager.cpp
|
|
@@ -116,7 +116,8 @@ QT_BEGIN_NAMESPACE
|
|
|
|
QSessionManagerPrivate::QSessionManagerPrivate(const QString &id,
|
|
const QString &key)
|
|
- : QObjectPrivate()
|
|
+ : QObjectPrivate(),
|
|
+ autoCloseWindowsEnabled(true)
|
|
{
|
|
platformSessionManager = QGuiApplicationPrivate::platformIntegration()->createPlatformSessionManager(id, key);
|
|
Q_ASSERT_X(platformSessionManager, "Platform session management",
|
|
@@ -350,6 +351,58 @@ QStringList QSessionManager::discardCommand() const
|
|
}
|
|
|
|
/*!
|
|
+ \since 5.6
|
|
+
|
|
+ Sets whether the session manager will try to close application windows during
|
|
+ session exit to \a enabled.
|
|
+
|
|
+ \sa autoCloseWindowsEnabled()
|
|
+*/
|
|
+void QSessionManager::setAutoCloseWindowsEnabled(bool enabled)
|
|
+{
|
|
+ Q_D(QSessionManager);
|
|
+ d->autoCloseWindowsEnabled = enabled;
|
|
+}
|
|
+
|
|
+/*!
|
|
+ \since 5.6
|
|
+
|
|
+ Returns whether the session manager will try to close application windows during
|
|
+ session exit.
|
|
+
|
|
+ If this is true immediately after QGuiApplication::commitDataRequest() has been
|
|
+ emitted, and allowsInteraction() is true, Qt will send CloseEvent to all
|
|
+ windows of the application. If that fails to close all windows, session exit is
|
|
+ canceled and the application keeps running.
|
|
+
|
|
+ The purpose of that is to give applications without explicit session management
|
|
+ support a chance to cancel session exit through the common
|
|
+ "are you sure you want to close this window?" feature.
|
|
+
|
|
+ \warning If all windows \e are closed due to this feature,
|
|
+ that may quit the application before it is explicitly instructed to quit through
|
|
+ the platform's session management protocol - see
|
|
+ QGuiApplication::quitOnLastWindowClosed(). That may in turn prevent the platform
|
|
+ session manager from saving the application's state correctly because the
|
|
+ application broke the protocol.
|
|
+
|
|
+ If your application implements full session management, you should disable this.
|
|
+
|
|
+ It is sufficient to set this property once on any instance of QSessionManager
|
|
+ to set its value for the lifetime of the application - it acts like a class
|
|
+ static variable.
|
|
+
|
|
+ The default is true.
|
|
+
|
|
+ \sa setAutoCloseWindowsEnabled()
|
|
+*/
|
|
+bool QSessionManager::autoCloseWindowsEnabled() const
|
|
+{
|
|
+ Q_D(const QSessionManager);
|
|
+ return d->autoCloseWindowsEnabled;
|
|
+}
|
|
+
|
|
+/*!
|
|
\overload
|
|
|
|
Low-level write access to the application's identification and state
|
|
diff --git a/src/gui/kernel/qsessionmanager.h b/src/gui/kernel/qsessionmanager.h
|
|
index 36aa391..696d9d8 100644
|
|
--- a/src/gui/kernel/qsessionmanager.h
|
|
+++ b/src/gui/kernel/qsessionmanager.h
|
|
@@ -78,6 +78,9 @@ public:
|
|
void setDiscardCommand(const QStringList&);
|
|
QStringList discardCommand() const;
|
|
|
|
+ void setAutoCloseWindowsEnabled(bool);
|
|
+ bool autoCloseWindowsEnabled() const;
|
|
+
|
|
void setManagerProperty(const QString& name, const QString& value);
|
|
void setManagerProperty(const QString& name, const QStringList& value);
|
|
|
|
diff --git a/src/gui/kernel/qsessionmanager_p.h b/src/gui/kernel/qsessionmanager_p.h
|
|
index 8949962..0acf865 100644
|
|
--- a/src/gui/kernel/qsessionmanager_p.h
|
|
+++ b/src/gui/kernel/qsessionmanager_p.h
|
|
@@ -65,6 +65,7 @@ public:
|
|
virtual ~QSessionManagerPrivate();
|
|
|
|
QPlatformSessionManager *platformSessionManager;
|
|
+ bool autoCloseWindowsEnabled;
|
|
};
|
|
|
|
QT_END_NAMESPACE
|
|
--
|
|
2.6.2.2.g1b5ffa3
|