2020-11-23 15:14:48 -04:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2021-09-28 18:04:06 +03:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-27 11:37:58 +02:00
|
|
|
|
2021-10-28 00:27:49 +03:00
|
|
|
import shared.popups 1.0
|
|
|
|
import shared.controls 1.0
|
2020-11-23 15:14:48 -04:00
|
|
|
|
2021-10-27 11:37:58 +02:00
|
|
|
RadioButtonSelector {
|
|
|
|
id: root
|
|
|
|
|
2021-12-14 19:47:32 +01:00
|
|
|
property var advancedStore
|
2020-11-23 16:41:57 -04:00
|
|
|
property string network: ""
|
2021-01-08 18:10:31 -04:00
|
|
|
property string networkName: ""
|
2020-11-23 15:14:48 -04:00
|
|
|
property string newNetwork: ""
|
2021-10-27 11:37:58 +02:00
|
|
|
|
|
|
|
title: networkName == "" ? Utils.getNetworkName(network) : networkName
|
2021-12-14 19:47:32 +01:00
|
|
|
checked: root.advancedStore.currentNetworkName === root.title
|
2021-10-27 11:37:58 +02:00
|
|
|
|
|
|
|
onCheckedChanged: {
|
2021-03-19 11:25:29 +01:00
|
|
|
if (checked) {
|
2021-12-14 19:47:32 +01:00
|
|
|
if (root.advancedStore.currentNetworkName === root.network)
|
|
|
|
return
|
|
|
|
|
|
|
|
root.newNetwork = root.network;
|
|
|
|
Global.openPopup(confirmDialogComponent)
|
2021-03-19 11:25:29 +01:00
|
|
|
}
|
|
|
|
}
|
2020-11-23 15:14:48 -04:00
|
|
|
|
2021-04-13 13:49:51 -04:00
|
|
|
Component {
|
|
|
|
id: confirmDialogComponent
|
|
|
|
ConfirmationDialog {
|
|
|
|
id: confirmDialog
|
|
|
|
//% "Warning!"
|
2021-09-09 11:10:29 +02:00
|
|
|
header.title: qsTrId("close-app-title")
|
2021-04-13 13:49:51 -04:00
|
|
|
//% "The account will be logged out. When you unlock it again, the selected network will be used"
|
|
|
|
confirmationText: qsTrId("logout-app-content")
|
|
|
|
onConfirmButtonClicked: {
|
2021-12-14 19:47:32 +01:00
|
|
|
root.advancedStore.setNetworkName(root.newNetwork)
|
2021-04-13 13:49:51 -04:00
|
|
|
}
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
2020-11-23 15:14:48 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|