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

Maximiliano Curia maxy at moszumanska.debian.org
Fri Oct 14 14:26:38 UTC 2016


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

The following commit has been merged in the master branch:
commit 3ff7779c7c6927dd0170896a8d9a0f53939eae8d
Author: Albert Vaca <albertvaka at gmail.com>
Date:   Tue Jun 25 18:08:34 2013 +0200

    Ooops
---
 daemon/CMakeLists.txt | 11 ++++++++++-
 daemon/daemon.cpp     |  5 +++++
 daemon/daemon.h       |  9 ++++++---
 daemon/device.h       | 18 +++++++++---------
 kcm/CMakeLists.txt    |  6 +++++-
 kcm/kcm.cpp           | 34 ++++++++++++++++++++++++++++------
 kcm/kcm.h             | 12 +++++++++++-
 letsgo.sh             |  4 ++--
 8 files changed, 76 insertions(+), 23 deletions(-)

diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt
index 0317020..e3116e1 100644
--- a/daemon/CMakeLists.txt
+++ b/daemon/CMakeLists.txt
@@ -14,7 +14,7 @@ set(kded_androidshine_SRCS
 
     networkpackage.cpp
     daemon.cpp
-
+    device.cpp
 )
 
 kde4_add_plugin(kded_androidshine ${kded_androidshine_SRCS})
@@ -28,6 +28,15 @@ target_link_libraries(kded_androidshine
     ${QJSON_LIBRARY}
 )
 
+qt4_generate_dbus_interface(
+    daemon.h
+    org.kde.kdeconnect.xml
+    OPTIONS -a
+)
+
+add_dependencies(kded_androidshine ${CMAKE_CURRENT_BINARY_DIR}/org.kde.kdeconnect.xml)
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.kdeconnect.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR})
 install(TARGETS kded_androidshine DESTINATION ${PLUGIN_INSTALL_DIR})
 install(FILES androidshine.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded)
 install(FILES androidshine.notifyrc DESTINATION ${DATA_INSTALL_DIR}/androidshine)
diff --git a/daemon/daemon.cpp b/daemon/daemon.cpp
index bac59b5..f2c1215 100644
--- a/daemon/daemon.cpp
+++ b/daemon/daemon.cpp
@@ -28,6 +28,7 @@
 #include <QtNetwork/QUdpSocket>
 #include <QFile>
 
+#include <QDBusConnection>
 #include <KDE/KIcon>
 
 #include <sstream>
@@ -72,6 +73,8 @@ Daemon::Daemon(QObject *parent, const QList<QVariant>&)
     //TODO: Read paired devices from config
     //pairedDevices.push_back(new Device("MyAndroid","MyAndroid"));
 
+    QDBusConnection::sessionBus().registerService("org.kde.kdeconnect");
+
 }
 
 QString Daemon::listVisibleDevices()
@@ -83,6 +86,8 @@ QString Daemon::listVisibleDevices()
     ret << std::setw(20) << "Name";
     ret << std::endl;
 
