9import QtQuick.Controls as Controls
10import org.kde.kirigami as Kirigami
11import org.kde.kirigamiaddons.formcard as FormCard
12import org.kde.kirigamiaddons.settings
14FormCard.FormCardPage {
17 required property string defaultModule
18 required property list<ConfigurationModule> modules
22 property var pageCache:
Object.create(null)
24 property bool initDone:
false
26 title:
i18ndc(
"kirigami-addons6",
"@title",
"Settings")
29 target:
window.pageStack.layers
31 onBusyChanged:
if (!
window.pageStack.layers.busy && !initDone) {
32 const module = getModuleByName(defaultModule);
34 window.pageStack.layers.push(pageForModule(module));
42 Layout.fillWidth:
true
43 Layout.topMargin:
Kirigami.Units.gridUnit
46 Layout.fillWidth:
true
49 topPadding:
Kirigami.Units.smallSpacing
50 bottomPadding:
Kirigami.Units.smallSpacing
54 Layout.fillWidth:
true
56 onTextChanged: repeater.filterText = text.toLowerCase();
65 property string filterText:
""
68 const isFiltering = filterText.length !== 0;
69 let filteredCategories =
new Array();
71 for (let i in root.modules) {
72 const module = modules[i];
73 const modulePassesFilter =
module.text.toLowerCase().includes(filterText);
74 if (module.visible && (isFiltering ? modulePassesFilter :
true)) {
75 const category = filteredCategories.find((category) =>
category.name === module.category);
79 filteredCategories.push({
80 name:
module.category,
86 return filteredCategories;
92 required
property var modelData
97 title: categoryDelegate.modelData.name ===
"_main_category" ?
i18ndc(
"kirigami-addons6",
"@title:group",
"Settings") : modelData.
name
107 model: categoryDelegate.modelData.modules
108 delegate: ColumnLayout {
111 required property int index
114 Layout.fillWidth: true
117 visible: moduleDelegate.index !== 0
124 root.window.pageStack.layers.push(pageForModule(modelData));
127 contentItem: RowLayout {
129 source: moduleDelegate.modelData.icon.name
130 Layout.rightMargin:
Kirigami.Units.largeSpacing
131 implicitWidth:
Kirigami.Units.iconSizes.medium
132 implicitHeight:
Kirigami.Units.iconSizes.medium
136 Layout.fillWidth:
true
137 text: moduleDelegate.modelData.text
138 elide:
Text.ElideRight
142 Layout.alignment:
Qt.AlignRight
143 source:
"arrow-right"
144 implicitWidth: Math.round(
Kirigami.Units.iconSizes.small * 0.75)
145 implicitHeight: Math.round(
Kirigami.Units.iconSizes.small * 0.75)
157 if (pageCache[module.moduleId]) {
158 return pageCache[module.moduleId];
160 const component =
module.page();
161 if (component.status === Component.Error) {
162 console.error(component.errorString());
164 const page = component.createObject(root, module.initialProperties());
165 if (page.title.length === 0) {
166 page.title =
module.text;
168 pageCache[module.moduleId] = page;
174 return modules.
find(module => module.moduleId == moduleId) ?? null;
This object holds the information of configuration module.
QString i18ndc(const char *domain, const char *context, const char *text, const TYPE &arg...)
KGUIADDONS_EXPORT QWindow * window(QObject *job)
QString name(StandardAction id)
Category category(StandardShortcut id)
const QList< QKeySequence > & find()