Warning, /plasma-mobile/plasma-settings/src/qml/ModulesListPage.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2011-2014 Sebastian Kügler <sebas@kde.org>
0003  * SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
0004  * SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 import QtQuick
0008 import QtQuick.Layouts
0009 import QtQuick.Controls as Controls
0010 import org.kde.kirigami as Kirigami
0011 import org.kde.kirigamiaddons.formcard 1 as FormCard
0012 
0013 import org.kde.plasma.settings 0.1
0014 
0015 Kirigami.ScrollablePage {
0016     id: settingsRoot
0017 
0018     title: i18n("Settings")
0019     
0020     property alias model: repeater.model
0021     
0022     Kirigami.Theme.colorSet: Kirigami.Theme.Window
0023     Kirigami.Theme.inherit: false
0024             
0025     leftPadding: 0
0026     rightPadding: 0
0027     topPadding: 0
0028     bottomPadding: 0
0029     
0030     Component {
0031         id: settingsModuleDelegate
0032         
0033         Column {
0034             id: column
0035             Layout.fillWidth: true
0036             
0037             FormCard.FormDelegateSeparator {
0038                 anchors.left: parent.left
0039                 anchors.right: parent.right
0040                 anchors.leftMargin: Kirigami.Units.largeSpacing
0041                 anchors.rightMargin: Kirigami.Units.largeSpacing
0042                 visible: model.index !== 0
0043                 above: column.parent.visibleChildren[model.index] ? column.parent.visibleChildren[model.index] : null
0044                 below: delegateItem
0045             }
0046             
0047             FormCard.AbstractFormDelegate {
0048                 id: delegateItem
0049                 width: parent.width
0050                 property string name: model.name
0051                 property string description: model.description
0052                 property string iconName: model.iconName ? model.iconName : "question"
0053                 
0054                 onClicked: {
0055                     // Only the first main page has a kcm property
0056                     applicationWindow().openModule(model.id);
0057                 }
0058                 
0059                 // width: cardColumn.width
0060 
0061                 contentItem: RowLayout {
0062                     Kirigami.Icon {
0063                         source: delegateItem.iconName
0064                         Layout.rightMargin: Kirigami.Units.largeSpacing
0065                         implicitWidth: Kirigami.Units.iconSizes.medium
0066                         implicitHeight: Kirigami.Units.iconSizes.medium
0067                     }
0068                     
0069                     ColumnLayout {
0070                         Layout.fillWidth: true
0071                         spacing: Kirigami.Units.smallSpacing
0072                         
0073                         Controls.Label {
0074                             Layout.fillWidth: true
0075                             text: delegateItem.name
0076                             elide: Text.ElideRight
0077                         }
0078                         
0079                         Controls.Label {
0080                             Layout.fillWidth: true
0081                             text: delegateItem.description
0082                             color: Kirigami.Theme.disabledTextColor
0083                             font: Kirigami.Theme.smallFont
0084                             elide: Text.ElideRight
0085                         }
0086                     }
0087                     
0088                     Kirigami.Icon {
0089                         Layout.alignment: Qt.AlignRight
0090                         source: "arrow-right"
0091                         implicitWidth: Math.round(Kirigami.Units.iconSizes.small * 0.75)
0092                         implicitHeight: Math.round(Kirigami.Units.iconSizes.small * 0.75)
0093                     }
0094                 }
0095             }
0096         }
0097     }
0098 
0099     // This is pretty much a placeholder of what will be the sandboxing mechanism: this element will be a wayland compositor that will contain off-process kcm pages
0100     Component {
0101         id: kcmContainer
0102 
0103         KCMContainer {}
0104     }
0105 
0106     ColumnLayout {
0107         spacing: 0
0108         width: settingsRoot.width
0109         
0110         // search bar
0111         FormCard.FormCard {
0112             Layout.fillWidth: true
0113             Layout.topMargin: Kirigami.Units.largeSpacing
0114             
0115             FormCard.AbstractFormDelegate {
0116                 Layout.fillWidth: true
0117                 background: Item {}
0118 
0119                 contentItem: RowLayout {
0120                     Kirigami.SearchField {
0121                         id: searchField
0122                         Layout.fillWidth: true
0123                         autoAccept: true
0124                         onAccepted: settingsRoot.model.filterString = searchField.text
0125                     }
0126                 }
0127             }
0128         }
0129 
0130         FormCard.FormHeader {
0131             title: i18n("Settings")
0132         }
0133         
0134         // settings categories
0135         FormCard.FormCard {
0136             id: settingsCard
0137 
0138             Repeater {
0139                 id: repeater
0140                 delegate: settingsModuleDelegate
0141             }
0142         }
0143     }
0144 }