status-desktop/ui/app/AppLayouts/Profile/controls/NetworkRadioSelector.qml

45 lines
1.3 KiB
QML
Raw Normal View History

2020-11-23 19:14:48 +00:00
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import utils 1.0
2020-11-23 19:14:48 +00:00
import "../../../../shared"
import "../../../../shared/popups"
2020-11-23 19:14:48 +00:00
import "../../../../shared/status"
// TODO: replace with StatusQ component
StatusRadioButtonRow {
2020-11-23 20:41:57 +00:00
property string network: ""
property string networkName: ""
2020-11-23 19:14:48 +00:00
property string newNetwork: ""
id: radioProd
text: networkName == "" ? Utils.getNetworkName(network) : networkName
buttonGroup: networkSettings
checked: profileModel.network.current === network
onRadioCheckedChanged: {
if (checked) {
if (profileModel.network.current === network) return;
newNetwork = network;
openPopup(confirmDialogComponent)
}
}
2020-11-23 19:14:48 +00:00
Component {
id: confirmDialogComponent
ConfirmationDialog {
id: confirmDialog
//% "Warning!"
header.title: qsTrId("close-app-title")
//% "The account will be logged out. When you unlock it again, the selected network will be used"
confirmationText: qsTrId("logout-app-content")
onConfirmButtonClicked: {
profileModel.network.current = newNetwork;
}
onClosed: {
profileModel.network.triggerNetworkChange()
destroy()
}
2020-11-23 19:14:48 +00:00
}
}
}