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/c9ac533df0c76d2a8743ae86e19e44643bee31= 59 diff --git a/powerdevil/daemon/powerdevilpolicyagent.cpp b/powerdevil/daemo= n/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 #include #include @@ -32,10 +29,13 @@ #include #include #include +#include = #include #include = +#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 QSt= ring & 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 desc =3D managerIface.a= syncCallWithArgumentList("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 =3D=3D CONSOLEKIT_SERVICE) { m_ckAvailable =3D true;