[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdeconnect-kde/filetransfer-debug] kded: ProtocolVersion is read for already known devices too
From: Albert Vaca <albertvaka () gmail ! com>
Date: 2013-10-01 1:18:44
Message-ID: E1VQobs-00064T-Ct () scm ! kde ! org
[Download RAW message or body]
Git commit 920d945a5df1f2b9576689b4c5425b02d86400c8 by Albert Vaca.
Committed on 01/10/2013 at 01:11.
Pushed by albertvaka into branch 'filetransfer-debug'.
ProtocolVersion is read for already known devices too
It might have changed since last connection, so we don't store it
M +1 -1 kded/daemon.cpp
M +9 -7 kded/device.cpp
M +1 -1 kded/device.h
http://commits.kde.org/kdeconnect-kde/920d945a5df1f2b9576689b4c5425b02d86400c8
diff --git a/kded/daemon.cpp b/kded/daemon.cpp
index e873ed7..16355d5 100644
--- a/kded/daemon.cpp
+++ b/kded/daemon.cpp
@@ -140,7 +140,7 @@ void Daemon::onNewDeviceLink(const NetworkPackage& \
identityPackage, DeviceLink* if (mDevices.contains(id)) {
//qDebug() << "It is a known device";
Device* device = mDevices[id];
- device->addLink(dl);
+ device->addLink(identityPackage, dl);
} else {
//qDebug() << "It is a new device";
diff --git a/kded/device.cpp b/kded/device.cpp
index 035d3a2..b7b015d 100644
--- a/kded/device.cpp
+++ b/kded/device.cpp
@@ -34,6 +34,8 @@ Device::Device(const QString& id)
m_pairStatus = Device::Paired;
+ m_protocolVersion = NetworkPackage::ProtocolVersion; //We don't know it yet
+
//Register in bus
QDBusConnection::sessionBus().registerObject(dbusPath(), this, \
QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors);
@@ -43,13 +45,8 @@ Device::Device(const NetworkPackage& identityPackage, DeviceLink* \
dl) {
m_deviceId = identityPackage.get<QString>("deviceId");
m_deviceName = identityPackage.get<QString>("deviceName");
-
m_protocolVersion = identityPackage.get<int>("protocolVersion");
- if (m_protocolVersion != NetworkPackage::ProtocolVersion) {
- qWarning() << m_deviceName << "- warning, device uses a different protocol \
version" << m_protocolVersion << "expected" << \
NetworkPackage::ProtocolVersion;
- }
-
- addLink(dl);
+ addLink(identityPackage, dl);
m_pairStatus = Device::NotPaired;
@@ -195,10 +192,15 @@ static bool lessThan(DeviceLink* p1, DeviceLink* p2)
return p1->provider()->priority() > p2->provider()->priority();
}
-void Device::addLink(DeviceLink* link)
+void Device::addLink(const NetworkPackage& identityPackage, DeviceLink* link)
{
//qDebug() << "Adding link to" << id() << "via" << link->provider();
+ m_protocolVersion = identityPackage.get<int>("protocolVersion");
+ if (m_protocolVersion != NetworkPackage::ProtocolVersion) {
+ qWarning() << m_deviceName << "- warning, device uses a different protocol \
version" << m_protocolVersion << "expected" << NetworkPackage::ProtocolVersion; + \
} +
connect(link, SIGNAL(destroyed(QObject*)),
this, SLOT(linkDestroyed(QObject*)));
diff --git a/kded/device.h b/kded/device.h
index ea87dea..7ac646b 100644
--- a/kded/device.h
+++ b/kded/device.h
@@ -62,7 +62,7 @@ public:
QString dbusPath() const { return "/modules/kdeconnect/devices/"+id(); }
//Add and remove links
- void addLink(DeviceLink*);
+ void addLink(const NetworkPackage& identityPackage, DeviceLink*);
void removeLink(DeviceLink*);
Q_SCRIPTABLE bool isPaired() const { return m_pairStatus==Device::Paired; }
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic