#include <plugins/Unity/Session/dbusunitysessionservice.h>
Inherits UnityDBusObject.
|
Q_SCRIPTABLE void | LogoutRequested (bool have_inhibitors) |
|
void | logoutRequested (bool have_inhibitors) |
|
Q_SCRIPTABLE void | RebootRequested (bool have_inhibitors) |
|
void | rebootRequested (bool have_inhibitors) |
|
Q_SCRIPTABLE void | ShutdownRequested (bool have_inhibitors) |
|
void | shutdownRequested (bool have_inhibitors) |
|
Q_SCRIPTABLE void | LogoutReady () |
|
void | logoutReady () |
|
Q_SCRIPTABLE void | LockRequested () |
|
void | lockRequested () |
|
Q_SCRIPTABLE void | Locked () |
|
Q_SCRIPTABLE void | Unlocked () |
|
|
Q_INVOKABLE void | logout () |
|
Q_INVOKABLE void | reboot () |
|
Q_INVOKABLE void | shutdown () |
|
Q_INVOKABLE void | endSession () |
|
DBusUnitySessionService provides com.canonical.Unity.Session dbus interface.
com.canonical.Unity.Session interface provides public methods and signals to handle eg. Logout/Reboot/Shutdown.
Definition at line 34 of file dbusunitysessionservice.h.
bool DBusUnitySessionService::CanHibernate |
( |
| ) |
const |
|
slot |
- Returns
- whether the system is capable of hibernating
Definition at line 249 of file dbusunitysessionservice.cpp.
251 return d->checkLogin1Call(
"CanHibernate");
bool DBusUnitySessionService::CanHybridSleep |
( |
| ) |
const |
|
slot |
- Returns
- whether the system is capable of hybrid sleep
- Since
- unity8
Definition at line 259 of file dbusunitysessionservice.cpp.
261 return d->checkLogin1Call(
"CanHybridSleep");
bool DBusUnitySessionService::CanLock |
( |
| ) |
const |
|
slot |
bool DBusUnitySessionService::CanReboot |
( |
| ) |
const |
|
slot |
- Returns
- whether the system is capable of rebooting
- Since
- unity8
Definition at line 264 of file dbusunitysessionservice.cpp.
266 return d->checkLogin1Call(
"CanReboot");
bool DBusUnitySessionService::CanShutdown |
( |
| ) |
const |
|
slot |
- Returns
- whether the system is capable of shutting down
Definition at line 269 of file dbusunitysessionservice.cpp.
271 return d->checkLogin1Call(
"CanPowerOff");
bool DBusUnitySessionService::CanSuspend |
( |
| ) |
const |
|
slot |
- Returns
- whether the system is capable of suspending
Definition at line 254 of file dbusunitysessionservice.cpp.
256 return d->checkLogin1Call(
"CanSuspend");
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 240 of file dbusunitysessionservice.cpp.
242 const QDBusMessage msg = QDBusMessage::createMethodCall(
"com.ubuntu.Upstart",
243 "/com/ubuntu/Upstart",
244 "com.ubuntu.Upstart0_6",
246 QDBusConnection::sessionBus().asyncCall(msg);
void DBusUnitySessionService::Hibernate |
( |
| ) |
|
|
slot |
Hibernate the system
This method puts the system into hibernation without user's confirmation.
Definition at line 368 of file dbusunitysessionservice.cpp.
370 d->makeLogin1Call(
"Hibernate", {
false});
QString DBusUnitySessionService::HostName |
( |
| ) |
const |
|
slot |
- Returns
- the local hostname
Definition at line 302 of file dbusunitysessionservice.cpp.
305 if (gethostname(hostName,
sizeof(hostName)) == -1) {
306 qWarning() <<
"Could not determine local hostname";
309 hostName[
sizeof(hostName) - 1] =
'\0';
310 return QString::fromLocal8Bit(hostName);
void DBusUnitySessionService::HybridSleep |
( |
| ) |
|
|
slot |
Hybrid sleep
This method puts the system into hybrid sleep without user's confirmation.
- Since
- unity8
Definition at line 373 of file dbusunitysessionservice.cpp.
375 d->makeLogin1Call(
"HybridSleep", {
false});
bool DBusUnitySessionService::IsLocked |
( |
| ) |
const |
|
slot |
void DBusUnitySessionService::Lock |
( |
| ) |
|
|
slot |
Locks the session immediately
Definition at line 319 of file dbusunitysessionservice.cpp.
322 const QString sessionPath = QString::fromLocal8Bit(qgetenv(
"XDG_SESSION_PATH"));
323 QDBusMessage msg = QDBusMessage::createMethodCall(
"org.freedesktop.DisplayManager",
325 "org.freedesktop.DisplayManager.Session",
327 QDBusReply<void> reply = QDBusConnection::systemBus().asyncCall(msg);
328 if (!reply.isValid()) {
329 qWarning() <<
"Lock call failed" << reply.error().message();
Q_SCRIPTABLE void Locked()
Q_SCRIPTABLE void DBusUnitySessionService::Locked |
( |
| ) |
|
|
signal |
Emitted after the session has been locked.
Q_SCRIPTABLE void DBusUnitySessionService::LockRequested |
( |
| ) |
|
|
signal |
void DBusUnitySessionService::Logout |
( |
| ) |
|
|
slot |
Logout the system.
This method directly logs out 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 233 of file dbusunitysessionservice.cpp.
237 Q_EMIT logoutReady();
Q_SCRIPTABLE void LogoutReady()
Q_SCRIPTABLE 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_inhibitors | if there are any special running applications which inhibit the logout. |
void DBusUnitySessionService::PromptLock |
( |
| ) |
|
|
slot |
QString DBusUnitySessionService::RealName |
( |
| ) |
const |
|
slot |
- Returns
- the real name of the current user
Definition at line 289 of file dbusunitysessionservice.cpp.
291 struct passwd *p = getpwuid(geteuid());
293 const QString gecos = QString::fromLocal8Bit(p->pw_gecos);
294 if (!gecos.isEmpty()) {
295 return gecos.split(QLatin1Char(
',')).first();
void DBusUnitySessionService::Reboot |
( |
| ) |
|
|
slot |
Reboot the system.
This method directly reboots 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 347 of file dbusunitysessionservice.cpp.
349 d->makeLogin1Call(
"Reboot", {
false});
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_inhibitors | if there are any special running applications which inhibit the reboot. |
void DBusUnitySessionService::RequestLogout |
( |
| ) |
|
|
slot |
Issue a logout request.
This method emits 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 341 of file dbusunitysessionservice.cpp.
344 Q_EMIT logoutRequested(
false);
Q_SCRIPTABLE void LogoutRequested(bool have_inhibitors)
void DBusUnitySessionService::RequestReboot |
( |
| ) |
|
|
slot |
Issue a reboot request.
This method emits 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 352 of file dbusunitysessionservice.cpp.
355 Q_EMIT rebootRequested(
false);
Q_SCRIPTABLE void RebootRequested(bool have_inhibitors)
void DBusUnitySessionService::RequestShutdown |
( |
| ) |
|
|
slot |
Issue a shutdown request.
This method emits 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 shutdown.
Definition at line 378 of file dbusunitysessionservice.cpp.
381 Q_EMIT shutdownRequested(
false);
Q_SCRIPTABLE void ShutdownRequested(bool have_inhibitors)
void DBusUnitySessionService::Shutdown |
( |
| ) |
|
|
slot |
Shutdown the system.
This method directly shuts down 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 358 of file dbusunitysessionservice.cpp.
360 d->makeLogin1Call(
"PowerOff", {
false});
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_inhibitors | if there are any special running applications which inhibit the shutdown. |
void DBusUnitySessionService::Suspend |
( |
| ) |
|
|
slot |
Suspend the system
This method puts the system into sleep without user's confirmation.
Definition at line 363 of file dbusunitysessionservice.cpp.
365 d->makeLogin1Call(
"Suspend", {
false});
Q_SCRIPTABLE void DBusUnitySessionService::Unlocked |
( |
| ) |
|
|
signal |
Emitted after the session has been unlocked.
QString DBusUnitySessionService::UserName |
( |
| ) |
const |
|
slot |
- Returns
- the login name of the current user
Definition at line 279 of file dbusunitysessionservice.cpp.
281 struct passwd *p = getpwuid(geteuid());
283 return QString::fromUtf8(p->pw_name);
The documentation for this class was generated from the following files: