diff --git a/core/device.cpp b/core/device.cpp index 31426ac29..d1bba2eed 100644 --- a/core/device.cpp +++ b/core/device.cpp @@ -62,7 +62,8 @@ Device::Device(QObject *parent, const QString &id) d = new Device::DevicePrivate(info); d->m_pairingHandler = new PairingHandler(this, PairState::Paired); - d->m_supportedPlugins = PluginLoader::instance()->getPluginList().toSet(); // Assume every plugin is supported until we get the capabilities + const auto supported = PluginLoader::instance()->getPluginList(); + d->m_supportedPlugins = QSet(supported.begin(), supported.end()); // Assume every plugin is supported until we get the capabilities // Register in bus QDBusConnection::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors); @@ -79,7 +80,8 @@ Device::Device(QObject *parent, DeviceLink *dl) d = new Device::DevicePrivate(dl->deviceInfo()); d->m_pairingHandler = new PairingHandler(this, PairState::NotPaired); - d->m_supportedPlugins = PluginLoader::instance()->getPluginList().toSet(); // Assume every plugin is supported until we get the capabilities + const auto supported = PluginLoader::instance()->getPluginList(); + d->m_supportedPlugins = QSet(supported.begin(), supported.end()); // Assume every plugin is supported until we get the capabilities addLink(dl); @@ -133,7 +135,7 @@ int Device::protocolVersion() QStringList Device::supportedPlugins() const { - return d->m_supportedPlugins.toList(); + return QList(d->m_supportedPlugins.cbegin(), d->m_supportedPlugins.cend()); } bool Device::hasPlugin(const QString &name) const @@ -161,8 +163,7 @@ void Device::reloadPlugins() const KPluginMetaData service = loader->getPluginInfo(pluginName); const bool pluginEnabled = isPluginEnabled(pluginName); - const QSet incomingCapabilities = - KPluginMetaData::readStringList(service.rawData(), QStringLiteral("X-KdeConnect-SupportedPacketType")).toSet(); + const QStringList incomingCapabilities = service.rawData().value(QStringLiteral("X-KdeConnect-SupportedPacketType")).toVariant().toStringList(); if (pluginEnabled) { KdeConnectPlugin *plugin = d->m_plugins.take(pluginName); diff --git a/core/kdeconnectconfig.cpp b/core/kdeconnectconfig.cpp index bd5146b8b..f6153b018 100644 --- a/core/kdeconnectconfig.cpp +++ b/core/kdeconnectconfig.cpp @@ -133,13 +133,15 @@ QSslCertificate KdeConnectConfig::certificate() DeviceInfo KdeConnectConfig::deviceInfo() { + const auto incoming = PluginLoader::instance()->incomingCapabilities(); + const auto outgoing = PluginLoader::instance()->outgoingCapabilities(); return DeviceInfo(deviceId(), certificate(), name(), deviceType(), NetworkPacket::s_protocolVersion, - PluginLoader::instance()->incomingCapabilities().toSet(), - PluginLoader::instance()->outgoingCapabilities().toSet()); + QSet(incoming.begin(), incoming.end()), + QSet(outgoing.begin(), outgoing.end())); } QDir KdeConnectConfig::baseConfigDir() diff --git a/core/kdeconnectplugin.cpp b/core/kdeconnectplugin.cpp index 406c2a1ad..213ecbe54 100644 --- a/core/kdeconnectplugin.cpp +++ b/core/kdeconnectplugin.cpp @@ -22,7 +22,13 @@ KdeConnectPlugin::KdeConnectPlugin(QObject *parent, const QVariantList &args) { d->m_device = qvariant_cast(args.at(0)); d->m_pluginName = args.at(1).toString(); + +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + const QStringList cap = args.at(2).toStringList(); + d->m_outgoingCapabilties = QSet(cap.begin(), cap.end()); +#else d->m_outgoingCapabilties = args.at(2).toStringList().toSet(); +#endif d->m_config = nullptr; d->iconName = args.at(3).toString(); }