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 728b449891
,
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.
This commit is contained in:
parent
fdea6d151e
commit
c4bcfd0b8c
1 changed files with 3 additions and 11 deletions
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include <KAboutData>
|
||||
#include <KCModule>
|
||||
#include <KCModuleLoader>
|
||||
#include <KConfigGroup>
|
||||
#include <KLocalizedString>
|
||||
#include <KPackage/PackageLoader>
|
||||
|
@ -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<KCModule>(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);
|
||||
|
|
Loading…
Reference in a new issue