From f194ab9a5236986b68a38c216ae9e61493ac1f03 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Fri, 16 Aug 2013 01:01:58 +0200 Subject: [PATCH] Plugins are not loaded until a device is reachable --- daemon/device.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/daemon/device.cpp b/daemon/device.cpp index 32ee92692..e349b03de 100644 --- a/daemon/device.cpp +++ b/daemon/device.cpp @@ -70,7 +70,7 @@ void Device::reloadPlugins() { QMap< QString, KdeConnectPlugin* > newPluginMap; - if (paired()) { //Do not load any plugin for unpaired devices + if (paired() && reachable()) { //Do not load any plugin for unpaired devices, nor useless loading them for unreachable devices QString path = KStandardDirs().resourceDirs("config").first()+"kdeconnect/"; QMap pluginStates = KSharedConfig::openConfig(path + id())->group("Plugins").entryMap(); @@ -150,6 +150,7 @@ void Device::addLink(DeviceLink* link) qSort(m_deviceLinks.begin(),m_deviceLinks.end(),lessThan); if (m_deviceLinks.size() == 1) { + reloadPlugins(); Q_EMIT reachableStatusChanged(); } @@ -167,6 +168,7 @@ void Device::removeLink(DeviceLink* link) qDebug() << "RemoveLink"<< m_deviceLinks.size() << "links remaining"; if (m_deviceLinks.empty()) { + reloadPlugins(); Q_EMIT reachableStatusChanged(); } }