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

View File

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