small code simplification
removes changes from list to set always uses the same path for figuring out the interfaces. reviewed by Albert Vaca
This commit is contained in:
parent
df3581459a
commit
617b66aeb8
1 changed files with 8 additions and 12 deletions
|
@ -122,24 +122,20 @@ void Device::reloadPlugins()
|
||||||
foreach (const QString& pluginName, loader->getPluginList()) {
|
foreach (const QString& pluginName, loader->getPluginList()) {
|
||||||
if (isPluginEnabled(pluginName)) {
|
if (isPluginEnabled(pluginName)) {
|
||||||
KdeConnectPlugin* plugin = m_plugins.take(pluginName);
|
KdeConnectPlugin* plugin = m_plugins.take(pluginName);
|
||||||
QStringList incomingInterfaces, outgoingInterfaces;
|
|
||||||
if (plugin) {
|
const KPluginMetaData service = loader->getPluginInfo(pluginName);
|
||||||
incomingInterfaces = m_pluginsByIncomingInterface.keys(plugin);
|
QSet<QString> incomingInterfaces = KPluginMetaData::readStringList(service.rawData(), "X-KdeConnect-SupportedPackageType").toSet();
|
||||||
outgoingInterfaces = m_pluginsByOutgoingInterface.keys(plugin);
|
QSet<QString> outgoingInterfaces = KPluginMetaData::readStringList(service.rawData(), "X-KdeConnect-OutgoingPackageType").toSet();
|
||||||
} else {
|
|
||||||
const KPluginMetaData service = loader->getPluginInfo(pluginName);
|
supportedIncomingInterfaces += incomingInterfaces;
|
||||||
incomingInterfaces = KPluginMetaData::readStringList(service.rawData(), "X-KdeConnect-SupportedPackageType");
|
|
||||||
outgoingInterfaces = KPluginMetaData::readStringList(service.rawData(), "X-KdeConnect-OutgoingPackageType");
|
|
||||||
}
|
|
||||||
supportedIncomingInterfaces += incomingInterfaces.toSet();
|
|
||||||
|
|
||||||
//If we don't find intersection with the received on one end and the sent on the other, we don't
|
//If we don't find intersection with the received on one end and the sent on the other, we don't
|
||||||
//let the plugin stay
|
//let the plugin stay
|
||||||
//Also, if no capabilities are specified on the other end, we don't apply this optimizaton, as
|
//Also, if no capabilities are specified on the other end, we don't apply this optimizaton, as
|
||||||
//we assume that the other client doesn't know about capabilities.
|
//we assume that the other client doesn't know about capabilities.
|
||||||
if (!m_incomingCapabilities.isEmpty() && !m_outgoingCapabilities.isEmpty()
|
if (!m_incomingCapabilities.isEmpty() && !m_outgoingCapabilities.isEmpty()
|
||||||
&& (m_incomingCapabilities & outgoingInterfaces.toSet()).isEmpty()
|
&& (m_incomingCapabilities & outgoingInterfaces).isEmpty()
|
||||||
&& (m_outgoingCapabilities & incomingInterfaces.toSet()).isEmpty()
|
&& (m_outgoingCapabilities & incomingInterfaces).isEmpty()
|
||||||
) {
|
) {
|
||||||
qCWarning(KDECONNECT_CORE) << "not loading " << pluginName << "because of unmatched capabilities";
|
qCWarning(KDECONNECT_CORE) << "not loading " << pluginName << "because of unmatched capabilities";
|
||||||
delete plugin;
|
delete plugin;
|
||||||
|
|
Loading…
Reference in a new issue