Changeset View
Changeset View
Standalone View
Standalone View
ksmserver/logout-greeter/shutdowndlg.cpp
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | |||||
59 | 59 | | |||
60 | #include <stdio.h> | 60 | #include <stdio.h> | ||
61 | #include <netwm.h> | 61 | #include <netwm.h> | ||
62 | 62 | | |||
63 | #include <X11/Xutil.h> | 63 | #include <X11/Xutil.h> | ||
64 | #include <X11/Xatom.h> | 64 | #include <X11/Xatom.h> | ||
65 | #include <fixx11h.h> | 65 | #include <fixx11h.h> | ||
66 | 66 | | |||
67 | #include <kdisplaymanager.h> | | |||
68 | | ||||
69 | #include <config-workspace.h> | 67 | #include <config-workspace.h> | ||
70 | 68 | | |||
71 | #include <KWayland/Client/surface.h> | 69 | #include <KWayland/Client/surface.h> | ||
72 | #include <KWayland/Client/plasmashell.h> | 70 | #include <KWayland/Client/plasmashell.h> | ||
73 | 71 | | |||
74 | Q_DECLARE_METATYPE(Solid::PowerManagement::SleepState) | 72 | Q_DECLARE_METATYPE(Solid::PowerManagement::SleepState) | ||
75 | 73 | | |||
76 | KSMShutdownDlg::KSMShutdownDlg( QWindow* parent, | 74 | KSMShutdownDlg::KSMShutdownDlg( QWindow* parent, | ||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 82 | { | |||
119 | QQmlPropertyMap *mapSpdMethods = new QQmlPropertyMap(this); | 117 | QQmlPropertyMap *mapSpdMethods = new QQmlPropertyMap(this); | ||
120 | QSet<Solid::PowerManagement::SleepState> spdMethods = Solid::PowerManagement::supportedSleepStates(); | 118 | QSet<Solid::PowerManagement::SleepState> spdMethods = Solid::PowerManagement::supportedSleepStates(); | ||
121 | mapSpdMethods->insert(QStringLiteral("StandbyState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::StandbyState))); | 119 | mapSpdMethods->insert(QStringLiteral("StandbyState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::StandbyState))); | ||
122 | mapSpdMethods->insert(QStringLiteral("SuspendState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::SuspendState))); | 120 | mapSpdMethods->insert(QStringLiteral("SuspendState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::SuspendState))); | ||
123 | mapSpdMethods->insert(QStringLiteral("HibernateState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::HibernateState))); | 121 | mapSpdMethods->insert(QStringLiteral("HibernateState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::HibernateState))); | ||
124 | context->setContextProperty(QStringLiteral("spdMethods"), mapSpdMethods); | 122 | context->setContextProperty(QStringLiteral("spdMethods"), mapSpdMethods); | ||
125 | context->setContextProperty(QStringLiteral("canLogout"), KAuthorized::authorize(QStringLiteral("logout"))); | 123 | context->setContextProperty(QStringLiteral("canLogout"), KAuthorized::authorize(QStringLiteral("logout"))); | ||
126 | 124 | | |||
127 | QString bootManager = KConfig(QStringLiteral(KDE_CONFDIR "/kdm/kdmrc"), KConfig::SimpleConfig) | 125 | // TODO KF6 remove, used to read "BootManager" from kdmrc | ||
128 | .group("Shutdown") | 126 | context->setContextProperty(QStringLiteral("bootManager"), QStringLiteral("None")); | ||
129 | .readEntry("BootManager", "None"); | 127 | | ||
130 | context->setContextProperty(QStringLiteral("bootManager"), bootManager); | 128 | // TODO KF6 remove, used to call KDisplayManager::bootOptions | ||
131 | 129 | QStringList rebootOptions; | |||
132 | QStringList options; | 130 | int def = 0; | ||
133 | int def, cur; | | |||
134 | if ( KDisplayManager().bootOptions( rebootOptions, def, cur ) ) { | | |||
135 | if ( cur > -1 ) { | | |||
136 | def = cur; | | |||
137 | } | | |||
138 | } | | |||
139 | QQmlPropertyMap *rebootOptionsMap = new QQmlPropertyMap(this); | 131 | QQmlPropertyMap *rebootOptionsMap = new QQmlPropertyMap(this); | ||
140 | rebootOptionsMap->insert(QStringLiteral("options"), QVariant::fromValue(rebootOptions)); | 132 | rebootOptionsMap->insert(QStringLiteral("options"), QVariant::fromValue(rebootOptions)); | ||
141 | rebootOptionsMap->insert(QStringLiteral("default"), QVariant::fromValue(def)); | 133 | rebootOptionsMap->insert(QStringLiteral("default"), QVariant::fromValue(def)); | ||
142 | context->setContextProperty(QStringLiteral("rebootOptions"), rebootOptionsMap); | 134 | context->setContextProperty(QStringLiteral("rebootOptions"), rebootOptionsMap); | ||
143 | 135 | | |||
144 | // engine stuff | 136 | // engine stuff | ||
145 | KDeclarative::KDeclarative kdeclarative; | 137 | KDeclarative::KDeclarative kdeclarative; | ||
146 | kdeclarative.setDeclarativeEngine(engine()); | 138 | kdeclarative.setDeclarativeEngine(engine()); | ||
▲ Show 20 Lines • Show All 173 Lines • Show Last 20 Lines |