1 /****************************************************************************
2 **
3 ** Copyright (C) 2013 Teo Mrnjavac <teo@kde.org>
4 ** Copyright (C) 2016 The Qt Company Ltd.
5 ** Contact: https://www.qt.io/licensing/
6 **
7 ** This file is part of the plugins of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** Commercial License Usage
11 ** Licensees holding valid commercial Qt licenses may use this file in
12 ** accordance with the commercial license agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and The Qt Company. For licensing terms
15 ** and conditions see https://www.qt.io/terms-conditions. For further
16 ** information use the contact form at https://www.qt.io/contact-us.
17 **
18 ** GNU Lesser General Public License Usage
19 ** Alternatively, this file may be used under the terms of the GNU Lesser
20 ** General Public License version 3 as published by the Free Software
21 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
22 ** packaging of this file. Please review the following information to
23 ** ensure the GNU Lesser General Public License version 3 requirements
24 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
25 **
26 ** GNU General Public License Usage
27 ** Alternatively, this file may be used under the terms of the GNU
28 ** General Public License version 2.0 or (at your option) the GNU General
29 ** Public license version 3 or any later version approved by the KDE Free
30 ** Qt Foundation. The licenses are as published by the Free Software
31 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
32 ** included in the packaging of this file. Please review the following
33 ** information to ensure the GNU General Public License requirements will
34 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
35 ** https://www.gnu.org/licenses/gpl-3.0.html.
36 **
37 ** $QT_END_LICENSE$
38 **
39 ****************************************************************************/
40 
41 #ifndef QXCBSESSIONMANAGER_H
42 #define QXCBSESSIONMANAGER_H
43 
44 //
45 //  W A R N I N G
46 //  -------------
47 //
48 // This file is part of the QPA API and is not meant to be used
49 // in applications. Usage of this API may make your code
50 // source and binary incompatible with future versions of Qt.
51 //
52 
53 #include <qpa/qplatformsessionmanager.h>
54 
55 #ifndef QT_NO_SESSIONMANAGER
56 
57 QT_BEGIN_NAMESPACE
58 
59 class QEventLoop;
60 
61 class QXcbSessionManager : public QPlatformSessionManager
62 {
63 public:
64     QXcbSessionManager(const QString &id, const QString &key);
65     virtual ~QXcbSessionManager();
66 
67     void *handle() const;
68 
setSessionId(const QString & id)69     void setSessionId(const QString &id) { m_sessionId = id; }
setSessionKey(const QString & key)70     void setSessionKey(const QString &key) { m_sessionKey = key; }
71 
72     bool allowsInteraction() override;
73     bool allowsErrorInteraction() override;
74     void release() override;
75 
76     void cancel() override;
77 
78     void setManagerProperty(const QString &name, const QString &value) override;
79     void setManagerProperty(const QString &name, const QStringList &value) override;
80 
81     bool isPhase2() const override;
82     void requestPhase2() override;
83 
84     void exitEventLoop();
85 
86 private:
87     QEventLoop *m_eventLoop;
88 };
89 
90 QT_END_NAMESPACE
91 
92 #endif //QT_NO_SESSIONMANAGER
93 
94 #endif //QXCBSESSIONMANAGER_H
95