mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
kcms/hotspot: Port to mobileform components
This commit is contained in:
parent
56d530f855
commit
fa2f34ca41
1 changed files with 66 additions and 44 deletions
|
|
@ -1,60 +1,82 @@
|
||||||
/*
|
// SPDX-FileCopyrightText: 2020 Tobias Fella <fella@posteo.de>
|
||||||
SPDX-FileCopyrightText: 2020 Tobias Fella <fella@posteo.de>
|
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
|
||||||
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||||
|
|
||||||
SPDX-License-Identifier: LGPL-2.0-or-later
|
import QtQuick
|
||||||
*/
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Controls as Controls
|
||||||
|
|
||||||
import QtQuick 2.6
|
import org.kde.plasma.networkmanagement as PlasmaNM
|
||||||
import QtQuick.Layouts 1.2
|
import org.kde.kirigami as Kirigami
|
||||||
import QtQuick.Controls 2.2 as Controls
|
import org.kde.kcm
|
||||||
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
|
import org.kde.kirigamiaddons.labs.mobileform as MobileForm
|
||||||
import org.kde.kirigami 2.10 as Kirigami
|
|
||||||
import org.kde.kcm 1.2
|
|
||||||
|
|
||||||
SimpleKCM {
|
SimpleKCM {
|
||||||
|
id: root
|
||||||
|
|
||||||
PlasmaNM.Handler {
|
leftPadding: 0
|
||||||
id: handler
|
rightPadding: 0
|
||||||
}
|
topPadding: Kirigami.Units.gridUnit
|
||||||
|
bottomPadding: Kirigami.Units.gridUnit
|
||||||
|
|
||||||
PlasmaNM.WirelessStatus {
|
ColumnLayout {
|
||||||
id: wirelessStatus
|
spacing: 0
|
||||||
}
|
width: root.width
|
||||||
|
|
||||||
Kirigami.FormLayout {
|
PlasmaNM.Handler {
|
||||||
Controls.Switch {
|
id: handler
|
||||||
id: hotspotToggle
|
}
|
||||||
Kirigami.FormData.label: i18n("Enabled:")
|
|
||||||
checked: wirelessStatus.hotspotSSID.length !== 0
|
PlasmaNM.WirelessStatus {
|
||||||
onToggled: {
|
id: wirelessStatus
|
||||||
if (hotspotToggle.checked) {
|
}
|
||||||
handler.createHotspot();
|
|
||||||
} else {
|
MobileForm.FormCard {
|
||||||
handler.stopHotspot();
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
contentItem: ColumnLayout {
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
MobileForm.FormSwitchDelegate {
|
||||||
|
id: hotspotToggle
|
||||||
|
text: i18n("Hotspot")
|
||||||
|
description: i18n("Whether the wireless hotspot is enabled.");
|
||||||
|
|
||||||
|
checked: wirelessStatus.hotspotSSID.length !== 0
|
||||||
|
|
||||||
|
onToggled: {
|
||||||
|
if (hotspotToggle.checked) {
|
||||||
|
handler.createHotspot();
|
||||||
|
} else {
|
||||||
|
handler.stopHotspot();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.TextField {
|
MobileForm.FormCard {
|
||||||
id: hotspotName
|
Layout.fillWidth: true
|
||||||
Kirigami.FormData.label: i18n("SSID:")
|
Layout.topMargin: Kirigami.Units.largeSpacing
|
||||||
text: PlasmaNM.Configuration.hotspotName
|
|
||||||
}
|
|
||||||
|
|
||||||
Kirigami.PasswordField {
|
contentItem: ColumnLayout {
|
||||||
id: hotspotPassword
|
spacing: 0
|
||||||
Kirigami.FormData.label: i18n("Password:")
|
|
||||||
text: PlasmaNM.Configuration.hotspotPassword
|
|
||||||
}
|
|
||||||
|
|
||||||
Controls.Button {
|
MobileForm.FormTextFieldDelegate {
|
||||||
text: i18n("Save")
|
label: i18n("Hotspot SSID")
|
||||||
onClicked: {
|
enabled: !hotspotToggle.checked
|
||||||
PlasmaNM.Configuration.hotspotName = hotspotName.text
|
text: PlasmaNM.Configuration.hotspotName
|
||||||
PlasmaNM.Configuration.hotspotPassword = hotspotPassword.text
|
onTextChanged: PlasmaNM.Configuration.hotspotName = text
|
||||||
if (hotspotToggle.checked) {
|
}
|
||||||
handler.stopHotspot()
|
|
||||||
handler.createHotspot()
|
MobileForm.FormDelegateSeparator {}
|
||||||
|
|
||||||
|
MobileForm.FormTextFieldDelegate {
|
||||||
|
label: i18n("Hotspot Password")
|
||||||
|
enabled: !hotspotToggle.checked
|
||||||
|
echoMode: MobileForm.FormTextFieldDelegate.Password
|
||||||
|
text: PlasmaNM.Configuration.hotspotPassword
|
||||||
|
onTextChanged: PlasmaNM.Configuration.hotspotPassword = text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue