Remove unused code for loading task switcher KCM

For all the task switchers on my system there is no KCM installed:

```bash
rg 'X-KDE-ParentComponents=(PlasmaXLight|org.kde.breeze.desktop|org.kde.breezedark.desktop|org.kde.breezetwilight.desktop|org.kde.breeze.desktop|org.kde.breezedark.desktop|org.kde.breezetwilight.desktop|org.kde.plasma.mycroft.bigscreen|small_icons|big_icons|compact|text|present_windows|thumbnail_grid|thumbnails|informative)'
```

As the docs state, this is only for buildin effects. Which means it is internal API.
Also I consider the choice of displaying a KCM *or* the preview odd, IMHO the preview
is the most important part.

I stumbled upon this when reviewing the metadata files as part of the preparation
for https://phabricator.kde.org/T14564.

Also this way of plugin loading is discouraged for performance reasons, because all the
plugins from the namespace have to be reopened to get their metadata.
This commit is contained in:
Alexander Lohnau 2021-12-11 09:34:13 +01:00
parent 92d3345310
commit 901cc62d28

View file

@ -380,52 +380,6 @@ void KWinTabBoxConfig::configureEffectClicked()
new LayoutPreview(form->effectComboCurrentData(KWinTabBoxConfigForm::LayoutPath).toString(),
form->showDesktopMode(),
this);
} else {
// For builtin effect, display a configuration dialog
QPointer<QDialog> configDialog = new QDialog(this);
configDialog->setLayout(new QVBoxLayout);
configDialog->setWindowTitle(form->effectComboCurrentData(Qt::DisplayRole).toString());
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::RestoreDefaults, configDialog);
connect(buttonBox, &QDialogButtonBox::accepted, configDialog.data(), &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, configDialog.data(), &QDialog::reject);
const QString name = form->effectComboCurrentData().toString();
auto filter = [name](const KPluginMetaData &md) -> bool
{
const QStringList parentComponents = KPluginMetaData::readStringList(md.rawData(), QStringLiteral("X-KDE-ParentComponents"));
return parentComponents.contains(name);
};
const QVector<KPluginMetaData> plugins = KPluginMetaData::findPlugins(QStringLiteral("kwin/effects/configs/"), filter);
if (plugins.isEmpty()) {
delete configDialog;
return;
}
KCModule *kcm = KPluginFactory::instantiatePlugin<KCModule>(plugins.first(), configDialog).plugin;
if (!kcm) {
delete configDialog;
return;
}
connect(buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, kcm, &KCModule::defaults);
QWidget *showWidget = new QWidget(configDialog);
QVBoxLayout *layout = new QVBoxLayout;
showWidget->setLayout(layout);
layout->addWidget(kcm);
configDialog->layout()->addWidget(showWidget);
configDialog->layout()->addWidget(buttonBox);
if (configDialog->exec() == QDialog::Accepted) {
kcm->save();
} else {
kcm->load();
}
delete configDialog;
}
}