Qt 4.8
qsessionmanager_qws.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include <qsessionmanager.h>
43 
44 #ifndef QT_NO_SESSIONMANAGER
45 
46 #include <qapplication.h>
47 #include <private/qobject_p.h>
48 
50 
52 {
53 public:
55  const QString &key);
56 
59  const QString sessionId;
60  const QString sessionKey;
62 };
63 
65  const QString &id,
66  const QString &key)
67  : QObjectPrivate(), sessionId(id), sessionKey(key)
68 {
69 }
70 
72  : QObject(*new QSessionManagerPrivate(this, id, key), app)
73 {
75  d->restartHint = RestartIfRunning;
76 }
77 
79 {
80 }
81 
83 {
84  Q_D(const QSessionManager);
85  return d->sessionId;
86 }
87 
89 {
90  Q_D(const QSessionManager);
91  return d->sessionKey;
92 }
93 
94 
96 {
97  return false;
98 }
99 
101 {
102  return false;
103 }
104 
106 {
107 }
108 
110 {
111 }
112 
114 {
116  d->restartHint = hint;
117 }
118 
120 {
121  Q_D(const QSessionManager);
122  return d->restartHint;
123 }
124 
126 {
128  d->restartCommand = command;
129 }
130 
132 {
133  Q_D(const QSessionManager);
134  return d->restartCommand;
135 }
136 
138 {
140  d->discardCommand = command;
141 }
142 
144 {
145  Q_D(const QSessionManager);
146  return d->discardCommand;
147 }
148 
150  const QString &value)
151 {
152  Q_UNUSED(name);
153  Q_UNUSED(value);
154 }
155 
157  const QStringList &value)
158 {
159  Q_UNUSED(name);
160  Q_UNUSED(value);
161 }
162 
163 bool QSessionManager::isPhase2() const
164 {
165  return false;
166 }
167 
169 {
170 }
171 
173 
174 #endif // QT_NO_SESSIONMANAGER
double d
Definition: qnumeric_p.h:62
bool allowsErrorInteraction()
Returns true if error interaction is permitted; otherwise returns false.
The QApplication class manages the GUI application&#39;s control flow and main settings.
Definition: qapplication.h:99
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QSessionManager::RestartHint restartHint
QStringList restartCommand() const
Returns the currently set restart command.
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
#define Q_D(Class)
Definition: qglobal.h:2482
void setDiscardCommand(const QStringList &)
Sets the discard command to the given list.
bool allowsInteraction()
Asks the session manager for permission to interact with the user.
QSessionManagerPrivate(QSessionManager *mgr, QString &id, QString &key)
void release()
Releases the session manager&#39;s interaction semaphore after an interaction phase.
void setRestartCommand(const QStringList &)
If the session manager is capable of restoring sessions it will execute command in order to restore t...
void setRestartHint(RestartHint)
Sets the application&#39;s restart hint to hint.
The QSessionManager class provides access to the session manager.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QSessionManager(QApplication *app, QString &id, QString &key)
const char * name
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
bool isPhase2() const
Returns true if the session manager is currently performing a second session management phase; otherw...
void setManagerProperty(const QString &name, const QString &value)
Low-level write access to the application&#39;s identification and state records are kept in the session ...
QStringList discardCommand() const
Returns the currently set discard command.
RestartHint
This enum type defines the circumstances under which this application wants to be restarted by the se...
QString sessionId() const
Returns the identifier of the current session.
QString sessionKey() const
Returns the session key in the current session.
int key
RestartHint restartHint() const
Returns the application&#39;s current restart hint.
void requestPhase2()
Requests a second session management phase for the application.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
void cancel()
Tells the session manager to cancel the shutdown process.