Qt 6.x
The Qt SDK
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 {
91 }
92 Q_ASSERT_X(platformSessionManager, "Platform session management",
93 "No platform session management, should use the default implementation");
94}
95
97{
99 platformSessionManager = nullptr;
100}
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
291{
292 Q_D(const QSessionManager);
293 return d->platformSessionManager->restartCommand();
294}
295
302{
303 Q_D(QSessionManager);
304 d->platformSessionManager->setDiscardCommand(command);
305}
306
317{
318 Q_D(const QSessionManager);
319 return d->platformSessionManager->discardCommand();
320}
321
331 const QString &value)
332{
333 Q_D(QSessionManager);
334 d->platformSessionManager->setManagerProperty(name, value);
335}
336
344 const QStringList &value)
345{
346 Q_D(QSessionManager);
347 d->platformSessionManager->setManagerProperty(name, value);
348}
349
357{
358 Q_D(const QSessionManager);
359 return d->platformSessionManager->isPhase2();
360}
361
380{
381 Q_D(QSessionManager);
382 d->platformSessionManager->requestPhase2();
383}
384
386
387#include "moc_qsessionmanager.cpp"
388
389#endif // QT_NO_SESSIONMANAGER
static QPlatformIntegration * platformIntegration()
\macro qGuiApp
\inmodule QtCore
Definition qobject.h:90
virtual QPlatformSessionManager * createPlatformSessionManager(const QString &id, const QString &key) const
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:127
Combined button and popup list for selecting options.
@ AA_DisableSessionManager
Definition qnamespace.h:465
#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]