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

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


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

The following commit has been merged in the master branch:
commit a4655770051f8f12017bf2f83435582c8be7dbc3
Author: Aleix Pol Gonzalez <aleixpol at kde.org>
Date:   Thu Jun 16 10:16:35 2016 +0200

    Move the Telepathy infrastructure at the plugin level
    
    At the moment, telepathy integration needs to be compiled within the
    daemon. This creates a rather aggressive dependency with Telepathy.
    
    This plugin proposes to move into a plugin, so that if the plugin isn't
    present, telepathy becomes out of the picture.
    
    REVIEW: 128149
---
 CMakeLists.txt                                    | 13 ++++---------
 daemon/CMakeLists.txt                             |  3 ---
 daemon/kdeconnectd.cpp                            |  9 ---------
 plugins/telephony/CMakeLists.txt                  | 12 ++++++------
 plugins/telephony/telephonyplugin.cpp             | 13 ++++---------
 plugins/telephony/telephonyplugin.h               | 11 ++---------
 telepathy-cm/CMakeLists.txt                       | 21 ++++++++++++---------
 telepathy-cm/connectcm_export.h                   | 12 ------------
 telepathy-cm/connection.h                         |  4 +---
 telepathy-cm/kdeconnect.manager                   |  8 +++-----
 telepathy-cm/kdeconnecttelepathyprotocolfactory.h |  4 +---
 telepathy-cm/main.cpp                             | 17 +++++++++++++++++
 telepathy-cm/protocol.cpp                         |  3 +++
 telepathy-cm/protocol.h                           |  5 ++---
 telepathy-cm/textchannel.h                        |  4 +---
 15 files changed, 56 insertions(+), 83 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index abd3438..4efde15 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,11 +14,8 @@ find_package(Qt5 5.2 REQUIRED COMPONENTS Quick Gui)
 find_package(KF5 REQUIRED COMPONENTS I18n ConfigWidgets DBusAddons)
 find_package(KF5DocTools)
 find_package(Qca-qt5 2.1.0 REQUIRED)
-# find_package(TelepathyQt5 0.9.5)
-# find_package(TelepathyQt5Service 0.9.7)
-if (TelepathyQt5_FOUND AND TelepathyQt5Service_FOUND)
-    add_definitions(-DHAVE_TELEPATHY)
-endif()
+find_package(TelepathyQt5 0.9.5)
+find_package(TelepathyQt5Service 0.9.7)
 
 include_directories(${CMAKE_SOURCE_DIR})
 
@@ -39,6 +36,8 @@ add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
 include(GenerateExportHeader)
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
 
+add_subdirectory(telepathy-cm)
+
 add_subdirectory(core)
 add_subdirectory(kcm)
 add_subdirectory(kcmplugin)
@@ -59,10 +58,6 @@ if(KF5DocTools_FOUND)
     add_subdirectory(doc)
 endif()
 
-if (TelepathyQt5_FOUND AND TelepathyQt5Service_FOUND)
-    add_subdirectory(telepathy-cm)
-endif()
-
 if(BUILD_TESTING)
     add_subdirectory(tests)
 endif()
diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt
index 359ea8d..649fe4a 100644
--- a/daemon/CMakeLists.txt
+++ b/daemon/CMakeLists.txt
@@ -8,9 +8,6 @@ add_executable(kdeconnectd kdeconnectd.cpp)
 target_link_libraries(kdeconnectd kdeconnectcore KF5::KIOWidgets KF5::DBusAddons KF5::Notifications KF5::I18n Qt5::Widgets)
 
 ecm_mark_nongui_executable(kdeconnectd)
-if(TelepathyQt5_FOUND AND TelepathyQt5Service_FOUND)
-    target_link_libraries(kdeconnectd connectcm)
-endif()
 
 configure_file(kdeconnectd.desktop.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdeconnectd.desktop)
 configure_file(org.kde.kdeconnect.service.in ${CMAKE_CURRENT_BINARY_DIR}/org.kde.kdeconnect.service)
diff --git a/daemon/kdeconnectd.cpp b/daemon/kdeconnectd.cpp
index 1b7a841..556fd9e 100644
--- a/daemon/kdeconnectd.cpp
+++ b/daemon/kdeconnectd.cpp
@@ -34,10 +34,6 @@
 #include "core/backends/pairinghandler.h"
 #include "kdeconnect-version.h"
 