+    emit deviceAdded("hola","hola");
+
     Q_FOREACH (Device* d, visibleDevices) {
         ret << std::setw(20) << d->id().toStdString();
         ret << std::setw(20) << d->name().toStdString();
diff --git a/daemon/daemon.h b/daemon/daemon.h
index 723c182..9ca8bdd 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -47,13 +47,12 @@ class Daemon
     : public KDEDModule
 {
     Q_OBJECT
+    Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect")
 
 public:
     Daemon(QObject *parent, const QList<QVariant>&);
     ~Daemon();
 
-//DBUS interface
-
 private Q_SLOTS:
     void deviceConnection(DeviceLink* dl);
 
@@ -67,11 +66,15 @@ public Q_SLOTS:
     Q_SCRIPTABLE QString listPairedDevices(QString id);
 
     Q_SCRIPTABLE bool linkAllPairedDevices();
-
 */
 
     Q_SCRIPTABLE QString listLinkedDevices();
 
+Q_SIGNALS:
+
+    Q_SCRIPTABLE void deviceAdded(QString id, QString name);
+    Q_SCRIPTABLE void deviceRemoved(QString id);
+
 private:
 
     void linkTo(DeviceLink* dl);
diff --git a/daemon/device.h b/daemon/device.h
index d68c0c7..c2c3fe9 100644
--- a/daemon/device.h
+++ b/daemon/device.h
@@ -21,20 +21,20 @@
 #ifndef DEVICE_H
 #define DEVICE_H
 
+#include <QObject>
+#include <QDBusConnection>
 #include <QString>
 
-class Device
+class Device : public QObject
 {
+    Q_OBJECT
+
 public:
-    Device(const QString& id, const QString& name)
-    {
-        mDeviceId = id;
-        mDeviceName = name;
-    }
+    Device(const QString& id, const QString& name);
 
-    QString id() const{ return mDeviceId; }
-    QString name() const { return mDeviceName; }
-    bool paired() const { return mPaired; }
+    Q_SCRIPTABLE QString id() const{ return mDeviceId; }
+    Q_SCRIPTABLE QString name() const { return mDeviceName; }
+    Q_SCRIPTABLE bool paired() const { return mPaired; }
 
     void pair() {
         mPaired = true;
diff --git a/kcm/CMakeLists.txt b/kcm/CMakeLists.txt
index a27b505..87f13b0 100644
--- a/kcm/CMakeLists.txt
+++ b/kcm/CMakeLists.txt
@@ -3,7 +3,11 @@ set(kcm_SRCS
     kcm.cpp
 )
 
-qt4_automoc(${kcm_SRCS})
+qt4_add_dbus_interface(
+   kcm_SRCS
+   ${DBUS_INTERFACES_INSTALL_DIR}/org.kde.kdeconnect.xml
+   daemoninterface
+)
 
 kde4_add_ui_files(kcm_SRCS kcm.ui wizzard.ui)
 
diff --git a/kcm/kcm.cpp b/kcm/kcm.cpp
index 46b6db1..e341276 100644
--- a/kcm/kcm.cpp
+++ b/kcm/kcm.cpp
@@ -18,7 +18,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
 #include "kcm.h"
 #include "ui_kcm.h"
 
@@ -28,6 +27,8 @@
 #include <QtGui/QAction>
 #include <QtGui/QStackedLayout>
 #include <QtGui/QListView>
+#include <QDBusConnection>
+#include <QDBusInterface>
 
 #include <KDebug>
 #include <kpluginfactory.h>
@@ -38,21 +39,31 @@ K_EXPORT_PLUGIN(KdeConnectKcmFactory("kdeconnect-kcm", "kdeconnect-kcm"))
 
 KdeConnectKcm::KdeConnectKcm(QWidget *parent, const QVariantList&)
     : KCModule(KdeConnectKcmFactory::componentData(), parent)
+    , dbusInterface("org.kde.kded", "/modules/androidshine", QDBusConnection::sessionBus(), this)
 {
+    
     m_ui = new Ui::KdeConnectKcmUi();
     m_ui->setupUi(this);
 
     m_model = new QStandardItemModel(this);
-    //m_selectionModel = new QItemSelectionModel(m_model);
-    //connect(m_selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(currentChanged(QModelIndex,QModelIndex)));
-    //m_selectionModel->setCurrentIndex(m_model->index(0), QItemSelectionModel::SelectCurrent);
-
     m_ui->deviceList->setIconSize(QSize(32,32));
     m_ui->deviceList->setModel(m_model);
     //m_ui->deviceList->setSelectionModel(m_selectionModel);
 
+    connect(&dbusInterface, SIGNAL(deviceAdded(QString, QString)), this, SLOT(deviceAdded(QString)));
+    connect(&dbusInterface, SIGNAL(deviceRemoved(QString, QString)), this, SLOT(deviceRemoved(QString)));
+
+    //TODO: Listen to the objectManager signals objectAdded and objectRemoved, que el daemon exportara
+    //dbusInterface = new QDBusInterface("com.hal.wlan", "/com/hal/wlan/com/hal/wlan", "com.hal.wlan", QDBusConnection::SessionBus(), this);
+    //dbusInterface->connection().connect("com.hal.wlan", "/com/hal/wlan/com/hal/wlan", "com.hal.wlan", "status_changed", this, SLOT(deviceAdded())
+
+    //m_selectionModel = new QItemSelectionModel(m_model);
+    //connect(m_selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(currentChanged(QModelIndex,QModelIndex)));
+    //m_selectionModel->setCurrentIndex(m_model->index(0), QItemSelectionModel::SelectCurrent);
+
     connect(m_ui->removeButton, SIGNAL(clicked(bool)), this, SLOT(removeButtonClicked()));
     connect(m_ui->addButton, SIGNAL(clicked(bool)), this, SLOT(addButtonClicked()));
+
 }
 
 KdeConnectKcm::~KdeConnectKcm()
@@ -62,7 +73,7 @@ KdeConnectKcm::~KdeConnectKcm()
 
 void KdeConnectKcm::addButtonClicked()
 {
-
+    m_model->appendRow(new QStandardItem("lalal"));
 }
 
 void KdeConnectKcm::removeButtonClicked()
@@ -75,4 +86,15 @@ void KdeConnectKcm::currentChanged(const QModelIndex& current, const QModelIndex
 
 }
 
+void KdeConnectKcm::deviceAdded(QString id, QString name) //TODO: Rebre mes coses...
+{
+    m_model->appendRow(new QStandardItem("hola"));
+}
+
+void KdeConnectKcm::deviceRemoved(QString id)
+{
+
+}
+
+
 #include "kcm.moc"
diff --git a/kcm/kcm.h b/kcm/kcm.h
index ee76743..0f041bf 100644
--- a/kcm/kcm.h
+++ b/kcm/kcm.h
@@ -21,8 +21,12 @@
 #ifndef KDECONNECTKCM_H
 #define KDECONNECTKCM_H
 
+#include <QStandardItemModel>
+#include <QDBusConnection>
+
 #include <kcmodule.h>
-#include <qstandarditemmodel.h>
+
+#include "daemoninterface.h"
 
 class Create;
 class QModelIndex;
@@ -30,6 +34,8 @@ class AccountsModel;
 class AccountWidget;
 class QStackedLayout;
 class QItemSelectionModel;
+class QDBusInterface;
+
 namespace Ui {
     class KdeConnectKcmUi;
 }
@@ -46,7 +52,11 @@ private Q_SLOTS:
     void removeButtonClicked();
     void currentChanged(const QModelIndex& current, const QModelIndex& previous);
 
+    void deviceAdded(QString id, QString name);
+    void deviceRemoved(QString id);
+
 private:
+    LocalDaemonInterface dbusInterface;
     Ui::KdeConnectKcmUi* m_ui;
     QStandardItemModel* m_model;
 
diff --git a/letsgo.sh b/letsgo.sh
index 864fc40..04610f2 100755
--- a/letsgo.sh
+++ b/letsgo.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-#Source bashrc to define kdebuild
+#Source bashrc to define kdebuild and environment variables
 #http://techbase.kde.org/Getting_Started/Build/Environment
 . ~/.bashrc
 
@@ -12,7 +12,7 @@ if kdebuild; then
 	while killall -9 kded4; do
 		true
 	done
-	
+
 	#qdbus org.kde.kded /kded unloadModule androidshine
 	#qdbus org.kde.kded /kded loadModule androidshine
 	kded4 2>&1 | grep -v "^kded(" &

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list