Call connected only once in the lifetime of a plugin

This commit is contained in:
Albert Vaca Cintora 2023-06-24 20:34:15 +02:00
parent 0c1e0df5ae
commit 9fa07a2361

View file

@ -180,6 +180,8 @@ void Device::reloadPlugins()
} }
newPluginMap[pluginName] = plugin; newPluginMap[pluginName] = plugin;
plugin->connected();
} }
} }
} }
@ -192,11 +194,9 @@ void Device::reloadPlugins()
d->m_plugins = newPluginMap; d->m_plugins = newPluginMap;
d->m_pluginsByIncomingCapability = newPluginsByIncomingCapability; d->m_pluginsByIncomingCapability = newPluginsByIncomingCapability;
// Recreate dbus paths for all plugins (new and existing)
QDBusConnection bus = QDBusConnection::sessionBus(); QDBusConnection bus = QDBusConnection::sessionBus();
for (KdeConnectPlugin *plugin : qAsConst(d->m_plugins)) { for (KdeConnectPlugin *plugin : qAsConst(d->m_plugins)) {
// TODO: see how it works in Android (only done once, when created)
plugin->connected();
const QString dbusPath = plugin->dbusPath(); const QString dbusPath = plugin->dbusPath();
if (!dbusPath.isEmpty()) { if (!dbusPath.isEmpty()) {
bus.registerObject(dbusPath, bus.registerObject(dbusPath,