79 lines
4.8 KiB
QML
79 lines
4.8 KiB
QML
pragma ComponentBehavior: Bound
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Controls.Material
|
|
import QtQuick.Layouts
|
|
import "services"
|
|
|
|
ScrollView {
|
|
id: root
|
|
contentWidth: availableWidth
|
|
clip: true
|
|
ColumnLayout {
|
|
width: root.availableWidth
|
|
spacing: 14
|
|
Label { text: "Мобильная сеть и SIM"; font.pixelSize: 22; color: Theme.primary }
|
|
Label { visible: Modems.error !== ""; text: Modems.error; wrapMode: Text.Wrap; color: Theme.outline; Layout.fillWidth: true }
|
|
Label { visible: Modems.actionError !== ""; text: Modems.actionError; wrapMode: Text.Wrap; color: Theme.outline; Layout.fillWidth: true }
|
|
Repeater {
|
|
model: Modems.devices
|
|
ColumnLayout {
|
|
required property var modelData
|
|
Layout.fillWidth: true
|
|
Label { text: (modelData.manufacturer || "Модем") + " " + (modelData.model || modelData.id); color: Theme.foreground; font.bold: true }
|
|
Label { text: "Состояние: " + modelData.state + (modelData.simPresent ? " · SIM обнаружена" : " · SIM не обнаружена"); color: Theme.foreground }
|
|
Label { text: "Оператор: " + (modelData.operator || "неизвестен") + " · Сигнал: " + modelData.signal + "%"; color: Theme.foreground }
|
|
RowLayout {
|
|
Button {
|
|
text: "Включить модем"
|
|
enabled: !Modems.actionBusy && modelData.state !== "error"
|
|
onClicked: Modems.setEnabled(modelData.id, true)
|
|
}
|
|
Button {
|
|
text: "Отключить модем"
|
|
enabled: !Modems.actionBusy && modelData.state !== "error"
|
|
onClicked: confirmDisable.open()
|
|
}
|
|
Dialog {
|
|
id: confirmDisable
|
|
title: "Отключить модем?"
|
|
modal: true
|
|
standardButtons: Dialog.Yes | Dialog.Cancel
|
|
onAccepted: Modems.setEnabled(modelData.id, false)
|
|
Label { text: "Мобильное соединение может прерваться." }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Label { text: "Мобильные подключения (NetworkManager)"; font.pixelSize: 19; color: Theme.primary }
|
|
Label { visible: MobileConnections.error !== ""; text: MobileConnections.error; wrapMode: Text.Wrap; color: Theme.outline; Layout.fillWidth: true }
|
|
TextField { id: profileName; Layout.fillWidth: true; placeholderText: "Имя подключения"; text: "Мобильный интернет"; maximumLength: 64 }
|
|
TextField { id: apnField; Layout.fillWidth: true; placeholderText: "APN оператора (например, internet)"; maximumLength: 100 }
|
|
Button {
|
|
text: "Создать профиль APN"
|
|
enabled: !MobileConnections.busy && profileName.text.trim().length > 0 && /^[a-zA-Z0-9][a-zA-Z0-9.-]{0,99}$/.test(apnField.text)
|
|
onClicked: MobileConnections.perform("create", profileName.text.trim(), apnField.text)
|
|
}
|
|
Repeater {
|
|
model: MobileConnections.profiles
|
|
RowLayout {
|
|
required property var modelData
|
|
Layout.fillWidth: true
|
|
Label { text: modelData.name; color: Theme.foreground; Layout.fillWidth: true; elide: Text.ElideRight }
|
|
Button { text: "Подключить"; enabled: !MobileConnections.busy; onClicked: MobileConnections.perform("activate", modelData.uuid) }
|
|
Button { text: "Отключить"; enabled: !MobileConnections.busy; onClicked: MobileConnections.perform("deactivate", modelData.uuid) }
|
|
Button { text: "Удалить"; enabled: !MobileConnections.busy; onClicked: deleteConfirm.open() }
|
|
Dialog {
|
|
id: deleteConfirm
|
|
title: "Удалить профиль мобильной сети?"
|
|
modal: true
|
|
standardButtons: Dialog.Yes | Dialog.Cancel
|
|
onAccepted: MobileConnections.perform("delete", modelData.uuid)
|
|
Label { text: "Профиль будет удалён из NetworkManager." }
|
|
}
|
|
}
|
|
}
|
|
Label { text: "PIN/PUK не запрашиваются и не сохраняются. Подключение выполняется NetworkManager с системной авторизацией; наличие SIM и поддержка модема обязательны."; wrapMode: Text.Wrap; color: Theme.outline; Layout.fillWidth: true }
|
|
}
|
|
}
|