Changeset View
Changeset View
Standalone View
Standalone View
startkde/plasma-shutdown/shutdown.cpp
- This file was moved from startkde/plasma-session/shutdown.cpp.
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | 41 | { | |||
---|---|---|---|---|---|
42 | m_shutdownType = shutdownType; | 42 | m_shutdownType = shutdownType; | ||
43 | 43 | | |||
44 | OrgKdeKSMServerInterfaceInterface ksmserverIface(QStringLiteral("org.kde.ksmserver"), QStringLiteral("/KSMServer"), QDBusConnection::sessionBus()); | 44 | OrgKdeKSMServerInterfaceInterface ksmserverIface(QStringLiteral("org.kde.ksmserver"), QStringLiteral("/KSMServer"), QDBusConnection::sessionBus()); | ||
45 | auto closeSessionReply = ksmserverIface.closeSession(); | 45 | auto closeSessionReply = ksmserverIface.closeSession(); | ||
46 | auto watcher = new QDBusPendingCallWatcher(closeSessionReply, this); | 46 | auto watcher = new QDBusPendingCallWatcher(closeSessionReply, this); | ||
47 | connect(watcher, &QDBusPendingCallWatcher::finished, this, [closeSessionReply, watcher, this]() { | 47 | connect(watcher, &QDBusPendingCallWatcher::finished, this, [closeSessionReply, watcher, this]() { | ||
48 | watcher->deleteLater(); | 48 | watcher->deleteLater(); | ||
49 | if (closeSessionReply.isError()) { | 49 | if (closeSessionReply.isError()) { | ||
50 | qDebug() << "ksmserver failed to complete logout"; | 50 | qCWarning(PLASMA_SESSION) << "ksmserver failed to complete logout"; | ||
51 | qApp->quit(); | ||||
51 | } | 52 | } | ||
52 | if (closeSessionReply.value()) { | 53 | if (closeSessionReply.value()) { | ||
53 | logoutComplete(); | 54 | logoutComplete(); | ||
54 | } else { | 55 | } else { | ||
55 | logoutCancelled(); | 56 | logoutCancelled(); | ||
56 | } | 57 | } | ||
57 | }); | 58 | }); | ||
58 | } | 59 | } | ||
59 | 60 | | |||
60 | void Shutdown::logoutCancelled() | 61 | void Shutdown::logoutCancelled() | ||
61 | { | 62 | { | ||
62 | m_shutdownType = KWorkSpace::ShutdownTypeNone; | 63 | m_shutdownType = KWorkSpace::ShutdownTypeNone; | ||
64 | qApp->quit(); | ||||
63 | } | 65 | } | ||
64 | 66 | | |||
65 | void Shutdown::logoutComplete() { | 67 | void Shutdown::logoutComplete() { | ||
66 | runShutdownScripts(); | 68 | runShutdownScripts(); | ||
67 | if (m_shutdownType == KWorkSpace::ShutdownTypeHalt) { | 69 | if (m_shutdownType == KWorkSpace::ShutdownTypeHalt) { | ||
68 | SessionBackend::self()->shutdown(); | 70 | SessionBackend::self()->shutdown(); | ||
69 | } else if (m_shutdownType == KWorkSpace::ShutdownTypeReboot) { | 71 | } else if (m_shutdownType == KWorkSpace::ShutdownTypeReboot) { | ||
70 | SessionBackend::self()->reboot(); | 72 | SessionBackend::self()->reboot(); | ||
Show All 27 Lines |