-#ifdef HAVE_TELEPATHY
-#include "kdeconnecttelepathyprotocolfactory.h"
-#endif
-
 class DesktopDaemon : public Daemon
 {
     Q_OBJECT
@@ -95,11 +91,6 @@ int main(int argc, char* argv[])
     Daemon* daemon = new DesktopDaemon;
     QObject::connect(daemon, SIGNAL(destroyed(QObject*)), &app, SLOT(quit()));
 
-#ifdef HAVE_TELEPATHY
-    //keep a reference to the KTP CM so that we can register on DBus
-    auto telepathyPlugin = KDEConnectTelepathyProtocolFactory::interface();
-#endif
-
     return app.exec();
 }
 
diff --git a/plugins/telephony/CMakeLists.txt b/plugins/telephony/CMakeLists.txt
index 666c54f..583aa8f 100644
--- a/plugins/telephony/CMakeLists.txt
+++ b/plugins/telephony/CMakeLists.txt
@@ -1,20 +1,20 @@
 find_package(KF5 REQUIRED COMPONENTS Notifications)
 
+include_directories(${CMAKE_BINARY_DIR})
+
 set(kdeconnect_telephony_SRCS
     telephonyplugin.cpp
     sendsmsdialog.cpp
 )
 
+qt5_generate_dbus_interface(${CMAKE_SOURCE_DIR}/telepathy-cm/protocol.h ${CMAKE_CURRENT_BINARY_DIR}/kdeconnectinterface.xml)
+qt5_add_dbus_interface(kdeconnect_telephony_SRCS ${CMAKE_CURRENT_BINARY_DIR}/kdeconnectinterface.xml kdeconnectinterface)
+
 kdeconnect_add_plugin(kdeconnect_telephony JSON kdeconnect_telephony.json SOURCES ${kdeconnect_telephony_SRCS})
 
 target_link_libraries(kdeconnect_telephony
     kdeconnectcore
     KF5::I18n
     KF5::Notifications
+    Qt5::DBus
 )
-
-if (TelepathyQt5_FOUND AND TelepathyQt5Service_FOUND)
-target_link_libraries(kdeconnect_telephony
-    connectcm
-)
-endif()
\ No newline at end of file
diff --git a/plugins/telephony/telephonyplugin.cpp b/plugins/telephony/telephonyplugin.cpp
index d285c39..5015c6c 100644
--- a/plugins/telephony/telephonyplugin.cpp
+++ b/plugins/telephony/telephonyplugin.cpp
@@ -34,12 +34,9 @@ Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_TELEPHONY, "kdeconnect.plugin.telephony")
 
 TelephonyPlugin::TelephonyPlugin(QObject *parent, const QVariantList &args)
     : KdeConnectPlugin(parent, args)
+    , m_telepathyInterface(new OrgFreedesktopTelepathyConnectionManagerKdeconnectInterface("org.freedesktop.Telepathy.ConnectionManager.kdeconnect", "/kdeconnect", QDBusConnection::sessionBus(), this))
 {
-#ifdef HAVE_TELEPATHY    
-    //keep a reference to the KTP CM so that we can register on DBus
-    m_telepathyInterface = KDEConnectTelepathyProtocolFactory::interface();
-    connect(m_telepathyInterface.constData(), SIGNAL(messageReceived(QString,QString)), SLOT(sendSms(QString,QString)));
-#endif
+    connect(m_telepathyInterface, SIGNAL(messageReceived(QString,QString)), SLOT(sendSms(QString,QString)));
 }
 
 KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np)
@@ -66,7 +63,7 @@ KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np)
     } else if (event == "sms") {
         type = QStringLiteral("smsReceived");
         icon = QStringLiteral("mail-receive");
-        QString messageBody = np.get<QString>("messageBody","");
+        QString messageBody = np.get<QString>("messageBody", "");
         content = i18n("SMS from %1<br>%2", contactName, messageBody);
         flags |= KNotification::Persistent;
     } else if (event == "talking") {
@@ -118,7 +115,6 @@ bool TelephonyPlugin::receivePackage(const NetworkPackage& np)
         //TODO: Clear the old notification
         return true;
     }
-#ifdef HAVE_TELEPATHY
     if (np.get<QString>("event") == QLatin1String("sms")) {
         const QString messageBody = np.get<QString>("messageBody","");
         const QString phoneNumber = np.get<QString>("phoneNumber", i18n("unknown number"));
@@ -127,8 +123,7 @@ bool TelephonyPlugin::receivePackage(const NetworkPackage& np)
              return true;
         }
     }
-#endif 
-    
+
     KNotification* n = createNotification(np);
     if (n != nullptr) n->sendEvent();
 
diff --git a/plugins/telephony/telephonyplugin.h b/plugins/telephony/telephonyplugin.h
index d1a6873..58b9752 100644
--- a/plugins/telephony/telephonyplugin.h
+++ b/plugins/telephony/telephonyplugin.h
@@ -26,10 +26,7 @@
 #include <KNotification>
 
 #include <core/kdeconnectplugin.h>
