Warning, /plasma/plasma-mobile/initialstart/modules/cellular/package/contents/ui/EditProfileDialog.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2020-2023 Devin Lin <espidev@gmail.com>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick 2.12
0005 import QtQuick.Layouts 1.2
0006 import QtQuick.Controls 2.12 as Controls
0007 
0008 import org.kde.kirigami 2.19 as Kirigami
0009 
0010 import org.kde.plasma.mm as PlasmaMM
0011 
0012 Kirigami.Dialog {
0013     id: dialog
0014     title: i18n("Edit APN")
0015     clip: true
0016 
0017     property var profile
0018 
0019     standardButtons: Controls.Dialog.Ok | Controls.Dialog.Cancel
0020 
0021     onAccepted: {
0022         if (profile === null) { // create new profile
0023             PlasmaMM.SignalIndicator.addProfile(profileName.text, profileApn.text, profileUsername.text, profilePassword.text, profileNetworkType.value);
0024         } else { // edit existing profile
0025             PlasmaMM.SignalIndicator.updateProfile(profile.connectionUni, profileName.text, profileApn.text, profileUsername.text, profilePassword.text, profileNetworkType.value);
0026         }
0027     }
0028     preferredWidth: Kirigami.Units.gridUnit * 20
0029     padding: Kirigami.Units.gridUnit
0030 
0031     ColumnLayout {
0032         Kirigami.FormLayout {
0033             Layout.fillWidth: true
0034             wideMode: false
0035 
0036             Controls.TextField {
0037                 id: profileName
0038                 Kirigami.FormData.label: i18n("Name")
0039                 text: profile !== null ? profile.name : ""
0040             }
0041             Controls.TextField {
0042                 id: profileApn
0043                 Kirigami.FormData.label: i18n("APN")
0044                 text: profile != null ? profile.apn : ""
0045             }
0046             Controls.TextField {
0047                 id: profileUsername
0048                 Kirigami.FormData.label: i18n("Username")
0049                 text: profile != null ? profile.user : ""
0050             }
0051             Controls.TextField {
0052                 id: profilePassword
0053                 Kirigami.FormData.label: i18n("Password")
0054                 text: profile != null ? profile.password : ""
0055             }
0056             Controls.ComboBox {
0057                 id: profileNetworkType
0058                 Kirigami.FormData.label: i18n("Network type")
0059                 model: [i18n("4G/3G/2G"), i18n("3G/2G"), i18n("2G"), i18n("Only 4G"), i18n("Only 3G"), i18n("Only 2G"), i18n("Any")]
0060                 Component.onCompleted: if (profile !== null) {
0061                     currentIndex = indexOfValue(profile.networkType);
0062                 }
0063             }
0064         }
0065     }
0066 }