diff --git a/autotests/integration/kwin_wayland_test.cpp b/autotests/integration/kwin_wayland_test.cpp index fdbf9c9c70..15a5c3eacc 100644 --- a/autotests/integration/kwin_wayland_test.cpp +++ b/autotests/integration/kwin_wayland_test.cpp @@ -62,12 +62,12 @@ WaylandTestApplication::WaylandTestApplication(OperationMode mode, int &argc, ch removeLibraryPath(ownPath); addLibraryPath(ownPath); - const auto plugins = KPluginLoader::findPluginsById(QStringLiteral("org.kde.kwin.waylandbackends"), "KWinWaylandVirtualBackend"); - if (plugins.empty()) { + const KPluginMetaData plugin = KPluginMetaData::findPluginById(QStringLiteral("org.kde.kwin.waylandbackends"), "KWinWaylandVirtualBackend"); + if (!plugin.isValid()) { quit(); return; } - initPlatform(plugins.first()); + initPlatform(plugin); WaylandServer::create(this); setProcessStartupEnvironment(QProcessEnvironment::systemEnvironment()); } diff --git a/autotests/test_x11_timestamp_update.cpp b/autotests/test_x11_timestamp_update.cpp index f4d6b661cc..1210b51b6e 100644 --- a/autotests/test_x11_timestamp_update.cpp +++ b/autotests/test_x11_timestamp_update.cpp @@ -43,13 +43,13 @@ X11TestApplication::X11TestApplication(int &argc, char **argv) removeLibraryPath(ownPath); addLibraryPath(ownPath); - const auto plugins = KPluginLoader::findPluginsById(QStringLiteral("org.kde.kwin.platforms"), + const KPluginMetaData plugin = KPluginMetaData::findPluginById(QStringLiteral("org.kde.kwin.platforms"), QStringLiteral("KWinX11Platform")); - if (plugins.empty()) { + if (!plugin.isValid()) { quit(); return; } - initPlatform(plugins.first()); + initPlatform(plugin); } X11TestApplication::~X11TestApplication() diff --git a/src/decorations/decorationbridge.cpp b/src/decorations/decorationbridge.cpp index 333faa84d8..3e54528f6c 100644 --- a/src/decorations/decorationbridge.cpp +++ b/src/decorations/decorationbridge.cpp @@ -137,13 +137,13 @@ void DecorationBridge::init() void DecorationBridge::initPlugin() { - const auto offers = KPluginLoader::findPluginsById(s_pluginName, m_plugin); - if (offers.isEmpty()) { - qCWarning(KWIN_DECORATIONS) << "Could not locate decoration plugin"; + const KPluginMetaData metaData = KPluginMetaData::findPluginById(s_pluginName, m_plugin); + if (!metaData.isValid()) { + qCWarning(KWIN_DECORATIONS) << "Could not locate decoration plugin" << m_plugin; return; } - qCDebug(KWIN_DECORATIONS) << "Trying to load decoration plugin: " << offers.first().fileName(); - KPluginLoader loader(offers.first().fileName()); + qCDebug(KWIN_DECORATIONS) << "Trying to load decoration plugin: " << metaData.fileName(); + KPluginLoader loader(metaData.fileName()); KPluginFactory *factory = loader.factory(); if (!factory) { qCWarning(KWIN_DECORATIONS) << "Error loading plugin:" << loader.errorString(); diff --git a/src/kcmkwin/common/effectsmodel.cpp b/src/kcmkwin/common/effectsmodel.cpp index e0f36ceee2..c93198c557 100644 --- a/src/kcmkwin/common/effectsmodel.cpp +++ b/src/kcmkwin/common/effectsmodel.cpp @@ -605,13 +605,13 @@ QModelIndex EffectsModel::findByPluginId(const QString &pluginId) const static KCModule *loadBinaryConfig(const QString &configModule, QObject *parent) { - const QVector offers = KPluginLoader::findPluginsById(QStringLiteral("kwin/effects/configs/"), configModule); + const KPluginMetaData metaData = KPluginMetaData::findPluginById(QStringLiteral("kwin/effects/configs/"), configModule); - if (offers.isEmpty()) { + if (!metaData.isValid()) { return nullptr; } - KPluginLoader loader(offers.first().fileName()); + KPluginLoader loader(metaData.fileName()); KPluginFactory *factory = loader.factory(); return factory->create(parent); diff --git a/src/main_x11.cpp b/src/main_x11.cpp index c55f1eb830..ad867e072c 100644 --- a/src/main_x11.cpp +++ b/src/main_x11.cpp @@ -466,13 +466,13 @@ int main(int argc, char * argv[]) } // find and load the X11 platform plugin - const auto plugins = KPluginLoader::findPluginsById(QStringLiteral("org.kde.kwin.platforms"), - QStringLiteral("KWinX11Platform")); - if (plugins.isEmpty()) { + const KPluginMetaData plugin = KPluginMetaData::findPluginById(QStringLiteral("org.kde.kwin.platforms"), QStringLiteral("KWinX11Platform")); + + if (!plugin.isValid()) { std::cerr << "FATAL ERROR: KWin could not find the KWinX11Platform plugin" << std::endl; return 1; } - a.initPlatform(plugins.first()); + a.initPlatform(plugin); if (!a.platform()) { std::cerr << "FATAL ERROR: could not instantiate the platform plugin" << std::endl; return 1; diff --git a/src/pluginmanager.cpp b/src/pluginmanager.cpp index 93710d0908..0b4e3ae5b2 100644 --- a/src/pluginmanager.cpp +++ b/src/pluginmanager.cpp @@ -127,8 +127,8 @@ bool PluginManager::loadStaticPlugin(const QString &pluginId) bool PluginManager::loadDynamicPlugin(const QString &pluginId) { - const auto offers = KPluginLoader::findPluginsById(s_pluginDirectory, pluginId); - for (const KPluginMetaData &metadata : offers) { + const KPluginMetaData metadata = KPluginMetaData::findPluginById(s_pluginDirectory, pluginId); + if (metadata.isValid()) { if (loadDynamicPlugin(metadata)) { return true; }