kcms: Port to kcmutils_add_qml_kcm and org.kde.config QML module

kcmutils_add_qml_kcm creates a QRC that contains the "ui" folder.
This this simplifies the installation of KCMs, because all needed files
are bundled with the plugin.
In KCMUtils this means we can get rid of KPackage.

The new org.kde.kcmutils QML module also contains the org.kde.kcm
components that were previously part of KDeclarative.

Depends on https://invent.kde.org/frameworks/kcmutils/-/merge_requests/146
This commit is contained in:
Alexander Lohnau 2023-05-10 14:27:03 +02:00
parent eea8200479
commit 784f36affa
25 changed files with 26 additions and 50 deletions

View file

@ -20,8 +20,7 @@ kcmutils_generate_module_data(
kconfig_add_kcfg_files(kcmkwindecoration_SRCS kwindecorationsettings.kcfgc GENERATE_MOC)
kcoreaddons_add_plugin(kcm_kwindecoration SOURCES ${kcmkwindecoration_SRCS} INSTALL_NAMESPACE "plasma/kcms/systemsettings")
kcmutils_generate_desktop_file(kcm_kwindecoration)
kcmutils_add_qml_kcm(kcm_kwindecoration SOURCES ${kcmkwindecoration_SRCS})
target_link_libraries(kcm_kwindecoration
KDecoration2::KDecoration
@ -50,9 +49,6 @@ target_link_libraries(kwin-applywindowdecoration
configure_file(window-decorations.knsrc.cmake ${CMAKE_CURRENT_BINARY_DIR}/window-decorations.knsrc)
# This desktop file is installed only for retrocompatibility with sycoca
install(FILES kwindecorationsettings.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/window-decorations.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR})
install(TARGETS kwin-applywindowdecoration DESTINATION ${KDE_INSTALL_LIBEXECDIR})
kpackage_install_package(package kcm_kwindecoration kcms)

View file

@ -8,7 +8,7 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls as QQC2
import org.kde.kcm as KCM
import org.kde.kcmutils as KCM
import org.kde.kirigami 2.20 as Kirigami
import org.kde.kwin.private.kdecoration as KDecoration

View file

@ -9,7 +9,7 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls as QQC2
import org.kde.kcm as KCM
import org.kde.kcmutils as KCM
import org.kde.kirigami 2.20 as Kirigami
KCM.AbstractKCM {

View file

@ -6,7 +6,7 @@
*/
import QtQuick
import org.kde.kcm as KCM
import org.kde.kcmutils as KCM
import org.kde.kirigami 2.20 as Kirigami
import org.kde.kwin.private.kdecoration as KDecoration

View file

@ -9,7 +9,7 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls as QQC2
import org.kde.kcm as KCM
import org.kde.kcmutils as KCM
import org.kde.kirigami 2.20 as Kirigami
import org.kde.newstuff as NewStuff

View file

@ -13,8 +13,7 @@ set(kcm_kwin_virtualdesktops_PART_SRCS
kconfig_add_kcfg_files(kcm_kwin_virtualdesktops_PART_SRCS virtualdesktopssettings.kcfgc GENERATE_MOC)
kcoreaddons_add_plugin(kcm_kwin_virtualdesktops SOURCES ${kcm_kwin_virtualdesktops_PART_SRCS} INSTALL_NAMESPACE "plasma/kcms/systemsettings")
kcmutils_generate_desktop_file(kcm_kwin_virtualdesktops)
kcmutils_add_qml_kcm(kcm_kwin_virtualdesktops SOURCES ${kcm_kwin_virtualdesktops_PART_SRCS})
target_link_libraries(kcm_kwin_virtualdesktops
Qt::DBus
@ -27,7 +26,4 @@ target_link_libraries(kcm_kwin_virtualdesktops
kcmkwincommon
)
########### install files ###############
install(FILES virtualdesktopssettings.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
kpackage_install_package(package kcm_kwin_virtualdesktops kcms)

View file

@ -8,7 +8,7 @@ import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Layouts
import org.kde.kcm as KCM
import org.kde.kcmutils as KCM
import org.kde.kirigami 2.20 as Kirigami
KCM.ScrollViewKCM {

View file

@ -9,8 +9,7 @@ set(kcm_kwin_effects_PART_SRCS
desktopeffectsdata.cpp
)
kcoreaddons_add_plugin(kcm_kwin_effects SOURCES ${kcm_kwin_effects_PART_SRCS} INSTALL_NAMESPACE "plasma/kcms/systemsettings")
kcmutils_generate_desktop_file(kcm_kwin_effects)
kcmutils_add_qml_kcm(kcm_kwin_effects SOURCES ${kcm_kwin_effects_PART_SRCS})
target_link_libraries(kcm_kwin_effects
Qt::DBus
@ -25,7 +24,4 @@ target_link_libraries(kcm_kwin_effects
kcmkwincommon
)
########### install files ###############
install(FILES kwineffect.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR})
kpackage_install_package(package kcm_kwin_effects kcms)

View file

@ -11,7 +11,7 @@ import QtQuick.Controls as QQC2
import QtQuick.Layouts
import org.kde.kirigami 2 as Kirigami
import org.kde.kcm as KCM
import org.kde.kcmutils as KCM
Kirigami.SwipeListItem {
id: listItem

View file

@ -10,7 +10,7 @@ import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Layouts
import org.kde.kcm
import org.kde.kcmutils
import org.kde.config
import org.kde.kirigami 2 as Kirigami
import org.kde.newstuff as NewStuff

View file

@ -41,8 +41,5 @@ if (KWIN_BUILD_ACTIVITIES)
endif()
target_link_libraries(KWinRulesObjects ${kcm_libs} ${kwin_kcm_rules_XCB_LIBS})
kcoreaddons_add_plugin(kcm_kwinrules SOURCES kcmrules.cpp INSTALL_NAMESPACE "plasma/kcms/systemsettings")
kcmutils_generate_desktop_file(kcm_kwinrules)
kcmutils_add_qml_kcm(kcm_kwinrules SOURCES kcmrules.cpp)
target_link_libraries(kcm_kwinrules KWinRulesObjects)
kpackage_install_package(package kcm_kwinrules kcms)

View file

@ -8,7 +8,7 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls as QQC2
import org.kde.kirigami 2.10 as Kirigami
import org.kde.kcm 1.6 as KCM
import org.kde.kcmutils as KCM
Kirigami.AbstractListItem {
id: ruleDelegate

View file

@ -8,12 +8,12 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls as QQC2
import org.kde.kirigami 2.19 as Kirigami
import org.kde.kcm
import org.kde.kcmutils as KCM
import org.kde.kitemmodels
import org.kde.kcms.kwinrules
ScrollViewKCM {
KCM.ScrollViewKCM {
id: rulesEditor
title: kcm.rulesModel.description

View file

@ -8,8 +8,7 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls as QQC2
import QtQml.Models
import org.kde.kcm as KCM
import org.kde.kcmutils as KCMUtils
import org.kde.kcmutils as KCM
import org.kde.kirigami 2.12 as Kirigami
KCM.ScrollViewKCM {
@ -19,8 +18,8 @@ KCM.ScrollViewKCM {
implicitWidth: Kirigami.Units.gridUnit * 35
implicitHeight: Kirigami.Units.gridUnit * 25
KCMUtils.ConfigModule.columnWidth: Kirigami.Units.gridUnit * 23
KCMUtils.ConfigModule.buttons: KCMUtils.ConfigModule.Help | KCMUtils.ConfigModule.Apply
KCM.ConfigModule.columnWidth: Kirigami.Units.gridUnit * 23
KCM.ConfigModule.buttons: KCM.ConfigModule.Help | KCM.ConfigModule.Apply
property var selectedIndexes: []

View file

@ -1,9 +1,8 @@
# KI18N Translation Domain for this library
add_definitions(-DTRANSLATION_DOMAIN=\"kcm_kwin_scripts\")
kcoreaddons_add_plugin(kcm_kwin_scripts INSTALL_NAMESPACE plasma/kcms/systemsettings)
kcmutils_add_qml_kcm(kcm_kwin_scripts INSTALL_NAMESPACE plasma/kcms/systemsettings)
kcmutils_generate_desktop_file(kcm_kwin_scripts)
target_sources(kcm_kwin_scripts PRIVATE
module.cpp
kwinscriptsdata.cpp
@ -19,5 +18,4 @@ target_link_libraries(kcm_kwin_scripts
KF6::KCMUtilsQuick
)
kpackage_install_package(package kcm_kwin_scripts kcms)
install(FILES kwinscripts.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR})

View file

@ -9,13 +9,12 @@ import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Layouts
import org.kde.kcm
import org.kde.config
import org.kde.kirigami 2.10 as Kirigami
import org.kde.newstuff as NewStuff
import org.kde.kcmutils as KCMUtils
import org.kde.kcmutils as KCM
ScrollViewKCM {
KCM.ScrollViewKCM {
implicitWidth: Kirigami.Units.gridUnit * 22
implicitHeight: Kirigami.Units.gridUnit * 20
@ -53,12 +52,12 @@ ScrollViewKCM {
}
}
view: KCMUtils.KPluginSelector {
view: KCMUtils.PluginSelector {
id: selector
sourceModel: kcm.model
query: searchField.text
delegate: KCMUtils.KPluginDelegate {
delegate: KCM.PluginDelegate {
onConfigTriggered: kcm.configure(model.config)
additionalActions: [
Kirigami.Action {

View file

@ -12,8 +12,7 @@ kcmutils_generate_module_data(
)
kconfig_add_kcfg_files(kcm_virtualkeyboard_PART_SRCS virtualkeyboardsettings.kcfgc GENERATE_MOC)
kcoreaddons_add_plugin(kcm_virtualkeyboard SOURCES kcmvirtualkeyboard.cpp ${kcm_virtualkeyboard_PART_SRCS} INSTALL_NAMESPACE plasma/kcms/systemsettings)
kcmutils_generate_desktop_file(kcm_virtualkeyboard)
kcmutils_add_qml_kcm(kcm_virtualkeyboard SOURCES kcmvirtualkeyboard.cpp ${kcm_virtualkeyboard_PART_SRCS})
target_link_libraries(kcm_virtualkeyboard
KF6::I18n
@ -21,5 +20,3 @@ target_link_libraries(kcm_virtualkeyboard
KF6::Service
KF6::KCMUtilsQuick
)
kpackage_install_package(package kcm_virtualkeyboard kcms)

View file

@ -9,7 +9,7 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls as QQC2
import org.kde.kirigami 2.6 as Kirigami
import org.kde.kcm as KCM
import org.kde.kcmutils as KCM
KCM.GridViewKCM {
id: root

View file

@ -12,8 +12,7 @@ kcmutils_generate_module_data(
)
kconfig_add_kcfg_files(kcm_kwinxwayland_PART_SRCS kwinxwaylandsettings.kcfgc GENERATE_MOC)
kcoreaddons_add_plugin(kcm_kwinxwayland SOURCES kcmkwinxwayland.cpp ${kcm_kwinxwayland_PART_SRCS} INSTALL_NAMESPACE plasma/kcms/systemsettings)
kcmutils_generate_desktop_file(kcm_kwinxwayland)
kcmutils_add_qml_kcm(kcm_kwinxwayland SOURCES kcmkwinxwayland.cpp ${kcm_kwinxwayland_PART_SRCS})
target_link_libraries(kcm_kwinxwayland
KF6::I18n
@ -21,4 +20,3 @@ target_link_libraries(kcm_kwinxwayland
KF6::KCMUtilsQuick
Wayland::Client
)
kpackage_install_package(package kcm_kwinxwayland kcms)

View file

@ -9,7 +9,7 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls as QQC2
import org.kde.kirigami 2.6 as Kirigami
import org.kde.kcm as KCM
import org.kde.kcmutils as KCM
import org.kde.kwin.kwinxwaylandsettings
import org.kde.kquickcontrols