Warning, /plasma/plasma-mobile/kcms/cellularnetwork/ui/EditProfileDialog.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2020-2022 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 cellularnetworkkcm 1.0 0011 0012 Kirigami.Dialog { 0013 id: dialog 0014 title: i18n("Edit APN") 0015 clip: true 0016 0017 property Modem modem 0018 property ProfileSettings profile 0019 0020 property int pageWidth 0021 0022 standardButtons: Controls.Dialog.Ok | Controls.Dialog.Cancel 0023 0024 onAccepted: { 0025 if (profile == null) { // create new profile 0026 modem.addProfile(profileName.text, profileApn.text, profileUsername.text, profilePassword.text, profileNetworkType.value); 0027 } else { // edit existing profile 0028 modem.updateProfile(profile.connectionUni, profileName.text, profileApn.text, profileUsername.text, profilePassword.text, profileNetworkType.value); 0029 } 0030 } 0031 preferredWidth: pageWidth - Kirigami.Units.gridUnit * 4 0032 padding: Kirigami.Units.gridUnit 0033 0034 ColumnLayout { 0035 Kirigami.FormLayout { 0036 Layout.fillWidth: true 0037 wideMode: false 0038 0039 Controls.TextField { 0040 id: profileName 0041 Kirigami.FormData.label: i18n("Name") 0042 text: profile != null ? profile.name : "" 0043 } 0044 Controls.TextField { 0045 id: profileApn 0046 Kirigami.FormData.label: i18n("APN") 0047 text: profile != null ? profile.apn : "" 0048 } 0049 Controls.TextField { 0050 id: profileUsername 0051 Kirigami.FormData.label: i18n("Username") 0052 text: profile != null ? profile.user : "" 0053 } 0054 Controls.TextField { 0055 id: profilePassword 0056 Kirigami.FormData.label: i18n("Password") 0057 text: profile != null ? profile.password : "" 0058 } 0059 Controls.ComboBox { 0060 id: profileNetworkType 0061 Kirigami.FormData.label: i18n("Network type") 0062 model: [i18n("4G/3G/2G"), i18n("3G/2G"), i18n("2G"), i18n("Only 4G"), i18n("Only 3G"), i18n("Only 2G"), i18n("Any")] 0063 Component.onCompleted: { 0064 if (profile != null) { 0065 currentIndex = indexOfValue(profile.networkType) 0066 } 0067 } 0068 } 0069 } 0070 } 0071 }