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

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


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

The following commit has been merged in the master branch:
commit 9939b58df029da370dd63172b04c78f9bbb8eb99
Author: Albert Vaca <albertvaka at gmail.com>
Date:   Wed Jun 22 11:40:31 2016 +0200

    Merge telephonyplugin and telepathy plugin
    
    We now use the telepathy interface when it's available, and fall back to
    our custom dialog when it's not. This also makes the kdeconnect telepathy
    connection manager be completely decoupled from the kdeconnect code.
    
    CCMAIL: david at davidedmundson.co.uk
---
 plugins/telepathy/CMakeLists.txt              | 29 ------------
 plugins/telepathy/kdeconnect_telepathy.json   | 27 -----------
 plugins/telepathy/telepathy-cm/CMakeLists.txt |  3 ++
 plugins/telepathy/telepathyplugin.cpp         | 64 ---------------------------
 plugins/telepathy/telepathyplugin.h           | 53 ----------------------
 plugins/telephony/telephonyplugin.cpp         | 11 +++++
 plugins/telephony/telephonyplugin.h           |  3 ++
 7 files changed, 17 insertions(+), 173 deletions(-)

diff --git a/plugins/telepathy/CMakeLists.txt b/plugins/telepathy/CMakeLists.txt
index bda74d1..59a02f0 100644
--- a/plugins/telepathy/CMakeLists.txt
+++ b/plugins/telepathy/CMakeLists.txt
@@ -1,31 +1,2 @@
-find_package(TelepathyQt5 0.9.5)
-find_package(TelepathyQt5Service 0.9.7)
-
-set_package_properties(TelepathyQt5 PROPERTIES
-    PURPOSE "Allows integration with Telepathy. We suggest 'plugins/telepathy' to be packaged separately."
-    TYPE OPTIONAL
-)
-set_package_properties(TelepathyQt5Service PROPERTIES
-    PURPOSE "Allows integration with Telepathy. We suggest 'plugins/telepathy' to be packaged separately."
-    TYPE OPTIONAL
-)
-if (NOT TelepathyQt5Service_FOUND OR NOT TelepathyQt5_FOUND)
-    return()
-endif()
-
-include_directories(${CMAKE_BINARY_DIR})
 
 add_subdirectory(telepathy-cm)
