on ed657ae help sign in
unity8/plugins/Unity/Session/dbusunitysessionservice.h
82 lines 2.6 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 * logoutReady signal
51 *
52 * This signal is emitted when all the apps are closed. And the system
53 * is safe to logout.
54 */
55 void logoutReady();
57public Q_SLOTS:
58 /**
59 * Logout the system.
60 *
61 * This method directly logout the system without user's confirmation.
62 * Ordinary applications should avoid calling this method. Please call
63 * RequestLogout() to ask the user to decide logout or not.
64 * This method will stop all the running applications and then signal
65 * logoutReady when all the apps stopped.
66 */
67 Q_SCRIPTABLE void Logout();
69 /**
70 * Issue a logout request.
71 *
72 * This method emit the logoutRequested signal to the shell with a boolean
73 * which indicates if there's any inhibitors. The shell should receive
74 * this signal and display a dialog to ask the user to confirm the logout
75 * action. If confirmed, shell can call Logout() method to kill the apps
76 * and then logout
77 */
78 Q_SCRIPTABLE void RequestLogout();
80};
82#endif // DBUSUNITYSESSIONSERVICE_H