diff --git a/core/daemon.cpp b/core/daemon.cpp index 04218be1b..2c5c1ecff 100644 --- a/core/daemon.cpp +++ b/core/daemon.cpp @@ -123,7 +123,7 @@ void Daemon::removeDevice(Device* device) void Daemon::cleanDevices() { Q_FOREACH(Device* device, d->mDevices) { - if (!device->isPaired()) { + if (!device->isPaired() && device->connectionSource() == DeviceLink::ConnectionStarted::Remotely) { removeDevice(device); } } diff --git a/core/device.cpp b/core/device.cpp index 46df8bdd3..75bbcded8 100644 --- a/core/device.cpp +++ b/core/device.cpp @@ -489,6 +489,18 @@ void Device::setAsPaired() } +DeviceLink::ConnectionStarted Device::connectionSource() const +{ + DeviceLink::ConnectionStarted ret = DeviceLink::Remotely; + Q_FOREACH(DeviceLink* link, m_deviceLinks) { + if(link->connectionSource() == DeviceLink::ConnectionStarted::Locally) { + ret = DeviceLink::ConnectionStarted::Locally; + break; + } + } + return ret; +} + QStringList Device::availableLinks() const { QStringList sl; diff --git a/core/device.h b/core/device.h index fbffb990c..908333a7d 100644 --- a/core/device.h +++ b/core/device.h @@ -30,6 +30,7 @@ #include #include "networkpackage.h" +#include "backends/devicelink.h" class DeviceLink; class KdeConnectPlugin; @@ -108,6 +109,8 @@ public: void setPluginEnabled(const QString& pluginName, bool enabled); bool isPluginEnabled(const QString& pluginName) const; + DeviceLink::ConnectionStarted connectionSource() const; + public Q_SLOTS: ///sends a @p np package to the device virtual bool sendPackage(NetworkPackage& np);