Changeset View
Changeset View
Standalone View
Standalone View
logout-greeter/shutdowndlg.cpp
Show All 24 Lines | |||||
25 | 25 | | |||
26 | #include <QApplication> | 26 | #include <QApplication> | ||
27 | #include <QQuickItem> | 27 | #include <QQuickItem> | ||
28 | #include <QTimer> | 28 | #include <QTimer> | ||
29 | #include <QFile> | 29 | #include <QFile> | ||
30 | #include <QDBusConnection> | 30 | #include <QDBusConnection> | ||
31 | #include <QDBusMessage> | 31 | #include <QDBusMessage> | ||
32 | #include <QDBusPendingCall> | 32 | #include <QDBusPendingCall> | ||
33 | #include <QDBusVariant> | ||||
33 | #include <QQuickView> | 34 | #include <QQuickView> | ||
34 | #include <QQmlContext> | 35 | #include <QQmlContext> | ||
35 | #include <QQmlEngine> | 36 | #include <QQmlEngine> | ||
36 | #include <QQmlPropertyMap> | 37 | #include <QQmlPropertyMap> | ||
37 | #include <QPainter> | 38 | #include <QPainter> | ||
38 | #include <QStandardPaths> | 39 | #include <QStandardPaths> | ||
39 | #include <QX11Info> | 40 | #include <QX11Info> | ||
40 | #include <QScreen> | 41 | #include <QScreen> | ||
Show All 20 Lines | |||||
61 | #include <fixx11h.h> | 62 | #include <fixx11h.h> | ||
62 | 63 | | |||
63 | #include <config-workspace.h> | 64 | #include <config-workspace.h> | ||
64 | #include <debug.h> | 65 | #include <debug.h> | ||
65 | 66 | | |||
66 | #include <KWayland/Client/surface.h> | 67 | #include <KWayland/Client/surface.h> | ||
67 | #include <KWayland/Client/plasmashell.h> | 68 | #include <KWayland/Client/plasmashell.h> | ||
68 | 69 | | |||
70 | static const QString s_login1Service = QStringLiteral("org.freedesktop.login1"); | ||||
71 | static const QString s_login1Path = QStringLiteral("/org/freedesktop/login1"); | ||||
72 | static const QString s_dbusPropertiesInterface = QStringLiteral("org.freedesktop.DBus.Properties"); | ||||
73 | static const QString s_login1ManagerInterface = QStringLiteral("org.freedesktop.login1.Manager"); | ||||
74 | static const QString s_login1RebootToFirmwareSetup = QStringLiteral("RebootToFirmwareSetup"); | ||||
75 | | ||||
69 | Q_DECLARE_METATYPE(Solid::PowerManagement::SleepState) | 76 | Q_DECLARE_METATYPE(Solid::PowerManagement::SleepState) | ||
70 | 77 | | |||
71 | KSMShutdownDlg::KSMShutdownDlg(QWindow* parent, | 78 | KSMShutdownDlg::KSMShutdownDlg(QWindow* parent, | ||
72 | bool maysd, KWorkSpace::ShutdownType sdtype, | 79 | bool maysd, KWorkSpace::ShutdownType sdtype, | ||
73 | KWayland::Client::PlasmaShell *plasmaShell) | 80 | KWayland::Client::PlasmaShell *plasmaShell) | ||
74 | : QuickViewSharedEngine(parent), | 81 | : QuickViewSharedEngine(parent), | ||
75 | m_result(false), | 82 | m_result(false), | ||
76 | m_waylandPlasmaShell(plasmaShell) | 83 | m_waylandPlasmaShell(plasmaShell) | ||
Show All 36 Lines | 86 | { | |||
113 | QQmlPropertyMap *mapSpdMethods = new QQmlPropertyMap(this); | 120 | QQmlPropertyMap *mapSpdMethods = new QQmlPropertyMap(this); | ||
114 | QSet<Solid::PowerManagement::SleepState> spdMethods = Solid::PowerManagement::supportedSleepStates(); | 121 | QSet<Solid::PowerManagement::SleepState> spdMethods = Solid::PowerManagement::supportedSleepStates(); | ||
115 | mapSpdMethods->insert(QStringLiteral("StandbyState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::StandbyState))); | 122 | mapSpdMethods->insert(QStringLiteral("StandbyState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::StandbyState))); | ||
116 | mapSpdMethods->insert(QStringLiteral("SuspendState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::SuspendState))); | 123 | mapSpdMethods->insert(QStringLiteral("SuspendState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::SuspendState))); | ||
117 | mapSpdMethods->insert(QStringLiteral("HibernateState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::HibernateState))); | 124 | mapSpdMethods->insert(QStringLiteral("HibernateState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::HibernateState))); | ||
118 | context->setContextProperty(QStringLiteral("spdMethods"), mapSpdMethods); | 125 | context->setContextProperty(QStringLiteral("spdMethods"), mapSpdMethods); | ||
119 | context->setContextProperty(QStringLiteral("canLogout"), KAuthorized::authorize(QStringLiteral("logout"))); | 126 | context->setContextProperty(QStringLiteral("canLogout"), KAuthorized::authorize(QStringLiteral("logout"))); | ||
120 | 127 | | |||
128 | bool rebootToFirmwareSetup = false; | ||||
129 | QDBusMessage message = QDBusMessage::createMethodCall(s_login1Service, s_login1Path, s_dbusPropertiesInterface, QStringLiteral("Get")); | ||||
130 | message.setArguments({s_login1ManagerInterface, s_login1RebootToFirmwareSetup}); | ||||
131 | QDBusMessage reply = QDBusConnection::systemBus().call(message); | ||||
132 | if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 1) { | ||||
133 | const QVariant propertyVariant = reply.arguments().constFirst().value<QDBusVariant>().variant(); | ||||
134 | if (propertyVariant.type() == QVariant::Bool) { | ||||
135 | rebootToFirmwareSetup = propertyVariant.toBool(); | ||||
136 | } | ||||
137 | } | ||||
138 | context->setContextProperty("rebootToFirmwareSetup", rebootToFirmwareSetup); | ||||
139 | | ||||
121 | // TODO KF6 remove, used to read "BootManager" from kdmrc | 140 | // TODO KF6 remove, used to read "BootManager" from kdmrc | ||
122 | context->setContextProperty(QStringLiteral("bootManager"), QStringLiteral("None")); | 141 | context->setContextProperty(QStringLiteral("bootManager"), QStringLiteral("None")); | ||
123 | 142 | | |||
124 | //TODO KF6 remove. Unused | 143 | //TODO KF6 remove. Unused | ||
125 | context->setContextProperty(QStringLiteral("choose"), false); | 144 | context->setContextProperty(QStringLiteral("choose"), false); | ||
126 | 145 | | |||
127 | 146 | | |||
128 | // TODO KF6 remove, used to call KDisplayManager::bootOptions | 147 | // TODO KF6 remove, used to call KDisplayManager::bootOptions | ||
▲ Show 20 Lines • Show All 182 Lines • Show Last 20 Lines |