Commit c21f63a1 authored by Nicolas Fella's avatar Nicolas Fella

Add lock inhibition for Plasma

parent 454cb84c
......@@ -63,6 +63,7 @@ else()
solidlockbackend.cpp
)
qt5_add_dbus_interface(itinerary_app_srcs org.kde.Solid.PowerManagement.Actions.BrightnessControl.xml brightnesscontroldbusinterface)
qt5_add_dbus_interface(itinerary_app_srcs org.freedesktop.ScreenSaver.xml screensaverdbusinterface)
endif()
add_executable(itinerary-app ${itinerary_app_srcs})
......
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.freedesktop.ScreenSaver">
<signal name="ActiveChanged">
<arg type="b"/>
</signal>
<method name="Lock"/>
<method name="SimulateUserActivity"/>
<method name="GetActive">
<arg direction="out" type="b"/>
</method>
<method name="GetActiveTime">
<arg direction="out" type="u" name="seconds"/>
</method>
<method name="GetSessionIdleTime">
<arg direction="out" type="u" name="seconds"/>
</method>
<method name="SetActive">
<arg direction="out" type="b"/>
<arg direction="in" type="b" name="e"/>
</method>
<method name="Inhibit">
<arg direction="in" type="s" name="application_name"/>
<arg direction="in" type="s" name="reason_for_inhibit"/>
<arg direction="out" type="u" name="cookie"/>
</method>
<method name="UnInhibit">
<arg direction="in" type="u" name="cookie"/>
</method>
<method name="Throttle">
<arg direction="in" type="s" name="application_name"/>
<arg direction="in" type="s" name="reason_for_inhibit"/>
<arg direction="out" type="u" name="cookie"/>
</method>
<method name="UnThrottle">
<arg direction="in" type="u" name="cookie"/>
</method>
</interface>
<interface name="org.kde.screensaver">
<method name="SwitchUser"/>
<method name="configure"/>
</interface>
<interface name="org.freedesktop.DBus.Properties">
<method name="Get">
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg name="value" type="v" direction="out"/>
</method>
<method name="Set">
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method>
<method name="GetAll">
<arg name="interface_name" type="s" direction="in"/>
<arg name="values" type="a{sv}" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
</method>
<signal name="PropertiesChanged">
<arg name="interface_name" type="s" direction="out"/>
<arg name="changed_properties" type="a{sv}" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/>
<arg name="invalidated_properties" type="as" direction="out"/>
</signal>
</interface>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg name="xml_data" type="s" direction="out"/>
</method>
</interface>
<interface name="org.freedesktop.DBus.Peer">
<method name="Ping"/>
<method name="GetMachineId">
<arg name="machine_uuid" type="s" direction="out"/>
</method>
</interface>
</node>
......@@ -17,25 +17,26 @@
#include "solidlockbackend.h"
#include "screensaverdbusinterface.h"
#include <KLocalizedString>
#include <QDBusConnection>
#include <QDebug>
SolidLockBackend::SolidLockBackend(QObject *parent)
: LockBackend(parent)
, m_cookie(0)
{
}
SolidLockBackend::~SolidLockBackend()
{
m_iface = new OrgFreedesktopScreenSaverInterface(QStringLiteral("org.freedesktop.ScreenSaver"), QStringLiteral("/org/freedesktop/ScreenSaver"), QDBusConnection::sessionBus(), this);
}
void SolidLockBackend::setInhibitionOff()
{
qDebug() << "Off";
m_iface->UnInhibit(m_cookie);
}
void SolidLockBackend::setInhibitionOn()
{
qDebug() << "ON";
m_cookie = m_iface->Inhibit(QStringLiteral("org.kde.itinerary"), i18n("In barcode scanning mode"));
}
......@@ -21,15 +21,20 @@
#include <QObject>
#include "lockmanager.h"
class OrgFreedesktopScreenSaverInterface;
class SolidLockBackend : public LockBackend
{
public:
explicit SolidLockBackend(QObject *parent = nullptr);
~SolidLockBackend() override;
void setInhibitionOff() override;
void setInhibitionOn() override;
private:
OrgFreedesktopScreenSaverInterface* m_iface;
int m_cookie;
};
#endif // SOLIDLOCKBACKEND_H
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment