#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 () |
|
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.
◆ CanHibernate
bool DBusUnitySessionService::CanHibernate |
( |
| ) |
const |
|
slot |
- Returns
- whether the system is capable of hibernating
Definition at line 291 of file dbusunitysessionservice.cpp.
293 return d->checkLogin1Call(QStringLiteral(
"CanHibernate"));
◆ CanHybridSleep
bool DBusUnitySessionService::CanHybridSleep |
( |
| ) |
const |
|
slot |
- Returns
- whether the system is capable of hybrid sleep
- Since
- unity8
Definition at line 301 of file dbusunitysessionservice.cpp.
303 return d->checkLogin1Call(QStringLiteral(
"CanHybridSleep"));
◆ CanLock
bool DBusUnitySessionService::CanLock |
( |
| ) |
const |
|
slot |
- Returns
- whether the system is capable of locking the session
Definition at line 316 of file dbusunitysessionservice.cpp.
319 if (user.startsWith(QStringLiteral(
"guest-")) ||
320 d->isUserInGroup(user, QStringLiteral(
"nopasswdlogin"))) {
Q_SCRIPTABLE QString UserName() const
◆ CanReboot
bool DBusUnitySessionService::CanReboot |
( |
| ) |
const |
|
slot |
- Returns
- whether the system is capable of rebooting
- Since
- unity8
Definition at line 306 of file dbusunitysessionservice.cpp.
308 return d->checkLogin1Call(QStringLiteral(
"CanReboot"));
◆ CanShutdown
bool DBusUnitySessionService::CanShutdown |
( |
| ) |
const |
|
slot |
- Returns
- whether the system is capable of shutting down
Definition at line 311 of file dbusunitysessionservice.cpp.
313 return d->checkLogin1Call(QStringLiteral(
"CanPowerOff"));
◆ CanSuspend
bool DBusUnitySessionService::CanSuspend |
( |
| ) |
const |
|
slot |
- Returns
- whether the system is capable of suspending
Definition at line 296 of file dbusunitysessionservice.cpp.
298 return d->checkLogin1Call(QStringLiteral(
"CanSuspend"));
◆ EndSession
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 282 of file dbusunitysessionservice.cpp.
284 const QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral(
"com.ubuntu.Upstart"),
285 QStringLiteral(
"/com/ubuntu/Upstart"),
286 QStringLiteral(
"com.ubuntu.Upstart0_6"),
287 QStringLiteral(
"EndSession"));
288 QDBusConnection::sessionBus().asyncCall(msg);
◆ Hibernate
void DBusUnitySessionService::Hibernate |
( |
| ) |
|
|
slot |
Hibernate the system
This method puts the system into hibernation without user's confirmation.
Definition at line 459 of file dbusunitysessionservice.cpp.
462 d->makeLogin1Call(QStringLiteral(
"Hibernate"), {
false});
Q_SCRIPTABLE void PromptLock()
◆ HostName
QString DBusUnitySessionService::HostName |
( |
| ) |
const |
|
slot |
- Returns
- the local hostname
Definition at line 346 of file dbusunitysessionservice.cpp.
349 if (gethostname(hostName,
sizeof(hostName)) == -1) {
350 qWarning() <<
"Could not determine local hostname";
353 hostName[
sizeof(hostName) - 1] =
'\0';
354 return QString::fromLocal8Bit(hostName);
◆ HybridSleep
void DBusUnitySessionService::HybridSleep |
( |
| ) |
|
|
slot |
Hybrid sleep
This method puts the system into hybrid sleep without user's confirmation.
- Since
- unity8
Definition at line 465 of file dbusunitysessionservice.cpp.
468 d->makeLogin1Call(QStringLiteral(
"HybridSleep"), {
false});
Q_SCRIPTABLE void PromptLock()
◆ IsLocked
bool DBusUnitySessionService::IsLocked |
( |
| ) |
const |
|
slot |
◆ Lock
void DBusUnitySessionService::Lock |
( |
| ) |
|
|
slot |
◆ Locked
Q_SCRIPTABLE void DBusUnitySessionService::Locked |
( |
| ) |
|
|
signal |
Emitted after the session has been locked.
◆ LockRequested
Q_SCRIPTABLE void DBusUnitySessionService::LockRequested |
( |
| ) |
|
|
signal |
◆ Logout
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 275 of file dbusunitysessionservice.cpp.
279 Q_EMIT logoutReady();
Q_SCRIPTABLE void LogoutReady()
◆ 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.
◆ LogoutRequested
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. |
◆ PromptLock
void DBusUnitySessionService::PromptLock |
( |
| ) |
|
|
slot |
◆ RealName
QString DBusUnitySessionService::RealName |
( |
| ) |
const |
|
slot |
- Returns
- the real name of the current user
Definition at line 332 of file dbusunitysessionservice.cpp.
334 struct passwd *p = getpwuid(geteuid());
336 const QString gecos = QString::fromLocal8Bit(p->pw_gecos);
337 if (!gecos.isEmpty()) {
338 const QStringList splitGecos = gecos.split(QLatin1Char(
','));
339 return splitGecos.first();
◆ Reboot
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 437 of file dbusunitysessionservice.cpp.
439 d->makeLogin1Call(QStringLiteral(
"Reboot"), {
false});
◆ RebootRequested
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. |
◆ RequestLogout
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 431 of file dbusunitysessionservice.cpp.
434 Q_EMIT logoutRequested(
false);
Q_SCRIPTABLE void LogoutRequested(bool have_inhibitors)
◆ RequestReboot
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 442 of file dbusunitysessionservice.cpp.
445 Q_EMIT rebootRequested(
false);
Q_SCRIPTABLE void RebootRequested(bool have_inhibitors)
◆ RequestShutdown
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 471 of file dbusunitysessionservice.cpp.
474 Q_EMIT shutdownRequested(
false);
Q_SCRIPTABLE void ShutdownRequested(bool have_inhibitors)
◆ Shutdown
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 448 of file dbusunitysessionservice.cpp.
450 d->makeLogin1Call(QStringLiteral(
"PowerOff"), {
false});
◆ ShutdownRequested
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. |
◆ Suspend
void DBusUnitySessionService::Suspend |
( |
| ) |
|
|
slot |
Suspend the system
This method puts the system into sleep without user's confirmation.
Definition at line 453 of file dbusunitysessionservice.cpp.
456 d->makeLogin1Call(QStringLiteral(
"Suspend"), {
false});
Q_SCRIPTABLE void PromptLock()
◆ Unlocked
Q_SCRIPTABLE void DBusUnitySessionService::Unlocked |
( |
| ) |
|
|
signal |
Emitted after the session has been unlocked.
◆ UserName
QString DBusUnitySessionService::UserName |
( |
| ) |
const |
|
slot |
- Returns
- the login name of the current user
Definition at line 327 of file dbusunitysessionservice.cpp.
329 return QString::fromUtf8(g_get_user_name());
The documentation for this class was generated from the following files: