From 61718d9017607fef502d4eab77b0f885683da1ad Mon Sep 17 00:00:00 2001
From: Nicolas Fella
Date: Fri, 17 Feb 2023 16:29:36 +0100
Subject: [PATCH] Port QML KCMs away from setAboutData
Let them use the JSON metadata instead
---
src/kcms/decoration/kcm.cpp | 14 ++------------
src/kcms/decoration/kcm.h | 2 +-
src/kcms/desktop/virtualdesktops.cpp | 9 ++-------
src/kcms/desktop/virtualdesktops.h | 2 +-
src/kcms/effects/kcm.cpp | 14 ++------------
src/kcms/effects/kcm.h | 2 +-
src/kcms/rules/kcmrules.cpp | 15 ++-------------
src/kcms/rules/kcmrules.h | 2 +-
src/kcms/virtualkeyboard/kcmvirtualkeyboard.cpp | 11 ++---------
src/kcms/virtualkeyboard/kcmvirtualkeyboard.h | 2 +-
src/kcms/xwayland/kcmkwinxwayland.cpp | 11 ++---------
src/kcms/xwayland/kcmkwinxwayland.h | 2 +-
12 files changed, 18 insertions(+), 68 deletions(-)
diff --git a/src/kcms/decoration/kcm.cpp b/src/kcms/decoration/kcm.cpp
index c5d369ba43..343a6cdef9 100644
--- a/src/kcms/decoration/kcm.cpp
+++ b/src/kcms/decoration/kcm.cpp
@@ -11,7 +11,6 @@
#include "declarative-plugin/buttonsmodel.h"
#include "decorationmodel.h"
-#include
#include
#include
#include
@@ -36,8 +35,8 @@ namespace
const KDecoration2::BorderSize s_defaultRecommendedBorderSize = KDecoration2::BorderSize::Normal;
}
-KCMKWinDecoration::KCMKWinDecoration(QObject *parent, const QVariantList &arguments)
- : KQuickAddons::ManagedConfigModule(parent, arguments)
+KCMKWinDecoration::KCMKWinDecoration(QObject *parent, const KPluginMetaData &metaData, const QVariantList &arguments)
+ : KQuickAddons::ManagedConfigModule(parent, metaData, arguments)
, m_themesModel(new KDecoration2::Configuration::DecorationsModel(this))
, m_proxyThemesModel(new QSortFilterProxyModel(this))
, m_leftButtonsModel(new KDecoration2::Preview::ButtonsModel(DecorationButtonsList(), this))
@@ -45,15 +44,6 @@ KCMKWinDecoration::KCMKWinDecoration(QObject *parent, const QVariantList &argume
, m_availableButtonsModel(new KDecoration2::Preview::ButtonsModel(this))
, m_data(new KWinDecorationData(this))
{
- auto about = new KAboutData(QStringLiteral("kcm_kwindecoration"),
- i18n("Window Decorations"),
- QStringLiteral("1.0"),
- QString(),
- KAboutLicense::GPL);
- about->addAuthor(i18n("Valerio Pilo"),
- i18n("Author"),
- QStringLiteral("vpilo@coldshock.net"));
- setAboutData(about);
setButtons(Apply | Default | Help);
qmlRegisterAnonymousType("org.kde.kwin.KWinDecoration", 1);
qmlRegisterAnonymousType("org.kde.kwin.KWinDecoration", 1);
diff --git a/src/kcms/decoration/kcm.h b/src/kcms/decoration/kcm.h
index 047fdee794..4d9e36ca95 100644
--- a/src/kcms/decoration/kcm.h
+++ b/src/kcms/decoration/kcm.h
@@ -47,7 +47,7 @@ class KCMKWinDecoration : public KQuickAddons::ManagedConfigModule
Q_PROPERTY(QAbstractListModel *availableButtonsModel READ availableButtonsModel CONSTANT)
public:
- KCMKWinDecoration(QObject *parent, const QVariantList &arguments);
+ KCMKWinDecoration(QObject *parent, const KPluginMetaData &metaData, const QVariantList &arguments);
KWinDecorationSettings *settings() const;
QSortFilterProxyModel *themesModel() const;
diff --git a/src/kcms/desktop/virtualdesktops.cpp b/src/kcms/desktop/virtualdesktops.cpp
index 4c545b069a..911c2b4293 100644
--- a/src/kcms/desktop/virtualdesktops.cpp
+++ b/src/kcms/desktop/virtualdesktops.cpp
@@ -25,15 +25,10 @@ K_PLUGIN_FACTORY_WITH_JSON(VirtualDesktopsFactory,
namespace KWin
{
-VirtualDesktops::VirtualDesktops(QObject *parent, const QVariantList &args)
- : KQuickAddons::ManagedConfigModule(parent, args)
+VirtualDesktops::VirtualDesktops(QObject *parent, const KPluginMetaData &metaData, const QVariantList &args)
+ : KQuickAddons::ManagedConfigModule(parent, metaData, args)
, m_data(new VirtualDesktopsData(this))
{
- KAboutData *about = new KAboutData(QStringLiteral("kcm_kwin_virtualdesktops"),
- i18n("Virtual Desktops"),
- QStringLiteral("2.0"), QString(), KAboutLicense::GPL);
- setAboutData(about);
-
qmlRegisterAnonymousType("org.kde.kwin.kcm.desktop", 0);
setButtons(Apply | Default | Help);
diff --git a/src/kcms/desktop/virtualdesktops.h b/src/kcms/desktop/virtualdesktops.h
index 40d528397d..de8063e094 100644
--- a/src/kcms/desktop/virtualdesktops.h
+++ b/src/kcms/desktop/virtualdesktops.h
@@ -27,7 +27,7 @@ class VirtualDesktops : public KQuickAddons::ManagedConfigModule
Q_PROPERTY(VirtualDesktopsSettings *virtualDesktopsSettings READ virtualDesktopsSettings CONSTANT)
public:
- explicit VirtualDesktops(QObject *parent = nullptr, const QVariantList &list = QVariantList());
+ explicit VirtualDesktops(QObject *parent, const KPluginMetaData &metaData, const QVariantList &list);
~VirtualDesktops() override;
QAbstractItemModel *desktopsModel() const;
diff --git a/src/kcms/effects/kcm.cpp b/src/kcms/effects/kcm.cpp
index f07483262d..6e42d41457 100644
--- a/src/kcms/effects/kcm.cpp
+++ b/src/kcms/effects/kcm.cpp
@@ -9,7 +9,6 @@
#include "effectsfilterproxymodel.h"
#include "effectsmodel.h"
-#include
#include
#include
@@ -24,21 +23,12 @@ K_PLUGIN_FACTORY_WITH_JSON(DesktopEffectsKCMFactory,
namespace KWin
{
-DesktopEffectsKCM::DesktopEffectsKCM(QObject *parent, const QVariantList &args)
- : KQuickAddons::ConfigModule(parent, args)
+DesktopEffectsKCM::DesktopEffectsKCM(QObject *parent, const KPluginMetaData &metaData, const QVariantList &args)
+ : KQuickAddons::ConfigModule(parent, metaData, args)
, m_model(new EffectsModel(this))
{
qmlRegisterType("org.kde.private.kcms.kwin.effects", 1, 0, "EffectsFilterProxyModel");
- auto about = new KAboutData(
- QStringLiteral("kcm_kwin_effects"),
- i18n("Desktop Effects"),
- QStringLiteral("2.0"),
- QString(),
- KAboutLicense::GPL);
- about->addAuthor(i18n("Vlad Zahorodnii"), QString(), QStringLiteral("vlad.zahorodnii@kde.org"));
- setAboutData(about);
-
setButtons(Apply | Default | Help);
connect(m_model, &EffectsModel::dataChanged, this, &DesktopEffectsKCM::updateNeedsSave);
diff --git a/src/kcms/effects/kcm.h b/src/kcms/effects/kcm.h
index c83ec0778f..f57f80c9cf 100644
--- a/src/kcms/effects/kcm.h
+++ b/src/kcms/effects/kcm.h
@@ -22,7 +22,7 @@ class DesktopEffectsKCM : public KQuickAddons::ConfigModule
Q_PROPERTY(QAbstractItemModel *effectsModel READ effectsModel CONSTANT)
public:
- explicit DesktopEffectsKCM(QObject *parent = nullptr, const QVariantList &list = {});
+ explicit DesktopEffectsKCM(QObject *parent, const KPluginMetaData &metaData, const QVariantList &list);
~DesktopEffectsKCM() override;
QAbstractItemModel *effectsModel() const;
diff --git a/src/kcms/rules/kcmrules.cpp b/src/kcms/rules/kcmrules.cpp
index d99e640a64..c7c5a56950 100644
--- a/src/kcms/rules/kcmrules.cpp
+++ b/src/kcms/rules/kcmrules.cpp
@@ -11,7 +11,6 @@
#include
#include
-#include
#include
#include
#include
@@ -19,21 +18,11 @@
namespace KWin
{
-KCMKWinRules::KCMKWinRules(QObject *parent, const QVariantList &arguments)
- : KQuickAddons::ConfigModule(parent, arguments)
+KCMKWinRules::KCMKWinRules(QObject *parent, const KPluginMetaData &metaData, const QVariantList &arguments)
+ : KQuickAddons::ConfigModule(parent, metaData, arguments)
, m_ruleBookModel(new RuleBookModel(this))
, m_rulesModel(new RulesModel(this))
{
- auto about = new KAboutData(QStringLiteral("kcm_kwinrules"),
- i18n("Window Rules"),
- QStringLiteral("1.0"),
- QString(),
- KAboutLicense::GPL);
- about->addAuthor(i18n("Ismael Asensio"),
- i18n("Author"),
- QStringLiteral("isma.af@gmail.com"));
- setAboutData(about);
-
setQuickHelp(i18n("Window-specific Settings
Here you can customize window settings specifically only"
" for some windows.
"
" Please note that this configuration will not take effect if you do not use"
diff --git a/src/kcms/rules/kcmrules.h b/src/kcms/rules/kcmrules.h
index cd48f6f1d5..0733ab2e56 100644
--- a/src/kcms/rules/kcmrules.h
+++ b/src/kcms/rules/kcmrules.h
@@ -24,7 +24,7 @@ class KCMKWinRules : public KQuickAddons::ConfigModule
Q_PROPERTY(int editIndex READ editIndex NOTIFY editIndexChanged)
public:
- explicit KCMKWinRules(QObject *parent, const QVariantList &arguments);
+ explicit KCMKWinRules(QObject *parent, const KPluginMetaData &metaData, const QVariantList &arguments);
Q_INVOKABLE void setRuleDescription(int index, const QString &description);
Q_INVOKABLE void editRule(int index);
diff --git a/src/kcms/virtualkeyboard/kcmvirtualkeyboard.cpp b/src/kcms/virtualkeyboard/kcmvirtualkeyboard.cpp
index aec983c997..aebfa06636 100644
--- a/src/kcms/virtualkeyboard/kcmvirtualkeyboard.cpp
+++ b/src/kcms/virtualkeyboard/kcmvirtualkeyboard.cpp
@@ -6,7 +6,6 @@
#include "kcmvirtualkeyboard.h"
-#include
#include
#include
#include
@@ -18,18 +17,12 @@
K_PLUGIN_FACTORY_WITH_JSON(KcmVirtualKeyboardFactory, "kcm_virtualkeyboard.json", registerPlugin(); registerPlugin();)
-KcmVirtualKeyboard::KcmVirtualKeyboard(QObject *parent, const QVariantList &args)
- : KQuickAddons::ManagedConfigModule(parent)
+KcmVirtualKeyboard::KcmVirtualKeyboard(QObject *parent, const KPluginMetaData &metaData, const QVariantList &args)
+ : KQuickAddons::ManagedConfigModule(parent, metaData, args)
, m_data(new VirtualKeyboardData(this))
, m_model(new VirtualKeyboardsModel(this))
{
qmlRegisterAnonymousType("org.kde.kwin.virtualkeyboardsettings", 1);
-
- setAboutData(new KAboutData(QStringLiteral("kcm_virtualkeyboard"),
- i18n("Virtual Keyboard"),
- QStringLiteral("1.0"),
- i18n("Choose Virtual Keyboard"),
- KAboutLicense::GPL));
}
KcmVirtualKeyboard::~KcmVirtualKeyboard() = default;
diff --git a/src/kcms/virtualkeyboard/kcmvirtualkeyboard.h b/src/kcms/virtualkeyboard/kcmvirtualkeyboard.h
index 7e7707c0cf..cead783b24 100644
--- a/src/kcms/virtualkeyboard/kcmvirtualkeyboard.h
+++ b/src/kcms/virtualkeyboard/kcmvirtualkeyboard.h
@@ -42,7 +42,7 @@ class KcmVirtualKeyboard : public KQuickAddons::ManagedConfigModule
Q_PROPERTY(QAbstractItemModel *model READ keyboardsModel CONSTANT)
public:
- explicit KcmVirtualKeyboard(QObject *parent = nullptr, const QVariantList &list = QVariantList());
+ explicit KcmVirtualKeyboard(QObject *parent, const KPluginMetaData &metaData, const QVariantList &list);
~KcmVirtualKeyboard() override;
VirtualKeyboardSettings *settings() const;
diff --git a/src/kcms/xwayland/kcmkwinxwayland.cpp b/src/kcms/xwayland/kcmkwinxwayland.cpp
index 00ae369ccf..08a7fad858 100644
--- a/src/kcms/xwayland/kcmkwinxwayland.cpp
+++ b/src/kcms/xwayland/kcmkwinxwayland.cpp
@@ -6,7 +6,6 @@
#include "kcmkwinxwayland.h"
-#include
#include
#include
#include
@@ -18,19 +17,13 @@
K_PLUGIN_FACTORY_WITH_JSON(KcmXwaylandFactory, "kcm_kwinxwayland.json", registerPlugin(); registerPlugin();)
-KcmXwayland::KcmXwayland(QObject *parent, const QVariantList &args)
- : KQuickAddons::ManagedConfigModule(parent)
+KcmXwayland::KcmXwayland(QObject *parent, const KPluginMetaData &metaData, const QVariantList &args)
+ : KQuickAddons::ManagedConfigModule(parent, metaData, args)
, m_data(new KWinXwaylandData(this))
, m_settings(new KWinXwaylandSettings(m_data))
{
registerSettings(m_settings);
qmlRegisterAnonymousType("org.kde.kwin.kwinxwaylandsettings", 1);
-
- setAboutData(new KAboutData(QStringLiteral("kcm_kwinxwayland"),
- i18n("Legacy X11 App Support"),
- QStringLiteral("1.0"),
- i18n("Allow legacy X11 apps to read keystrokes typed in other apps"),
- KAboutLicense::GPL));
}
KcmXwayland::~KcmXwayland() = default;
diff --git a/src/kcms/xwayland/kcmkwinxwayland.h b/src/kcms/xwayland/kcmkwinxwayland.h
index e95d7ef53b..c981da9693 100644
--- a/src/kcms/xwayland/kcmkwinxwayland.h
+++ b/src/kcms/xwayland/kcmkwinxwayland.h
@@ -19,7 +19,7 @@ class KcmXwayland : public KQuickAddons::ManagedConfigModule
Q_PROPERTY(KWinXwaylandSettings *settings READ settings CONSTANT)
public:
- explicit KcmXwayland(QObject *parent = nullptr, const QVariantList &list = QVariantList());
+ explicit KcmXwayland(QObject *parent, const KPluginMetaData &metaData, const QVariantList &list);
~KcmXwayland() override;
KWinXwaylandSettings *settings() const