@@ -64,19 +64,19 @@ public:
6464 QStringLiteral("GetSessionByPID"));
6565 msg << (quint32) getpid();
6666
67− QDBusReply<QDBusObjectPath> reply = QDBusConnection::systemBus().call(msg);
67+ QDBusReply<QDBusObjectPath> reply = QDBusConnection::SM_BUSNAME().call(msg);
6868 if (reply.isValid()) {
6969 logindSessionPath = reply.value().path();
7070
7171 // start watching the Active property
72− QDBusConnection::systemBus().connect(LOGIN1_SERVICE, logindSessionPath, QStringLiteral("org.freedesktop.DBus.Properties"), QStringLiteral("PropertiesChanged"),
73− this, SLOT(onPropertiesChanged(QString,QVariantMap,QStringList)));
72+ QDBusConnection::SM_BUSNAME().connect(LOGIN1_SERVICE, logindSessionPath, QStringLiteral("org.freedesktop.DBus.Properties"), QStringLiteral("PropertiesChanged"),
73+ this, SLOT(onPropertiesChanged(QString,QVariantMap,QStringList)));
7474
7575 setupSystemdInhibition();
7676
7777 // re-enable the inhibition upon resume from sleep
78− QDBusConnection::systemBus().connect(LOGIN1_SERVICE, LOGIN1_PATH, LOGIN1_IFACE, QStringLiteral("PrepareForSleep"),
79− this, SLOT(onResuming(bool)));
78+ QDBusConnection::SM_BUSNAME().connect(LOGIN1_SERVICE, LOGIN1_PATH, LOGIN1_IFACE, QStringLiteral("PrepareForSleep"),
79+ this, SLOT(onResuming(bool)));
8080 } else {
8181 qWarning() << "Failed to get logind session path" << reply.error().message();
8282 }
@@ -96,7 +96,7 @@ public:
9696 msg << "Unity8 handles power events"; // why
9797 msg << "block"; // mode
9898
99− QDBusPendingCall pendingCall = QDBusConnection::systemBus().asyncCall(msg);
99+ QDBusPendingCall pendingCall = QDBusConnection::SM_BUSNAME().asyncCall(msg);
100100 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall, this);
101101 connect(watcher, &QDBusPendingCallWatcher::finished,
102102 this, [this](QDBusPendingCallWatcher* watcher) {
@@ -114,7 +114,7 @@ public:
114114 bool checkLogin1Call(const QString &method) const
115115 {
116116 QDBusMessage msg = QDBusMessage::createMethodCall(LOGIN1_SERVICE, LOGIN1_PATH, LOGIN1_IFACE, method);
117− QDBusReply<QString> reply = QDBusConnection::systemBus().call(msg);
117+ QDBusReply<QString> reply = QDBusConnection::SM_BUSNAME().call(msg);
118118 return reply.isValid() && (reply == QStringLiteral("yes") || reply == QStringLiteral("challenge"));
119119 }
120120
@@ -125,7 +125,7 @@ public:
125125 LOGIN1_IFACE,
126126 method);
127127 msg.setArguments(args);
128− QDBusConnection::systemBus().asyncCall(msg);
128+ QDBusConnection::SM_BUSNAME().asyncCall(msg);
129129 }
130130
131131 void setActive(bool active)
@@ -157,7 +157,7 @@ public:
157157 msg << LOGIN1_SESSION_IFACE;
158158 msg << ACTIVE_KEY;
159159
160− QDBusPendingCall pendingCall = QDBusConnection::systemBus().asyncCall(msg);
160+ QDBusPendingCall pendingCall = QDBusConnection::SM_BUSNAME().asyncCall(msg);
161161 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall, this);
162162 connect(watcher, &QDBusPendingCallWatcher::finished,
163163 this, [this](QDBusPendingCallWatcher* watcher) {
@@ -191,7 +191,7 @@ public:
191191 msg << LOGIN1_SESSION_IFACE;
192192 msg << IDLE_SINCE_KEY;
193193
194− QDBusReply<QVariant> reply = QDBusConnection::systemBus().call(msg);
194+ QDBusReply<QVariant> reply = QDBusConnection::SM_BUSNAME().call(msg);
195195 if (reply.isValid()) {
196196 return reply.value().value<quint64>();
197197 } else {
@@ -208,7 +208,7 @@ public:
208208 LOGIN1_SESSION_IFACE,
209209 QStringLiteral("SetIdleHint"));
210210 msg << idle;
211− QDBusConnection::systemBus().asyncCall(msg);
211+ QDBusConnection::SM_BUSNAME().asyncCall(msg);
212212 }
213213
214214private Q_SLOTS:
@@ -244,10 +244,10 @@ DBusUnitySessionService::DBusUnitySessionService()
244244{
245245 if (!d->logindSessionPath.isEmpty()) {
246246 // connect our PromptLock() slot to the logind's session Lock() signal
247− QDBusConnection::systemBus().connect(LOGIN1_SERVICE, d->logindSessionPath, LOGIN1_SESSION_IFACE, QStringLiteral("Lock"), this, SLOT(PromptLock()));
247+ QDBusConnection::SM_BUSNAME().connect(LOGIN1_SERVICE, d->logindSessionPath, LOGIN1_SESSION_IFACE, QStringLiteral("Lock"), this, SLOT(PromptLock()));
248248 // ... and our Unlocked() signal to the logind's session Unlock() signal
249249 // (lightdm handles the unlocking by calling logind's Unlock method which in turn emits this signal we connect to)
250− QDBusConnection::systemBus().connect(LOGIN1_SERVICE, d->logindSessionPath, LOGIN1_SESSION_IFACE, QStringLiteral("Unlock"), this, SIGNAL(Unlocked()));
250+ QDBusConnection::SM_BUSNAME().connect(LOGIN1_SERVICE, d->logindSessionPath, LOGIN1_SESSION_IFACE, QStringLiteral("Unlock"), this, SIGNAL(Unlocked()));
251251 connect(d, &DBusUnitySessionServicePrivate::prepareForSleep, this, &DBusUnitySessionService::PromptLock);
252252 } else {
253253 qWarning() << "Failed to connect to logind's session Lock/Unlock signals";
@@ -332,14 +332,18 @@ QString DBusUnitySessionService::HostName() const
332332
333333void DBusUnitySessionService::PromptLock()
334334{
335− // Fast lock (no animation)
335+ // Prompt as in quick. No locking animation needed. Usually used by
336+ // indicator-session in combination with a switch to greeter or other
337+ // user session.
336338 Q_EMIT LockRequested();
337339 Q_EMIT lockRequested();
338340}
339341
340342void DBusUnitySessionService::Lock()
341343{
342− // Slower lock (with animation)
344+ // Normal lock (with animation, as compared to PromptLock above). Usually
345+ // used by indicator-session to lock the session in place.
346+ //
343347 // FIXME: We also -- as a bit of a hack around indicator-session not fully
344348 // supporting a phone profile -- switch to greeter here. The unity7 flow is
345349 // that the user chooses "Lock/Switch" from the indicator, and then can go
@@ -371,7 +375,7 @@ void DBusUnitySessionService::switchToGreeter()
371375 QStringLiteral("org.freedesktop.DisplayManager.Session"),
372376 QStringLiteral("Lock"));
373377
374− QDBusPendingCall pendingCall = QDBusConnection::systemBus().asyncCall(msg);
378+ QDBusPendingCall pendingCall = QDBusConnection::SM_BUSNAME().asyncCall(msg);
375379 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall, this);
376380 connect(watcher, &QDBusPendingCallWatcher::finished,
377381 this, [this](QDBusPendingCallWatcher* watcher) {