-
-qt5_generate_dbus_interface(${CMAKE_CURRENT_SOURCE_DIR}/telepathy-cm/protocol.h ${CMAKE_CURRENT_BINARY_DIR}/kdeconnectinterface.xml)
-qt5_add_dbus_interface(kdeconnect_telepathy_SRCS ${CMAKE_CURRENT_BINARY_DIR}/kdeconnectinterface.xml kdeconnectinterface)
-
-kdeconnect_add_plugin(kdeconnect_telepathy JSON kdeconnect_telepathy.json
-    SOURCES telepathyplugin.cpp ${kdeconnect_telepathy_SRCS})
-
-target_link_libraries(kdeconnect_telepathy
-    kdeconnectcore
-    KF5::I18n
-    Qt5::DBus
-    Qt5::Gui
-)
diff --git a/plugins/telepathy/kdeconnect_telepathy.json b/plugins/telepathy/kdeconnect_telepathy.json
deleted file mode 100644
index 2ec42b2..0000000
--- a/plugins/telepathy/kdeconnect_telepathy.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
-    "Encoding": "UTF-8", 
-    "KPlugin": {
-        "Authors": [
-            {
-                "Name": "David Edmundson",
-                "Email": "davidedmundson at kde.org"
-            }
-        ], 
-        "Description": "Show notifications for calls and SMS (answering coming soon)", 
-        "EnabledByDefault": true, 
-        "Icon": "telepathy",
-        "Id": "kdeconnect_telepathy",
-        "License": "GPL", 
-        "Name": "Telepathy service integration",
-        "ServiceTypes": [ "KdeConnect/Plugin" ],
-        "Version": "0.1", 
-        "Website": "http://blog.davidedmundson.co.uk"
-    }, 
-    "X-KdeConnect-OutgoingPackageType": [
-        "kdeconnect.telephony.request",
-        "kdeconnect.sms.request"
-    ], 
-    "X-KdeConnect-SupportedPackageType": [
-        "kdeconnect.telephony"
-    ]
-}
diff --git a/plugins/telepathy/telepathy-cm/CMakeLists.txt b/plugins/telepathy/telepathy-cm/CMakeLists.txt
index 33a8331..3d16143 100644
--- a/plugins/telepathy/telepathy-cm/CMakeLists.txt
+++ b/plugins/telepathy/telepathy-cm/CMakeLists.txt
@@ -1,3 +1,6 @@
+find_package(TelepathyQt5 0.9.5)
+find_package(TelepathyQt5Service 0.9.7)
+
 project(connectcm)
 
 add_executable(connectcm
diff --git a/plugins/telepathy/telepathyplugin.cpp b/plugins/telepathy/telepathyplugin.cpp
deleted file mode 100644
index c0dd289..0000000
--- a/plugins/telepathy/telepathyplugin.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Copyright 2013 Albert Vaca <albertvaka 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
- * 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 <http://www.gnu.org/licenses/>.
- */
-
-#include "telepathyplugin.h"
-
-#include <KLocalizedString>
-#include <QIcon>
-#include <QDebug>
-
-#include <KPluginFactory>
-
-K_PLUGIN_FACTORY_WITH_JSON( KdeConnectPluginFactory, "kdeconnect_telepathy.json", registerPlugin< TelepathyPlugin >(); )
-
-Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_TELEPHONY, "kdeconnect.plugin.telephony")
-
-TelepathyPlugin::TelepathyPlugin(QObject *parent, const QVariantList &args)
-    : KdeConnectPlugin(parent, args)
-    , m_telepathyInterface(new OrgFreedesktopTelepathyConnectionManagerKdeconnectInterface("org.freedesktop.Telepathy.ConnectionManager.kdeconnect", "/kdeconnect", QDBusConnection::sessionBus(), this))
-{
-    connect(m_telepathyInterface, SIGNAL(messageReceived(QString,QString)), SLOT(sendSms(QString,QString)));
-}
-
-bool TelepathyPlugin::receivePackage(const NetworkPackage& np)
-{
-    if (np.get<QString>("event") == QLatin1String("sms")) {
-        const QString messageBody = np.get<QString>("messageBody","");
-        const QString phoneNumber = np.get<QString>("phoneNumber", i18n("unknown number"));
-        const QString contactName = np.get<QString>("contactName", phoneNumber);
-        if (m_telepathyInterface->sendMessage(contactName, messageBody)) {
-             return true;
-        }
-    }
-
-    return true;
-}
-
-void TelepathyPlugin::sendSms(const QString& phoneNumber, const QString& messageBody)
-{
-    NetworkPackage np(PACKAGE_TYPE_SMS_REQUEST, {
-        {"sendSms", true},
-        {"phoneNumber", phoneNumber},
-        {"messageBody", messageBody}
-    });
-    sendPackage(np);
-}
-
-#include "telepathyplugin.moc"
diff --git a/plugins/telepathy/telepathyplugin.h b/plugins/telepathy/telepathyplugin.h
deleted file mode 100644
index 106336c..0000000
--- a/plugins/telepathy/telepathyplugin.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Copyright 2013 Albert Vaca <albertvaka 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
- * 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 <http://www.gnu.org/licenses/>.
- */
-
-#ifndef TELEPHONYPLUGIN_H
-#define TELEPHONYPLUGIN_H
-
-#include <QLoggingCategory>
-
-#include <core/kdeconnectplugin.h>
-#include "kdeconnectinterface.h"
-
-#define PACKAGE_TYPE_TELEPHONY_REQUEST QLatin1String("kdeconnect.telephony.request")
-#define PACKAGE_TYPE_SMS_REQUEST QLatin1String("kdeconnect.sms.request")
-
-Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_TELEPHONY)
-
-class TelepathyPlugin
-    : public KdeConnectPlugin
-{
-    Q_OBJECT
-
-public:
-    explicit TelepathyPlugin(QObject *parent, const QVariantList &args);
-    void connected() override {}
-
-public Q_SLOTS:
-    bool receivePackage(const NetworkPackage& np) override;
-
-private Q_SLOTS:
-    void sendSms(const QString& phoneNumber, const QString& messageBody);
-
-private:
-    OrgFreedesktopTelepathyConnectionManagerKdeconnectInterface* m_telepathyInterface;
-};
-
-#endif
diff --git a/plugins/telephony/telephonyplugin.cpp b/plugins/telephony/telephonyplugin.cpp
index 19697bf..c682ec7 100644
--- a/plugins/telephony/telephonyplugin.cpp
+++ b/plugins/telephony/telephonyplugin.cpp
@@ -25,6 +25,7 @@
 #include <KLocalizedString>
 #include <QIcon>
 #include <QDebug>
+#include <QDBusPendingCall>
 
 #include <KPluginFactory>
 
@@ -34,7 +35,9 @@ Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_TELEPHONY, "kdeconnect.plugin.telephony")
 
 TelephonyPlugin::TelephonyPlugin(QObject *parent, const QVariantList &args)
     : KdeConnectPlugin(parent, args)
+    , m_telepathyInterface("org.freedesktop.Telepathy.ConnectionManager.kdeconnect", "/kdeconnect")
 {
+    connect(&m_telepathyInterface, SIGNAL(messageReceived(QString,QString)), SLOT(sendSms(QString,QString)));
 }
 
 KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np)
@@ -44,6 +47,14 @@ KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np)
     const QString contactName = np.get<QString>("contactName", phoneNumber);
     const QByteArray phoneThumbnail = QByteArray::fromBase64(np.get<QByteArray>("phoneThumbnail", ""));
 
+    // In case telepathy can handle the message, don't do anything else
+    if (event == QLatin1String("sms") && m_telepathyInterface.isValid()) {
+        qCDebug(KDECONNECT_PLUGIN_TELEPHONY) << "Passing a text message to the telepathy interface";
+        const QString messageBody = np.get<QString>("messageBody","");
+        m_telepathyInterface.asyncCall("sendMessage", contactName, messageBody);
+        return nullptr;
+    }
+
     QString content, type, icon;
     KNotification::NotificationFlags flags = KNotification::CloseOnTimeout | KNotification::CloseWhenWidgetActivated;
 
diff --git a/plugins/telephony/telephonyplugin.h b/plugins/telephony/telephonyplugin.h
index b08d09b..d596e30 100644
--- a/plugins/telephony/telephonyplugin.h
+++ b/plugins/telephony/telephonyplugin.h
@@ -22,6 +22,7 @@
 #define TELEPHONYPLUGIN_H
 
 #include <QLoggingCategory>
+#include <QDBusInterface>
 
 #include <KNotification>
 
@@ -52,6 +53,8 @@ private Q_SLOTS:
 
 private:
     KNotification* createNotification(const NetworkPackage& np);
+
+    QDBusInterface m_telepathyInterface;
 };
 
 #endif

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list