diff --git a/app/qml/main.qml b/app/qml/main.qml index 9b4cf8251..441e21ed1 100644 --- a/app/qml/main.qml +++ b/app/qml/main.qml @@ -29,6 +29,7 @@ ApplicationWindow visible: true width: 400 height: 500 + title: i18n("KDE Connect") toolBar: RowLayout { Button { @@ -123,8 +124,18 @@ ApplicationWindow } ); } Button { - text: i18n("Remote touch and keyboard") - enabled: false + text: i18n("Mouse Pad") + onClicked: stack.push( { + item: "qrc:/qml/mousepad.qml", + properties: { remoteControlInterface: RemoteControlDbusInterfaceFactory.create(deviceView.currentDevice.id()) } + } ); + } + Button { + property var lockIface: LockDeviceDbusInterfaceFactory.create(deviceView.currentDevice.id()) + text: lockIface.isLocked ? i18n("Unlock") : i18n("Lock") + onClicked: { + lockIface.isLocked = !lockIface.isLocked; + } } Item { Layout.fillHeight: true } diff --git a/app/qml/mousepad.qml b/app/qml/mousepad.qml new file mode 100644 index 000000000..6586f78a6 --- /dev/null +++ b/app/qml/mousepad.qml @@ -0,0 +1,64 @@ +/* + * Copyright 2015 Aleix Pol Gonzalez + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Layouts 1.1 + +ColumnLayout +{ + id: mousepad + property QtObject remoteControlInterface + + MouseArea { + id: area + Layout.fillWidth: true + Layout.fillHeight: true + property var lastPos: Qt.point(-1, -1) + + onClicked: mousepad.remoteControlInterface.sendCommand("singleclick", true); + + onPositionChanged: { + if (lastPos.x > -1) { +// console.log("move", mouse.x, mouse.y, lastPos) + var delta = Qt.point(mouse.x-lastPos.x, mouse.y-lastPos.y); + + remoteControlInterface.moveCursor(delta); + } + lastPos = Qt.point(mouse.x, mouse.y); + } + } + RowLayout { + Layout.fillWidth: true + + Button { + Layout.fillWidth: true + onClicked: mousepad.remoteControlInterface.sendCommand("singleclick", true); + } + Button { + Layout.fillWidth: true + onClicked: mousepad.remoteControlInterface.sendCommand("middleclick", true); + } + Button { + Layout.fillWidth: true + onClicked: mousepad.remoteControlInterface.sendCommand("rightclick", true); + } + } +} diff --git a/app/qml/mpris.qml b/app/qml/mpris.qml index 17f0ac0b2..0dd66f2c0 100644 --- a/app/qml/mpris.qml +++ b/app/qml/mpris.qml @@ -20,7 +20,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.2 -import QtQuick.Layouts 1.2 +import QtQuick.Layouts 1.1 ColumnLayout { @@ -41,27 +41,27 @@ ColumnLayout Layout.fillWidth: true text: root.mprisInterface.nowPlaying } - Button { - Layout.fillWidth: true - text: root.mprisInterface.isPlaying ? "pause" : "play" - onClicked: root.mprisInterface.sendAction("PlayPause"); - } RowLayout { Layout.fillWidth: true Button { Layout.fillWidth: true - text: "<<" + iconName: "media-skip-backward" onClicked: root.mprisInterface.sendAction("Previous") } Button { Layout.fillWidth: true - text: ">>" + iconName: root.mprisInterface.isPlaying ? "media-playback-pause" : "media-playback-start" + onClicked: root.mprisInterface.sendAction("PlayPause"); + } + Button { + Layout.fillWidth: true + iconName: "media-skip-forward" onClicked: root.mprisInterface.sendAction("Next") } } RowLayout { Layout.fillWidth: true - Label { text: "x" } + Label { text: i18n("Volume:") } Slider { value: root.mprisInterface.volume maximumValue: 100 diff --git a/app/resources.qrc b/app/resources.qrc index 3731e0ac0..225f85136 100644 --- a/app/resources.qrc +++ b/app/resources.qrc @@ -3,5 +3,6 @@ qml/main.qml qml/DeviceDelegate.qml qml/mpris.qml + qml/mousepad.qml diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp index 94c49e453..cfcb70d9f 100644 --- a/cli/kdeconnect-cli.cpp +++ b/cli/kdeconnect-cli.cpp @@ -56,6 +56,7 @@ int main(int argc, char** argv) parser.addOption(QCommandLineOption("ping-msg", i18n("Same as ping but you can set the message to display"), i18n("message"))); parser.addOption(QCommandLineOption("share", i18n("Share a file to a said device"), "path")); parser.addOption(QCommandLineOption("list-notifications", i18n("Display the notifications on a said device"))); + parser.addOption(QCommandLineOption("lock", i18n("Lock the specified device"))); parser.addOption(QCommandLineOption(QStringList("device") << "d", i18n("Device ID"), "dev")); parser.addOption(QCommandLineOption("encryption-info", i18n("Get encryption info about said device"))); about.setupCommandLine(&parser); diff --git a/interfaces/CMakeLists.txt b/interfaces/CMakeLists.txt index 0220af8e5..f44b605b3 100644 --- a/interfaces/CMakeLists.txt +++ b/interfaces/CMakeLists.txt @@ -10,6 +10,7 @@ function(geninterface source_h output_h) get_filename_component(basename ${output_h} NAME_WE) qt5_add_dbus_interface(libkdeconnect_SRC ${xml_file} ${basename}) set(libkdeconnect_SRC ${libkdeconnect_SRC} PARENT_SCOPE) + set(libkdeconnect_HEADERS ${libkdeconnect_HEADERS} PARENT_SCOPE) endfunction() set(libkdeconnect_SRC @@ -32,14 +33,15 @@ set(libkdeconnect_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/kdeconnectinterfaces_export.h ) -geninterface(${CMAKE_SOURCE_DIR}/core/daemon.h daemoninterface.h) -geninterface(${CMAKE_SOURCE_DIR}/core/device.h deviceinterface.h) -geninterface(${CMAKE_SOURCE_DIR}/plugins/battery/batterydbusinterface.h devicebatteryinterface.h) -geninterface(${CMAKE_SOURCE_DIR}/plugins/sftp/sftpplugin.h devicesftpinterface.h) -geninterface(${CMAKE_SOURCE_DIR}/plugins/notifications/notificationsdbusinterface.h devicenotificationsinterface.h) -geninterface(${CMAKE_SOURCE_DIR}/plugins/notifications/notification.h notificationinterface.h) +geninterface(${CMAKE_SOURCE_DIR}/core/daemon.h daemoninterface) +geninterface(${CMAKE_SOURCE_DIR}/core/device.h deviceinterface) +geninterface(${CMAKE_SOURCE_DIR}/plugins/battery/batterydbusinterface.h devicebatteryinterface) +geninterface(${CMAKE_SOURCE_DIR}/plugins/sftp/sftpplugin.h devicesftpinterface) +geninterface(${CMAKE_SOURCE_DIR}/plugins/notifications/notificationsdbusinterface.h devicenotificationsinterface) +geninterface(${CMAKE_SOURCE_DIR}/plugins/notifications/notification.h notificationinterface) geninterface(${CMAKE_SOURCE_DIR}/plugins/mprisremote/mprisremoteplugin.h mprisremoteinterface) - +geninterface(${CMAKE_SOURCE_DIR}/plugins/remotecontrol/remotecontrolplugin.h remotecontrolinterface) +geninterface(${CMAKE_SOURCE_DIR}/plugins/lockdevice/lockdeviceplugin.h lockdeviceinterface) add_library(kdeconnectinterfaces SHARED ${libkdeconnect_SRC}) set_target_properties(kdeconnectinterfaces PROPERTIES diff --git a/interfaces/dbusinterfaces.cpp b/interfaces/dbusinterfaces.cpp index 68b4c64ae..db3ce5a80 100644 --- a/interfaces/dbusinterfaces.cpp +++ b/interfaces/dbusinterfaces.cpp @@ -113,3 +113,25 @@ MprisDbusInterface::MprisDbusInterface(const QString& id, QObject* parent) MprisDbusInterface::~MprisDbusInterface() { } + +RemoteControlDbusInterface::RemoteControlDbusInterface(const QString& id, QObject* parent) + : OrgKdeKdeconnectDeviceRemotecontrolInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/remotecontrol", QDBusConnection::sessionBus(), parent) +{ +} + +RemoteControlDbusInterface::~RemoteControlDbusInterface() +{ +} + +LockDeviceDbusInterface::LockDeviceDbusInterface(const QString& id, QObject* parent) + : OrgKdeKdeconnectDeviceLockdeviceInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/lockdevice", QDBusConnection::sessionBus(), parent) +{ + connect(this, &OrgKdeKdeconnectDeviceLockdeviceInterface::lockedChanged, this, &LockDeviceDbusInterface::lockedChangedProxy); + Q_ASSERT(isValid()); +} + +LockDeviceDbusInterface::~LockDeviceDbusInterface() +{ +} + +#include "dbusinterfaces.moc" diff --git a/interfaces/dbusinterfaces.h b/interfaces/dbusinterfaces.h index d42a28f9e..2f51599f3 100644 --- a/interfaces/dbusinterfaces.h +++ b/interfaces/dbusinterfaces.h @@ -30,6 +30,8 @@ #include "interfaces/devicenotificationsinterface.h" #include "interfaces/notificationinterface.h" #include "interfaces/mprisremoteinterface.h" +#include "interfaces/remotecontrolinterface.h" +#include "interfaces/lockdeviceinterface.h" /** * Using these "proxy" classes just in case we need to rename the @@ -124,4 +126,26 @@ Q_SIGNALS: void propertiesChangedProxy(); }; +class KDECONNECTINTERFACES_EXPORT RemoteControlDbusInterface + : public OrgKdeKdeconnectDeviceRemotecontrolInterface +{ + Q_OBJECT +public: + RemoteControlDbusInterface(const QString& deviceId, QObject* parent = 0); + ~RemoteControlDbusInterface() override; +}; + +class KDECONNECTINTERFACES_EXPORT LockDeviceDbusInterface + : public OrgKdeKdeconnectDeviceLockdeviceInterface +{ + Q_OBJECT + Q_PROPERTY(bool isLocked READ isLocked WRITE setIsLocked NOTIFY lockedChangedProxy) +public: + LockDeviceDbusInterface(const QString& deviceId, QObject* parent = 0); + virtual ~LockDeviceDbusInterface(); + +Q_SIGNALS: + void lockedChangedProxy(bool isLocked); +}; + #endif diff --git a/kcm/kcm_kdeconnect.desktop b/kcm/kcm_kdeconnect.desktop index 09d519a3b..874e3eceb 100755 --- a/kcm/kcm_kdeconnect.desktop +++ b/kcm/kcm_kdeconnect.desktop @@ -75,7 +75,7 @@ X-KDE-Keywords[nl]=Netwerk,Android,Apparaten X-KDE-Keywords[pl]=Sieć,Android,Urządzenia X-KDE-Keywords[pt]=Rede,Android,Dispositivos X-KDE-Keywords[pt_BR]=Rede,Android,Dispositivos -X-KDE-Keywords[ru]=Network,Android,Devices,сеть,Андроид, устройства +X-KDE-Keywords[ru]=Network,Android,Devices,сеть,Андроид,устройства X-KDE-Keywords[sk]=Sieť,Android,Zariadenia X-KDE-Keywords[sv]=Nätverk, Android, apparater X-KDE-Keywords[tr]=Ağ,Android,Cihazlar,Aygıtlar diff --git a/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp b/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp index 0db9e8bce..269b7ef00 100644 --- a/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp +++ b/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp @@ -49,11 +49,22 @@ QObject* createSftpInterface(QVariant deviceId) return new SftpDbusInterface(deviceId.toString()); } +QObject* createRemoteControlInterface(QVariant deviceId) +{ + return new RemoteControlDbusInterface(deviceId.toString()); +} + QObject* createMprisInterface(QVariant deviceId) { return new MprisDbusInterface(deviceId.toString()); } +QObject* createDeviceLockInterface(QVariant deviceId) +{ + Q_ASSERT(!deviceId.toString().isEmpty()); + return new LockDeviceDbusInterface(deviceId.toString()); +} + QObject* createDBusResponse() { return new DBusAsyncResponse(); @@ -67,6 +78,7 @@ void KdeConnectDeclarativePlugin::registerTypes(const char* uri) qmlRegisterType(uri, 1, 0, "ProcessRunner"); qmlRegisterType(uri, 1, 0, "DevicesSortProxyModel"); qmlRegisterUncreatableType(uri, 1, 0, "MprisDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess")); + qmlRegisterUncreatableType(uri, 1, 0, "LockDeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess")); qmlRegisterUncreatableType(uri, 1, 0, "DeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess")); } @@ -85,6 +97,12 @@ void KdeConnectDeclarativePlugin::initializeEngine(QQmlEngine* engine, const cha engine->rootContext()->setContextProperty("MprisDbusInterfaceFactory" , new ObjectFactory(engine, createMprisInterface)); + + engine->rootContext()->setContextProperty("RemoteControlDbusInterfaceFactory" + , new ObjectFactory(engine, createRemoteControlInterface)); + + engine->rootContext()->setContextProperty("LockDeviceDbusInterfaceFactory" + , new ObjectFactory(engine, createDeviceLockInterface)); engine->rootContext()->setContextProperty("DBusResponseFactory" , new ObjectFactory(engine, createDBusResponse)); diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 35aec662e..176ba174b 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -16,6 +16,8 @@ add_subdirectory(screensaver-inhibit) if(EXPERIMENTALAPP_ENABLED) add_subdirectory(mprisremote) + add_subdirectory(remotecontrol) + add_subdirectory(lockdevice) endif() #FIXME: If we split notifications in several files, they won't appear in the same group in the Notifications KCM diff --git a/plugins/battery/kdeconnect_battery.json b/plugins/battery/kdeconnect_battery.json index 98410fe1e..bb29e1813 100644 --- a/plugins/battery/kdeconnect_battery.json +++ b/plugins/battery/kdeconnect_battery.json @@ -45,6 +45,7 @@ "Name[pl]": "Monitor baterii", "Name[pt]": "Monitor da bateria", "Name[pt_BR]": "Monitor de bateria", + "Name[ru]": "Индикатор батареи", "Name[sk]": "Monitor batérie", "Name[sv]": "Batteriövervakare", "Name[tr]": "Pil izleyici", diff --git a/plugins/clipboard/kdeconnect_clipboard.json b/plugins/clipboard/kdeconnect_clipboard.json index d2bc73c68..4bb854188 100644 --- a/plugins/clipboard/kdeconnect_clipboard.json +++ b/plugins/clipboard/kdeconnect_clipboard.json @@ -45,6 +45,7 @@ "Name[pl]": "Schowek", "Name[pt]": "Área de Transferência", "Name[pt_BR]": "Área de transferência", + "Name[ru]": "Буфер обмена", "Name[sk]": "Schránka", "Name[sv]": "Klippbord", "Name[tr]": "Geçici taşıma panosu", diff --git a/plugins/lockdevice/CMakeLists.txt b/plugins/lockdevice/CMakeLists.txt new file mode 100644 index 000000000..2e7a96577 --- /dev/null +++ b/plugins/lockdevice/CMakeLists.txt @@ -0,0 +1,9 @@ +qt5_add_dbus_interface(lockdevice_SRCS org.freedesktop.ScreenSaver.xml screensaverdbusinterface) + +kdeconnect_add_plugin(kdeconnect_lockdevice JSON kdeconnect_lockdevice.json SOURCES lockdeviceplugin.cpp ${lockdevice_SRCS}) + +target_link_libraries(kdeconnect_lockdevice + kdeconnectcore + Qt5::DBus + KF5::I18n +) diff --git a/plugins/lockdevice/kdeconnect_lockdevice.json b/plugins/lockdevice/kdeconnect_lockdevice.json new file mode 100644 index 000000000..0a909ac3e --- /dev/null +++ b/plugins/lockdevice/kdeconnect_lockdevice.json @@ -0,0 +1,48 @@ +{ + "Encoding": "UTF-8", + "KPlugin": { + "Authors": [ + { + "Email": "aleixpol@kde.org", + "Name": "Aleix Pol" + } + ], + "Description": "Locks your systems", + "Description[ca]": "Bloqueja els vostres sistemes", + "Description[de]": "Sperrt Ihre Systeme", + "Description[gl]": "Bloquea os seus sistemas.", + "Description[nl]": "Vergrendeld uw systemen", + "Description[pl]": "Zablokuj swoje systemy", + "Description[pt]": "Bloqueia os seus sistemas", + "Description[pt_BR]": "Bloqueia seus sistemas", + "Description[sv]": "Låser dina system", + "Description[uk]": "Блокує вашу систему", + "Description[x-test]": "xxLocks your systemsxx", + "EnabledByDefault": true, + "Icon": "applications-miscelaneaous", + "Id": "kdeconnect_lockdevice", + "License": "GPL", + "Name": "LockDevice", + "Name[ca]": "Bloqueja el dispositiu", + "Name[de]": "Gerätesperrung", + "Name[gl]": "Bloqueo do dispositivo", + "Name[nl]": "Apparaat vergrendelen", + "Name[pl]": "ZablokujUrządzenie", + "Name[pt]": "Bloqueio de Dispositivo", + "Name[pt_BR]": "Bloqueio de dispositivo", + "Name[sv]": "Lås enhet", + "Name[uk]": "LockDevice", + "Name[x-test]": "xxLockDevicexx", + "ServiceTypes": [ + "KdeConnect/Plugin" + ], + "Version": "0.1", + "Website": "https://kde.org" + }, + "X-KdeConnect-OutgoingPackageType": [ + "kdeconnect.lock" + ], + "X-KdeConnect-SupportedPackageType": [ + "kdeconnect.lock" + ] +} \ No newline at end of file diff --git a/plugins/lockdevice/lockdeviceplugin.cpp b/plugins/lockdevice/lockdeviceplugin.cpp new file mode 100644 index 000000000..a24b66b9f --- /dev/null +++ b/plugins/lockdevice/lockdeviceplugin.cpp @@ -0,0 +1,108 @@ +/** + * Copyright 2015 Aleix Pol Gonzalez + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "lockdeviceplugin.h" + +#include +#include + +#include +#include +#include +#include "screensaverdbusinterface.h" + +#include + +K_PLUGIN_FACTORY_WITH_JSON( KdeConnectLockPluginFactory, "kdeconnect_lockdevice.json", registerPlugin(); ) + +Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_LOCKREMOTE, "kdeconnect.plugin.lock") + +LockDevicePlugin::LockDevicePlugin(QObject* parent, const QVariantList& args) + : KdeConnectPlugin(parent, args) + , m_remoteLocked(false) + , m_iface(nullptr) +{ +} + +LockDevicePlugin::~LockDevicePlugin() +{ + delete m_iface; +} + +bool LockDevicePlugin::isLocked() const +{ + return m_remoteLocked; +} +void LockDevicePlugin::setLocked(bool locked) +{ + NetworkPackage np(PACKAGE_TYPE_LOCK); + np.set("setLocked", locked); + sendPackage(np); +} + +bool LockDevicePlugin::receivePackage(const NetworkPackage & np) +{ + if (np.has("isLocked")) { + bool locked = np.get("isLocked"); + if (m_remoteLocked != locked) { + m_remoteLocked = locked; + Q_EMIT lockedChanged(locked); + } + } + + bool sendState = np.has("requestLocked"); + if (np.has("setLocked")) { + iface()->SetActive(np.get("setLocked")); + sendState = true; + } + if (sendState) { + NetworkPackage np(PACKAGE_TYPE_LOCK); + np.set("isLocked", iface()->GetActive()); + sendPackage(np); + } + + return true; +} + +OrgFreedesktopScreenSaverInterface* LockDevicePlugin::iface() +{ + if (!m_iface) { + m_iface = new OrgFreedesktopScreenSaverInterface("org.freedesktop.ScreenSaver", "/org/freedesktop/ScreenSaver", QDBusConnection::sessionBus()); + if(!m_iface->isValid()) + qCWarning(KDECONNECT_PLUGIN_LOCKREMOTE) << "Couldn't connect to the ScreenSaver interface"; + } + return m_iface; +} + +void LockDevicePlugin::connected() +{ + QDBusConnection::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportAllContents); + + NetworkPackage np(PACKAGE_TYPE_LOCK); + np.set("requestLocked", QVariant()); + sendPackage(np); +} + +QString LockDevicePlugin::dbusPath() const +{ + return "/modules/kdeconnect/devices/" + device()->id() + "/lockdevice"; +} + +#include "lockdeviceplugin.moc" diff --git a/plugins/lockdevice/lockdeviceplugin.h b/plugins/lockdevice/lockdeviceplugin.h new file mode 100644 index 000000000..834ae3a13 --- /dev/null +++ b/plugins/lockdevice/lockdeviceplugin.h @@ -0,0 +1,61 @@ +/** + * Copyright 2015 Aleix Pol Gonzalez + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef LOCKDEVICEPLUGIN_H +#define LOCKDEVICEPLUGIN_H + +#include + +#include + +class OrgFreedesktopScreenSaverInterface; + +#define PACKAGE_TYPE_LOCK QLatin1String("kdeconnect.lock") + +class Q_DECL_EXPORT LockDevicePlugin + : public KdeConnectPlugin +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.lockdevice") + Q_PROPERTY(bool isLocked READ isLocked WRITE setLocked NOTIFY lockedChanged) + +public: + explicit LockDevicePlugin(QObject *parent, const QVariantList &args); + virtual ~LockDevicePlugin(); + + bool isLocked() const; + void setLocked(bool b); + + void connected() override; + bool receivePackage(const NetworkPackage & np) override; + +Q_SIGNALS: + void lockedChanged(bool locked); + +private: + QString dbusPath() const; + bool m_remoteLocked; + + OrgFreedesktopScreenSaverInterface* iface(); + + OrgFreedesktopScreenSaverInterface* m_iface; +}; + +#endif diff --git a/plugins/lockdevice/org.freedesktop.ScreenSaver.xml b/plugins/lockdevice/org.freedesktop.ScreenSaver.xml new file mode 100644 index 000000000..5efd9433c --- /dev/null +++ b/plugins/lockdevice/org.freedesktop.ScreenSaver.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/mousepad/CMakeLists.txt b/plugins/mousepad/CMakeLists.txt index ecfdbb7b2..85798afbe 100644 --- a/plugins/mousepad/CMakeLists.txt +++ b/plugins/mousepad/CMakeLists.txt @@ -6,7 +6,7 @@ find_package(XTest REQUIRED) find_package(X11 REQUIRED) find_package(LibFakeKey REQUIRED) find_package(Qt5X11Extras REQUIRED) -find_package(KF5Wayland) +find_package(KF5Wayland 5.3.90) set(HAVE_WAYLAND ${KF5Wayland_FOUND}) configure_file(config-mousepad.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-mousepad.h ) diff --git a/plugins/mousepad/kdeconnect_mousepad.json b/plugins/mousepad/kdeconnect_mousepad.json index 77852b7db..eb4ea9fec 100644 --- a/plugins/mousepad/kdeconnect_mousepad.json +++ b/plugins/mousepad/kdeconnect_mousepad.json @@ -56,9 +56,7 @@ ], "Version": "0.1" }, - "X-KdeConnect-OutgoingPackageType": [ - "kdeconnect.mousepad" - ], + "X-KdeConnect-OutgoingPackageType": [], "X-KdeConnect-SupportedPackageType": [ "kdeconnect.mousepad" ] diff --git a/plugins/notifications/kdeconnect_notifications.json b/plugins/notifications/kdeconnect_notifications.json index f36afadb1..cdf9dfead 100644 --- a/plugins/notifications/kdeconnect_notifications.json +++ b/plugins/notifications/kdeconnect_notifications.json @@ -42,6 +42,7 @@ "Name[pl]": "Powiadomienia synchronizacji", "Name[pt]": "Sincronização de notificações", "Name[pt_BR]": "Sincronização de notificações", + "Name[ru]": "Синхронизация уведомлений", "Name[sk]": "Synchronizácia pripomienok", "Name[sv]": "Underrättelsesynkronisering", "Name[tr]": "Bildirim eşitleme", diff --git a/plugins/remotecontrol/CMakeLists.txt b/plugins/remotecontrol/CMakeLists.txt new file mode 100644 index 000000000..c33d932d3 --- /dev/null +++ b/plugins/remotecontrol/CMakeLists.txt @@ -0,0 +1,7 @@ +kdeconnect_add_plugin(kdeconnect_remotecontrol JSON kdeconnect_remotecontrol.json SOURCES remotecontrolplugin.cpp) + +target_link_libraries(kdeconnect_remotecontrol + kdeconnectcore + Qt5::DBus + KF5::I18n +) diff --git a/plugins/remotecontrol/kdeconnect_remotecontrol.json b/plugins/remotecontrol/kdeconnect_remotecontrol.json new file mode 100644 index 000000000..4600a86b9 --- /dev/null +++ b/plugins/remotecontrol/kdeconnect_remotecontrol.json @@ -0,0 +1,44 @@ +{ + "Encoding": "UTF-8", + "KPlugin": { + "Authors": [ + { + "Email": "aleixpol@kde.org", + "Name": "Aleix Pol" + } + ], + "Description": "Control Remote systems", + "Description[ca]": "Sistemes de control remot", + "Description[gl]": "Controla sistemas remotos.", + "Description[nl]": "Systemen op afstand bedienen", + "Description[pl]": "Sterowanie zdalnymi systemami", + "Description[pt]": "Comandar sistemas à distância", + "Description[pt_BR]": "Controle remoto de sistemas", + "Description[sv]": "Styr fjärrsystem", + "Description[uk]": "Системи віддаленого керування", + "Description[x-test]": "xxControl Remote systemsxx", + "EnabledByDefault": true, + "Icon": "applications-multimedia", + "Id": "kdeconnect_remotecontrol", + "License": "GPL", + "Name": "RemoteControl", + "Name[ca]": "Control remot", + "Name[gl]": "Mando a distancia", + "Name[nl]": "Afstandsbediening", + "Name[pl]": "ZdalneSterowanie", + "Name[pt]": "Comando à Distância", + "Name[pt_BR]": "Controle remoto", + "Name[sv]": "Fjärrkontroll", + "Name[uk]": "RemoteControl", + "Name[x-test]": "xxRemoteControlxx", + "ServiceTypes": [ + "KdeConnect/Plugin" + ], + "Version": "0.1", + "Website": "https://kde.org" + }, + "X-KdeConnect-OutgoingPackageType": [ + "kdeconnect.mousepad" + ], + "X-KdeConnect-SupportedPackageType": [] +} \ No newline at end of file diff --git a/plugins/remotecontrol/remotecontrolplugin.cpp b/plugins/remotecontrol/remotecontrolplugin.cpp new file mode 100644 index 000000000..935f3b93b --- /dev/null +++ b/plugins/remotecontrol/remotecontrolplugin.cpp @@ -0,0 +1,70 @@ +/** + * Copyright 2013 Albert Vaca + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "remotecontrolplugin.h" + +#include +#include + +#include +#include +#include +#include + +#include + +K_PLUGIN_FACTORY_WITH_JSON( KdeConnectPluginFactory, "kdeconnect_remotecontrol.json", registerPlugin< RemoteControlPlugin >(); ) + +Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_REMOTECONTROL, "kdeconnect.plugin.remotecontrol") + +RemoteControlPlugin::RemoteControlPlugin(QObject *parent, const QVariantList &args) + : KdeConnectPlugin(parent, args) +{ +} + +RemoteControlPlugin::~RemoteControlPlugin() +{} + +void RemoteControlPlugin::moveCursor(const QPoint &p) +{ + NetworkPackage np(PACKAGE_TYPE_MOUSEPAD); + np.set("dx", p.x()); + np.set("dy", p.y()); + sendPackage(np); +} + +void RemoteControlPlugin::sendCommand(const QString &name, bool val) +{ + NetworkPackage np(PACKAGE_TYPE_MOUSEPAD); + np.set(name, val); + sendPackage(np); +} + +void RemoteControlPlugin::connected() +{ + QDBusConnection::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportAllContents); +} + +QString RemoteControlPlugin::dbusPath() const +{ + return "/modules/kdeconnect/devices/" + device()->id() + "/remotecontrol"; +} + +#include "remotecontrolplugin.moc" diff --git a/plugins/remotecontrol/remotecontrolplugin.h b/plugins/remotecontrol/remotecontrolplugin.h new file mode 100644 index 000000000..0c2fbc967 --- /dev/null +++ b/plugins/remotecontrol/remotecontrolplugin.h @@ -0,0 +1,50 @@ +/** + * Copyright 2013 Albert Vaca + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef MPRISREMOTEPLUGIN_H +#define MPRISREMOTEPLUGIN_H + +#include + +#include + +#define PACKAGE_TYPE_MOUSEPAD QLatin1String("kdeconnect.mousepad") + +class Q_DECL_EXPORT RemoteControlPlugin + : public KdeConnectPlugin +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.remotecontrol") + +public: + explicit RemoteControlPlugin(QObject *parent, const QVariantList &args); + ~RemoteControlPlugin() override; + + bool receivePackage(const NetworkPackage& /*np*/) override { return false; } + void connected() override; + + Q_INVOKABLE void moveCursor(const QPoint &p); + Q_INVOKABLE void sendCommand(const QString &name, bool val); + +private: + QString dbusPath() const; +}; + +#endif