hotspot-kcm: Port to FormCard

This commit is contained in:
Carl Schwan 2023-09-21 19:30:04 +02:00
parent 69dc189941
commit dc047a0eb9
No known key found for this signature in database
GPG key ID: 02325448204E452A

View file

@ -9,75 +9,68 @@ import QtQuick.Controls as Controls
import org.kde.plasma.networkmanagement as PlasmaNM import org.kde.plasma.networkmanagement as PlasmaNM
import org.kde.kirigami as Kirigami import org.kde.kirigami as Kirigami
import org.kde.kcmutils import org.kde.kcmutils
import org.kde.kirigamiaddons.labs.mobileform as MobileForm import org.kde.kirigamiaddons.formcard as FormCard
SimpleKCM { SimpleKCM {
id: root id: root
leftPadding: 0 leftPadding: 0
rightPadding: 0 rightPadding: 0
topPadding: Kirigami.Units.gridUnit topPadding: 0
bottomPadding: Kirigami.Units.gridUnit bottomPadding: 0
ColumnLayout {
spacing: 0
width: root.width
data: [
PlasmaNM.Handler { PlasmaNM.Handler {
id: handler id: handler
} },
PlasmaNM.WirelessStatus { PlasmaNM.WirelessStatus {
id: wirelessStatus id: wirelessStatus
} }
]
MobileForm.FormCard { ColumnLayout {
Layout.fillWidth: true spacing: 0
contentItem: ColumnLayout { FormCard.FormCard {
spacing: 0 Layout.topMargin: Kirigami.Units.gridUnit
MobileForm.FormSwitchDelegate { FormCard.FormSwitchDelegate {
id: hotspotToggle id: hotspotToggle
text: i18n("Hotspot") text: i18n("Hotspot")
description: i18n("Whether the wireless hotspot is enabled."); description: i18n("Whether the wireless hotspot is enabled.");
checked: wirelessStatus.hotspotSSID.length !== 0 checked: wirelessStatus.hotspotSSID.length !== 0
onToggled: { onToggled: {
if (hotspotToggle.checked) { if (hotspotToggle.checked) {
handler.createHotspot(); handler.createHotspot();
} else { } else {
handler.stopHotspot(); handler.stopHotspot();
}
} }
} }
} }
} }
MobileForm.FormCard { FormCard.FormCard {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.gridUnit Layout.topMargin: Kirigami.Units.gridUnit
Layout.bottomMargin: Kirigami.Units.gridUnit
contentItem: ColumnLayout { FormCard.FormTextFieldDelegate {
spacing: 0 label: i18n("Hotspot SSID")
enabled: !hotspotToggle.checked
text: PlasmaNM.Configuration.hotspotName
onTextChanged: PlasmaNM.Configuration.hotspotName = text
}
MobileForm.FormTextFieldDelegate { FormCard.FormDelegateSeparator {}
label: i18n("Hotspot SSID")
enabled: !hotspotToggle.checked
text: PlasmaNM.Configuration.hotspotName
onTextChanged: PlasmaNM.Configuration.hotspotName = text
}
MobileForm.FormDelegateSeparator {} FormCard.FormTextFieldDelegate {
label: i18n("Hotspot Password")
MobileForm.FormTextFieldDelegate { enabled: !hotspotToggle.checked
label: i18n("Hotspot Password") echoMode: TextInput.Password
enabled: !hotspotToggle.checked text: PlasmaNM.Configuration.hotspotPassword
echoMode: TextInput.Password onTextChanged: PlasmaNM.Configuration.hotspotPassword = text
text: PlasmaNM.Configuration.hotspotPassword
onTextChanged: PlasmaNM.Configuration.hotspotPassword = text
}
} }
} }
} }