From c4bcfd0b8c278bd02001f5d64f5d472161861b59 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Tue, 11 Jan 2022 19:37:45 +0100 Subject: [PATCH] Utilize KCModuleLoader::loadModule for loading KCMs This will take care of showing user-visible error messages in case the plugin does not exist. While we get a log message from KCoreAddons with the change of 728b4498915a83636e753eebcd513202319ad973, the user does not get prompted. Especially if the kcmshell/systemsettings was not opened from the command line, spotting those error messages is more difficult. --- src/kcmkwin/common/effectsmodel.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/kcmkwin/common/effectsmodel.cpp b/src/kcmkwin/common/effectsmodel.cpp index e596695477..895876cc9a 100644 --- a/src/kcmkwin/common/effectsmodel.cpp +++ b/src/kcmkwin/common/effectsmodel.cpp @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -601,14 +602,10 @@ QModelIndex EffectsModel::findByPluginId(const QString &pluginId) const return index(std::distance(m_effects.constBegin(), it), 0); } -static KCModule *loadBinaryConfig(const QString &configModule, QObject *parent) +static KCModule *loadBinaryConfig(const QString &configModule, QWidget *parent) { - if (configModule.isEmpty()) { - return nullptr; - } - const KPluginMetaData metaData(QStringLiteral("kwin/effects/configs/") + configModule); - return KPluginFactory::instantiatePlugin(metaData, parent).plugin; + return KCModuleLoader::loadModule(metaData, parent); } static KCModule *findScriptedConfig(const QString &pluginId, QObject *parent) @@ -636,11 +633,6 @@ void EffectsModel::requestConfigure(const QModelIndex &index, QWindow *transient module = loadBinaryConfig(configModule, dialog); } - if (!module) { - delete dialog; - return; - } - dialog->setWindowTitle(index.data(NameRole).toString()); dialog->winId(); dialog->windowHandle()->setTransientParent(transientParent);