on 9bb49bf help sign in
unity8/plugins/Unity/Session/dbusunitysessionservice.h
139 lines 4.5 kB history raw
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
17#ifndef DBUSUNITYSESSIONSERVICE_H
18#define DBUSUNITYSESSIONSERVICE_H
20#include <QObject>
22/**
23 * DBusUnitySessionService provides com.canonical.Unity.Session dbus
24 * interface.
25 *
26 * com.canonical.Unity.Session interface provides public methods
27 * and signals to handle Logout/Reboot/Shutdown.
28 */
29class DBusUnitySessionService : public QObject
31 Q_OBJECT
32 Q_CLASSINFO("D-Bus Interface", "com.canonical.Unity.Session")
34public:
35 DBusUnitySessionService();
36 ~DBusUnitySessionService();
38Q_SIGNALS:
39 /**
40 * logoutRequested signal
41 *
42 * This signal is emitted when some applications request the system to
43 * logout.
44 * @param have_inhibitors if there are any special running applications
45 * which inhibit the logout.
46 */
47 void logoutRequested(bool have_inhibitors);
49 /**
50 * rebootRequested signal
51 *
52 * This signal is emitted when some applications request the system to
53 * reboot.
54 * @param have_inhibitors if there are any special running applications
55 * which inhibit the reboot.
56 */
57 void rebootRequested(bool have_inhibitors);
59 /**
60 * shutdownRequested signal
61 *
62 * This signal is emitted when some applications request the system to
63 * shutdown.
64 * @param have_inhibitors if there are any special running applications
65 * which inhibit the shutdown.
66 */
67 void shutdownRequested(bool have_inhibitors);
70 /**
71 * logoutReady signal
72 *
73 * This signal is emitted when all the apps are closed. And the system
74 * is safe to logout.
75 */
76 void logoutReady();
78public Q_SLOTS:
79 /**
80 * Logout the system.
81 *
82 * This method directly logout the system without user's confirmation.
83 * Ordinary applications should avoid calling this method. Please call
84 * RequestLogout() to ask the user to decide logout or not.
85 */
86 Q_SCRIPTABLE void Logout();
88 /**
89 * Reboot the system.
90 *
91 * This method directly reboot the system without user's confirmation.
92 * Ordinary applications should avoid calling this method. Please call
93 * RequestReboot() to ask the user to decide reboot or not.
94 */
95 Q_SCRIPTABLE void Reboot();
97 /**
98 * Shutdown the system.
99 *
100 * This method directly shutdown the system without user's confirmation.
101 * Ordinary applications should avoid calling this method. Please call
102 * RequestShutdown() to ask the user to decide shutdown or not.
103 */
104 Q_SCRIPTABLE void Shutdown();
106 /**
107 * Issue a logout request.
108 *
109 * This method emit the logoutRequested signal to the shell with a boolean
110 * which indicates if there's any inhibitors. The shell should receive
111 * this signal and display a dialog to ask the user to confirm the logout
112 * action. If confirmed, shell can call Logout() method to logout.
113 */
114 Q_SCRIPTABLE void RequestLogout();
116 /**
117 * Issue a reboot request.
118 *
119 * This method emit the rebootRequested signal to the shell with a boolean
120 * which indicates if there's any inhibitors. The shell should receive
121 * this signal and display a dialog to ask the user to confirm the reboot
122 * action. If confirmed, shell can call Reboot() method to reboot
123 */
124 Q_SCRIPTABLE void RequestReboot();
126 /**
127 * Issue a shutdown request.
128 *
129 * This method emit the shutdownRequested signal to the shell with a
130 * boolean which indicates if there's any inhibitors.
131 * The shell should receive
132 * this signal and display a dialog to ask the user to confirm the reboot
133 * action. If confirmed, shell can call Shutdown() method to reboot
134 */
135 Q_SCRIPTABLE void RequestShutdown();
137};
139#endif // DBUSUNITYSESSIONSERVICE_H