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#ifndef QSESSIONMANAGER_H
5#define QSESSIONMANAGER_H
6
7#include <QtGui/qtguiglobal.h>
8#include <QtCore/qobject.h>
9#include <QtGui/qwindowdefs.h>
10#include <QtCore/qstring.h>
11#include <QtCore/qstringlist.h>
12
13#ifndef QT_NO_SESSIONMANAGER
14
15QT_BEGIN_NAMESPACE
16
17
18class QGuiApplication;
19
20class QSessionManagerPrivate;
21
22class Q_GUI_EXPORT QSessionManager : public QObject
23{
24 Q_OBJECT
25 Q_DECLARE_PRIVATE(QSessionManager)
26 QSessionManager(QGuiApplication *app, QString &id, QString &key);
27 ~QSessionManager();
28public:
29 QString sessionId() const;
30 QString sessionKey() const;
31
32 bool allowsInteraction();
33 bool allowsErrorInteraction();
34 void release();
35
36 void cancel();
37
38 enum RestartHint {
39 RestartIfRunning,
40 RestartAnyway,
41 RestartImmediately,
42 RestartNever
43 };
44 void setRestartHint(RestartHint);
45 RestartHint restartHint() const;
46
47 void setRestartCommand(const QStringList&);
48 QStringList restartCommand() const;
49 void setDiscardCommand(const QStringList&);
50 QStringList discardCommand() const;
51
52 void setManagerProperty(const QString& name, const QString& value);
53 void setManagerProperty(const QString& name, const QStringList& value);
54
55 bool isPhase2() const;
56 void requestPhase2();
57
58private:
59 friend class QGuiApplication;
60 friend class QGuiApplicationPrivate;
61};
62
63QT_END_NAMESPACE
64
65#endif // QT_NO_SESSIONMANAGER
66
67#endif // QSESSIONMANAGER_H
68

source code of qtbase/src/gui/kernel/qsessionmanager.h