Warning, /plasma/plasma-mobile/kcms/cellularnetwork/ui/SimPage.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick
0005 import QtQuick.Layouts
0006 import QtQuick.Controls as Controls
0007 
0008 import org.kde.plasma.networkmanagement as PlasmaNM
0009 import org.kde.kcmutils
0010 import org.kde.kirigami as Kirigami
0011 import org.kde.kirigamiaddons.formcard 1 as FormCard
0012 import org.kde.kirigamiaddons.components 1 as Components
0013 
0014 import cellularnetworkkcm 1.0
0015 
0016 FormCard.FormCardPage {
0017     id: simPage
0018 
0019     property Sim sim: null
0020 
0021     property string displayId: sim ? sim.displayId : ""
0022     property bool simEnabled: sim ? sim.enabled : false
0023     property bool isRoaming: sim ? (sim.modem ? sim.modem.isRoaming : false) : false
0024 
0025     property bool simLocked: sim ? sim.locked : false
0026     property string simImsi: sim ? sim.imsi : ""
0027     property string simEid: sim ? sim.eid : ""
0028     property string operatorCode: sim ? (sim.modem ? sim.modem.details.operatorCode : "") : ""
0029     property string operatorName: sim ? (sim.modem ? sim.modem.details.operatorName : "") : ""
0030     property string simOperatorIdentifier: sim ? sim.operatorIdentifier : ""
0031     property string simOperatorName: sim ? sim.operatorName : ""
0032     property string simIdentifier: sim ? sim.simIdentifier : ""
0033     property var simEmergencyNumbers: sim ? sim.emergencyNumbers : []
0034 
0035     title: i18n("SIM") + " " + displayId
0036 
0037     data: PlasmaNM.EnabledConnections {
0038         id: enabledConnections
0039     }
0040 
0041     header: Components.Banner {
0042         width: parent.width
0043         visible: !simEnabled
0044         type: Kirigami.MessageType.Error
0045         text: i18n("This SIM slot is empty, a SIM card needs to be inserted in order for it to be used.")
0046     }
0047 
0048     MessagesList {
0049         id: messagesList
0050         Layout.fillWidth: true
0051         Layout.margins: Kirigami.Units.gridUnit
0052         model: kcm.messages
0053     }
0054 
0055     FormCard.FormCard {
0056         Layout.topMargin: Kirigami.Units.gridUnit
0057 
0058         FormCard.FormSwitchDelegate {
0059             id: dataRoamingCheckBox
0060             text: i18n("Data Roaming")
0061             description: i18n("Allow your device to use networks other than your carrier.")
0062             enabled: simEnabled
0063             checked: isRoaming
0064             onCheckedChanged: sim.modem.isRoaming = checked
0065         }
0066 
0067         FormCard.FormDelegateSeparator { above: dataRoamingCheckBox; below: apnButton }
0068 
0069         FormCard.FormButtonDelegate {
0070             id: apnButton
0071             icon.name: "globe"
0072             text: i18n("Modify APNs")
0073             description: i18n("Configure access point names for your carrier.")
0074             enabled: simEnabled && enabledConnections.wwanEnabled
0075             onClicked: kcm.push("ProfileList.qml", { "modem": sim.modem });
0076         }
0077 
0078         FormCard.FormDelegateSeparator { above: apnButton; below: networksButton }
0079 
0080         FormCard.FormButtonDelegate {
0081             id: networksButton
0082             icon.name: "network-mobile-available"
0083             text: i18n("Networks")
0084             description: i18n("Select a network operator.")
0085             enabled: simEnabled
0086             onClicked: kcm.push("AvailableNetworks.qml", { "modem": sim.modem, "sim": sim });
0087         }
0088 
0089         FormCard.FormDelegateSeparator { above: networksButton; below: simLockButton }
0090 
0091         FormCard.FormButtonDelegate {
0092             id: simLockButton
0093             icon.name: "unlock"
0094             text: i18n("SIM Lock")
0095             description: i18n("Modify SIM lock settings.")
0096             // enabled: simEnabled
0097             onClicked: kcm.push("SimLockPage.qml", { "sim": sim });
0098         }
0099 
0100         FormCard.FormDelegateSeparator { above: simLockButton; below: modemDetailsButton }
0101 
0102         FormCard.FormButtonDelegate {
0103             id: modemDetailsButton
0104             icon.name: "network-modem"
0105             text: i18n("Modem Details")
0106             description: i18n("View the details of the modem this SIM is connected to.")
0107             onClicked: kcm.push("ModemPage.qml", { "modem": sim.modem })
0108         }
0109     }
0110 
0111     FormCard.FormHeader {
0112         title: i18n("SIM Details")
0113     }
0114 
0115     FormCard.FormCard {
0116         FormCard.FormTextDelegate {
0117             id: lockedText
0118             text: i18n("Locked")
0119             description: simLocked ? i18n("Yes") : i18n("No")
0120         }
0121 
0122         FormCard.FormDelegateSeparator {}
0123 
0124         FormCard.FormTextDelegate  {
0125             id: imsiText
0126             text: i18n("IMSI")
0127             description: simImsi
0128         }
0129 
0130         FormCard.FormDelegateSeparator {}
0131 
0132         FormCard.FormTextDelegate  {
0133             id: eidText
0134             text: i18n("EID")
0135             description: simEid
0136         }
0137 
0138         FormCard.FormDelegateSeparator {}
0139 
0140         FormCard.FormTextDelegate {
0141             id: opCodeModemText
0142             text: i18n("Operator Code (modem)")
0143             description: operatorCode
0144         }
0145 
0146         FormCard.FormDelegateSeparator {}
0147 
0148         FormCard.FormTextDelegate  {
0149             id: opNameModemText
0150             text: i18n("Operator Name (modem)")
0151             description: operatorName
0152         }
0153 
0154         FormCard.FormDelegateSeparator {}
0155 
0156         FormCard.FormTextDelegate  {
0157             id: opCodeSimText
0158             text: i18n("Operator Code (provided by SIM)")
0159             description: simOperatorIdentifier
0160         }
0161 
0162         FormCard.FormDelegateSeparator {}
0163 
0164         FormCard.FormTextDelegate {
0165             id: opNameSimText
0166             text: i18n("Operator Name (provided by SIM)")
0167             description: simOperatorName
0168         }
0169 
0170         FormCard.FormDelegateSeparator {}
0171 
0172         FormCard.FormTextDelegate {
0173             id: simIdText
0174             text: i18n("SIM ID")
0175             description: simIdentifier
0176         }
0177 
0178         FormCard.FormDelegateSeparator {}
0179 
0180         FormCard.AbstractFormDelegate {
0181             id: emergencyNumbersText
0182 
0183             background: null
0184             contentItem: ColumnLayout {
0185                 Layout.fillWidth: true
0186                 spacing: Kirigami.Units.smallSpacing
0187 
0188                 Controls.Label {
0189                     Layout.fillWidth: true
0190                     text: i18n("Emergency Numbers")
0191                     elide: Text.ElideRight
0192                 }
0193 
0194                 Repeater {
0195                     model: simEmergencyNumbers
0196 
0197                     Controls.Label {
0198                         Layout.fillWidth: true
0199                         text: modelData
0200                         color: Kirigami.Theme.disabledTextColor
0201                         font: Kirigami.Theme.smallFont
0202                         elide: Text.ElideRight
0203                     }
0204                 }
0205             }
0206         }
0207     }
0208 }