feat(ChatContextMenu): add confirmation dialog when leaving group chat

Fixes #11998
This commit is contained in:
Teodor M. Ionita 2023-08-31 16:42:51 +03:00 committed by Shinnok
parent f71caf8e77
commit 1d644d0b9c
1 changed files with 24 additions and 1 deletions

View File

@ -231,7 +231,7 @@ StatusMenu {
type: StatusAction.Type.Danger
onTriggered: {
if (root.chatType === Constants.chatType.privateGroupChat) {
root.leaveChat(root.chatId);
Global.openPopup(leaveGroupConfirmationDialogComponent);
} else {
Global.openPopup(deleteChatConfirmationDialogComponent);
}
@ -276,6 +276,29 @@ StatusMenu {
}
}
Component {
id: leaveGroupConfirmationDialogComponent
ConfirmationDialog {
confirmButtonObjectName: "leaveGroupConfirmationDialogLeaveButton"
headerSettings.title: qsTr("Leave group")
confirmationText: qsTr("Are you sure you want to leave group chat <b>%1</b>?").arg(root.chatName)
confirmButtonLabel: qsTr("Leave")
showCancelButton: true
cancelBtnType: "normal"
onClosed: {
destroy()
}
onCancelButtonClicked: {
close()
}
onConfirmButtonClicked: {
root.leaveChat(root.chatId)
close()
}
}
}
Component {
id: deleteChatConfirmationDialogComponent
ConfirmationDialog {