2023-03-14 02:26:52 +00:00
|
|
|
/*
|
|
|
|
|
SPDX-FileCopyrightText: 2017 Martin Kacej <m.kacej@atlas.sk>
|
|
|
|
|
|
|
|
|
|
SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import QtQuick 2.6
|
|
|
|
|
import QtQuick.Layouts 1.2
|
|
|
|
|
import QtQuick.Controls 2.2 as Controls
|
2023-09-23 23:27:13 +00:00
|
|
|
import org.kde.plasma.networkmanagement as PlasmaNM
|
2023-03-14 02:26:52 +00:00
|
|
|
import org.kde.kirigami 2.2 as Kirigami
|
2023-07-09 22:50:33 +00:00
|
|
|
import org.kde.ksvg 1.0 as KSvg
|
2023-03-14 02:26:52 +00:00
|
|
|
|
|
|
|
|
Kirigami.SwipeListItem {
|
|
|
|
|
|
|
|
|
|
enabled: true
|
|
|
|
|
|
|
|
|
|
property var map : []
|
|
|
|
|
property bool predictableWirelessPassword: !Uuid && Type == PlasmaNM.Enums.Wireless &&
|
|
|
|
|
(SecurityType == PlasmaNM.Enums.StaticWep ||
|
|
|
|
|
SecurityType == PlasmaNM.Enums.WpaPsk ||
|
|
|
|
|
SecurityType == PlasmaNM.Enums.Wpa2Psk ||
|
|
|
|
|
SecurityType == PlasmaNM.Enums.SAE)
|
|
|
|
|
|
2023-11-08 21:23:53 +00:00
|
|
|
contentItem: RowLayout {
|
2023-11-08 17:57:27 +00:00
|
|
|
spacing: Kirigami.Units.largeSpacing
|
2023-03-14 02:26:52 +00:00
|
|
|
|
2023-11-08 21:23:53 +00:00
|
|
|
Kirigami.Icon {
|
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
|
Layout.preferredWidth: Kirigami.Units.iconSizes.medium
|
|
|
|
|
Layout.preferredHeight: Kirigami.Units.iconSizes.medium
|
2023-03-14 02:26:52 +00:00
|
|
|
|
2023-11-08 21:23:53 +00:00
|
|
|
source: mobileProxyModel.showSavedMode ? "network-wireless-connected-100" : ConnectionIcon
|
2023-03-14 02:26:52 +00:00
|
|
|
|
|
|
|
|
Controls.BusyIndicator {
|
2023-11-08 21:23:53 +00:00
|
|
|
anchors.fill: parent
|
2023-03-14 02:26:52 +00:00
|
|
|
running: ConnectionState == PlasmaNM.Enums.Activating
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Controls.Label {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
text: ItemUniqueName
|
|
|
|
|
textFormat: Text.PlainText
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actions: [
|
|
|
|
|
Kirigami.Action {
|
2023-05-07 13:11:17 +00:00
|
|
|
icon.name: "network-connect"
|
2023-03-14 02:26:52 +00:00
|
|
|
visible: ConnectionState != PlasmaNM.Enums.Activated
|
|
|
|
|
onTriggered: changeState()
|
|
|
|
|
},
|
|
|
|
|
Kirigami.Action {
|
2023-05-07 13:11:17 +00:00
|
|
|
icon.name: "network-disconnect"
|
2023-03-14 02:26:52 +00:00
|
|
|
visible: ConnectionState == PlasmaNM.Enums.Activated
|
|
|
|
|
onTriggered: handler.deactivateConnection(ConnectionPath, DevicePath)
|
|
|
|
|
},
|
|
|
|
|
Kirigami.Action {
|
2023-05-07 13:11:17 +00:00
|
|
|
icon.name: "configure"
|
2023-03-14 02:26:52 +00:00
|
|
|
visible: (Uuid != "")? true : false
|
|
|
|
|
onTriggered: {
|
|
|
|
|
kcm.push("NetworkSettings.qml", {path: ConnectionPath})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
Kirigami.Action {
|
2023-05-07 13:11:17 +00:00
|
|
|
icon.name: "entry-delete"
|
2023-03-14 02:26:52 +00:00
|
|
|
visible: (Uuid != "")? true : false
|
|
|
|
|
onTriggered: handler.removeConnection(ConnectionPath)
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
|
changeState()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function changeState() {
|
|
|
|
|
if (Uuid || !predictableWirelessPassword) {
|
|
|
|
|
if (ConnectionState == PlasmaNM.Enums.Deactivated) {
|
|
|
|
|
if (!predictableWirelessPassword && !Uuid) {
|
|
|
|
|
handler.addAndActivateConnection(DevicePath, SpecificPath);
|
|
|
|
|
} else {
|
|
|
|
|
handler.activateConnection(ConnectionPath, DevicePath, SpecificPath);
|
|
|
|
|
}
|
|
|
|
|
} else{
|
|
|
|
|
//show popup
|
|
|
|
|
}
|
|
|
|
|
} else if (predictableWirelessPassword) {
|
|
|
|
|
connectionDialog.headingText = i18n("Connect to") + " " + ItemUniqueName;
|
|
|
|
|
connectionDialog.devicePath = DevicePath;
|
|
|
|
|
connectionDialog.specificPath = SpecificPath;
|
|
|
|
|
connectionDialog.securityType = SecurityType;
|
|
|
|
|
connectionDialog.openAndClear();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|