mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-26 06:14:45 +00:00
kcms/wifi: Port to MobileForm
Fixes https://invent.kde.org/plasma/plasma-mobile/-/issues/279
This commit is contained in:
parent
c35e4a94d9
commit
17024dfdd4
3 changed files with 359 additions and 253 deletions
|
|
@ -1,20 +1,21 @@
|
||||||
/*
|
// SPDX-FileCopyrightText: 2017 Martin Kacej <m.kacej@atlas.sk>
|
||||||
SPDX-FileCopyrightText: 2017 Martin Kacej <m.kacej@atlas.sk>
|
// 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.Window
|
||||||
|
import QtQuick.Controls as Controls
|
||||||
|
|
||||||
import QtQuick 2.6
|
|
||||||
import QtQuick.Layouts 1.2
|
|
||||||
import QtQuick.Controls 2.2 as Controls
|
|
||||||
import org.kde.plasma.networkmanagement as PlasmaNM
|
import org.kde.plasma.networkmanagement as PlasmaNM
|
||||||
import org.kde.kirigami 2.2 as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
import org.kde.ksvg 1.0 as KSvg
|
import org.kde.ksvg as KSvg
|
||||||
|
import org.kde.kirigamiaddons.formcard 1 as FormCard
|
||||||
|
|
||||||
Kirigami.SwipeListItem {
|
FormCard.AbstractFormDelegate {
|
||||||
|
id: delegate
|
||||||
enabled: true
|
|
||||||
|
|
||||||
|
property bool editMode
|
||||||
property var map : []
|
property var map : []
|
||||||
property bool predictableWirelessPassword: !Uuid && Type == PlasmaNM.Enums.Wireless &&
|
property bool predictableWirelessPassword: !Uuid && Type == PlasmaNM.Enums.Wireless &&
|
||||||
(SecurityType == PlasmaNM.Enums.StaticWep ||
|
(SecurityType == PlasmaNM.Enums.StaticWep ||
|
||||||
|
|
@ -22,54 +23,80 @@ Kirigami.SwipeListItem {
|
||||||
SecurityType == PlasmaNM.Enums.Wpa2Psk ||
|
SecurityType == PlasmaNM.Enums.Wpa2Psk ||
|
||||||
SecurityType == PlasmaNM.Enums.SAE)
|
SecurityType == PlasmaNM.Enums.SAE)
|
||||||
|
|
||||||
|
verticalPadding: Kirigami.Units.largeSpacing
|
||||||
|
|
||||||
contentItem: RowLayout {
|
contentItem: RowLayout {
|
||||||
spacing: Kirigami.Units.largeSpacing
|
spacing: 0
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.rightMargin: Kirigami.Units.gridUnit
|
||||||
|
implicitWidth: Kirigami.Units.iconSizes.smallMedium
|
||||||
|
implicitHeight: Kirigami.Units.iconSizes.smallMedium
|
||||||
|
|
||||||
Kirigami.Icon {
|
Kirigami.Icon {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
implicitWidth: Kirigami.Units.iconSizes.smallMedium
|
||||||
Layout.preferredWidth: Kirigami.Units.iconSizes.medium
|
implicitHeight: Kirigami.Units.iconSizes.smallMedium
|
||||||
Layout.preferredHeight: Kirigami.Units.iconSizes.medium
|
visible: ConnectionState !== PlasmaNM.Enums.Activating
|
||||||
|
anchors.centerIn: parent
|
||||||
source: mobileProxyModel.showSavedMode ? "network-wireless-connected-100" : ConnectionIcon
|
source: mobileProxyModel.showSavedMode ? "network-wireless-connected-100" : ConnectionIcon
|
||||||
|
}
|
||||||
|
|
||||||
Controls.BusyIndicator {
|
Controls.BusyIndicator {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
running: ConnectionState == PlasmaNM.Enums.Activating
|
running: ConnectionState === PlasmaNM.Enums.Activating
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.Label {
|
Controls.Label {
|
||||||
|
id: internalTextItem
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
elide: Text.ElideRight
|
|
||||||
text: ItemUniqueName
|
text: ItemUniqueName
|
||||||
textFormat: Text.PlainText
|
elide: Text.ElideRight
|
||||||
}
|
font.bold: ConnectionState === PlasmaNM.Enums.Activated
|
||||||
|
Accessible.ignored: true // base class sets this text on root already
|
||||||
}
|
}
|
||||||
|
|
||||||
actions: [
|
RowLayout {
|
||||||
Kirigami.Action {
|
// ensure that the row is always of same height
|
||||||
|
Controls.ToolButton {
|
||||||
|
id: heightMetrics
|
||||||
|
opacity: 0
|
||||||
|
implicitWidth: 0
|
||||||
|
icon.name: 'network-connect'
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
|
Controls.ToolButton {
|
||||||
icon.name: "network-connect"
|
icon.name: "network-connect"
|
||||||
visible: ConnectionState != PlasmaNM.Enums.Activated
|
text: i18n('Connect')
|
||||||
onTriggered: changeState()
|
visible: ConnectionState != PlasmaNM.Enums.Activated && root.editMode
|
||||||
},
|
display: Controls.ToolButton.IconOnly
|
||||||
Kirigami.Action {
|
onClicked: changeState()
|
||||||
|
}
|
||||||
|
Controls.ToolButton {
|
||||||
icon.name: "network-disconnect"
|
icon.name: "network-disconnect"
|
||||||
visible: ConnectionState == PlasmaNM.Enums.Activated
|
text: i18n('Disconnect')
|
||||||
onTriggered: handler.deactivateConnection(ConnectionPath, DevicePath)
|
visible: ConnectionState == PlasmaNM.Enums.Activated && root.editMode
|
||||||
},
|
display: Controls.ToolButton.IconOnly
|
||||||
Kirigami.Action {
|
onClicked: handler.deactivateConnection(ConnectionPath, DevicePath)
|
||||||
|
}
|
||||||
|
Controls.ToolButton {
|
||||||
icon.name: "configure"
|
icon.name: "configure"
|
||||||
visible: (Uuid != "")? true : false
|
text: i18n('Configure')
|
||||||
onTriggered: {
|
visible: (Uuid != "") && root.editMode
|
||||||
|
display: Controls.ToolButton.IconOnly
|
||||||
|
onClicked: {
|
||||||
kcm.push("NetworkSettings.qml", {path: ConnectionPath})
|
kcm.push("NetworkSettings.qml", {path: ConnectionPath})
|
||||||
}
|
}
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
icon.name: "entry-delete"
|
|
||||||
visible: (Uuid != "")? true : false
|
|
||||||
onTriggered: handler.removeConnection(ConnectionPath)
|
|
||||||
}
|
}
|
||||||
]
|
Controls.ToolButton {
|
||||||
|
icon.name: "entry-delete"
|
||||||
|
text: i18n('Delete')
|
||||||
|
visible: (Uuid != "") && root.editMode
|
||||||
|
display: Controls.ToolButton.IconOnly
|
||||||
|
onClicked: handler.removeConnection(ConnectionPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
changeState()
|
changeState()
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,18 @@
|
||||||
/*
|
// SPDX-FileCopyrightText: 2017 Martin Kacej <m.kacej@atlas.sk>
|
||||||
SPDX-FileCopyrightText: 2017 Martin Kacej <m.kacej@atlas.sk>
|
// 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 2.15
|
import QtQuick.Controls as Controls
|
||||||
import QtQuick.Layouts 1.2
|
|
||||||
import QtQuick.Controls 2.2 as Controls
|
import org.kde.kirigami as Kirigami
|
||||||
import org.kde.kirigami 2.3 as Kirigami
|
|
||||||
import org.kde.plasma.networkmanagement as PlasmaNM
|
import org.kde.plasma.networkmanagement as PlasmaNM
|
||||||
import org.kde.kcmutils
|
import org.kde.kcmutils
|
||||||
|
import org.kde.kirigamiaddons.formcard 1 as FormCard
|
||||||
|
|
||||||
SimpleKCM {
|
Kirigami.ScrollablePage {
|
||||||
title: path ? wirelessSettings["ssid"] : i18n("Add new Connection")
|
title: path ? wirelessSettings["ssid"] : i18n("Add New Connection")
|
||||||
|
|
||||||
property var path
|
property var path
|
||||||
|
|
||||||
|
|
@ -41,35 +42,49 @@ SimpleKCM {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
Kirigami.FormLayout {
|
topPadding: Kirigami.Units.gridUnit
|
||||||
Item {
|
bottomPadding: Kirigami.Units.gridUnit
|
||||||
Kirigami.FormData.label: i18n("General")
|
leftPadding: 0
|
||||||
Kirigami.FormData.isSection: true
|
rightPadding: 0
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
FormCard.FormHeader {
|
||||||
|
title: i18n('General')
|
||||||
}
|
}
|
||||||
Controls.TextField {
|
|
||||||
|
FormCard.FormCard {
|
||||||
|
FormCard.FormTextFieldDelegate {
|
||||||
id: ssidField
|
id: ssidField
|
||||||
Kirigami.FormData.label: i18n("SSID:")
|
label: i18n('SSID')
|
||||||
text: wirelessSettings["ssid"] ? wirelessSettings["ssid"] : ""
|
text: wirelessSettings["ssid"] ? wirelessSettings["ssid"] : ""
|
||||||
enabled: true
|
enabled: true
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
ipSettings["id"] = text
|
ipSettings["id"] = text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Controls.CheckBox {
|
|
||||||
|
FormCard.FormDelegateSeparator {
|
||||||
|
above: ssidField
|
||||||
|
below: hidden
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormSwitchDelegate {
|
||||||
id: hidden
|
id: hidden
|
||||||
Kirigami.FormData.label: i18n("Hidden Network:")
|
text: i18n("Hidden Network")
|
||||||
checked: wirelessSettings["hidden"] ? wirelessSettings["hidden"] : false
|
checked: wirelessSettings["hidden"] ? wirelessSettings["hidden"] : false
|
||||||
onToggled: ipSettings["hidden"] = checked
|
onToggled: ipSettings["hidden"] = checked
|
||||||
}
|
}
|
||||||
|
|
||||||
Kirigami.Separator {
|
|
||||||
Kirigami.FormData.label: i18n("Security")
|
|
||||||
Kirigami.FormData.isSection: true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.ComboBox {
|
FormCard.FormHeader {
|
||||||
|
title: i18n('Security')
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormCard {
|
||||||
|
FormCard.FormComboBoxDelegate {
|
||||||
id: securityCombobox
|
id: securityCombobox
|
||||||
Kirigami.FormData.label: i18n("Security type:")
|
currentIndex: 0
|
||||||
|
text: i18n('Security type')
|
||||||
model: ListModel {
|
model: ListModel {
|
||||||
id: securityTypesModel
|
id: securityTypesModel
|
||||||
// FIXME just placeholder element to set "text" property as default
|
// FIXME just placeholder element to set "text" property as default
|
||||||
|
|
@ -102,39 +117,56 @@ SimpleKCM {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PasswordField {
|
FormCard.FormDelegateSeparator {
|
||||||
id: passwordField
|
above: securityCombobox
|
||||||
Kirigami.FormData.label: i18n("Password:")
|
below: passwordDelegate
|
||||||
|
visible: passwordDelegate.visible
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormTextFieldDelegate {
|
||||||
|
id: passwordDelegate
|
||||||
|
label: i18n('Password')
|
||||||
|
echoMode: TextInput.Password
|
||||||
|
inputMethodHints: Qt.ImhHiddenText
|
||||||
text: secrets["psk"]
|
text: secrets["psk"]
|
||||||
visible: securityTypesModel.get(securityCombobox.currentIndex).type !== PlasmaNM.Enums.NoneSecurity
|
visible: securityTypesModel.get(securityCombobox.currentIndex).type !== PlasmaNM.Enums.NoneSecurity
|
||||||
onTextChanged: securitySettings["password"] = text
|
onTextChanged: securitySettings["password"] = text
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.ComboBox {
|
FormCard.FormDelegateSeparator {
|
||||||
|
above: passwordDelegate
|
||||||
|
below: authComboBox
|
||||||
|
visible: authComboBox.visible
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormComboBoxDelegate {
|
||||||
id: authComboBox
|
id: authComboBox
|
||||||
Kirigami.FormData.label: i18n("Authentication:")
|
text: i18n("Authentication:")
|
||||||
|
currentIndex: 0
|
||||||
visible: securityCombobox.currentIndex === 2
|
visible: securityCombobox.currentIndex === 2
|
||||||
|| securityCombobox.currentIndex === 4
|
|| securityCombobox.currentIndex === 4
|
||||||
model: [i18n("TLS"), i18n("LEAP"), i18n("FAST"), i18n(
|
model: [i18n("TLS"), i18n("LEAP"), i18n("FAST"), i18n(
|
||||||
"Tunneled TLS"), i18n(
|
"Tunneled TLS"), i18n(
|
||||||
"Protected EAP")] // more - SIM, AKA, PWD ?
|
"Protected EAP")] // more - SIM, AKA, PWD ?
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.Label {
|
Controls.Label {
|
||||||
visible: securityCombobox.currentIndex !== 3 && securityCombobox.currentIndex !== 0
|
visible: securityCombobox.currentIndex !== 3 && securityCombobox.currentIndex !== 0
|
||||||
text: "----Not yet implemented----"
|
text: "----Not yet implemented----"
|
||||||
color: "red"
|
color: "red"
|
||||||
}
|
}
|
||||||
|
|
||||||
Kirigami.Separator {
|
|
||||||
Kirigami.FormData.label: i18n("IP settings")
|
|
||||||
Kirigami.FormData.isSection: true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.ComboBox {
|
FormCard.FormHeader {
|
||||||
|
title: i18n('IP Settings')
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormCard {
|
||||||
|
FormCard.FormComboBoxDelegate {
|
||||||
id: ipMethodCombobox
|
id: ipMethodCombobox
|
||||||
|
text: i18n('Method')
|
||||||
model: [i18n("Automatic"), i18n("Manual")]
|
model: [i18n("Automatic"), i18n("Manual")]
|
||||||
currentIndex: ipSettings["method"] === "manual" ? 1 : 0
|
currentIndex: ipSettings["method"] === "manual" ? 1 : 0
|
||||||
property var manualIp: currentIndex === 1
|
property var manualIp: currentIndex === 1
|
||||||
|
|
@ -143,9 +175,15 @@ SimpleKCM {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.TextField {
|
FormCard.FormDelegateSeparator {
|
||||||
|
above: ipMethodCombobox
|
||||||
|
below: manualIPaddress
|
||||||
|
visible: manualIPaddress.visible
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormTextFieldDelegate {
|
||||||
id: manualIPaddress
|
id: manualIPaddress
|
||||||
Kirigami.FormData.label: i18n("IP Address:")
|
label: i18n("IP Address")
|
||||||
visible: ipMethodCombobox.manualIp
|
visible: ipMethodCombobox.manualIp
|
||||||
placeholderText: "192.168.1.128"
|
placeholderText: "192.168.1.128"
|
||||||
text: ipSettings["address"] ? ipSettings["address"] : ""
|
text: ipSettings["address"] ? ipSettings["address"] : ""
|
||||||
|
|
@ -155,9 +193,15 @@ SimpleKCM {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.TextField {
|
FormCard.FormDelegateSeparator {
|
||||||
|
above: manualIPaddress
|
||||||
|
below: manualIPgateway
|
||||||
|
visible: manualIPgateway.visible
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormTextFieldDelegate {
|
||||||
id: manualIPgateway
|
id: manualIPgateway
|
||||||
Kirigami.FormData.label: i18n("Gateway:")
|
label: i18n("Gateway")
|
||||||
visible: ipMethodCombobox.manualIp
|
visible: ipMethodCombobox.manualIp
|
||||||
placeholderText: "192.168.1.1"
|
placeholderText: "192.168.1.1"
|
||||||
text: ipSettings["gateway"] ? ipSettings["gateway"] : ""
|
text: ipSettings["gateway"] ? ipSettings["gateway"] : ""
|
||||||
|
|
@ -167,9 +211,15 @@ SimpleKCM {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.TextField {
|
FormCard.FormDelegateSeparator {
|
||||||
|
above: manualIPgateway
|
||||||
|
below: manualIPprefix
|
||||||
|
visible: manualIPprefix.visible
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormTextFieldDelegate {
|
||||||
id: manualIPprefix
|
id: manualIPprefix
|
||||||
Kirigami.FormData.label: i18n("Network prefix length:")
|
label: i18n("Network prefix length")
|
||||||
visible: ipMethodCombobox.manualIp
|
visible: ipMethodCombobox.manualIp
|
||||||
placeholderText: "16"
|
placeholderText: "16"
|
||||||
text: ipSettings["prefix"] ? ipSettings["prefix"] : ""
|
text: ipSettings["prefix"] ? ipSettings["prefix"] : ""
|
||||||
|
|
@ -180,9 +230,15 @@ SimpleKCM {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.TextField {
|
FormCard.FormDelegateSeparator {
|
||||||
|
above: manualIPprefix
|
||||||
|
below: manualIPdns
|
||||||
|
visible: manualIPdns.visible
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormTextFieldDelegate {
|
||||||
id: manualIPdns
|
id: manualIPdns
|
||||||
Kirigami.FormData.label: i18n("DNS:")
|
label: i18n("DNS")
|
||||||
visible: ipMethodCombobox.manualIp
|
visible: ipMethodCombobox.manualIp
|
||||||
placeholderText: "8.8.8.8"
|
placeholderText: "8.8.8.8"
|
||||||
text: ipSettings["dns"] ? ipSettings["dns"] : ""
|
text: ipSettings["dns"] ? ipSettings["dns"] : ""
|
||||||
|
|
@ -192,6 +248,7 @@ SimpleKCM {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
wirelessSettings = kcm.getConnectionSettings(path, "802-11-wireless")
|
wirelessSettings = kcm.getConnectionSettings(path, "802-11-wireless")
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,34 @@
|
||||||
/*
|
// SPDX-FileCopyrightText: 2017 Martin Kacej <m.kacej@atlas.sk>
|
||||||
SPDX-FileCopyrightText: 2017 Martin Kacej <m.kacej@atlas.sk>
|
// 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 QtQuick.Layouts 1.2
|
|
||||||
import QtQuick.Controls 2.2 as Controls
|
|
||||||
import org.kde.plasma.networkmanagement as PlasmaNM
|
import org.kde.plasma.networkmanagement as PlasmaNM
|
||||||
import org.kde.kirigami 2.12 as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
import org.kde.kcmutils
|
import org.kde.kcmutils
|
||||||
|
import org.kde.kirigamiaddons.formcard 1 as FormCard
|
||||||
|
|
||||||
ScrollViewKCM {
|
SimpleKCM {
|
||||||
id: main
|
id: root
|
||||||
|
|
||||||
|
property bool editMode: false
|
||||||
|
|
||||||
|
topPadding: Kirigami.Units.gridUnit
|
||||||
|
bottomPadding: Kirigami.Units.gridUnit
|
||||||
|
leftPadding: 0
|
||||||
|
rightPadding: 0
|
||||||
|
|
||||||
|
actions: [
|
||||||
|
Kirigami.Action {
|
||||||
|
text: i18n("Edit")
|
||||||
|
icon.name: 'entry-edit'
|
||||||
|
checkable: true
|
||||||
|
onCheckedChanged: root.editMode = checked
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
PlasmaNM.Handler {
|
PlasmaNM.Handler {
|
||||||
id: handler
|
id: handler
|
||||||
|
|
@ -43,9 +59,16 @@ ScrollViewKCM {
|
||||||
onTriggered: handler.requestScan()
|
onTriggered: handler.requestScan()
|
||||||
}
|
}
|
||||||
|
|
||||||
header: Kirigami.InlineMessage {
|
ConnectDialog {
|
||||||
|
id: connectionDialog
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
|
||||||
|
Kirigami.InlineMessage {
|
||||||
id: inlineError
|
id: inlineError
|
||||||
showCloseButton: true
|
showCloseButton: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
type: Kirigami.MessageType.Warning
|
type: Kirigami.MessageType.Warning
|
||||||
Connections {
|
Connections {
|
||||||
|
|
@ -57,61 +80,60 @@ ScrollViewKCM {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectDialog {
|
FormCard.FormCard {
|
||||||
id: connectionDialog
|
FormCard.FormSwitchDelegate {
|
||||||
|
id: wifiSwitch
|
||||||
|
text: i18n("Wi-Fi")
|
||||||
|
checked: enabledConnections.wirelessEnabled
|
||||||
|
onClicked: {
|
||||||
|
handler.enableWireless(checked);
|
||||||
|
checked = Qt.binding(() => enabledConnections.wirelessEnabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
view: ListView {
|
FormCard.FormHeader {
|
||||||
id: view
|
visible: savedCard.visible
|
||||||
|
title: i18n('Saved Networks')
|
||||||
clip: true
|
|
||||||
currentIndex: -1
|
|
||||||
|
|
||||||
section.property: "Section"
|
|
||||||
section.delegate: Kirigami.ListSectionHeader {
|
|
||||||
text: section
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FormCard.FormCard {
|
||||||
|
id: savedCard
|
||||||
|
visible: enabledConnections.wirelessEnabled && connectedRepeater.count > 0
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
id: connectedRepeater
|
||||||
model: mobileProxyModel
|
model: mobileProxyModel
|
||||||
delegate: ConnectionItemDelegate {}
|
delegate: ConnectionItemDelegate {
|
||||||
|
editMode: root.editMode
|
||||||
Kirigami.PlaceholderMessage {
|
// connected or saved
|
||||||
anchors.centerIn: parent
|
visible: (Uuid != "") || ConnectionState === PlasmaNM.Enums.Activated
|
||||||
width: parent.width - (Kirigami.Units.largeSpacing * 4)
|
|
||||||
visible: !enabledConnections.wirelessEnabled
|
|
||||||
text: i18n("Wi-Fi is disabled")
|
|
||||||
icon.name: "network-wireless-disconnected"
|
|
||||||
helpfulAction: Kirigami.Action {
|
|
||||||
icon.name: "network-wireless-connected"
|
|
||||||
text: i18n("Enable")
|
|
||||||
onTriggered: handler.enableWireless(true)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
footer: Kirigami.ActionToolBar {
|
FormCard.FormHeader {
|
||||||
flat: false
|
|
||||||
actions: [
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Disable Wi-Fi")
|
|
||||||
icon.name: "network-disconnect"
|
|
||||||
visible: enabledConnections.wirelessEnabled
|
|
||||||
onTriggered: handler.enableWireless(false)
|
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Add Custom Connection")
|
|
||||||
icon.name: "list-add"
|
|
||||||
visible: enabledConnections.wirelessEnabled
|
|
||||||
onTriggered: kcm.push("NetworkSettings.qml")
|
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Show Saved Connections")
|
|
||||||
icon.name: "document-save"
|
|
||||||
onTriggered: mobileProxyModel.showSavedMode = !mobileProxyModel.showSavedMode
|
|
||||||
checkable: true
|
|
||||||
checked: false
|
|
||||||
visible: enabledConnections.wirelessEnabled
|
visible: enabledConnections.wirelessEnabled
|
||||||
|
title: i18n("Available Networks")
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormCard {
|
||||||
|
visible: enabledConnections.wirelessEnabled
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: mobileProxyModel
|
||||||
|
delegate: ConnectionItemDelegate {
|
||||||
|
editMode: root.editMode
|
||||||
|
visible: !((Uuid != "") || ConnectionState === PlasmaNM.Enums.Activated)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormButtonDelegate {
|
||||||
|
icon.name: 'list-add'
|
||||||
|
text: i18n('Add Custom Connection')
|
||||||
|
visible: enabledConnections.wirelessEnabled
|
||||||
|
onClicked: kcm.push("NetworkSettings.qml")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue