Unity 8
DBusUnitySessionService Class Reference

#include <plugins/Unity/Session/dbusunitysessionservice.h>

Inherits UnityDBusObject.

Public Slots

Q_SCRIPTABLE void Logout ()
 
Q_SCRIPTABLE void Reboot ()
 
Q_SCRIPTABLE void Shutdown ()
 
Q_SCRIPTABLE void RequestLogout ()
 
Q_SCRIPTABLE void RequestReboot ()
 
Q_SCRIPTABLE void RequestShutdown ()
 
Q_SCRIPTABLE void EndSession ()
 

Signals

Q_SCRIPTABLE void logoutRequested (bool have_inhibitors)
 
Q_SCRIPTABLE void rebootRequested (bool have_inhibitors)
 
Q_SCRIPTABLE void shutdownRequested (bool have_inhibitors)
 
void logoutReady ()
 

Public Member Functions

Q_INVOKABLE void logout ()
 
Q_INVOKABLE void reboot ()
 
Q_INVOKABLE void shutdown ()
 
Q_INVOKABLE void endSession ()
 

Detailed Description

DBusUnitySessionService provides com.canonical.Unity.Session dbus interface.

com.canonical.Unity.Session interface provides public methods and signals to handle Logout/Reboot/Shutdown.

Definition at line 34 of file dbusunitysessionservice.h.

Member Function Documentation

void DBusUnitySessionService::EndSession ( )
slot

Issue an EndSession request.

This method calls the EndSession() Upstart DBus method on the current DBus session bus.

Definition at line 38 of file dbusunitysessionservice.cpp.

39 {
40  QDBusConnection connection = QDBusConnection::sessionBus();
41  QDBusInterface iface1 ("com.ubuntu.Upstart",
42  "/com/ubuntu/Upstart",
43  "com.ubuntu.Upstart0_6",
44  connection);
45 
46  iface1.call("EndSession");
47 }
void DBusUnitySessionService::Logout ( )
slot

Logout the system.

This method directly logout the system without user's confirmation. Ordinary applications should avoid calling this method. Please call RequestLogout() to ask the user to decide logout or not.

Definition at line 33 of file dbusunitysessionservice.cpp.

34 {
35  Q_EMIT logoutReady();
36 }
void DBusUnitySessionService::logoutReady ( )
signal

logoutReady signal

This signal is emitted when all the apps are closed. And the system is safe to logout.

Q_SCRIPTABLE void DBusUnitySessionService::logoutRequested ( bool  have_inhibitors)
signal

logoutRequested signal

This signal is emitted when some applications request the system to logout.

Parameters
have_inhibitorsif there are any special running applications which inhibit the logout.
void DBusUnitySessionService::Reboot ( )
slot

Reboot the system.

This method directly reboot the system without user's confirmation. Ordinary applications should avoid calling this method. Please call RequestReboot() to ask the user to decide reboot or not.

Definition at line 54 of file dbusunitysessionservice.cpp.

55 {
56  QDBusConnection connection = QDBusConnection::systemBus();
57  QDBusInterface iface1 ("org.freedesktop.login1",
58  "/org/freedesktop/login1",
59  "org.freedesktop.login1.Manager",
60  connection);
61 
62  iface1.call("Reboot", false);
63 }
Q_SCRIPTABLE void DBusUnitySessionService::rebootRequested ( bool  have_inhibitors)
signal

rebootRequested signal

This signal is emitted when some applications request the system to reboot.

Parameters
have_inhibitorsif there are any special running applications which inhibit the reboot.
void DBusUnitySessionService::RequestLogout ( )
slot

Issue a logout request.

This method emit the logoutRequested signal to the shell with a boolean which indicates if there's any inhibitors. The shell should receive this signal and display a dialog to ask the user to confirm the logout action. If confirmed, shell can call Logout() method to logout.

Definition at line 49 of file dbusunitysessionservice.cpp.

50 {
51  Q_EMIT logoutRequested(false);
52 }
Q_SCRIPTABLE void logoutRequested(bool have_inhibitors)
void DBusUnitySessionService::RequestReboot ( )
slot

Issue a reboot request.

This method emit the rebootRequested signal to the shell with a boolean which indicates if there's any inhibitors. The shell should receive this signal and display a dialog to ask the user to confirm the reboot action. If confirmed, shell can call Reboot() method to reboot

Definition at line 65 of file dbusunitysessionservice.cpp.

66 {
67  Q_EMIT rebootRequested(false);
68 }
Q_SCRIPTABLE void rebootRequested(bool have_inhibitors)
void DBusUnitySessionService::RequestShutdown ( )
slot

Issue a shutdown request.

This method emit the shutdownRequested signal to the shell with a boolean which indicates if there's any inhibitors. The shell should receive this signal and display a dialog to ask the user to confirm the reboot action. If confirmed, shell can call Shutdown() method to reboot

Definition at line 81 of file dbusunitysessionservice.cpp.

82 {
83  Q_EMIT shutdownRequested(false);
84 }
Q_SCRIPTABLE void shutdownRequested(bool have_inhibitors)
void DBusUnitySessionService::Shutdown ( )
slot

Shutdown the system.

This method directly shutdown the system without user's confirmation. Ordinary applications should avoid calling this method. Please call RequestShutdown() to ask the user to decide shutdown or not.

Definition at line 70 of file dbusunitysessionservice.cpp.

71 {
72  QDBusConnection connection = QDBusConnection::systemBus();
73  QDBusInterface iface1 ("org.freedesktop.login1",
74  "/org/freedesktop/login1",
75  "org.freedesktop.login1.Manager",
76  connection);
77 
78  iface1.call("PowerOff", false);
79 }
Q_SCRIPTABLE void DBusUnitySessionService::shutdownRequested ( bool  have_inhibitors)
signal

shutdownRequested signal

This signal is emitted when some applications request the system to shutdown.

Parameters
have_inhibitorsif there are any special running applications which inhibit the shutdown.

The documentation for this class was generated from the following files: