feat: show a confirmation dialog before deleting an account

This commit is contained in:
Jonathan Rainville 2020-06-10 16:28:24 -04:00 committed by Iuri Matias
parent 4d7eee1ebf
commit ddd1105ff0
1 changed files with 22 additions and 11 deletions

View File

@ -103,20 +103,31 @@ ModalPopup {
title: "Deleting account failed"
icon: StandardIcon.Critical
standardButtons: StandardButton.Ok
}
MessageDialog {
id: confirmationDialog
title: qsTr("Are you sure?")
text: qsTr("A deleted account cannot be retrieved later. Only press yes if you backed up your key/seed or don't care about this account anymore")
icon: StandardIcon.Warning
standardButtons: StandardButton.Yes | StandardButton.No
onAccepted: {
const error = walletModel.deleteAccount(currentAccount.address);
if (error) {
deleteError.text = error
deleteError.open()
return
}
// Change active account to the first
changeSelectedAccount(0)
popup.close();
}
}
onClicked : {
// TODO add a confirmation message
const error = walletModel.deleteAccount(currentAccount.address);
if (error) {
deleteError.text = error
deleteError.open()
return
}
// Change active account to the first
changeSelectedAccount(0)
popup.close();
confirmationDialog.open()
}
}
StyledButton {