[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:27:45 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=c8dbbed
The following commit has been merged in the master branch:
commit c8dbbed685cb6abde9cf13958764c6b30446b0b9
Author: Aleix Pol <aleixpol at kde.org>
Date: Fri Jun 27 18:21:40 2014 +0200
Move the send ping code to the ping plugin
turn it into a dbus call to the plugin
Reviewed by Albert Vaca
---
cli/kdeconnect-cli.cpp | 4 ++++
core/device.cpp | 7 -------
core/device.h | 1 -
kcm/kcm.cpp | 3 ++-
plugins/ping/kdeconnect_ping.desktop | 2 +-
plugins/ping/pingplugin.cpp | 18 ++++++++++++++++++
plugins/ping/pingplugin.h | 7 ++++++-
7 files changed, 31 insertions(+), 11 deletions(-)
diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp
index a4c4fd8..d425bd3 100644
--- a/cli/kdeconnect-cli.cpp
+++ b/cli/kdeconnect-cli.cpp
@@ -40,6 +40,7 @@ int main(int argc, char** argv)
options.add("share <path>", ki18n("Share a file to a said device"));
options.add("pair", ki18n("Request pairing to a said device"));
options.add("unpair", ki18n("Stop pairing to a said device"));
+ options.add("ping", ki18n("Sends a ping to said device"));
options.add("device <dev>", ki18n("Device ID"));
KCmdLineArgs::addCmdLineOptions( options );
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
@@ -98,6 +99,9 @@ int main(int argc, char** argv)
QDBusPendingReply<void> req = dev.unpair();
req.waitForFinished();
}
+ } else if(args->isSet("ping")) {
+ QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kdeconnect", "/modules/kdeconnect/devices/"+device+"/ping", "org.kde.kdeconnect.device.ping", "sendPing");
+ QDBusConnection::sessionBus().call(msg);
} else
KCmdLineArgs::usageError(i18n("Nothing to be done with the device"));
}
diff --git a/core/device.cpp b/core/device.cpp
index 29982e7..b005140 100644
--- a/core/device.cpp
+++ b/core/device.cpp
@@ -470,13 +470,6 @@ QStringList Device::availableLinks() const
return sl;
}
-void Device::sendPing()
-{
- NetworkPackage np(PACKAGE_TYPE_PING);
- bool success = sendPackage(np);
- kDebug(kdeconnect_kded()) << "sendPing:" << success;
-}
-
Device::DeviceType Device::str2type(QString deviceType) {
if (deviceType == "desktop") return Desktop;
if (deviceType == "laptop") return Laptop;
diff --git a/core/device.h b/core/device.h
index ec757b8..d154300 100644
--- a/core/device.h
+++ b/core/device.h
@@ -105,7 +105,6 @@ public Q_SLOTS:
Q_SCRIPTABLE void requestPair();
Q_SCRIPTABLE void unpair();
Q_SCRIPTABLE void reloadPlugins(); //From kconf
- Q_SCRIPTABLE void sendPing();
void acceptPairing();
void rejectPairing();
diff --git a/kcm/kcm.cpp b/kcm/kcm.cpp
index 78a39cf..f809a53 100644
--- a/kcm/kcm.cpp
+++ b/kcm/kcm.cpp
@@ -250,5 +250,6 @@ void KdeConnectKcm::save()
void KdeConnectKcm::sendPing()
{
if (!currentDevice) return;
- currentDevice->sendPing();
+ QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kdeconnect", "/modules/kdeconnect/devices/"+currentDevice->id()+"/ping", "org.kde.kdeconnect.device.ping", "sendPing");
+ QDBusConnection::sessionBus().call(msg);
}
diff --git a/plugins/ping/kdeconnect_ping.desktop b/plugins/ping/kdeconnect_ping.desktop
index 23bfe8e..aa6c7a5 100644
--- a/plugins/ping/kdeconnect_ping.desktop
+++ b/plugins/ping/kdeconnect_ping.desktop
@@ -59,4 +59,4 @@ Comment[uk]=Надсилання і отримання сигналів підт
Comment[x-test]=xxSend and receive pingsxx
X-KdeConnect-SupportedPackageType=kdeconnect.ping
-# X-KdeConnect-OutgoingPackageType=kdeconnect.ping
+X-KdeConnect-OutgoingPackageType=kdeconnect.ping
diff --git a/plugins/ping/pingplugin.cpp b/plugins/ping/pingplugin.cpp
index 182cdbc..5d5575c 100644
--- a/plugins/ping/pingplugin.cpp
+++ b/plugins/ping/pingplugin.cpp
@@ -26,6 +26,7 @@
#include <core/kdebugnamespace.h>
#include <core/device.h>
+#include <QDBusConnection>
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< PingPlugin >(); )
K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_ping", "kdeconnect-plugins") )
@@ -53,3 +54,20 @@ bool PingPlugin::receivePackage(const NetworkPackage& np)
return true;
}
+
+void PingPlugin::sendPing()
+{
+ NetworkPackage np(PACKAGE_TYPE_PING);
+ bool success = sendPackage(np);
+ kDebug(kdeconnect_kded()) << "sendPing:" << success;
+}
+
+void PingPlugin::connected()
+{
+ QDBusConnection::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportAllContents);
+}
+
+QString PingPlugin::dbusPath() const
+{
+ return "/modules/kdeconnect/devices/" + device()->id() + "/ping";
+}
diff --git a/plugins/ping/pingplugin.h b/plugins/ping/pingplugin.h
index f31e660..3156307 100644
--- a/plugins/ping/pingplugin.h
+++ b/plugins/ping/pingplugin.h
@@ -29,15 +29,20 @@ class KDE_EXPORT PingPlugin
: public KdeConnectPlugin
{
Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.ping")
public:
explicit PingPlugin(QObject *parent, const QVariantList &args);
virtual ~PingPlugin();
+ Q_SCRIPTABLE void sendPing();
+
public Q_SLOTS:
virtual bool receivePackage(const NetworkPackage& np);
- virtual void connected() { };
+ virtual void connected();
+private:
+ QString dbusPath() const;
};
#endif
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list