power-kcm: Port to FormCard

This commit is contained in:
Carl Schwan 2023-09-21 21:08:02 +02:00
parent a12a106439
commit c864d9f5e1
No known key found for this signature in database
GPG key ID: 02325448204E452A

View file

@ -14,7 +14,7 @@ import QtQuick.Layouts 1.11
import org.kde.kirigami 2.10 as Kirigami import org.kde.kirigami 2.10 as Kirigami
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.kcmutils import org.kde.kcmutils
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.kcm.power.mobile.private 1.0 import org.kde.kcm.power.mobile.private 1.0
SimpleKCM { SimpleKCM {
@ -22,27 +22,22 @@ SimpleKCM {
leftPadding: 0 leftPadding: 0
rightPadding: 0 rightPadding: 0
topPadding: Kirigami.Units.gridUnit topPadding: 0
bottomPadding: Kirigami.Units.gridUnit bottomPadding: Kirigami.Units.gridUnit
ColumnLayout { ColumnLayout {
width: parent.width width: parent.width
spacing: 0 spacing: 0
MobileForm.FormCard { FormCard.FormHeader {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Devices") title: i18n("Devices")
} }
FormCard.FormCard {
Repeater { Repeater {
model: kcm.batteries model: kcm.batteries
delegate: MobileForm.AbstractFormDelegate { delegate: FormCard.AbstractFormDelegate {
Layout.fillWidth: true Layout.fillWidth: true
onClicked: kcm.push("BatteryPage.qml", { "battery": model.battery, "vendor": model.vendor, "product": model.product, "currentUdi": model.udi }) onClicked: kcm.push("BatteryPage.qml", { "battery": model.battery, "vendor": model.vendor, "product": model.product, "currentUdi": model.udi })
@ -115,20 +110,13 @@ SimpleKCM {
} }
} }
} }
}
MobileForm.FormCard { FormCard.FormHeader {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.gridUnit
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Screen") title: i18n("Screen")
} }
MobileForm.FormComboBoxDelegate { FormCard.FormCard {
FormCard.FormComboBoxDelegate {
id: dimScreenCombo id: dimScreenCombo
text: i18nc("Part of a sentence like 'Dim screen after 5 minutes'", "Dim screen after") text: i18nc("Part of a sentence like 'Dim screen after 5 minutes'", "Dim screen after")
model: kcm.timeOptions() model: kcm.timeOptions()
@ -137,9 +125,9 @@ SimpleKCM {
onCurrentIndexChanged: kcm.dimScreenIdx = currentIndex onCurrentIndexChanged: kcm.dimScreenIdx = currentIndex
} }
MobileForm.FormDelegateSeparator { above: dimScreenCombo; below: screenOffCombo } FormCard.FormDelegateSeparator { above: dimScreenCombo; below: screenOffCombo }
MobileForm.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
id: screenOffCombo id: screenOffCombo
text: i18nc("Part of a sentence like 'Turn off screen after 5 minutes'", "Turn off screen after") text: i18nc("Part of a sentence like 'Turn off screen after 5 minutes'", "Turn off screen after")
model: kcm.timeOptions() model: kcm.timeOptions()
@ -148,9 +136,9 @@ SimpleKCM {
onCurrentIndexChanged: kcm.screenOffIdx = currentIndex onCurrentIndexChanged: kcm.screenOffIdx = currentIndex
} }
MobileForm.FormDelegateSeparator { above: screenOffCombo; below: suspendCombo } FormCard.FormDelegateSeparator { above: screenOffCombo; below: suspendCombo }
MobileForm.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
id: suspendCombo id: suspendCombo
text: i18nc("Part of a sentence like 'Suspend device after 5 minutes'", "Suspend device after") text: i18nc("Part of a sentence like 'Suspend device after 5 minutes'", "Suspend device after")
model: kcm.timeOptions() model: kcm.timeOptions()
@ -161,4 +149,3 @@ SimpleKCM {
} }
} }
} }
}