From 0e7e541a62a38af2e302c2bff7275fe6c28a0aa1 Mon Sep 17 00:00:00 2001 From: PavelS Date: Fri, 5 Aug 2022 09:47:19 +0300 Subject: [PATCH] fix(@desktop/community) add delete button to edit channel popup - update labels in edit channel popup Fixes #6732 --- .../Chat/popups/community/CreateChannelPopup.qml | 15 +++++++++++++-- .../AppLayouts/Chat/views/ChatContextMenuView.qml | 5 +++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ui/app/AppLayouts/Chat/popups/community/CreateChannelPopup.qml b/ui/app/AppLayouts/Chat/popups/community/CreateChannelPopup.qml index 9708decf7f..95870797c8 100644 --- a/ui/app/AppLayouts/Chat/popups/community/CreateChannelPopup.qml +++ b/ui/app/AppLayouts/Chat/popups/community/CreateChannelPopup.qml @@ -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() diff --git a/ui/app/AppLayouts/Chat/views/ChatContextMenuView.qml b/ui/app/AppLayouts/Chat/views/ChatContextMenuView.qml index ad5f4326ac..72c9f2277f 100644 --- a/ui/app/AppLayouts/Chat/views/ChatContextMenuView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatContextMenuView.qml @@ -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() }