@@ -227,11 +227,14 @@ private Q_SLOTS:
228 if (!active) {
228 if (!active) {
229 setupSystemdInhibition();
229 setupSystemdInhibition();
231+ Q_EMIT prepareForSleep();
233Q_SIGNALS:
235Q_SIGNALS:
234 void screensaverActiveChanged(bool active);
236 void screensaverActiveChanged(bool active);
237+ void prepareForSleep();
237Q_GLOBAL_STATIC(DBusUnitySessionServicePrivate, d)
240Q_GLOBAL_STATIC(DBusUnitySessionServicePrivate, d)
@@ -245,6 +248,7 @@ DBusUnitySessionService::DBusUnitySessionService()
245 // ... and our Unlocked() signal to the logind's session Unlock() signal
248 // ... and our Unlocked() signal to the logind's session Unlock() signal
246 // (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)
247 QDBusConnection::systemBus().connect(LOGIN1_SERVICE, d->logindSessionPath, LOGIN1_SESSION_IFACE, QStringLiteral("Unlock"), this, SIGNAL(Unlocked()));
250 QDBusConnection::systemBus().connect(LOGIN1_SERVICE, d->logindSessionPath, LOGIN1_SESSION_IFACE, QStringLiteral("Unlock"), this, SIGNAL(Unlocked()));
251+ connect(d, &DBusUnitySessionServicePrivate::prepareForSleep, this, &DBusUnitySessionService::PromptLock);
249 qWarning() << "Failed to connect to logind's session Lock/Unlock signals";
253 qWarning() << "Failed to connect to logind's session Lock/Unlock signals";
@@ -390,16 +394,19 @@ void DBusUnitySessionService::Shutdown()
391void DBusUnitySessionService::Suspend()
395void DBusUnitySessionService::Suspend()
393 d->makeLogin1Call(QStringLiteral("Suspend"), {false});
398 d->makeLogin1Call(QStringLiteral("Suspend"), {false});
396void DBusUnitySessionService::Hibernate()
401void DBusUnitySessionService::Hibernate()
398 d->makeLogin1Call(QStringLiteral("Hibernate"), {false});
404 d->makeLogin1Call(QStringLiteral("Hibernate"), {false});
401void DBusUnitySessionService::HybridSleep()
407void DBusUnitySessionService::HybridSleep()
403 d->makeLogin1Call(QStringLiteral("HybridSleep"), {false});
410 d->makeLogin1Call(QStringLiteral("HybridSleep"), {false});