fix(@desktop/community) add delete button to edit channel popup

- update labels in edit channel popup

Fixes #6732
This commit is contained in:
PavelS 2022-08-05 09:47:19 +03:00 committed by PavelS
parent 6c562580ba
commit 0e7e541a62
2 changed files with 18 additions and 2 deletions

View File

@ -21,6 +21,7 @@ StatusDialog {
height: 509
property bool isEdit: false
property bool isDeleteable: false
property string chatId: ""
property string categoryId: ""
property string channelName: ""
@ -37,6 +38,7 @@ StatusDialog {
signal createCommunityChannel(string chName, string chDescription, string chEmoji, string chColor, string chCategoryId)
signal editCommunityChannel(string chName, string chDescription, string chEmoji, string chColor, string chCategoryId)
signal deleteCommunityChannel()
title: qsTr("New channel")
@ -277,12 +279,21 @@ StatusDialog {
footer: StatusDialogFooter {
rightButtons: ObjectModel {
StatusButton {
objectName: "deleteCommunityChannelBtn"
visible: isEdit && isDeleteable
text: qsTr("Delete channel")
type: StatusBaseButton.Type.Danger
onClicked: {
root.deleteCommunityChannel()
}
}
StatusButton {
objectName: "createOrEditCommunityChannelBtn"
enabled: isFormValid()
text: isEdit ?
qsTr("Save") :
qsTr("Create")
qsTr("Save changes") :
qsTr("Create channel")
onClicked: {
if (!isFormValid()) {
scrollView.scrollBackUp()

View File

@ -189,6 +189,7 @@ StatusPopupMenu {
CreateChannelPopup {
anchors.centerIn: parent
isEdit: true
isDeleteable: root.isCommunityChat
emojiPopup: root.emojiPopup
onCreateCommunityChannel: {
root.createCommunityChannel(root.chatId, chName, chDescription, chEmoji, chColor);
@ -197,6 +198,10 @@ StatusPopupMenu {
root.editCommunityChannel(root.chatId, chName, chDescription, chEmoji, chColor,
chCategoryId);
}
onDeleteCommunityChannel: {
Global.openPopup(deleteChatConfirmationDialogComponent)
close()
}
onClosed: {
destroy()
}