[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde-workspace] powerdevil/daemon: systemd inhibit support for PowerDevil
From:       Lukas Tinkl <lukas () kde ! org>
Date:       2012-09-26 13:25:10
Message-ID: 20120926132510.2B913A6322 () git ! kde ! org
[Download RAW message or body]

Git commit c9ac533df0c76d2a8743ae86e19e44643bee3159 by Lukas Tinkl.
Committed on 26/09/2012 at 15:10.
Pushed by lukas into branch 'master'.

systemd inhibit support for PowerDevil

REVIEW: 106533

M  +17   -4    powerdevil/daemon/powerdevilpolicyagent.cpp

http://commits.kde.org/kde-workspace/c9ac533df0c76d2a8743ae86e19e44643bee3159

diff --git a/powerdevil/daemon/powerdevilpolicyagent.cpp \
b/powerdevil/daemon/powerdevilpolicyagent.cpp index 2196ea4..efc3476 100644
--- a/powerdevil/daemon/powerdevilpolicyagent.cpp
+++ b/powerdevil/daemon/powerdevilpolicyagent.cpp
@@ -18,9 +18,6 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
  ***************************************************************************/
 
-
-#include "powerdevilpolicyagent.h"
-
 #include <QtCore/QCoreApplication>
 #include <QtDBus/QDBusObjectPath>
 #include <QtDBus/QDBusArgument>
@@ -32,10 +29,13 @@
 #include <QtDBus/QDBusPendingReply>
 #include <QtDBus/QDBusConnectionInterface>
 #include <QtDBus/QDBusServiceWatcher>
+#include <QtDBus/QDBusUnixFileDescriptor>
 
 #include <KGlobal>
 #include <KDebug>
 
+#include "powerdevilpolicyagent.h"
+
 struct NamedDBusObjectPath
 {
     QString name;
@@ -102,7 +102,6 @@ PolicyAgent::PolicyAgent(QObject* parent)
 
 PolicyAgent::~PolicyAgent()
 {
-
 }
 
 void PolicyAgent::init()
@@ -225,6 +224,20 @@ void PolicyAgent::onSessionHandlerRegistered(const QString & \
serviceName)  
         onActiveSessionChanged(m_activeSessionPath);
 
+        // inhibit systemd handling of power/sleep/lid buttons
+        QVariantList args;
+        args << "handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch"; \
// what +        args << "PowerDevil"; // who
+        args << "KDE handles power events"; // why
+        args << "block"; // mode
+        QDBusPendingReply<QDBusUnixFileDescriptor> desc = \
managerIface.asyncCallWithArgumentList("Inhibit", args); +        \
desc.waitForFinished(); +        if (desc.isValid() && desc.value().isValid()) {
+            kDebug() << "systemd powersave events handling inhibited";
+        }
+        else
+            kWarning() << "failed to inhibit systemd powersave handling";
+
         kDebug() << "systemd support initialized";
     } else if (serviceName == CONSOLEKIT_SERVICE) {
         m_ckAvailable = true;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic