From 901cc62d28586ebca528465aaf61fb0d009957d6 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Sat, 11 Dec 2021 09:34:13 +0100 Subject: [PATCH] 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. --- src/kcmkwin/kwintabbox/main.cpp | 46 --------------------------------- 1 file changed, 46 deletions(-) diff --git a/src/kcmkwin/kwintabbox/main.cpp b/src/kcmkwin/kwintabbox/main.cpp index d42bee3454..fcba5d9e88 100644 --- a/src/kcmkwin/kwintabbox/main.cpp +++ b/src/kcmkwin/kwintabbox/main.cpp @@ -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 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 plugins = KPluginMetaData::findPlugins(QStringLiteral("kwin/effects/configs/"), filter); - - if (plugins.isEmpty()) { - delete configDialog; - return; - } - - KCModule *kcm = KPluginFactory::instantiatePlugin(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; } }