[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kde-workspace/KDE/4.9] powerdevil/daemon: listen to the systemd-login1 session's Lock signal
From: Lukáš Tinkl <lukas () kde ! org>
Date: 2012-11-28 20:59:21
Message-ID: 20121128205921.A2BC5A6091 () git ! kde ! org
[Download RAW message or body]
Git commit ebdd6189ab808ce1415d2dc41410cc0c3c4c490b by Lukáš Tinkl.
Committed on 28/11/2012 at 21:58.
Pushed by lukas into branch 'KDE/4.9'.
listen to the systemd-login1 session's Lock signal
see http://www.freedesktop.org/wiki/Software/systemd/writing-desktop-environments
M +12 -0 powerdevil/daemon/powerdevilpolicyagent.cpp
M +1 -0 powerdevil/daemon/powerdevilpolicyagent.h
http://commits.kde.org/kde-workspace/ebdd6189ab808ce1415d2dc41410cc0c3c4c490b
diff --git a/powerdevil/daemon/powerdevilpolicyagent.cpp \
b/powerdevil/daemon/powerdevilpolicyagent.cpp index e6f2084..d688512 100644
--- a/powerdevil/daemon/powerdevilpolicyagent.cpp
+++ b/powerdevil/daemon/powerdevilpolicyagent.cpp
@@ -34,6 +34,7 @@
#include <KDebug>
#include "powerdevilpolicyagent.h"
+#include "screensaver_interface.h"
struct NamedDBusObjectPath
{
@@ -161,6 +162,15 @@ QString PolicyAgent::getNamedPathProperty(const QString &path, \
const QString &if return QString();
}
+void PolicyAgent::forceLockAndWait()
+{
+ OrgFreedesktopScreenSaverInterface \
screenSaveriface("org.freedesktop.ScreenSaver", + \
"/ScreenSaver", + \
QDBusConnection::sessionBus()); + QDBusPendingReply< void > reply = \
screenSaveriface.Lock(); + reply.waitForFinished();
+}
+
void PolicyAgent::onSessionHandlerRegistered(const QString & serviceName)
{
if (serviceName == SYSTEMD_LOGIN1_SERVICE) {
@@ -193,6 +203,8 @@ void PolicyAgent::onSessionHandlerRegistered(const QString & \
serviceName) return;
}
+ // listen to the systemd-login1 session's Lock signal
+ connect(m_sdSessionInterface.data(), SIGNAL(Lock()), this, \
SLOT(forceLockAndWait()));
// now let's obtain the seat
QString seatPath = getNamedPathProperty(sessionPath, \
SYSTEMD_LOGIN1_SESSION_IFACE, "Seat");
diff --git a/powerdevil/daemon/powerdevilpolicyagent.h \
b/powerdevil/daemon/powerdevilpolicyagent.h index f1e8c03..aa3d0cd 100644
--- a/powerdevil/daemon/powerdevilpolicyagent.h
+++ b/powerdevil/daemon/powerdevilpolicyagent.h
@@ -91,6 +91,7 @@ private Q_SLOTS:
void onSessionHandlerUnregistered(const QString & serviceName);
void onActiveSessionChanged(const QString & ifaceName, const QVariantMap & \
changedProps, const QStringList & invalidatedProps); void \
onActiveSessionChanged(const QString &activeSession); + void forceLockAndWait();
private:
explicit PolicyAgent(QObject* parent = 0);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic