[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498

Maximiliano Curia maxy at moszumanska.debian.org
Fri Oct 14 14:29:05 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=9985a59

The following commit has been merged in the master branch:
commit 9985a596080470c5fd9121970502768da6aa72a6
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Fri Sep 11 17:51:50 2015 +0200

    Find my phone plugin
    
    Add a plugin that sends a package to ring an alarm on a phone
    
    Also adjusts plasmoid to have a button to invoke this.
---
 cli/kdeconnect-cli.cpp                             |  4 ++
 interfaces/CMakeLists.txt                          |  2 +
 interfaces/dbusinterfaces.cpp                      | 11 +++++
 interfaces/dbusinterfaces.h                        | 11 +++++
 .../kdeconnectdeclarativeplugin.cpp                |  9 ++++
 plasmoid/package/contents/ui/DeviceDelegate.qml    | 28 ++++++++++--
 plugins/CMakeLists.txt                             |  2 +
 plugins/findmyphone/CMakeLists.txt                 |  9 ++++
 .../findmyphoneplugin.cpp}                         | 50 +++++++++-------------
 .../findmyphoneplugin.h}                           | 21 +++++----
 plugins/findmyphone/kdeconnect_findmyphone.json    | 29 +++++++++++++
 11 files changed, 133 insertions(+), 43 deletions(-)

diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp
index f8f6fec..e869ff4 100644
--- a/cli/kdeconnect-cli.cpp
+++ b/cli/kdeconnect-cli.cpp
@@ -51,6 +51,7 @@ int main(int argc, char** argv)
     parser.addOption(QCommandLineOption("id-only", i18n("Make --list-devices or --list-available print only the devices id, to ease scripting")));
     parser.addOption(QCommandLineOption("refresh", i18n("Search for devices in the network and re-establish connections")));
     parser.addOption(QCommandLineOption("pair", i18n("Request pairing to a said device")));
+    parser.addOption(QCommandLineOption("ring", i18n("Find the said device by ringing it.")));
     parser.addOption(QCommandLineOption("unpair", i18n("Stop pairing to a said device")));
     parser.addOption(QCommandLineOption("ping", i18n("Sends a ping to said device")));
     parser.addOption(QCommandLineOption("ping-msg", i18n("Same as ping but you can set the message to display"), i18n("message")));
@@ -144,6 +145,9 @@ int main(int argc, char** argv)
                 msg.setArguments(QVariantList() << message);
             }
             QDBusConnection::sessionBus().call(msg);
+        } else if(parser.isSet("ring")) {
+            QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kdeconnect", "/modules/kdeconnect/devices/"+device+"/findmyphone", "org.kde.kdeconnect.device.findmyphone", "ring");
+            QDBusConnection::sessionBus().call(msg);
         } else if(parser.isSet("list-notifications")) {
             NotificationsModel notifications;
             notifications.setDeviceId(device);
diff --git a/interfaces/CMakeLists.txt b/interfaces/CMakeLists.txt
index f44b605..2fa6c8b 100644
--- a/interfaces/CMakeLists.txt
+++ b/interfaces/CMakeLists.txt
@@ -38,11 +38,13 @@ 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/findmyphone/findmyphoneplugin.h devicefindmyphoneinterface)
 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
     VERSION ${KDECONNECT_VERSION}
diff --git a/interfaces/dbusinterfaces.cpp b/interfaces/dbusinterfaces.cpp
index 9629c85..d0883f8 100644
--- a/interfaces/dbusinterfaces.cpp
+++ b/interfaces/dbusinterfaces.cpp
@@ -137,4 +137,15 @@ LockDeviceDbusInterface::~LockDeviceDbusInterface()
 {
 }
 
+FindMyPhoneDeviceDbusInterface::FindMyPhoneDeviceDbusInterface(const QString& deviceId, QObject* parent):
+    OrgKdeKdeconnectDeviceFindmyphoneInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + deviceId + "/findmyphone", QDBusConnection::sessionBus(), parent)
+{
+}
+
+FindMyPhoneDeviceDbusInterface::~FindMyPhoneDeviceDbusInterface()
+{
+}
+
+
+
 #include "dbusinterfaces.moc"
diff --git a/interfaces/dbusinterfaces.h b/interfaces/dbusinterfaces.h
index b85a313..88a494d 100644
--- a/interfaces/dbusinterfaces.h
+++ b/interfaces/dbusinterfaces.h
@@ -27,6 +27,7 @@
 #include "interfaces/deviceinterface.h"
 #include "interfaces/devicebatteryinterface.h"
 #include "interfaces/devicesftpinterface.h"
+#include "interfaces/devicefindmyphoneinterface.h"
 #include "interfaces/devicenotificationsinterface.h"
 #include "interfaces/notificationinterface.h"
 #include "interfaces/mprisremoteinterface.h"
@@ -97,6 +98,7 @@ public:
     virtual ~NotificationDbusInterface();
 };
 
+
 class KDECONNECTINTERFACES_EXPORT SftpDbusInterface
     : public OrgKdeKdeconnectDeviceSftpInterface
 {
@@ -148,4 +150,13 @@ Q_SIGNALS:
     void lockedChangedProxy(bool isLocked);
 };
 
+class KDECONNECTINTERFACES_EXPORT FindMyPhoneDeviceDbusInterface
+    : public OrgKdeKdeconnectDeviceFindmyphoneInterface
+{
+    Q_OBJECT
+public:
+    explicit FindMyPhoneDeviceDbusInterface(const QString& deviceId, QObject* parent = nullptr);
+    virtual ~FindMyPhoneDeviceDbusInterface();
+};
+
 #endif
diff --git a/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp b/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp
index 269b7ef..d64239f 100644
--- a/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp
+++ b/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp
@@ -44,6 +44,11 @@ QObject* createDeviceBatteryDbusInterface(QVariant deviceId)
     return new DeviceBatteryDbusInterface(deviceId.toString());
 }
 
+QObject* createFindMyPhoneInterface(QVariant deviceId)
+{
+    return new FindMyPhoneDeviceDbusInterface(deviceId.toString());
+}
+
 QObject* createSftpInterface(QVariant deviceId)
 {
     return new SftpDbusInterface(deviceId.toString());
@@ -79,6 +84,7 @@ void KdeConnectDeclarativePlugin::registerTypes(const char* uri)
     qmlRegisterType<DevicesSortProxyModel>(uri, 1, 0, "DevicesSortProxyModel");
     qmlRegisterUncreatableType<MprisDbusInterface>(uri, 1, 0, "MprisDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess"));
     qmlRegisterUncreatableType<LockDeviceDbusInterface>(uri, 1, 0, "LockDeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess"));
+    qmlRegisterUncreatableType<FindMyPhoneDeviceDbusInterface>(uri, 1, 0, "FindMyPhoneDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess"));
     qmlRegisterUncreatableType<DeviceDbusInterface>(uri, 1, 0, "DeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess"));
 }
 
@@ -92,6 +98,9 @@ void KdeConnectDeclarativePlugin::initializeEngine(QQmlEngine* engine, const cha
     engine->rootContext()->setContextProperty("DeviceBatteryDbusInterfaceFactory"
       , new ObjectFactory(engine, createDeviceBatteryDbusInterface));
     
+    engine->rootContext()->setContextProperty("FindMyPhoneDbusInterfaceFactory"
+      , new ObjectFactory(engine, createFindMyPhoneInterface));
+
     engine->rootContext()->setContextProperty("SftpDbusInterfaceFactory"
       , new ObjectFactory(engine, createSftpInterface));
 
diff --git a/plasmoid/package/contents/ui/DeviceDelegate.qml b/plasmoid/package/contents/ui/DeviceDelegate.qml
index d774f66..bcc4fbc 100644
--- a/plasmoid/package/contents/ui/DeviceDelegate.qml
+++ b/plasmoid/package/contents/ui/DeviceDelegate.qml
@@ -19,6 +19,7 @@
  */
 
 import QtQuick 2.1
+import QtQuick.Layouts 1.2
 import org.kde.plasma.core 2.0 as PlasmaCore
 import org.kde.plasma.components 2.0 as PlasmaComponents
 import org.kde.kdeconnect 1.0
@@ -33,12 +34,34 @@ PlasmaComponents.ListItem
     Column {
         width: parent.width
         
-        Row
+        RowLayout
         {
+            Item {
+                //spacer to make the label centre aligned in a row yet still elide and everything
+                implicitWidth: ring.width + browse.width + parent.spacing
+            }
+
             PlasmaComponents.Label {
-                width: browse.visible? parent.width - browse.width : parent.width
                 horizontalAlignment: Text.AlignHCenter
+                elide: Text.ElideRight
                 text: display
+                Layout.fillWidth: true
+            }
+
+           PlasmaComponents.Button
+            {
+                FindMyPhone {
+                    id: findmyphone
+                    deviceId: root.deviceId
+                }
+
+                id: ring
+                iconSource: "preferences-desktop-notification"
+                visible: findmyphone.available
+
+                onClicked: {
+                    findmyphone.ring()
+                }
             }
 
             PlasmaComponents.Button
@@ -57,7 +80,6 @@ PlasmaComponents.ListItem
                 }
             }
 
-
             height: browse.height
             width: parent.width
         }
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index f81d982..2fb4014 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -16,6 +16,8 @@ if(NOT WIN32)
     add_subdirectory(sftp)
 endif()
 
+add_subdirectory(findmyphone)
+
 if(EXPERIMENTALAPP_ENABLED)
     add_subdirectory(mprisremote)
     add_subdirectory(remotecontrol)
diff --git a/plugins/findmyphone/CMakeLists.txt b/plugins/findmyphone/CMakeLists.txt
new file mode 100644
index 0000000..80b3f71
--- /dev/null
+++ b/plugins/findmyphone/CMakeLists.txt
@@ -0,0 +1,9 @@
+set(kdeconnect_findmyphone_SRCS
+    findmyphoneplugin.cpp
+)
+
+kdeconnect_add_plugin(kdeconnect_findmyphone JSON kdeconnect_findmyphone.json SOURCES ${kdeconnect_findmyphone_SRCS})
+
+target_link_libraries(kdeconnect_findmyphone kdeconnectcore kdeconnectcore Qt5::Core Qt5::DBus)
+
+
diff --git a/plugins/remotecontrol/remotecontrolplugin.cpp b/plugins/findmyphone/findmyphoneplugin.cpp
similarity index 53%
copy from plugins/remotecontrol/remotecontrolplugin.cpp
copy to plugins/findmyphone/findmyphoneplugin.cpp
index 02469f8..0ee2332 100644
--- a/plugins/remotecontrol/remotecontrolplugin.cpp
+++ b/plugins/findmyphone/findmyphoneplugin.cpp
@@ -1,5 +1,6 @@
 /**
- * Copyright 2015 Aleix Pol Gonzalez <aleixpol at kde.org>
+ * Copyright 2014 Apoorv Parle <apparle at gmail.com>
+ * Copyright 2015 David Edmundson <davidedmundson at kde.org>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -18,53 +19,44 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "remotecontrolplugin.h"
-
-#include <KLocalizedString>
-#include <KPluginFactory>
-
-#include <QDebug>
-#include <QDBusConnection>
-#include <QPoint>
-#include <QLoggingCategory>
+#include "findmyphoneplugin.h"
 
 #include <core/device.h>
+#include <QDBusConnection>
+#include <QDebug>
 
-K_PLUGIN_FACTORY_WITH_JSON( KdeConnectPluginFactory, "kdeconnect_remotecontrol.json", registerPlugin< RemoteControlPlugin >(); )
+#include <KPluginFactory>
 
-Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_REMOTECONTROL, "kdeconnect.plugin.remotecontrol")
+K_PLUGIN_FACTORY_WITH_JSON( KdeConnectPluginFactory, "kdeconnect_findmyphone.json", registerPlugin< FindMyPhonePlugin >(); )
 
-RemoteControlPlugin::RemoteControlPlugin(QObject *parent, const QVariantList &args)
-    : KdeConnectPlugin(parent, args)
+FindMyPhonePlugin::FindMyPhonePlugin(QObject* parent, const QVariantList& args) : KdeConnectPlugin(parent, args)
 {
 }
 
-RemoteControlPlugin::~RemoteControlPlugin()
-{}
+FindMyPhonePlugin::~FindMyPhonePlugin()
+{
+}
 
-void RemoteControlPlugin::moveCursor(const QPoint &p)
+bool FindMyPhonePlugin::receivePackage(const NetworkPackage& np)
 {
-    NetworkPackage np(PACKAGE_TYPE_MOUSEPAD);
-    np.set("dx", p.x());
-    np.set("dy", p.y());
-    sendPackage(np);
+    return false;
 }
 
-void RemoteControlPlugin::sendCommand(const QString &name, bool val)
+void FindMyPhonePlugin::ring()
 {
-    NetworkPackage np(PACKAGE_TYPE_MOUSEPAD);
-    np.set(name, val);
-    sendPackage(np);
+    NetworkPackage np(PACKAGE_TYPE_FINDMYPHONE);
+    bool success = sendPackage(np);
 }
 
-void RemoteControlPlugin::connected()
+void FindMyPhonePlugin::connected()
 {
     QDBusConnection::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportAllContents);
 }
 
-QString RemoteControlPlugin::dbusPath() const
+QString FindMyPhonePlugin::dbusPath() const
 {
-    return "/modules/kdeconnect/devices/" + device()->id() + "/remotecontrol";
+    return "/modules/kdeconnect/devices/" + device()->id() + "/findmyphone";
 }
 
-#include "remotecontrolplugin.moc"
+#include "findmyphoneplugin.moc"
+
diff --git a/plugins/ping/pingplugin.h b/plugins/findmyphone/findmyphoneplugin.h
similarity index 67%
copy from plugins/ping/pingplugin.h
copy to plugins/findmyphone/findmyphoneplugin.h
index d122c5c..03d15a6 100644
--- a/plugins/ping/pingplugin.h
+++ b/plugins/findmyphone/findmyphoneplugin.h
@@ -1,5 +1,5 @@
 /**
- * Copyright 2013 Albert Vaca <albertvaka at gmail.com>
+ * Copyright 2014 Apoorv Parle <apparle at gmail.com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -25,24 +25,23 @@
 
 #include <core/kdeconnectplugin.h>
 
-#define PACKAGE_TYPE_PING QLatin1String("kdeconnect.ping")
+#define PACKAGE_TYPE_FINDMYPHONE QStringLiteral("kdeconnect.findmyphone")
 
-class Q_DECL_EXPORT PingPlugin
+class FindMyPhonePlugin
     : public KdeConnectPlugin
 {
     Q_OBJECT
-    Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.ping")
+    Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.findmyphone")
 
 public:
-    explicit PingPlugin(QObject *parent, const QVariantList &args);
-    virtual ~PingPlugin();
-
-    Q_SCRIPTABLE void sendPing();
-    Q_SCRIPTABLE void sendPing(const QString& customMessage);
+    explicit FindMyPhonePlugin(QObject *parent, const QVariantList &args);
+    virtual ~FindMyPhonePlugin();
+    
+    Q_SCRIPTABLE void ring();
 
 public Q_SLOTS:
-    virtual bool receivePackage(const NetworkPackage& np) override;
-    virtual void connected() override;
+    virtual void connected();
+    virtual bool receivePackage(const NetworkPackage& np);
 
 private:
     QString dbusPath() const;
diff --git a/plugins/findmyphone/kdeconnect_findmyphone.json b/plugins/findmyphone/kdeconnect_findmyphone.json
new file mode 100644
index 0000000..075e8d1
--- /dev/null
+++ b/plugins/findmyphone/kdeconnect_findmyphone.json
@@ -0,0 +1,29 @@
+{
+   "KPlugin" : {
+   "Encoding" : "UTF-8",
+      "Name" : "Find My Phone",
+      "Description" : "Find your lost phone by making it play an alarm sound    ",
+      "Id" : "kdeconnect_findmyphone",
+      "Version" : "0.1",
+      "Authors" : [
+         {
+            "Name" : "Apoorv Parle",
+            "Email" : "apparle at gmail.com"
+         },
+         {
+            "Name" : "David Edmundson",
+            "Email" : "davidedmundson at kde.org"
+         }
+      ],
+      "License" : "GPL",
+      "EnabledByDefault" : true,
+      "ServiceTypes" : [
+         "KdeConnect/Plugin"
+      ],
+      "Website" : "http://kde.org",
+      "Icon" : "edit-find"
+   },
+   "X-KdeConnect-OutgoingPackageType" : [
+      "kdeconnect.findmyphone"
+   ]
+}

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list