-
-#ifdef HAVE_TELEPATHY
-#include "kdeconnecttelepathyprotocolfactory.h"
-#endif
+#include "kdeconnectinterface.h"
 
 #define PACKAGE_TYPE_TELEPHONY_REQUEST QLatin1String("kdeconnect.telephony.request")
 #define PACKAGE_TYPE_SMS_REQUEST QLatin1String("kdeconnect.sms.request")
@@ -55,12 +52,8 @@ private Q_SLOTS:
 
 private:
     KNotification* createNotification(const NetworkPackage& np);
-    
-#ifdef HAVE_TELEPATHY
-    ConnectProtocolPtr m_telepathyInterface;
-#endif
-
 
+    OrgFreedesktopTelepathyConnectionManagerKdeconnectInterface* m_telepathyInterface;
 };
 
 #endif
diff --git a/telepathy-cm/CMakeLists.txt b/telepathy-cm/CMakeLists.txt
index fc763fb..bf526a9 100644
--- a/telepathy-cm/CMakeLists.txt
+++ b/telepathy-cm/CMakeLists.txt
@@ -1,24 +1,27 @@
 project(connectcm)
 
-add_definitions(-DCONNECTCM_LIBRARY)
-
-set(connectcm_SOURCES
+add_executable(connectcm
+    main.cpp
     connection.cpp
     protocol.cpp
     textchannel.cpp
     kdeconnecttelepathyprotocolfactory.cpp
 )
 
-add_library(connectcm SHARED ${connectcm_SOURCES})
-
 target_link_libraries(connectcm
-PUBLIC
     Qt5::Core
     ${TELEPATHY_QT5_LIBRARIES}
     ${TELEPATHY_QT5_SERVICE_LIBRARIES}
 )
 
-install (TARGETS connectcm
-    ${INSTALL_TARGETS_DEFAULT_ARGS}
-)
+install (TARGETS connectcm DESTINATION ${CMAKE_INSTALL_LIBEXECDIR})
 
+file(WRITE ${CMAKE_BINARY_DIR}/org.freedesktop.Telepathy.ConnectionManager.kdeconnect.service "Name=org.freedesktop.Telepathy.ConnectionManager.kdeconnect
+Exec=$<TARGET_FILE_DIR:connectcm>")
+
+install(FILES ${CMAKE_BINARY_DIR}/org.freedesktop.Telepathy.ConnectionManager.kdeconnect.service DESTINATION share/dbus-1/services)
+
+install(
+    FILES kdeconnect.manager
+    DESTINATION share/telepathy/managers
+)
diff --git a/telepathy-cm/connectcm_export.h b/telepathy-cm/connectcm_export.h
deleted file mode 100644
index 740ae98..0000000
--- a/telepathy-cm/connectcm_export.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef CONNECTCM_EXPORT_H
-#define CONNECTCM_EXPORT_H
-
-#include <QtCore/QtGlobal>
-
-#if defined(CONNECTCM_LIBRARY)
-#define CONNECTCM_EXPORT Q_DECL_EXPORT
-#else
-#define CONNECTCM_EXPORT Q_DECL_IMPORT
-#endif
-
-#endif
diff --git a/telepathy-cm/connection.h b/telepathy-cm/connection.h
index b4438bf..2916655 100644
--- a/telepathy-cm/connection.h
+++ b/telepathy-cm/connection.h
@@ -14,12 +14,10 @@
 #ifndef CONNECTCM_CONNECTION_H
 #define CONNECTCM_CONNECTION_H
 
-#include "connectcm_export.h"
-
 #include <TelepathyQt/BaseConnection>
 #include <TelepathyQt/BaseChannel>
 
-class CONNECTCM_EXPORT ConnectConnection : public Tp::BaseConnection
+class ConnectConnection : public Tp::BaseConnection
 {
     Q_OBJECT
 public:
diff --git a/telepathy-cm/kdeconnect.manager b/telepathy-cm/kdeconnect.manager
index fcdeb08..a4dd290 100644
--- a/telepathy-cm/kdeconnect.manager
+++ b/telepathy-cm/kdeconnect.manager
@@ -1,6 +1,4 @@
 [ConnectionManager]
-BusName=org.freedesktop.Telepathy.ConnectionManager.kdeconnect
-ObjectPath=/org/freedesktop/Telepathy/ConnectionManager/kdeconnect
-Interfaces=
-
-[Protocol kdeconnect]
\ No newline at end of file
+Name = kdeconnect
+BusName = org.freedesktop.Telepathy.ConnectionManager.kdeconnect
+ObjectPath = /org/freedesktop/Telepathy/ConnectionManager/kdeconnect
diff --git a/telepathy-cm/kdeconnecttelepathyprotocolfactory.h b/telepathy-cm/kdeconnecttelepathyprotocolfactory.h
index 51b44fd..84d048a 100644
--- a/telepathy-cm/kdeconnecttelepathyprotocolfactory.h
+++ b/telepathy-cm/kdeconnecttelepathyprotocolfactory.h
@@ -1,7 +1,5 @@
 #include "protocol.h"
 
-#include "connectcm_export.h"
-
 typedef Tp::SharedPtr<KDEConnectTelepathyProtocol> ConnectProtocolPtr;
 
 /*
@@ -9,7 +7,7 @@ typedef Tp::SharedPtr<KDEConnectTelepathyProtocol> ConnectProtocolPtr;
  * Whilst the main process also holds a reference.
  * 
  */
-class CONNECTCM_EXPORT KDEConnectTelepathyProtocolFactory
+class KDEConnectTelepathyProtocolFactory
 {
 public:
     static ConnectProtocolPtr interface();
diff --git a/telepathy-cm/main.cpp b/telepathy-cm/main.cpp
new file mode 100644
index 0000000..b229178
--- /dev/null
+++ b/telepathy-cm/main.cpp
@@ -0,0 +1,17 @@
+#include <QCoreApplication>
+
+#include <TelepathyQt/BaseConnectionManager>
+#include <TelepathyQt/Constants>
+#include <TelepathyQt/Debug>
+
+#include "kdeconnecttelepathyprotocolfactory.h"
+
+int main(int argc, char *argv[])
+{
+    QCoreApplication app(argc, argv);
+    app.setApplicationName(QLatin1String("telepathy-morse"));
+
+    KDEConnectTelepathyProtocolFactory::interface();
+
+    return app.exec();
+}
diff --git a/telepathy-cm/protocol.cpp b/telepathy-cm/protocol.cpp
index 1e98729..eb4fbb3 100644
--- a/telepathy-cm/protocol.cpp
+++ b/telepathy-cm/protocol.cpp
@@ -48,6 +48,9 @@ KDEConnectTelepathyProtocol::KDEConnectTelepathyProtocol(const QDBusConnection &
     presenceIface->setStatuses(Tp::PresenceSpecList(ConnectConnection::getConnectStatusSpecMap()));
     plugInterface(Tp::AbstractProtocolInterfacePtr::dynamicCast(presenceIface));*/
 
+    auto bus = QDBusConnection::sessionBus();
+    bus.registerObject("/kdeconnect", this, QDBusConnection::ExportAllSignals | QDBusConnection::ExportAllSlots);
+
     Tp::DBusError err;
 }
 
diff --git a/telepathy-cm/protocol.h b/telepathy-cm/protocol.h
index 5431aa8..6d4e4fa 100644
--- a/telepathy-cm/protocol.h
+++ b/telepathy-cm/protocol.h
@@ -14,16 +14,15 @@
 #ifndef CONNECTCM_PROTOCOL_H
 #define CONNECTCM_PROTOCOL_H
 
-#include "connectcm_export.h"
-
 #include <TelepathyQt/BaseProtocol>
 
 class ConnectConnection;
 
-class CONNECTCM_EXPORT KDEConnectTelepathyProtocol : public Tp::BaseProtocol
+class KDEConnectTelepathyProtocol : public Tp::BaseProtocol
 {
     Q_OBJECT
     Q_DISABLE_COPY(KDEConnectTelepathyProtocol)
+    Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Telepathy.ConnectionManager.kdeconnect")
 
 public:
     KDEConnectTelepathyProtocol(const QDBusConnection &dbusConnection, const QString &name);
diff --git a/telepathy-cm/textchannel.h b/telepathy-cm/textchannel.h
index 3781283..163a23e 100644
--- a/telepathy-cm/textchannel.h
+++ b/telepathy-cm/textchannel.h
@@ -14,15 +14,13 @@
 #ifndef CONNECTCM_TEXTCHANNEL_H
 #define CONNECTCM_TEXTCHANNEL_H
 
-#include "connectcm_export.h"
-
 #include <TelepathyQt/BaseChannel>
 
 class ConnectTextChannel;
 
 typedef Tp::SharedPtr<ConnectTextChannel> ConnectTextChannelPtr;
 
-class CONNECTCM_EXPORT ConnectTextChannel : public Tp::BaseChannelTextType
+class ConnectTextChannel : public Tp::BaseChannelTextType
 {
     Q_OBJECT
 public:

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list