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,55 +23,81 @@ 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
|
||||||
|
|
||||||
Kirigami.Icon {
|
Item {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.rightMargin: Kirigami.Units.gridUnit
|
||||||
Layout.preferredWidth: Kirigami.Units.iconSizes.medium
|
implicitWidth: Kirigami.Units.iconSizes.smallMedium
|
||||||
Layout.preferredHeight: Kirigami.Units.iconSizes.medium
|
implicitHeight: Kirigami.Units.iconSizes.smallMedium
|
||||||
|
|
||||||
source: mobileProxyModel.showSavedMode ? "network-wireless-connected-100" : ConnectionIcon
|
Kirigami.Icon {
|
||||||
|
implicitWidth: Kirigami.Units.iconSizes.smallMedium
|
||||||
|
implicitHeight: Kirigami.Units.iconSizes.smallMedium
|
||||||
|
visible: ConnectionState !== PlasmaNM.Enums.Activating
|
||||||
|
anchors.centerIn: parent
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
// 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"
|
||||||
|
text: i18n('Connect')
|
||||||
|
visible: ConnectionState != PlasmaNM.Enums.Activated && root.editMode
|
||||||
|
display: Controls.ToolButton.IconOnly
|
||||||
|
onClicked: changeState()
|
||||||
|
}
|
||||||
|
Controls.ToolButton {
|
||||||
|
icon.name: "network-disconnect"
|
||||||
|
text: i18n('Disconnect')
|
||||||
|
visible: ConnectionState == PlasmaNM.Enums.Activated && root.editMode
|
||||||
|
display: Controls.ToolButton.IconOnly
|
||||||
|
onClicked: handler.deactivateConnection(ConnectionPath, DevicePath)
|
||||||
|
}
|
||||||
|
Controls.ToolButton {
|
||||||
|
icon.name: "configure"
|
||||||
|
text: i18n('Configure')
|
||||||
|
visible: (Uuid != "") && root.editMode
|
||||||
|
display: Controls.ToolButton.IconOnly
|
||||||
|
onClicked: {
|
||||||
|
kcm.push("NetworkSettings.qml", {path: ConnectionPath})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Controls.ToolButton {
|
||||||
|
icon.name: "entry-delete"
|
||||||
|
text: i18n('Delete')
|
||||||
|
visible: (Uuid != "") && root.editMode
|
||||||
|
display: Controls.ToolButton.IconOnly
|
||||||
|
onClicked: handler.removeConnection(ConnectionPath)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
actions: [
|
|
||||||
Kirigami.Action {
|
|
||||||
icon.name: "network-connect"
|
|
||||||
visible: ConnectionState != PlasmaNM.Enums.Activated
|
|
||||||
onTriggered: changeState()
|
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
icon.name: "network-disconnect"
|
|
||||||
visible: ConnectionState == PlasmaNM.Enums.Activated
|
|
||||||
onTriggered: handler.deactivateConnection(ConnectionPath, DevicePath)
|
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
icon.name: "configure"
|
|
||||||
visible: (Uuid != "")? true : false
|
|
||||||
onTriggered: {
|
|
||||||
kcm.push("NetworkSettings.qml", {path: ConnectionPath})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
icon.name: "entry-delete"
|
|
||||||
visible: (Uuid != "")? true : false
|
|
||||||
onTriggered: 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,154 +42,210 @@ 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 {
|
|
||||||
id: ssidField
|
FormCard.FormCard {
|
||||||
Kirigami.FormData.label: i18n("SSID:")
|
FormCard.FormTextFieldDelegate {
|
||||||
text: wirelessSettings["ssid"] ? wirelessSettings["ssid"] : ""
|
id: ssidField
|
||||||
enabled: true
|
label: i18n('SSID')
|
||||||
onTextChanged: {
|
text: wirelessSettings["ssid"] ? wirelessSettings["ssid"] : ""
|
||||||
ipSettings["id"] = text
|
enabled: true
|
||||||
|
onTextChanged: {
|
||||||
|
ipSettings["id"] = text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormDelegateSeparator {
|
||||||
|
above: ssidField
|
||||||
|
below: hidden
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormSwitchDelegate {
|
||||||
|
id: hidden
|
||||||
|
text: i18n("Hidden Network")
|
||||||
|
checked: wirelessSettings["hidden"] ? wirelessSettings["hidden"] : false
|
||||||
|
onToggled: ipSettings["hidden"] = checked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Controls.CheckBox {
|
|
||||||
id: hidden
|
FormCard.FormHeader {
|
||||||
Kirigami.FormData.label: i18n("Hidden Network:")
|
title: i18n('Security')
|
||||||
checked: wirelessSettings["hidden"] ? wirelessSettings["hidden"] : false
|
|
||||||
onToggled: ipSettings["hidden"] = checked
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Kirigami.Separator {
|
FormCard.FormCard {
|
||||||
Kirigami.FormData.label: i18n("Security")
|
FormCard.FormComboBoxDelegate {
|
||||||
Kirigami.FormData.isSection: true
|
id: securityCombobox
|
||||||
}
|
currentIndex: 0
|
||||||
|
text: i18n('Security type')
|
||||||
Controls.ComboBox {
|
model: ListModel {
|
||||||
id: securityCombobox
|
id: securityTypesModel
|
||||||
Kirigami.FormData.label: i18n("Security type:")
|
// FIXME just placeholder element to set "text" property as default
|
||||||
model: ListModel {
|
ListElement {
|
||||||
id: securityTypesModel
|
text: "placeholder"
|
||||||
// FIXME just placeholder element to set "text" property as default
|
}
|
||||||
ListElement {
|
function load() {
|
||||||
text: "placeholder"
|
clear()
|
||||||
}
|
append({ "text": i18n("None"), "type": PlasmaNM.Enums.NoneSecurity })
|
||||||
function load() {
|
append({ "text": i18n("WEP Key"), "type": PlasmaNM.Enums.StaticWep })
|
||||||
clear()
|
append({ "text": i18n("Dynamic WEP"), "type": PlasmaNM.Enums.DynamicWep })
|
||||||
append({ "text": i18n("None"), "type": PlasmaNM.Enums.NoneSecurity })
|
append({ "text": i18n("WPA/WPA2 Personal"), "type": PlasmaNM.Enums.Wpa2Psk })
|
||||||
append({ "text": i18n("WEP Key"), "type": PlasmaNM.Enums.StaticWep })
|
append({ "text": i18n("WPA/WPA2 Enterprise"), "type": PlasmaNM.Enums.Wpa2Eap })
|
||||||
append({ "text": i18n("Dynamic WEP"), "type": PlasmaNM.Enums.DynamicWep })
|
switch (securitySettings["key-mgmt"]) {
|
||||||
append({ "text": i18n("WPA/WPA2 Personal"), "type": PlasmaNM.Enums.Wpa2Psk })
|
case "none":
|
||||||
append({ "text": i18n("WPA/WPA2 Enterprise"), "type": PlasmaNM.Enums.Wpa2Eap })
|
securityCombobox.currentIndex = 0
|
||||||
switch (securitySettings["key-mgmt"]) {
|
break
|
||||||
case "none":
|
case "ieee8021x":
|
||||||
securityCombobox.currentIndex = 0
|
securityCombobox.currentIndex = 1
|
||||||
break
|
break
|
||||||
case "ieee8021x":
|
case "wpa-psk":
|
||||||
securityCombobox.currentIndex = 1
|
securityCombobox.currentIndex = 3
|
||||||
break
|
break
|
||||||
case "wpa-psk":
|
case "wpa-eap":
|
||||||
securityCombobox.currentIndex = 3
|
securityCombobox.currentIndex = 4
|
||||||
break
|
break
|
||||||
case "wpa-eap":
|
default:
|
||||||
securityCombobox.currentIndex = 4
|
securityCombobox.currentIndex = 0
|
||||||
break
|
break
|
||||||
default:
|
}
|
||||||
securityCombobox.currentIndex = 0
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
FormCard.FormDelegateSeparator {
|
||||||
|
above: securityCombobox
|
||||||
|
below: passwordDelegate
|
||||||
|
visible: passwordDelegate.visible
|
||||||
|
}
|
||||||
|
|
||||||
PasswordField {
|
FormCard.FormTextFieldDelegate {
|
||||||
id: passwordField
|
id: passwordDelegate
|
||||||
Kirigami.FormData.label: i18n("Password:")
|
label: i18n('Password')
|
||||||
text: secrets["psk"]
|
echoMode: TextInput.Password
|
||||||
visible: securityTypesModel.get(securityCombobox.currentIndex).type !== PlasmaNM.Enums.NoneSecurity
|
inputMethodHints: Qt.ImhHiddenText
|
||||||
onTextChanged: securitySettings["password"] = text
|
text: secrets["psk"]
|
||||||
}
|
visible: securityTypesModel.get(securityCombobox.currentIndex).type !== PlasmaNM.Enums.NoneSecurity
|
||||||
|
onTextChanged: securitySettings["password"] = text
|
||||||
|
}
|
||||||
|
|
||||||
Controls.ComboBox {
|
FormCard.FormDelegateSeparator {
|
||||||
id: authComboBox
|
above: passwordDelegate
|
||||||
Kirigami.FormData.label: i18n("Authentication:")
|
below: authComboBox
|
||||||
visible: securityCombobox.currentIndex === 2
|
visible: authComboBox.visible
|
||||||
|| securityCombobox.currentIndex === 4
|
}
|
||||||
model: [i18n("TLS"), i18n("LEAP"), i18n("FAST"), i18n(
|
|
||||||
"Tunneled TLS"), i18n(
|
|
||||||
"Protected EAP")] // more - SIM, AKA, PWD ?
|
|
||||||
}
|
|
||||||
Controls.Label {
|
|
||||||
visible: securityCombobox.currentIndex !== 3 && securityCombobox.currentIndex !== 0
|
|
||||||
text: "----Not yet implemented----"
|
|
||||||
color: "red"
|
|
||||||
}
|
|
||||||
|
|
||||||
Kirigami.Separator {
|
FormCard.FormComboBoxDelegate {
|
||||||
Kirigami.FormData.label: i18n("IP settings")
|
id: authComboBox
|
||||||
Kirigami.FormData.isSection: true
|
text: i18n("Authentication:")
|
||||||
}
|
currentIndex: 0
|
||||||
|
visible: securityCombobox.currentIndex === 2
|
||||||
|
|| securityCombobox.currentIndex === 4
|
||||||
|
model: [i18n("TLS"), i18n("LEAP"), i18n("FAST"), i18n(
|
||||||
|
"Tunneled TLS"), i18n(
|
||||||
|
"Protected EAP")] // more - SIM, AKA, PWD ?
|
||||||
|
}
|
||||||
|
|
||||||
Controls.ComboBox {
|
Controls.Label {
|
||||||
id: ipMethodCombobox
|
visible: securityCombobox.currentIndex !== 3 && securityCombobox.currentIndex !== 0
|
||||||
model: [i18n("Automatic"), i18n("Manual")]
|
text: "----Not yet implemented----"
|
||||||
currentIndex: ipSettings["method"] === "manual" ? 1 : 0
|
color: "red"
|
||||||
property var manualIp: currentIndex === 1
|
|
||||||
onCurrentIndexChanged: {
|
|
||||||
ipSettings["method"] = currentIndex === 1 ? "manual" : "auto"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.TextField {
|
FormCard.FormHeader {
|
||||||
id: manualIPaddress
|
title: i18n('IP Settings')
|
||||||
Kirigami.FormData.label: i18n("IP Address:")
|
|
||||||
visible: ipMethodCombobox.manualIp
|
|
||||||
placeholderText: "192.168.1.128"
|
|
||||||
text: ipSettings["address"] ? ipSettings["address"] : ""
|
|
||||||
onTextChanged: ipSettings["address"] = text
|
|
||||||
validator: RegularExpressionValidator {
|
|
||||||
regularExpression: ipRegex
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.TextField {
|
FormCard.FormCard {
|
||||||
id: manualIPgateway
|
FormCard.FormComboBoxDelegate {
|
||||||
Kirigami.FormData.label: i18n("Gateway:")
|
id: ipMethodCombobox
|
||||||
visible: ipMethodCombobox.manualIp
|
text: i18n('Method')
|
||||||
placeholderText: "192.168.1.1"
|
model: [i18n("Automatic"), i18n("Manual")]
|
||||||
text: ipSettings["gateway"] ? ipSettings["gateway"] : ""
|
currentIndex: ipSettings["method"] === "manual" ? 1 : 0
|
||||||
onTextChanged: ipSettings["gateway"] = text
|
property var manualIp: currentIndex === 1
|
||||||
validator: RegularExpressionValidator {
|
onCurrentIndexChanged: {
|
||||||
regularExpression: ipRegex
|
ipSettings["method"] = currentIndex === 1 ? "manual" : "auto"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Controls.TextField {
|
FormCard.FormDelegateSeparator {
|
||||||
id: manualIPprefix
|
above: ipMethodCombobox
|
||||||
Kirigami.FormData.label: i18n("Network prefix length:")
|
below: manualIPaddress
|
||||||
visible: ipMethodCombobox.manualIp
|
visible: manualIPaddress.visible
|
||||||
placeholderText: "16"
|
|
||||||
text: ipSettings["prefix"] ? ipSettings["prefix"] : ""
|
|
||||||
onTextChanged: ipSettings["prefix"] = text
|
|
||||||
validator: IntValidator {
|
|
||||||
bottom: 1
|
|
||||||
top: 32
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Controls.TextField {
|
FormCard.FormTextFieldDelegate {
|
||||||
id: manualIPdns
|
id: manualIPaddress
|
||||||
Kirigami.FormData.label: i18n("DNS:")
|
label: i18n("IP Address")
|
||||||
visible: ipMethodCombobox.manualIp
|
visible: ipMethodCombobox.manualIp
|
||||||
placeholderText: "8.8.8.8"
|
placeholderText: "192.168.1.128"
|
||||||
text: ipSettings["dns"] ? ipSettings["dns"] : ""
|
text: ipSettings["address"] ? ipSettings["address"] : ""
|
||||||
onTextChanged: ipSettings["dns"] = text
|
onTextChanged: ipSettings["address"] = text
|
||||||
validator: RegularExpressionValidator {
|
validator: RegularExpressionValidator {
|
||||||
regularExpression: ipRegex
|
regularExpression: ipRegex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormDelegateSeparator {
|
||||||
|
above: manualIPaddress
|
||||||
|
below: manualIPgateway
|
||||||
|
visible: manualIPgateway.visible
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormTextFieldDelegate {
|
||||||
|
id: manualIPgateway
|
||||||
|
label: i18n("Gateway")
|
||||||
|
visible: ipMethodCombobox.manualIp
|
||||||
|
placeholderText: "192.168.1.1"
|
||||||
|
text: ipSettings["gateway"] ? ipSettings["gateway"] : ""
|
||||||
|
onTextChanged: ipSettings["gateway"] = text
|
||||||
|
validator: RegularExpressionValidator {
|
||||||
|
regularExpression: ipRegex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormDelegateSeparator {
|
||||||
|
above: manualIPgateway
|
||||||
|
below: manualIPprefix
|
||||||
|
visible: manualIPprefix.visible
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormTextFieldDelegate {
|
||||||
|
id: manualIPprefix
|
||||||
|
label: i18n("Network prefix length")
|
||||||
|
visible: ipMethodCombobox.manualIp
|
||||||
|
placeholderText: "16"
|
||||||
|
text: ipSettings["prefix"] ? ipSettings["prefix"] : ""
|
||||||
|
onTextChanged: ipSettings["prefix"] = text
|
||||||
|
validator: IntValidator {
|
||||||
|
bottom: 1
|
||||||
|
top: 32
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormDelegateSeparator {
|
||||||
|
above: manualIPprefix
|
||||||
|
below: manualIPdns
|
||||||
|
visible: manualIPdns.visible
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormTextFieldDelegate {
|
||||||
|
id: manualIPdns
|
||||||
|
label: i18n("DNS")
|
||||||
|
visible: ipMethodCombobox.manualIp
|
||||||
|
placeholderText: "8.8.8.8"
|
||||||
|
text: ipSettings["dns"] ? ipSettings["dns"] : ""
|
||||||
|
onTextChanged: ipSettings["dns"] = text
|
||||||
|
validator: RegularExpressionValidator {
|
||||||
|
regularExpression: ipRegex
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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,75 +59,81 @@ ScrollViewKCM {
|
||||||
onTriggered: handler.requestScan()
|
onTriggered: handler.requestScan()
|
||||||
}
|
}
|
||||||
|
|
||||||
header: Kirigami.InlineMessage {
|
|
||||||
id: inlineError
|
|
||||||
showCloseButton: true
|
|
||||||
|
|
||||||
type: Kirigami.MessageType.Warning
|
|
||||||
Connections {
|
|
||||||
target: handler
|
|
||||||
function onConnectionActivationFailed(connectionPath, message) {
|
|
||||||
inlineError.text = message;
|
|
||||||
inlineError.visible = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ConnectDialog {
|
ConnectDialog {
|
||||||
id: connectionDialog
|
id: connectionDialog
|
||||||
}
|
}
|
||||||
|
|
||||||
view: ListView {
|
|
||||||
id: view
|
|
||||||
|
|
||||||
clip: true
|
ColumnLayout {
|
||||||
currentIndex: -1
|
|
||||||
|
|
||||||
section.property: "Section"
|
Kirigami.InlineMessage {
|
||||||
section.delegate: Kirigami.ListSectionHeader {
|
id: inlineError
|
||||||
text: section
|
showCloseButton: true
|
||||||
}
|
Layout.fillWidth: true
|
||||||
|
|
||||||
model: mobileProxyModel
|
type: Kirigami.MessageType.Warning
|
||||||
delegate: ConnectionItemDelegate {}
|
Connections {
|
||||||
|
target: handler
|
||||||
Kirigami.PlaceholderMessage {
|
function onConnectionActivationFailed(connectionPath, message) {
|
||||||
anchors.centerIn: parent
|
inlineError.text = message;
|
||||||
width: parent.width - (Kirigami.Units.largeSpacing * 4)
|
inlineError.visible = true;
|
||||||
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.FormCard {
|
||||||
flat: false
|
FormCard.FormSwitchDelegate {
|
||||||
actions: [
|
id: wifiSwitch
|
||||||
Kirigami.Action {
|
text: i18n("Wi-Fi")
|
||||||
text: i18n("Disable Wi-Fi")
|
checked: enabledConnections.wirelessEnabled
|
||||||
icon.name: "network-disconnect"
|
onClicked: {
|
||||||
visible: enabledConnections.wirelessEnabled
|
handler.enableWireless(checked);
|
||||||
onTriggered: handler.enableWireless(false)
|
checked = Qt.binding(() => enabledConnections.wirelessEnabled);
|
||||||
},
|
}
|
||||||
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
|
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
|
|
||||||
|
FormCard.FormHeader {
|
||||||
|
visible: savedCard.visible
|
||||||
|
title: i18n('Saved Networks')
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormCard {
|
||||||
|
id: savedCard
|
||||||
|
visible: enabledConnections.wirelessEnabled && connectedRepeater.count > 0
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
id: connectedRepeater
|
||||||
|
model: mobileProxyModel
|
||||||
|
delegate: ConnectionItemDelegate {
|
||||||
|
editMode: root.editMode
|
||||||
|
// connected or saved
|
||||||
|
visible: (Uuid != "") || ConnectionState === PlasmaNM.Enums.Activated
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormHeader {
|
||||||
|
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