shift-shell/initialstart/modules/cellular/package/contents/ui/EditProfileDialog.qml
Devin Lin 5c0fd57600 initialstart: Add first login experience
Adds an experience for users on first login, allowing some basic configuration.

This is separate from a first start wizard, which would run as a separate user with elevated permissions, and include options that an installer would have.
2023-04-01 07:09:57 +00:00

66 lines
2.3 KiB
QML

// SPDX-FileCopyrightText: 2020-2023 Devin Lin <espidev@gmail.com>
// SPDX-License-Identifier: GPL-2.0-or-later
import QtQuick 2.12
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.12 as Controls
import org.kde.kirigami 2.19 as Kirigami
import org.kde.plasma.mm 1.0 as PlasmaMM
Kirigami.Dialog {
id: dialog
title: i18n("Edit APN")
clip: true
property var profile
standardButtons: Controls.Dialog.Ok | Controls.Dialog.Cancel
onAccepted: {
if (profile === null) { // create new profile
PlasmaMM.SignalIndicator.addProfile(profileName.text, profileApn.text, profileUsername.text, profilePassword.text, profileNetworkType.value);
} else { // edit existing profile
PlasmaMM.SignalIndicator.updateProfile(profile.connectionUni, profileName.text, profileApn.text, profileUsername.text, profilePassword.text, profileNetworkType.value);
}
}
preferredWidth: Kirigami.Units.gridUnit * 20
padding: Kirigami.Units.gridUnit
ColumnLayout {
Kirigami.FormLayout {
Layout.fillWidth: true
wideMode: false
Controls.TextField {
id: profileName
Kirigami.FormData.label: i18n("Name")
text: profile !== null ? profile.name : ""
}
Controls.TextField {
id: profileApn
Kirigami.FormData.label: i18n("APN")
text: profile != null ? profile.apn : ""
}
Controls.TextField {
id: profileUsername
Kirigami.FormData.label: i18n("Username")
text: profile != null ? profile.user : ""
}
Controls.TextField {
id: profilePassword
Kirigami.FormData.label: i18n("Password")
text: profile != null ? profile.password : ""
}
Controls.ComboBox {
id: profileNetworkType
Kirigami.FormData.label: i18n("Network type")
model: [i18n("4G/3G/2G"), i18n("3G/2G"), i18n("2G"), i18n("Only 4G"), i18n("Only 3G"), i18n("Only 2G"), i18n("Any")]
Component.onCompleted: if (profile !== null) {
currentIndex = indexOfValue(profile.networkType);
}
}
}
}
}