status-desktop/ui/app/AppLayouts/Profile/controls/NetworkRadioSelector.qml
Alexandra Betouni f0b39ce4f6 Refactor: Moved openPopup function to Global
The openPopup function was declared in AppMain
and used via dynamic scoping in many places in the
application. Moved function to Global component
and updated all places to call it via Global instead.

Closes #4267
2022-02-01 11:38:46 +01:00

45 lines
1.2 KiB
QML

import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import utils 1.0
import shared.popups 1.0
import shared.controls 1.0
RadioButtonSelector {
id: root
property string network: ""
property string networkName: ""
property string newNetwork: ""
title: networkName == "" ? Utils.getNetworkName(network) : networkName
onCheckedChanged: {
if (checked) {
if (profileModel.network.current === root.network) return;
root.newNetwork = root.network;
Global.openPopup(confirmDialogComponent)
}
}
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 = root.newNetwork;
}
onClosed: {
profileModel.network.triggerNetworkChange()
destroy()
}
}
}
}