Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qsessionmanager.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include <qsessionmanager.h>
5#include <qguiapplication.h>
6#include <qpa/qplatformsessionmanager.h>
7#include <qpa/qplatformintegration.h>
8
9#include <private/qobject_p.h>
10#include <private/qguiapplication_p.h>
11#include <private/qsessionmanager_p.h>
12
13#ifndef QT_NO_SESSIONMANAGER
14
16
84 const QString &key)
86{
87 if (qApp->testAttribute(Qt::AA_DisableSessionManager)) {
89 } else {
90 platformSessionManager = QGuiApplicationPrivate::platformIntegration()->createPlatformSessionManager(id, key);
91 }
92 Q_ASSERT_X(platformSessionManager, "Platform session management",
93 "No platform session management, should use the default implementation");
94}
95
101
102QSessionManager::QSessionManager(QGuiApplication *app, QString &id, QString &key)
104{
105}
106
107QSessionManager::~QSessionManager()
108{
109}
110
120{
121 Q_D(const QSessionManager);
122 return d->platformSessionManager->sessionId();
123}
124
138{
139 Q_D(const QSessionManager);
140 return d->platformSessionManager->sessionKey();
141}
142
143
174{
175 Q_D(QSessionManager);
176 return d->platformSessionManager->allowsInteraction();
177}
178
191{
192 Q_D(QSessionManager);
193 return d->platformSessionManager->allowsErrorInteraction();
194}
195
203{
204 Q_D(QSessionManager);
205 d->platformSessionManager->release();
206}
207
215{
216 Q_D(QSessionManager);
217 d->platformSessionManager->cancel();
218}
219
235{
236 Q_D(QSessionManager);
237 d->platformSessionManager->setRestartHint(hint);
238}
239
249{
250 Q_D(const QSessionManager);
251 return d->platformSessionManager->restartHint();
252}
253
276{
277 Q_D(QSessionManager);
278 d->platformSessionManager->setRestartCommand(command);
279}
280
287{
288 Q_D(const QSessionManager);
289 return d->platformSessionManager->restartCommand();
290}
291
298{
299 Q_D(QSessionManager);
300 d->platformSessionManager->setDiscardCommand(command);
301}
302
309{
310 Q_D(const QSessionManager);
311 return d->platformSessionManager->discardCommand();
312}
313
323 const QString &value)
324{
325 Q_D(QSessionManager);
326 d->platformSessionManager->setManagerProperty(name, value);
327}
328
336 const QStringList &value)
337{
338 Q_D(QSessionManager);
339 d->platformSessionManager->setManagerProperty(name, value);
340}
341
349{
350 Q_D(const QSessionManager);
351 return d->platformSessionManager->isPhase2();
352}
353
372{
373 Q_D(QSessionManager);
374 d->platformSessionManager->requestPhase2();
375}
376
378
379#include "moc_qsessionmanager.cpp"
380
381#endif // QT_NO_SESSIONMANAGER
static QPlatformIntegration * platformIntegration()
\macro qGuiApp
\inmodule QtCore
Definition qobject.h:103
QSessionManagerPrivate(const QString &id, const QString &key)
QPlatformSessionManager * platformSessionManager
The QSessionManager class provides access to the session manager.
QStringList discardCommand() const
Returns the currently set discard command.
QString sessionKey() const
Returns the session key in the current session.
bool allowsInteraction()
Asks the session manager for permission to interact with the user.
void cancel()
Tells the session manager to cancel the shutdown process.
QString sessionId() const
Returns the identifier of the current session.
RestartHint restartHint() const
Returns the application's current restart hint.
RestartHint
This enum type defines the circumstances under which this application wants to be restarted by the se...
void release()
Releases the session manager's interaction semaphore after an interaction phase.
void requestPhase2()
Requests a second session management phase for the application.
bool allowsErrorInteraction()
Returns true if error interaction is permitted; otherwise returns false.
void setRestartHint(RestartHint)
Sets the application's restart hint to hint.
bool isPhase2() const
Returns true if the session manager is currently performing a second session management phase; otherw...
void setDiscardCommand(const QStringList &)
Sets the discard command to the given command.
void setRestartCommand(const QStringList &)
If the session manager is capable of restoring sessions it will execute command in order to restore t...
void setManagerProperty(const QString &name, const QString &value)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QStringList restartCommand() const
Returns the currently set restart command.
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
@ AA_DisableSessionManager
Definition qnamespace.h:466
#define qApp
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint64 key
GLenum GLuint id
[7]
GLuint name
#define Q_ASSERT_X(cond, x, msg)
Definition qrandom.cpp:48
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
QApplication app(argc, argv)
[0]