From 6281b9c232058759b21bf8e60c2f374fb5d42739 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Sun, 28 Aug 2016 11:19:00 +0200 Subject: [PATCH] Make it compile with Qt < 5.6 --- core/pluginloader.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/pluginloader.cpp b/core/pluginloader.cpp index 0a908f594..b913d6ced 100644 --- a/core/pluginloader.cpp +++ b/core/pluginloader.cpp @@ -109,8 +109,18 @@ QSet PluginLoader::pluginsForCapabilities(const QSet& incoming const QSet pluginIncomingCapabilities = KPluginMetaData::readStringList(service.rawData(), "X-KdeConnect-SupportedPackageType").toSet(); const QSet pluginOutgoingCapabilities = KPluginMetaData::readStringList(service.rawData(), "X-KdeConnect-OutgoingPackageType").toSet(); - if ((pluginIncomingCapabilities.isEmpty() && pluginOutgoingCapabilities.isEmpty()) - || incoming.intersects(pluginOutgoingCapabilities) || outgoing.intersects(pluginIncomingCapabilities)) { + bool capabilitiesEmpty = (pluginIncomingCapabilities.isEmpty() && pluginOutgoingCapabilities.isEmpty()); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) + bool capabilitiesIntersect = (outgoing.intersects(pluginIncomingCapabilities) || incoming.intersects(pluginOutgoingCapabilities)); +#else + QSet commonIncoming = incoming; + commonIncoming.intersect(pluginOutgoingCapabilities); + QSet commonOutgoing = outgoing; + commonOutgoing.intersect(pluginIncomingCapabilities); + bool capabilitiesIntersect = (!commonIncoming.isEmpty() || !commonOutgoing.isEmpty()); +#endif + + if (capabilitiesIntersect || capabilitiesEmpty) { ret += service.pluginId(); } else { qCDebug(KDECONNECT_CORE) << "Not loading plugin" << service.pluginId() << "because device doesn't support it";