Add QPA session manager
The QSessionManager doesn't allow customization in platform independent way. The new QPlatformSessionManager aims to change that. Now the QSessionManagerPrivate has a new QPlatformSessionManager member to forward all the calls to QSessionManager's functions. If no platform manager is present, the current behavior is used. QPlatformSessionManager mimics the current QSessionManager behavior. A new factory function has been added to QPlatformIntegration to return a QPlatformSessionManager Task-number: QTBUG-28228 Change-Id: Ida7ac16a8f5303df5014fcb67878170ebdb37203 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com> Reviewed-by: David Faure (KDE) <faure@kde.org>
This commit is contained in:
parent
a871f224f8
commit
85fc95f346
@ -56,6 +56,7 @@ HEADERS += \
|
|||||||
kernel/qpalette.h \
|
kernel/qpalette.h \
|
||||||
kernel/qshortcutmap_p.h \
|
kernel/qshortcutmap_p.h \
|
||||||
kernel/qsessionmanager.h \
|
kernel/qsessionmanager.h \
|
||||||
|
kernel/qsessionmanager_p.h \
|
||||||
kernel/qwindowdefs.h \
|
kernel/qwindowdefs.h \
|
||||||
kernel/qscreen.h \
|
kernel/qscreen.h \
|
||||||
kernel/qscreen_p.h \
|
kernel/qscreen_p.h \
|
||||||
@ -66,7 +67,8 @@ HEADERS += \
|
|||||||
kernel/qplatformdialoghelper.h \
|
kernel/qplatformdialoghelper.h \
|
||||||
kernel/qplatformservices.h \
|
kernel/qplatformservices.h \
|
||||||
kernel/qplatformscreenpageflipper.h \
|
kernel/qplatformscreenpageflipper.h \
|
||||||
kernel/qplatformsystemtrayicon.h
|
kernel/qplatformsystemtrayicon.h \
|
||||||
|
kernel/qplatformsessionmanager.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
kernel/qclipboard_qpa.cpp \
|
kernel/qclipboard_qpa.cpp \
|
||||||
@ -118,7 +120,8 @@ SOURCES += \
|
|||||||
kernel/qplatformdialoghelper.cpp \
|
kernel/qplatformdialoghelper.cpp \
|
||||||
kernel/qplatformservices.cpp \
|
kernel/qplatformservices.cpp \
|
||||||
kernel/qplatformscreenpageflipper.cpp \
|
kernel/qplatformscreenpageflipper.cpp \
|
||||||
kernel/qplatformsystemtrayicon_qpa.cpp
|
kernel/qplatformsystemtrayicon_qpa.cpp \
|
||||||
|
kernel/qplatformsessionmanager.cpp
|
||||||
|
|
||||||
contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
|
contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
@ -1068,7 +1068,10 @@ void QGuiApplicationPrivate::init()
|
|||||||
bool doGrabUnderDebugger = false;
|
bool doGrabUnderDebugger = false;
|
||||||
QList<QByteArray> pluginList;
|
QList<QByteArray> pluginList;
|
||||||
// Get command line params
|
// Get command line params
|
||||||
|
#ifndef QT_NO_SESSIONMANAGER
|
||||||
|
QString session_id;
|
||||||
|
QString session_key;
|
||||||
|
#endif
|
||||||
int j = argc ? 1 : 0;
|
int j = argc ? 1 : 0;
|
||||||
for (int i=1; i<argc; i++) {
|
for (int i=1; i<argc; i++) {
|
||||||
if (argv[i] && *argv[i] != '-') {
|
if (argv[i] && *argv[i] != '-') {
|
||||||
@ -2767,13 +2770,13 @@ bool QGuiApplication::isSessionRestored() const
|
|||||||
QString QGuiApplication::sessionId() const
|
QString QGuiApplication::sessionId() const
|
||||||
{
|
{
|
||||||
Q_D(const QGuiApplication);
|
Q_D(const QGuiApplication);
|
||||||
return d->session_id;
|
return d->session_manager->sessionId();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QGuiApplication::sessionKey() const
|
QString QGuiApplication::sessionKey() const
|
||||||
{
|
{
|
||||||
Q_D(const QGuiApplication);
|
Q_D(const QGuiApplication);
|
||||||
return d->session_key;
|
return d->session_manager->sessionKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QGuiApplication::isSavingSession() const
|
bool QGuiApplication::isSavingSession() const
|
||||||
@ -2782,12 +2785,12 @@ bool QGuiApplication::isSavingSession() const
|
|||||||
return d->is_saving_session;
|
return d->is_saving_session;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGuiApplicationPrivate::commitData(QSessionManager& manager)
|
void QGuiApplicationPrivate::commitData()
|
||||||
{
|
{
|
||||||
Q_Q(QGuiApplication);
|
Q_Q(QGuiApplication);
|
||||||
is_saving_session = true;
|
is_saving_session = true;
|
||||||
emit q->commitDataRequest(manager);
|
emit q->commitDataRequest(*session_manager);
|
||||||
if (manager.allowsInteraction()) {
|
if (session_manager->allowsInteraction()) {
|
||||||
QWindowList done;
|
QWindowList done;
|
||||||
QWindowList list = QGuiApplication::topLevelWindows();
|
QWindowList list = QGuiApplication::topLevelWindows();
|
||||||
bool cancelled = false;
|
bool cancelled = false;
|
||||||
@ -2802,17 +2805,17 @@ void QGuiApplicationPrivate::commitData(QSessionManager& manager)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cancelled)
|
if (cancelled)
|
||||||
manager.cancel();
|
session_manager->cancel();
|
||||||
}
|
}
|
||||||
is_saving_session = false;
|
is_saving_session = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QGuiApplicationPrivate::saveState(QSessionManager &manager)
|
void QGuiApplicationPrivate::saveState()
|
||||||
{
|
{
|
||||||
Q_Q(QGuiApplication);
|
Q_Q(QGuiApplication);
|
||||||
is_saving_session = true;
|
is_saving_session = true;
|
||||||
emit q->saveStateRequest(manager);
|
emit q->saveStateRequest(*session_manager);
|
||||||
is_saving_session = false;
|
is_saving_session = false;
|
||||||
}
|
}
|
||||||
#endif //QT_NO_SESSIONMANAGER
|
#endif //QT_NO_SESSIONMANAGER
|
||||||
|
@ -234,12 +234,10 @@ public:
|
|||||||
|
|
||||||
#ifndef QT_NO_SESSIONMANAGER
|
#ifndef QT_NO_SESSIONMANAGER
|
||||||
QSessionManager *session_manager;
|
QSessionManager *session_manager;
|
||||||
QString session_id;
|
|
||||||
QString session_key;
|
|
||||||
bool is_session_restored;
|
bool is_session_restored;
|
||||||
bool is_saving_session;
|
bool is_saving_session;
|
||||||
void commitData(QSessionManager& sm);
|
void commitData();
|
||||||
void saveState(QSessionManager& sm);
|
void saveState();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct ActiveTouchPointsKey {
|
struct ActiveTouchPointsKey {
|
||||||
|
@ -51,6 +51,10 @@
|
|||||||
#include <private/qdnd_p.h>
|
#include <private/qdnd_p.h>
|
||||||
#include <private/qsimpledrag_p.h>
|
#include <private/qsimpledrag_p.h>
|
||||||
|
|
||||||
|
#ifndef QT_NO_SESSIONMANAGER
|
||||||
|
# include <qpa/qplatformsessionmanager.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -395,4 +399,17 @@ QPlatformOffscreenSurface *QPlatformIntegration::createPlatformOffscreenSurface(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_SESSIONMANAGER
|
||||||
|
/*!
|
||||||
|
\since 5.2
|
||||||
|
|
||||||
|
Factory function for QPlatformSessionManager. The default QPlatformSessionManager provides the same
|
||||||
|
functionality as the QSessionManager.
|
||||||
|
*/
|
||||||
|
QPlatformSessionManager *QPlatformIntegration::createPlatformSessionManager(const QString &id, const QString &key) const
|
||||||
|
{
|
||||||
|
return new QPlatformSessionManager(id, key);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -74,6 +74,7 @@ class QPlatformTheme;
|
|||||||
class QPlatformDialogHelper;
|
class QPlatformDialogHelper;
|
||||||
class QPlatformSharedGraphicsCache;
|
class QPlatformSharedGraphicsCache;
|
||||||
class QPlatformServices;
|
class QPlatformServices;
|
||||||
|
class QPlatformSessionManager;
|
||||||
class QKeyEvent;
|
class QKeyEvent;
|
||||||
class QPlatformOffscreenSurface;
|
class QPlatformOffscreenSurface;
|
||||||
class QOffscreenSurface;
|
class QOffscreenSurface;
|
||||||
@ -156,6 +157,9 @@ public:
|
|||||||
|
|
||||||
virtual QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const;
|
virtual QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const;
|
||||||
|
|
||||||
|
#ifndef QT_NO_SESSIONMANAGER
|
||||||
|
virtual QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const;
|
||||||
|
#endif
|
||||||
protected:
|
protected:
|
||||||
void screenAdded(QPlatformScreen *screen);
|
void screenAdded(QPlatformScreen *screen);
|
||||||
};
|
};
|
||||||
|
131
src/gui/kernel/qplatformsessionmanager.cpp
Normal file
131
src/gui/kernel/qplatformsessionmanager.cpp
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of the QtGui module of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU General Public License version 3.0 requirements will be
|
||||||
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "qplatformsessionmanager.h"
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
QPlatformSessionManager::QPlatformSessionManager(const QString &id, const QString &key)
|
||||||
|
: m_sessionId(id),
|
||||||
|
m_sessionKey(key),
|
||||||
|
m_restartHint(QSessionManager::RestartIfRunning)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QPlatformSessionManager::~QPlatformSessionManager()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QPlatformSessionManager::sessionId() const
|
||||||
|
{
|
||||||
|
return m_sessionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QPlatformSessionManager::sessionKey() const
|
||||||
|
{
|
||||||
|
return m_sessionKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QPlatformSessionManager::allowsInteraction()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QPlatformSessionManager::allowsErrorInteraction()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QPlatformSessionManager::release()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void QPlatformSessionManager::cancel()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void QPlatformSessionManager::setRestartHint(QSessionManager::RestartHint restartHint)
|
||||||
|
{
|
||||||
|
m_restartHint = restartHint;
|
||||||
|
}
|
||||||
|
|
||||||
|
QSessionManager::RestartHint QPlatformSessionManager::restartHint() const
|
||||||
|
{
|
||||||
|
return m_restartHint;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QPlatformSessionManager::setRestartCommand(const QStringList &command)
|
||||||
|
{
|
||||||
|
m_restartCommand = command;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList QPlatformSessionManager::restartCommand() const
|
||||||
|
{
|
||||||
|
return m_restartCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QPlatformSessionManager::setDiscardCommand(const QStringList &command)
|
||||||
|
{
|
||||||
|
m_discardCommand = command;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList QPlatformSessionManager::discardCommand() const
|
||||||
|
{
|
||||||
|
return m_discardCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QPlatformSessionManager::setManagerProperty(const QString &name, const QStringList &value)
|
||||||
|
{
|
||||||
|
Q_UNUSED(name)
|
||||||
|
Q_UNUSED(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QPlatformSessionManager::isPhase2() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QPlatformSessionManager::requestPhase2()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
102
src/gui/kernel/qplatformsessionmanager.h
Normal file
102
src/gui/kernel/qplatformsessionmanager.h
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of the QtGui module of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU General Public License version 3.0 requirements will be
|
||||||
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QPLATFORMSESSIONMANAGER_H
|
||||||
|
#define QPLATFORMSESSIONMANAGER_H
|
||||||
|
|
||||||
|
//
|
||||||
|
// W A R N I N G
|
||||||
|
// -------------
|
||||||
|
//
|
||||||
|
// This file is part of the QPA API and is not meant to be used
|
||||||
|
// in applications. Usage of this API may make your code
|
||||||
|
// source and binary incompatible with future versions of Qt.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <QtCore/qmetatype.h>
|
||||||
|
#include <QtCore/qnamespace.h>
|
||||||
|
|
||||||
|
#include <QtGui/qsessionmanager.h>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class Q_GUI_EXPORT QPlatformSessionManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit QPlatformSessionManager(const QString &id, const QString &key);
|
||||||
|
virtual ~QPlatformSessionManager();
|
||||||
|
|
||||||
|
virtual QString sessionId() const;
|
||||||
|
virtual QString sessionKey() const;
|
||||||
|
|
||||||
|
virtual bool allowsInteraction();
|
||||||
|
virtual bool allowsErrorInteraction();
|
||||||
|
virtual void release();
|
||||||
|
|
||||||
|
virtual void cancel();
|
||||||
|
|
||||||
|
virtual void setRestartHint(QSessionManager::RestartHint restartHint);
|
||||||
|
virtual QSessionManager::RestartHint restartHint() const;
|
||||||
|
|
||||||
|
virtual void setRestartCommand(const QStringList &command);
|
||||||
|
virtual QStringList restartCommand() const;
|
||||||
|
virtual void setDiscardCommand(const QStringList &command);
|
||||||
|
virtual QStringList discardCommand() const;
|
||||||
|
|
||||||
|
virtual void setManagerProperty(const QString &name, const QStringList &value);
|
||||||
|
|
||||||
|
virtual bool isPhase2() const;
|
||||||
|
virtual void requestPhase2();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QStringList m_restartCommand;
|
||||||
|
QStringList m_discardCommand;
|
||||||
|
const QString m_sessionId;
|
||||||
|
const QString m_sessionKey;
|
||||||
|
QSessionManager::RestartHint m_restartHint;
|
||||||
|
|
||||||
|
Q_DISABLE_COPY(QPlatformSessionManager)
|
||||||
|
};
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // QPLATFORMSESSIONMANAGER_H
|
@ -41,8 +41,12 @@
|
|||||||
|
|
||||||
#include <qsessionmanager.h>
|
#include <qsessionmanager.h>
|
||||||
#include <qguiapplication.h>
|
#include <qguiapplication.h>
|
||||||
|
#include <qpa/qplatformsessionmanager.h>
|
||||||
|
#include <qpa/qplatformintegration.h>
|
||||||
|
|
||||||
#include <private/qobject_p.h>
|
#include <private/qobject_p.h>
|
||||||
|
#include <private/qguiapplication_p.h>
|
||||||
|
#include <private/qsessionmanager_p.h>
|
||||||
|
|
||||||
#ifndef QT_NO_SESSIONMANAGER
|
#ifndef QT_NO_SESSIONMANAGER
|
||||||
|
|
||||||
@ -117,32 +121,24 @@ QT_BEGIN_NAMESPACE
|
|||||||
The default hint is \c RestartIfRunning.
|
The default hint is \c RestartIfRunning.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
QSessionManagerPrivate::QSessionManagerPrivate(const QString &id,
|
||||||
class QSessionManagerPrivate : public QObjectPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QSessionManagerPrivate(QSessionManager *m, const QString &id,
|
|
||||||
const QString &key);
|
|
||||||
|
|
||||||
QStringList restartCommand;
|
|
||||||
QStringList discardCommand;
|
|
||||||
const QString sessionId;
|
|
||||||
const QString sessionKey;
|
|
||||||
QSessionManager::RestartHint restartHint;
|
|
||||||
};
|
|
||||||
|
|
||||||
QSessionManagerPrivate::QSessionManagerPrivate(QSessionManager*,
|
|
||||||
const QString &id,
|
|
||||||
const QString &key)
|
const QString &key)
|
||||||
: QObjectPrivate(), sessionId(id), sessionKey(key)
|
: QObjectPrivate()
|
||||||
{
|
{
|
||||||
|
platformSessionManager = QGuiApplicationPrivate::platformIntegration()->createPlatformSessionManager(id, key);
|
||||||
|
Q_ASSERT_X(platformSessionManager, "Platform session management",
|
||||||
|
"No platform session management, should use the default implementation");
|
||||||
|
}
|
||||||
|
|
||||||
|
QSessionManagerPrivate::~QSessionManagerPrivate()
|
||||||
|
{
|
||||||
|
delete platformSessionManager;
|
||||||
|
platformSessionManager = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSessionManager::QSessionManager(QGuiApplication *app, QString &id, QString &key)
|
QSessionManager::QSessionManager(QGuiApplication *app, QString &id, QString &key)
|
||||||
: QObject(*(new QSessionManagerPrivate(this, id, key)), app)
|
: QObject(*(new QSessionManagerPrivate(id, key)), app)
|
||||||
{
|
{
|
||||||
Q_D(QSessionManager);
|
|
||||||
d->restartHint = RestartIfRunning;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QSessionManager::~QSessionManager()
|
QSessionManager::~QSessionManager()
|
||||||
@ -160,7 +156,7 @@ QSessionManager::~QSessionManager()
|
|||||||
QString QSessionManager::sessionId() const
|
QString QSessionManager::sessionId() const
|
||||||
{
|
{
|
||||||
Q_D(const QSessionManager);
|
Q_D(const QSessionManager);
|
||||||
return d->sessionId;
|
return d->platformSessionManager->sessionId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -178,7 +174,7 @@ QString QSessionManager::sessionId() const
|
|||||||
QString QSessionManager::sessionKey() const
|
QString QSessionManager::sessionKey() const
|
||||||
{
|
{
|
||||||
Q_D(const QSessionManager);
|
Q_D(const QSessionManager);
|
||||||
return d->sessionKey;
|
return d->platformSessionManager->sessionKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -213,7 +209,8 @@ QString QSessionManager::sessionKey() const
|
|||||||
*/
|
*/
|
||||||
bool QSessionManager::allowsInteraction()
|
bool QSessionManager::allowsInteraction()
|
||||||
{
|
{
|
||||||
return false;
|
Q_D(QSessionManager);
|
||||||
|
return d->platformSessionManager->allowsInteraction();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -229,7 +226,8 @@ bool QSessionManager::allowsInteraction()
|
|||||||
*/
|
*/
|
||||||
bool QSessionManager::allowsErrorInteraction()
|
bool QSessionManager::allowsErrorInteraction()
|
||||||
{
|
{
|
||||||
return false;
|
Q_D(QSessionManager);
|
||||||
|
return d->platformSessionManager->allowsErrorInteraction();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -240,6 +238,8 @@ bool QSessionManager::allowsErrorInteraction()
|
|||||||
*/
|
*/
|
||||||
void QSessionManager::release()
|
void QSessionManager::release()
|
||||||
{
|
{
|
||||||
|
Q_D(QSessionManager);
|
||||||
|
d->platformSessionManager->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -250,6 +250,8 @@ void QSessionManager::release()
|
|||||||
*/
|
*/
|
||||||
void QSessionManager::cancel()
|
void QSessionManager::cancel()
|
||||||
{
|
{
|
||||||
|
Q_D(QSessionManager);
|
||||||
|
d->platformSessionManager->cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -268,7 +270,7 @@ void QSessionManager::cancel()
|
|||||||
void QSessionManager::setRestartHint(QSessionManager::RestartHint hint)
|
void QSessionManager::setRestartHint(QSessionManager::RestartHint hint)
|
||||||
{
|
{
|
||||||
Q_D(QSessionManager);
|
Q_D(QSessionManager);
|
||||||
d->restartHint = hint;
|
d->platformSessionManager->setRestartHint(hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -282,7 +284,7 @@ void QSessionManager::setRestartHint(QSessionManager::RestartHint hint)
|
|||||||
QSessionManager::RestartHint QSessionManager::restartHint() const
|
QSessionManager::RestartHint QSessionManager::restartHint() const
|
||||||
{
|
{
|
||||||
Q_D(const QSessionManager);
|
Q_D(const QSessionManager);
|
||||||
return d->restartHint;
|
return d->platformSessionManager->restartHint();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -308,7 +310,7 @@ QSessionManager::RestartHint QSessionManager::restartHint() const
|
|||||||
void QSessionManager::setRestartCommand(const QStringList &command)
|
void QSessionManager::setRestartCommand(const QStringList &command)
|
||||||
{
|
{
|
||||||
Q_D(QSessionManager);
|
Q_D(QSessionManager);
|
||||||
d->restartCommand = command;
|
d->platformSessionManager->setRestartCommand(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -323,7 +325,7 @@ void QSessionManager::setRestartCommand(const QStringList &command)
|
|||||||
QStringList QSessionManager::restartCommand() const
|
QStringList QSessionManager::restartCommand() const
|
||||||
{
|
{
|
||||||
Q_D(const QSessionManager);
|
Q_D(const QSessionManager);
|
||||||
return d->restartCommand;
|
return d->platformSessionManager->restartCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -334,7 +336,7 @@ QStringList QSessionManager::restartCommand() const
|
|||||||
void QSessionManager::setDiscardCommand(const QStringList &command)
|
void QSessionManager::setDiscardCommand(const QStringList &command)
|
||||||
{
|
{
|
||||||
Q_D(QSessionManager);
|
Q_D(QSessionManager);
|
||||||
d->discardCommand = command;
|
d->platformSessionManager->setDiscardCommand(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -349,7 +351,7 @@ void QSessionManager::setDiscardCommand(const QStringList &command)
|
|||||||
QStringList QSessionManager::discardCommand() const
|
QStringList QSessionManager::discardCommand() const
|
||||||
{
|
{
|
||||||
Q_D(const QSessionManager);
|
Q_D(const QSessionManager);
|
||||||
return d->discardCommand;
|
return d->platformSessionManager->discardCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -363,8 +365,7 @@ QStringList QSessionManager::discardCommand() const
|
|||||||
void QSessionManager::setManagerProperty(const QString &name,
|
void QSessionManager::setManagerProperty(const QString &name,
|
||||||
const QString &value)
|
const QString &value)
|
||||||
{
|
{
|
||||||
Q_UNUSED(name);
|
setManagerProperty(name, QStringList(value));
|
||||||
Q_UNUSED(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -376,8 +377,8 @@ void QSessionManager::setManagerProperty(const QString &name,
|
|||||||
void QSessionManager::setManagerProperty(const QString &name,
|
void QSessionManager::setManagerProperty(const QString &name,
|
||||||
const QStringList &value)
|
const QStringList &value)
|
||||||
{
|
{
|
||||||
Q_UNUSED(name);
|
Q_D(QSessionManager);
|
||||||
Q_UNUSED(value);
|
d->platformSessionManager->setManagerProperty(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -388,7 +389,8 @@ void QSessionManager::setManagerProperty(const QString &name,
|
|||||||
*/
|
*/
|
||||||
bool QSessionManager::isPhase2() const
|
bool QSessionManager::isPhase2() const
|
||||||
{
|
{
|
||||||
return false;
|
Q_D(const QSessionManager);
|
||||||
|
return d->platformSessionManager->isPhase2();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -409,6 +411,8 @@ bool QSessionManager::isPhase2() const
|
|||||||
*/
|
*/
|
||||||
void QSessionManager::requestPhase2()
|
void QSessionManager::requestPhase2()
|
||||||
{
|
{
|
||||||
|
Q_D(QSessionManager);
|
||||||
|
d->platformSessionManager->requestPhase2();
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
82
src/gui/kernel/qsessionmanager_p.h
Normal file
82
src/gui/kernel/qsessionmanager_p.h
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of the QtGui module of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU General Public License version 3.0 requirements will be
|
||||||
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QSESSIONMANAGER_P_H
|
||||||
|
#define QSESSIONMANAGER_P_H
|
||||||
|
|
||||||
|
//
|
||||||
|
// W A R N I N G
|
||||||
|
// -------------
|
||||||
|
//
|
||||||
|
// This file is not part of the Qt API. It exists purely as an
|
||||||
|
// implementation detail. This header file may change from version to
|
||||||
|
// version without notice, or even be removed.
|
||||||
|
//
|
||||||
|
// We mean it.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <private/qobject_p.h>
|
||||||
|
#include <QtCore/qstring.h>
|
||||||
|
#include <QtCore/qstringlist.h>
|
||||||
|
|
||||||
|
#ifndef QT_NO_SESSIONMANAGER
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class QPlatformSessionManager;
|
||||||
|
|
||||||
|
class QSessionManagerPrivate : public QObjectPrivate
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QSessionManagerPrivate(const QString &id,
|
||||||
|
const QString &key);
|
||||||
|
|
||||||
|
virtual ~QSessionManagerPrivate();
|
||||||
|
|
||||||
|
QPlatformSessionManager *platformSessionManager;
|
||||||
|
};
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // QT_NO_SESSIONMANAGER
|
||||||
|
|
||||||
|
#endif // QSESSIONMANAGER_P_H
|
Loading…
Reference in New Issue
Block a user