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

Maximiliano Curia maxy at moszumanska.debian.org
Fri Oct 14 14:28:52 UTC 2016


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

The following commit has been merged in the master branch:
commit cf3d37b5044a4b6630d0a151381cb168cc4a1a3a
Author: Vineet Garg <grgvineet at gmail.com>
Date:   Tue Aug 11 09:04:02 2015 +0530

    Fixed issue pointed out on RR
    Fixed some pairing handler issues
---
 core/backends/lan/landevicelink.cpp     |  2 +-
 core/backends/lan/lanpairinghandler.cpp |  7 ++++---
 core/backends/lan/server.h              |  2 +-
 core/backends/pairinghandler.h          | 11 +++++++++++
 core/daemon.cpp                         |  8 ++++++--
 core/device.cpp                         |  9 +++++----
 6 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/core/backends/lan/landevicelink.cpp b/core/backends/lan/landevicelink.cpp
index 3cd26cb..d293cd6 100644
--- a/core/backends/lan/landevicelink.cpp
+++ b/core/backends/lan/landevicelink.cpp
@@ -52,7 +52,7 @@ LanDeviceLink::LanDeviceLink(const QString& deviceId, LinkProvider* parent, QSsl
 
 QString LanDeviceLink::name()
 {
-    return "LanDeviceLink";
+    return "LanLink"; // Should be same in both android and kde version
 }
 
 void LanDeviceLink::setOnSsl(bool value)
diff --git a/core/backends/lan/lanpairinghandler.cpp b/core/backends/lan/lanpairinghandler.cpp
index 040ccfc..fd74d44 100644
--- a/core/backends/lan/lanpairinghandler.cpp
+++ b/core/backends/lan/lanpairinghandler.cpp
@@ -56,7 +56,7 @@ void LanPairingHandler::createPairPackage(NetworkPackage& np)
 void LanPairingHandler::packageReceived(const NetworkPackage& np)
 {
 
-    if (!np.get<QString>("link").compare(m_deviceLink->name())) return; // If this package is not received by my type of link
+    if (np.get<QString>("link").compare(m_deviceLink->name()) != 0) return; // If this package is not received by my type of link
 
     m_pairingTimeout.stop();
 
@@ -160,6 +160,7 @@ void LanPairingHandler::rejectPairing()
 {
     NetworkPackage np(PACKAGE_TYPE_PAIR);
     np.set("pair", false);
+    np.set("link", m_deviceLink->name());
     m_deviceLink->sendPackage(np);
     m_pairStatus = PairStatus::NotPaired;
 }
@@ -167,16 +168,16 @@ void LanPairingHandler::rejectPairing()
 void LanPairingHandler::unpair() {
     NetworkPackage np(PACKAGE_TYPE_PAIR);
     np.set("pair", false);
+    np.set("link", m_deviceLink->name());
     m_deviceLink->sendPackage(np);
     m_pairStatus = PairStatus::NotPaired;
-
-    Q_EMIT(unpairingDone()); // There will be multiple signals if there are multiple pairing handlers
 }
 
 void LanPairingHandler::pairingTimeout()
 {
     NetworkPackage np(PACKAGE_TYPE_PAIR);
     np.set("pair", false);
+    np.set("name", m_deviceLink->name());
     m_deviceLink->sendPackage(np);
     m_pairStatus = PairStatus::NotPaired;
     m_device->pairingTimeout(); // Use signal slot, or this is good ?
diff --git a/core/backends/lan/server.h b/core/backends/lan/server.h
index e0cabe6..64516f1 100644
--- a/core/backends/lan/server.h
+++ b/core/backends/lan/server.h
@@ -35,7 +35,7 @@ private:
     QList<QSslSocket*> pendingConnections;
 
 public:
-    Server(QObject* parent);
+    Server(QObject* parent = 0);
     virtual ~Server() {}
 
     QSslSocket* nextPendingConnection() Q_DECL_OVERRIDE;
diff --git a/core/backends/pairinghandler.h b/core/backends/pairinghandler.h
index 4eb041a..33d9224 100644
--- a/core/backends/pairinghandler.h
+++ b/core/backends/pairinghandler.h
@@ -27,6 +27,17 @@
 
 #include <QTimer>
 
+/*
+ * This class separates the pairing interface for each type of link.
+ * Since different links can pair via different methods, like for LanLink certificate and public key should be shared,
+ * for Bluetooth link they should be paired via bluetooth etc.
+ * Each "Device" instance maintains a hash map for these pairing handlers so that there can be single pairing handler per
+ * per link type per device.
+ * Pairing handler keeps information about device, latest link, and pair status of the link
+ * During first pairing process, the pairing process is nearly same as old process.
+ * After that if any one of the link is paired, then we can say that device is paired, so new link will pair automatically
+ */
+
 class PairingHandler : public QObject
 {
     Q_OBJECT
diff --git a/core/daemon.cpp b/core/daemon.cpp
index 233d35f..4edda41 100644
--- a/core/daemon.cpp
+++ b/core/daemon.cpp
@@ -131,8 +131,12 @@ QStringList Daemon::devices(bool onlyReachable, bool onlyVisible) const
 
 QByteArray Daemon::certificate(int format) const
 {
-	if (format == QSsl::Pem) return KdeConnectConfig::instance()->certificate().toPem();
-	else return KdeConnectConfig::instance()->certificate().toDer();
+	if (format == QSsl::Pem) {
+        return KdeConnectConfig::instance()->certificate().toPem();
+    }
+	else {
+        return KdeConnectConfig::instance()->certificate().toDer();
+    }
 }
 
 
diff --git a/core/device.cpp b/core/device.cpp
index be9cf62..76d2182 100644
--- a/core/device.cpp
+++ b/core/device.cpp
@@ -181,11 +181,11 @@ QString Device::pluginsConfigFile() const
 
 bool Device::pairRequested() const
 {
-    bool pr = false;
+    bool isPairRequested = false;
     Q_FOREACH(PairingHandler* ph, m_pairingHandlers) {
-        pr = pr || ph->pairRequested();
+        isPairRequested = isPairRequested || ph->pairRequested();
     }
-    return pr;
+    return isPairRequested;
 }
 
 void Device::requestPair()
@@ -224,6 +224,7 @@ void Device::unpair()
     Q_FOREACH(PairingHandler* ph, m_pairingHandlers.values()) {
         ph->unpair();
     }
+    unpairInternal(); // We do not depend on pairing handlers for unpairing, this method is likely to be called due to user events
 }
 
 void Device::unpairInternal()
@@ -239,7 +240,6 @@ void Device::unpairInternal()
 
 void Device::pairingTimeout()
 {
-    m_pairStatus = Device::NotPaired;
     Q_EMIT pairingFailed(i18n("Timed out"));
 }
 
@@ -370,6 +370,7 @@ void Device::rejectPairing()
 
     m_pairStatus = Device::NotPaired;
 
+    qDebug(KDECONNECT_CORE) << "Pairing handler count " << m_pairingHandlers.size();
     Q_FOREACH(PairingHandler* ph, m_pairingHandlers.values()) {
             ph->rejectPairing();
     }

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list