[SCM] kdeconnect packaging branch, master, updated. upstream/1.0.1-206-gf661872

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 18:27:09 UTC 2017


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

The following commit has been merged in the master branch:
commit 7d88340da7cd7a70bc88340295606f54c0437544
Author: Aleix Pol <aleixpol at kde.org>
Date:   Thu Nov 3 19:15:23 2016 +0100

    Makes it possible to send sms from kdeconnect-cli
    
    Summary: Introduces --send-sms and --destination
    
    Test Plan: Sent an sms to Albert Vaca
    
    Reviewers: #kde_connect, albertvaka
    
    Reviewed By: #kde_connect, albertvaka
    
    Differential Revision: https://phabricator.kde.org/D3252
---
 cli/kdeconnect-cli.cpp                | 11 +++++++++++
 plugins/telephony/telephonyplugin.cpp | 10 ++++++++++
 plugins/telephony/telephonyplugin.h   |  8 +++++---
 3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp
index cf9af0e..a172774 100644
--- a/cli/kdeconnect-cli.cpp
+++ b/cli/kdeconnect-cli.cpp
@@ -59,6 +59,8 @@ int main(int argc, char** argv)
     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("send-sms", i18n("Sends an SMS. Requires destination"), i18n("message")));
+    parser.addOption(QCommandLineOption("destination", i18n("Phone number to send the message"), i18n("phone number")));
     parser.addOption(QCommandLineOption(QStringList("device") << "d", i18n("Device ID"), "dev"));
     parser.addOption(QCommandLineOption(QStringList("name") << "n", i18n("Device Name"), "name"));
     parser.addOption(QCommandLineOption("encryption-info", i18n("Get encryption info about said device")));
@@ -183,6 +185,15 @@ int main(int argc, char** argv)
                 msg.setArguments(QVariantList() << message);
             }
             QDBusConnection::sessionBus().call(msg);
+        } else if(parser.isSet("send-sms")) {
+            if (parser.isSet("destination")) {
+                QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kdeconnect", "/modules/kdeconnect/devices/"+device+"/telephony", "org.kde.kdeconnect.device.telephony", "sendSms");
+                msg.setArguments({ parser.value("destination"), parser.value("send-sms") });
+                QDBusConnection::sessionBus().call(msg);
+            } else {
+                QTextStream(stderr) << i18n("error: should specify the SMS's recipient by passing --destination <phone number>");
+                return 1;
+            }
         } 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);
diff --git a/plugins/telephony/telephonyplugin.cpp b/plugins/telephony/telephonyplugin.cpp
index 8957e89..0d67be2 100644
--- a/plugins/telephony/telephonyplugin.cpp
+++ b/plugins/telephony/telephonyplugin.cpp
@@ -161,4 +161,14 @@ void TelephonyPlugin::showSendSmsDialog()
     dialog->show();
 }
 
+void TelephonyPlugin::connected()
+{
+    QDBusConnection::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportScriptableContents);
+}
+
+QString TelephonyPlugin::dbusPath() const
+{
+    return "/modules/kdeconnect/devices/" + device()->id() + "/telephony";
+}
+
 #include "telephonyplugin.moc"
diff --git a/plugins/telephony/telephonyplugin.h b/plugins/telephony/telephonyplugin.h
index d596e30..d122cd5 100644
--- a/plugins/telephony/telephonyplugin.h
+++ b/plugins/telephony/telephonyplugin.h
@@ -37,21 +37,23 @@ class TelephonyPlugin
     : public KdeConnectPlugin
 {
     Q_OBJECT
+    Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.telephony")
 
 public:
     explicit TelephonyPlugin(QObject *parent, const QVariantList &args);
 
     bool receivePackage(const NetworkPackage& np) override;
-    void connected() override { }
+    void connected() override;
 
 public Q_SLOTS:
-    void sendMutePackage();
+    Q_SCRIPTABLE void sendSms(const QString& phoneNumber, const QString& messageBody);
 
 private Q_SLOTS:
-    void sendSms(const QString& phoneNumber, const QString& messageBody);
+    void sendMutePackage();
     void showSendSmsDialog();
 
 private:
+    QString dbusPath() const;
     KNotification* createNotification(const NetworkPackage& np);
 
     QDBusInterface m_telepathyInterface;

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list