2015-07-22 02:37:34 +01:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2015 Aleix Pol Gonzalez <aleixpol@kde.org>
|
2015-07-22 02:37:34 +01:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2015-07-22 02:37:34 +01:00
|
|
|
*/
|
|
|
|
|
2023-07-21 19:22:59 +01:00
|
|
|
#pragma once
|
2015-07-22 02:37:34 +01:00
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
#include <core/kdeconnectplugin.h>
|
|
|
|
|
2023-07-24 13:18:47 +01:00
|
|
|
#include "generated/systeminterfaces/dbusproperties.h"
|
|
|
|
#include "generated/systeminterfaces/login1.h"
|
2015-07-22 02:37:34 +01:00
|
|
|
|
2018-03-04 19:48:51 +00:00
|
|
|
#define PACKET_TYPE_LOCK QStringLiteral("kdeconnect.lock")
|
|
|
|
#define PACKET_TYPE_LOCK_REQUEST QStringLiteral("kdeconnect.lock.request")
|
2015-07-22 02:37:34 +01:00
|
|
|
|
2023-07-22 10:37:35 +01:00
|
|
|
class LockDevicePlugin : public KdeConnectPlugin
|
2015-07-22 02:37:34 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.lockdevice")
|
|
|
|
Q_PROPERTY(bool isLocked READ isLocked WRITE setLocked NOTIFY lockedChanged)
|
|
|
|
|
|
|
|
public:
|
2022-09-10 22:23:52 +01:00
|
|
|
explicit LockDevicePlugin(QObject *parent, const QVariantList &args);
|
2015-07-22 02:37:34 +01:00
|
|
|
|
|
|
|
bool isLocked() const;
|
2020-11-14 01:08:04 +00:00
|
|
|
Q_SCRIPTABLE void setLocked(bool);
|
2015-07-22 02:37:34 +01:00
|
|
|
|
2016-12-30 15:38:12 +00:00
|
|
|
QString dbusPath() const override;
|
2015-07-22 02:37:34 +01:00
|
|
|
void connected() override;
|
2022-09-10 22:23:52 +01:00
|
|
|
bool receivePacket(const NetworkPacket &np) override;
|
2015-07-22 02:37:34 +01:00
|
|
|
|
|
|
|
Q_SIGNALS:
|
2020-08-19 23:47:29 +01:00
|
|
|
Q_SCRIPTABLE void lockedChanged(bool locked);
|
2015-07-22 02:37:34 +01:00
|
|
|
|
|
|
|
private:
|
2020-08-19 23:47:29 +01:00
|
|
|
void sendState();
|
|
|
|
|
|
|
|
bool m_remoteLocked;
|
|
|
|
bool m_localLocked = false;
|
2015-07-22 02:37:34 +01:00
|
|
|
|
2020-08-19 23:47:29 +01:00
|
|
|
OrgFreedesktopLogin1SessionInterface m_login1Interface;
|
|
|
|
OrgFreedesktopDBusPropertiesInterface m_propertiesInterface;
|
2015-07-22 02:37:34 +01:00
|
|
|
};
|