Changeset View
Changeset View
Standalone View
Standalone View
logind.cpp
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | |||||
59 | { | 59 | { | ||
60 | 60 | | |||
61 | const static QString s_login1Name = QStringLiteral("logind"); | 61 | const static QString s_login1Name = QStringLiteral("logind"); | ||
62 | const static QString s_login1Service = QStringLiteral("org.freedesktop.login1"); | 62 | const static QString s_login1Service = QStringLiteral("org.freedesktop.login1"); | ||
63 | const static QString s_login1Path = QStringLiteral("/org/freedesktop/login1"); | 63 | const static QString s_login1Path = QStringLiteral("/org/freedesktop/login1"); | ||
64 | const static QString s_login1ManagerInterface = QStringLiteral("org.freedesktop.login1.Manager"); | 64 | const static QString s_login1ManagerInterface = QStringLiteral("org.freedesktop.login1.Manager"); | ||
65 | const static QString s_login1SeatInterface = QStringLiteral("org.freedesktop.login1.Seat"); | 65 | const static QString s_login1SeatInterface = QStringLiteral("org.freedesktop.login1.Seat"); | ||
66 | const static QString s_login1SessionInterface = QStringLiteral("org.freedesktop.login1.Session"); | 66 | const static QString s_login1SessionInterface = QStringLiteral("org.freedesktop.login1.Session"); | ||
67 | const static QString s_login1ActivateProperty = QStringLiteral("Activate"); | 67 | const static QString s_login1ActiveProperty = QStringLiteral("Active"); | ||
broulik: Should the variable also be named Active? | |||||
Yea, thought about it. It was probably called s_login1ActivateProperty for now because in the ConsoleKit case it has the value "activate". But IMO calling it s_login1ActiveProperty as you proposed would make more sense because the variable/value describes a status. I can change it if others (@erickoegel?) think the same. Either with this diff or in a seperate one. romangg: Yea, thought about it. It was probably called `s_login1ActivateProperty` for now because in the… | |||||
68 | 68 | | |||
69 | const static QString s_ck2Name = QStringLiteral("ConsoleKit"); | 69 | const static QString s_ck2Name = QStringLiteral("ConsoleKit"); | ||
70 | const static QString s_ck2Service = QStringLiteral("org.freedesktop.ConsoleKit"); | 70 | const static QString s_ck2Service = QStringLiteral("org.freedesktop.ConsoleKit"); | ||
71 | const static QString s_ck2Path = QStringLiteral("/org/freedesktop/ConsoleKit/Manager"); | 71 | const static QString s_ck2Path = QStringLiteral("/org/freedesktop/ConsoleKit/Manager"); | ||
72 | const static QString s_ck2ManagerInterface = QStringLiteral("org.freedesktop.ConsoleKit.Manager"); | 72 | const static QString s_ck2ManagerInterface = QStringLiteral("org.freedesktop.ConsoleKit.Manager"); | ||
73 | const static QString s_ck2SeatInterface = QStringLiteral("org.freedesktop.ConsoleKit.Seat"); | 73 | const static QString s_ck2SeatInterface = QStringLiteral("org.freedesktop.ConsoleKit.Seat"); | ||
74 | const static QString s_ck2SessionInterface = QStringLiteral("org.freedesktop.ConsoleKit.Session"); | 74 | const static QString s_ck2SessionInterface = QStringLiteral("org.freedesktop.ConsoleKit.Session"); | ||
75 | const static QString s_ck2ActivateProperty = QStringLiteral("activate"); | 75 | const static QString s_ck2ActiveProperty = QStringLiteral("activate"); | ||
cfeck: Does this need to be changed, too? | |||||
erickoegel: Yes, it should be "active" as well. Sorry about that. | |||||
I pushed https://commits.kde.org/kwin/58322c277892942f5ab5128d2e864fb8547157c9 for this. Please verify. graesslin: I pushed https://commits.kde.org/kwin/58322c277892942f5ab5128d2e864fb8547157c9 for this. Please… | |||||
erickoegel: That's correct, thanks! | |||||
76 | 76 | | |||
77 | const static QString s_dbusPropertiesInterface = QStringLiteral("org.freedesktop.DBus.Properties"); | 77 | const static QString s_dbusPropertiesInterface = QStringLiteral("org.freedesktop.DBus.Properties"); | ||
78 | 78 | | |||
79 | 79 | | |||
80 | 80 | | |||
81 | LogindIntegration *LogindIntegration::s_self = nullptr; | 81 | LogindIntegration *LogindIntegration::s_self = nullptr; | ||
82 | 82 | | |||
83 | LogindIntegration *LogindIntegration::create(QObject *parent) | 83 | LogindIntegration *LogindIntegration::create(QObject *parent) | ||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 132 | { | |||
133 | if (controller == SessionControllerLogind) { | 133 | if (controller == SessionControllerLogind) { | ||
134 | // We have the logind serivce, set it up and use it | 134 | // We have the logind serivce, set it up and use it | ||
135 | m_sessionControllerName = s_login1Name; | 135 | m_sessionControllerName = s_login1Name; | ||
136 | m_sessionControllerService = s_login1Service; | 136 | m_sessionControllerService = s_login1Service; | ||
137 | m_sessionControllerPath = s_login1Path; | 137 | m_sessionControllerPath = s_login1Path; | ||
138 | m_sessionControllerManagerInterface = s_login1ManagerInterface; | 138 | m_sessionControllerManagerInterface = s_login1ManagerInterface; | ||
139 | m_sessionControllerSeatInterface = s_login1SeatInterface; | 139 | m_sessionControllerSeatInterface = s_login1SeatInterface; | ||
140 | m_sessionControllerSessionInterface = s_login1SessionInterface; | 140 | m_sessionControllerSessionInterface = s_login1SessionInterface; | ||
141 | m_sessionControllerActivateProperty = s_login1ActivateProperty; | 141 | m_sessionControllerActiveProperty = s_login1ActiveProperty; | ||
142 | m_logindServiceWatcher = new QDBusServiceWatcher(m_sessionControllerService, | 142 | m_logindServiceWatcher = new QDBusServiceWatcher(m_sessionControllerService, | ||
143 | m_bus, | 143 | m_bus, | ||
144 | QDBusServiceWatcher::WatchForUnregistration | QDBusServiceWatcher::WatchForRegistration, | 144 | QDBusServiceWatcher::WatchForUnregistration | QDBusServiceWatcher::WatchForRegistration, | ||
145 | this); | 145 | this); | ||
146 | connect(m_logindServiceWatcher, &QDBusServiceWatcher::serviceRegistered, this, &LogindIntegration::logindServiceRegistered); | 146 | connect(m_logindServiceWatcher, &QDBusServiceWatcher::serviceRegistered, this, &LogindIntegration::logindServiceRegistered); | ||
147 | connect(m_logindServiceWatcher, &QDBusServiceWatcher::serviceUnregistered, this, | 147 | connect(m_logindServiceWatcher, &QDBusServiceWatcher::serviceUnregistered, this, | ||
148 | [this]() { | 148 | [this]() { | ||
149 | m_connected = false; | 149 | m_connected = false; | ||
150 | emit connectedChanged(); | 150 | emit connectedChanged(); | ||
151 | } | 151 | } | ||
152 | ); | 152 | ); | ||
153 | logindServiceRegistered(); | 153 | logindServiceRegistered(); | ||
154 | } else if (controller == SessionControllerConsoleKit) { | 154 | } else if (controller == SessionControllerConsoleKit) { | ||
155 | // We have the ConsoleKit serivce, set it up and use it | 155 | // We have the ConsoleKit serivce, set it up and use it | ||
156 | m_sessionControllerName = s_ck2Name; | 156 | m_sessionControllerName = s_ck2Name; | ||
157 | m_sessionControllerService = s_ck2Service; | 157 | m_sessionControllerService = s_ck2Service; | ||
158 | m_sessionControllerPath = s_ck2Path; | 158 | m_sessionControllerPath = s_ck2Path; | ||
159 | m_sessionControllerManagerInterface = s_ck2ManagerInterface; | 159 | m_sessionControllerManagerInterface = s_ck2ManagerInterface; | ||
160 | m_sessionControllerSeatInterface = s_ck2SeatInterface; | 160 | m_sessionControllerSeatInterface = s_ck2SeatInterface; | ||
161 | m_sessionControllerSessionInterface = s_ck2SessionInterface; | 161 | m_sessionControllerSessionInterface = s_ck2SessionInterface; | ||
162 | m_sessionControllerActivateProperty = s_ck2ActivateProperty; | 162 | m_sessionControllerActiveProperty = s_ck2ActiveProperty; | ||
163 | m_logindServiceWatcher = new QDBusServiceWatcher(m_sessionControllerService, | 163 | m_logindServiceWatcher = new QDBusServiceWatcher(m_sessionControllerService, | ||
164 | m_bus, | 164 | m_bus, | ||
165 | QDBusServiceWatcher::WatchForUnregistration | QDBusServiceWatcher::WatchForRegistration, | 165 | QDBusServiceWatcher::WatchForUnregistration | QDBusServiceWatcher::WatchForRegistration, | ||
166 | this); | 166 | this); | ||
167 | connect(m_logindServiceWatcher, &QDBusServiceWatcher::serviceRegistered, this, &LogindIntegration::logindServiceRegistered); | 167 | connect(m_logindServiceWatcher, &QDBusServiceWatcher::serviceRegistered, this, &LogindIntegration::logindServiceRegistered); | ||
168 | connect(m_logindServiceWatcher, &QDBusServiceWatcher::serviceUnregistered, this, | 168 | connect(m_logindServiceWatcher, &QDBusServiceWatcher::serviceUnregistered, this, | ||
169 | [this]() { | 169 | [this]() { | ||
170 | m_connected = false; | 170 | m_connected = false; | ||
Show All 38 Lines | 199 | [this](QDBusPendingCallWatcher *self) { | |||
209 | m_sessionPath = reply.value().path(); | 209 | m_sessionPath = reply.value().path(); | ||
210 | qCDebug(KWIN_CORE) << "Session path:" << m_sessionPath; | 210 | qCDebug(KWIN_CORE) << "Session path:" << m_sessionPath; | ||
211 | m_connected = true; | 211 | m_connected = true; | ||
212 | connectSessionPropertiesChanged(); | 212 | connectSessionPropertiesChanged(); | ||
213 | // activate the session, in case we are not on it | 213 | // activate the session, in case we are not on it | ||
214 | QDBusMessage message = QDBusMessage::createMethodCall(m_sessionControllerService, | 214 | QDBusMessage message = QDBusMessage::createMethodCall(m_sessionControllerService, | ||
215 | m_sessionPath, | 215 | m_sessionPath, | ||
216 | m_sessionControllerSessionInterface, | 216 | m_sessionControllerSessionInterface, | ||
217 | QStringLiteral("Activate")); | 217 | QStringLiteral("Activate")); | ||
usta: is this will be Active or Activate | |||||
Activate should be right here. Here it's an action (to "Activate" the session) and not a status (is the session currently "Active"?). romangg: Activate should be right here. Here it's an action (to "Activate" the session) and not a status… | |||||
218 | // blocking on purpose | 218 | // blocking on purpose | ||
219 | m_bus.call(message); | 219 | m_bus.call(message); | ||
220 | getSeat(); | 220 | getSeat(); | ||
221 | getSessionActive(); | 221 | getSessionActive(); | ||
222 | getVirtualTerminal(); | 222 | getVirtualTerminal(); | ||
223 | 223 | | |||
224 | emit connectedChanged(); | 224 | emit connectedChanged(); | ||
225 | } | 225 | } | ||
Show All 20 Lines | |||||
246 | { | 246 | { | ||
247 | if (!m_connected || m_sessionPath.isEmpty()) { | 247 | if (!m_connected || m_sessionPath.isEmpty()) { | ||
248 | return; | 248 | return; | ||
249 | } | 249 | } | ||
250 | QDBusMessage message = QDBusMessage::createMethodCall(m_sessionControllerService, | 250 | QDBusMessage message = QDBusMessage::createMethodCall(m_sessionControllerService, | ||
251 | m_sessionPath, | 251 | m_sessionPath, | ||
252 | s_dbusPropertiesInterface, | 252 | s_dbusPropertiesInterface, | ||
253 | QStringLiteral("Get")); | 253 | QStringLiteral("Get")); | ||
254 | message.setArguments(QVariantList({m_sessionControllerSessionInterface, m_sessionControllerActivateProperty})); | 254 | message.setArguments(QVariantList({m_sessionControllerSessionInterface, m_sessionControllerActiveProperty})); | ||
255 | QDBusPendingReply<QVariant> reply = m_bus.asyncCall(message); | 255 | QDBusPendingReply<QVariant> reply = m_bus.asyncCall(message); | ||
256 | QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); | 256 | QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); | ||
257 | connect(watcher, &QDBusPendingCallWatcher::finished, this, | 257 | connect(watcher, &QDBusPendingCallWatcher::finished, this, | ||
258 | [this](QDBusPendingCallWatcher *self) { | 258 | [this](QDBusPendingCallWatcher *self) { | ||
259 | QDBusPendingReply<QVariant> reply = *self; | 259 | QDBusPendingReply<QVariant> reply = *self; | ||
260 | self->deleteLater(); | 260 | self->deleteLater(); | ||
261 | if (!reply.isValid()) { | 261 | if (!reply.isValid()) { | ||
262 | qCDebug(KWIN_CORE) << "Failed to get Active Property of " << m_sessionControllerName << " session:" << reply.error().message(); | 262 | qCDebug(KWIN_CORE) << "Failed to get Active Property of " << m_sessionControllerName << " session:" << reply.error().message(); | ||
▲ Show 20 Lines • Show All 186 Lines • Show Last 20 Lines |
Should the variable also be named Active?