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.plasma.components 3.0 as PlasmaComponents
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
SimpleKCM {
@ -22,27 +22,22 @@ SimpleKCM {
leftPadding: 0
rightPadding: 0
topPadding: Kirigami.Units.gridUnit
topPadding: 0
bottomPadding: Kirigami.Units.gridUnit
ColumnLayout {
width: parent.width
spacing: 0
MobileForm.FormCard {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
FormCard.FormHeader {
title: i18n("Devices")
}
FormCard.FormCard {
Repeater {
model: kcm.batteries
delegate: MobileForm.AbstractFormDelegate {
delegate: FormCard.AbstractFormDelegate {
Layout.fillWidth: true
onClicked: kcm.push("BatteryPage.qml", { "battery": model.battery, "vendor": model.vendor, "product": model.product, "currentUdi": model.udi })
@ -115,20 +110,13 @@ SimpleKCM {
}
}
}
}
MobileForm.FormCard {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.gridUnit
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
FormCard.FormHeader {
title: i18n("Screen")
}
MobileForm.FormComboBoxDelegate {
FormCard.FormCard {
FormCard.FormComboBoxDelegate {
id: dimScreenCombo
text: i18nc("Part of a sentence like 'Dim screen after 5 minutes'", "Dim screen after")
model: kcm.timeOptions()
@ -137,9 +125,9 @@ SimpleKCM {
onCurrentIndexChanged: kcm.dimScreenIdx = currentIndex
}
MobileForm.FormDelegateSeparator { above: dimScreenCombo; below: screenOffCombo }
FormCard.FormDelegateSeparator { above: dimScreenCombo; below: screenOffCombo }
MobileForm.FormComboBoxDelegate {
FormCard.FormComboBoxDelegate {
id: screenOffCombo
text: i18nc("Part of a sentence like 'Turn off screen after 5 minutes'", "Turn off screen after")
model: kcm.timeOptions()
@ -148,9 +136,9 @@ SimpleKCM {
onCurrentIndexChanged: kcm.screenOffIdx = currentIndex
}
MobileForm.FormDelegateSeparator { above: screenOffCombo; below: suspendCombo }
FormCard.FormDelegateSeparator { above: screenOffCombo; below: suspendCombo }
MobileForm.FormComboBoxDelegate {
FormCard.FormComboBoxDelegate {
id: suspendCombo
text: i18nc("Part of a sentence like 'Suspend device after 5 minutes'", "Suspend device after")
model: kcm.timeOptions()
@ -160,5 +148,4 @@ SimpleKCM {
}
}
}
}
}