@@ -64,19 +64,19 @@ public:
64 QStringLiteral("GetSessionByPID"));
64 QStringLiteral("GetSessionByPID"));
65 msg << (quint32) getpid();
65 msg << (quint32) getpid();
67− QDBusReply<QDBusObjectPath> reply = QDBusConnection::systemBus().call(msg);
67+ QDBusReply<QDBusObjectPath> reply = QDBusConnection::SM_BUSNAME().call(msg);
68 if (reply.isValid()) {
68 if (reply.isValid()) {
69 logindSessionPath = reply.value().path();
69 logindSessionPath = reply.value().path();
71 // start watching the Active property
71 // start watching the Active property
72− QDBusConnection::systemBus().connect(LOGIN1_SERVICE, logindSessionPath, QStringLiteral("org.freedesktop.DBus.Properties"), QStringLiteral("PropertiesChanged"),
72+ QDBusConnection::SM_BUSNAME().connect(LOGIN1_SERVICE, logindSessionPath, QStringLiteral("org.freedesktop.DBus.Properties"), QStringLiteral("PropertiesChanged"),
73− this, SLOT(onPropertiesChanged(QString,QVariantMap,QStringList)));
73+ this, SLOT(onPropertiesChanged(QString,QVariantMap,QStringList)));
75 setupSystemdInhibition();
75 setupSystemdInhibition();
77 // re-enable the inhibition upon resume from sleep
77 // re-enable the inhibition upon resume from sleep
78− QDBusConnection::systemBus().connect(LOGIN1_SERVICE, LOGIN1_PATH, LOGIN1_IFACE, QStringLiteral("PrepareForSleep"),
78+ QDBusConnection::SM_BUSNAME().connect(LOGIN1_SERVICE, LOGIN1_PATH, LOGIN1_IFACE, QStringLiteral("PrepareForSleep"),
79− this, SLOT(onResuming(bool)));
79+ this, SLOT(onResuming(bool)));
81 qWarning() << "Failed to get logind session path" << reply.error().message();
81 qWarning() << "Failed to get logind session path" << reply.error().message();
@@ -96,7 +96,7 @@ public:
96 msg << "Unity8 handles power events"; // why
96 msg << "Unity8 handles power events"; // why
97 msg << "block"; // mode
97 msg << "block"; // mode
99− QDBusPendingCall pendingCall = QDBusConnection::systemBus().asyncCall(msg);
99+ QDBusPendingCall pendingCall = QDBusConnection::SM_BUSNAME().asyncCall(msg);
100 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall, this);
100 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall, this);
101 connect(watcher, &QDBusPendingCallWatcher::finished,
101 connect(watcher, &QDBusPendingCallWatcher::finished,
102 this, [this](QDBusPendingCallWatcher* watcher) {
102 this, [this](QDBusPendingCallWatcher* watcher) {
@@ -114,7 +114,7 @@ public:
114 bool checkLogin1Call(const QString &method) const
114 bool checkLogin1Call(const QString &method) const
116 QDBusMessage msg = QDBusMessage::createMethodCall(LOGIN1_SERVICE, LOGIN1_PATH, LOGIN1_IFACE, method);
116 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);
118 return reply.isValid() && (reply == QStringLiteral("yes") || reply == QStringLiteral("challenge"));
118 return reply.isValid() && (reply == QStringLiteral("yes") || reply == QStringLiteral("challenge"));
@@ -125,7 +125,7 @@ public:
125 LOGIN1_IFACE,
125 LOGIN1_IFACE,
127 msg.setArguments(args);
127 msg.setArguments(args);
128− QDBusConnection::systemBus().asyncCall(msg);
128+ QDBusConnection::SM_BUSNAME().asyncCall(msg);
131 void setActive(bool active)
131 void setActive(bool active)
@@ -157,7 +157,7 @@ public:
157 msg << LOGIN1_SESSION_IFACE;
157 msg << LOGIN1_SESSION_IFACE;
158 msg << ACTIVE_KEY;
158 msg << ACTIVE_KEY;
160− QDBusPendingCall pendingCall = QDBusConnection::systemBus().asyncCall(msg);
160+ QDBusPendingCall pendingCall = QDBusConnection::SM_BUSNAME().asyncCall(msg);
161 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall, this);
161 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall, this);
162 connect(watcher, &QDBusPendingCallWatcher::finished,
162 connect(watcher, &QDBusPendingCallWatcher::finished,
163 this, [this](QDBusPendingCallWatcher* watcher) {
163 this, [this](QDBusPendingCallWatcher* watcher) {
@@ -191,7 +191,7 @@ public:
191 msg << LOGIN1_SESSION_IFACE;
191 msg << LOGIN1_SESSION_IFACE;
192 msg << IDLE_SINCE_KEY;
192 msg << IDLE_SINCE_KEY;
194− QDBusReply<QVariant> reply = QDBusConnection::systemBus().call(msg);
194+ QDBusReply<QVariant> reply = QDBusConnection::SM_BUSNAME().call(msg);
195 if (reply.isValid()) {
195 if (reply.isValid()) {
196 return reply.value().value<quint64>();
196 return reply.value().value<quint64>();
@@ -208,7 +208,7 @@ public:
208 LOGIN1_SESSION_IFACE,
208 LOGIN1_SESSION_IFACE,
209 QStringLiteral("SetIdleHint"));
209 QStringLiteral("SetIdleHint"));
210 msg << idle;
210 msg << idle;
211− QDBusConnection::systemBus().asyncCall(msg);
211+ QDBusConnection::SM_BUSNAME().asyncCall(msg);
214private Q_SLOTS:
214private Q_SLOTS:
@@ -244,10 +244,10 @@ DBusUnitySessionService::DBusUnitySessionService()
245 if (!d->logindSessionPath.isEmpty()) {
245 if (!d->logindSessionPath.isEmpty()) {
246 // connect our PromptLock() slot to the logind's session Lock() signal
246 // 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()));
248 // ... and our Unlocked() signal to the logind's session Unlock() signal
248 // ... and our Unlocked() signal to the logind's session Unlock() signal
249 // (lightdm handles the unlocking by calling logind's Unlock method which in turn emits this signal we connect to)
249 // (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()));
251 connect(d, &DBusUnitySessionServicePrivate::prepareForSleep, this, &DBusUnitySessionService::PromptLock);
251 connect(d, &DBusUnitySessionServicePrivate::prepareForSleep, this, &DBusUnitySessionService::PromptLock);
253 qWarning() << "Failed to connect to logind's session Lock/Unlock signals";
253 qWarning() << "Failed to connect to logind's session Lock/Unlock signals";
@@ -332,14 +332,18 @@ QString DBusUnitySessionService::HostName() const
333void DBusUnitySessionService::PromptLock()
333void DBusUnitySessionService::PromptLock()
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
336 Q_EMIT LockRequested();
338 Q_EMIT LockRequested();
337 Q_EMIT lockRequested();
339 Q_EMIT lockRequested();
340void DBusUnitySessionService::Lock()
342void DBusUnitySessionService::Lock()
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.
343 // FIXME: We also -- as a bit of a hack around indicator-session not fully
347 // FIXME: We also -- as a bit of a hack around indicator-session not fully
344 // supporting a phone profile -- switch to greeter here. The unity7 flow is
348 // supporting a phone profile -- switch to greeter here. The unity7 flow is
345 // that the user chooses "Lock/Switch" from the indicator, and then can go
349 // that the user chooses "Lock/Switch" from the indicator, and then can go
@@ -371,7 +375,7 @@ void DBusUnitySessionService::switchToGreeter()
371 QStringLiteral("org.freedesktop.DisplayManager.Session"),
375 QStringLiteral("org.freedesktop.DisplayManager.Session"),
372 QStringLiteral("Lock"));
376 QStringLiteral("Lock"));
374− QDBusPendingCall pendingCall = QDBusConnection::systemBus().asyncCall(msg);
378+ QDBusPendingCall pendingCall = QDBusConnection::SM_BUSNAME().asyncCall(msg);
375 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall, this);
379 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall, this);
376 connect(watcher, &QDBusPendingCallWatcher::finished,
380 connect(watcher, &QDBusPendingCallWatcher::finished,
377 this, [this](QDBusPendingCallWatcher* watcher) {
381 this, [this](QDBusPendingCallWatcher* watcher) {