From d6467923e407c839d67b0be9313061ffe769d4e4 Mon Sep 17 00:00:00 2001 From: Noelia Date: Mon, 27 Feb 2023 13:11:51 +0100 Subject: [PATCH] fix(Chats): Drag/drop image files is only available for community channels - Drag/drop images are available from all chat types (1:1 , group chats and community channels). - In case of community settings views, it is disabled. Fixes #9630 --- ui/app/mainui/AppMain.qml | 44 ++++++++++++-------------- ui/app/mainui/panels/DropAreaPanel.qml | 1 - 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index 04e687764d..bf14fb2a00 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -5,6 +5,7 @@ import QtMultimedia 5.13 import Qt.labs.qmlmodels 1.0 import Qt.labs.platform 1.1 import QtQml.Models 2.14 +import QtQml 2.15 import AppLayouts.Wallet 1.0 import AppLayouts.Node 1.0 @@ -761,8 +762,15 @@ Item { ChatLayout { id: chatLayoutContainer - rootStore: appMain.rootChatStore + Binding { + target: rootDropAreaPanel + property: "enabled" + value: chatLayoutContainer.currentIndex === 0 // Meaning: Chats / channels view + when: visible + restoreMode: Binding.RestoreBindingOrValue + } + rootStore: appMain.rootChatStore chatView.emojiPopup: statusEmojiPopup chatView.stickersPopup: statusStickersPopupLoader.item @@ -858,6 +866,16 @@ Item { Layout.fillHeight: true sourceComponent: ChatLayout { + id: chatLayoutComponent + + Binding { + target: rootDropAreaPanel + property: "enabled" + value: chatLayoutComponent.currentIndex === 0 // Meaning: Chats / channels view + when: visible + restoreMode: Binding.RestoreBindingOrValue + } + chatView.emojiPopup: statusEmojiPopup chatView.stickersPopup: statusStickersPopupLoader.item @@ -1172,32 +1190,10 @@ Item { } } - Connections { - target: appMain.rootStore.mainModuleInst - function onActiveSectionChanged() { - let communitySectionModule = appMain.rootStore.mainModuleInst.getCommunitySectionModule() - if (communitySectionModule) - rootDropAreaPanel.activeChatType = communitySectionModule.activeItem.type - } - } - DropAreaPanel { id: rootDropAreaPanel + width: appMain.width height: appMain.height - activeChatType: appMain.rootStore.mainModuleInst.getCommunitySectionModule() ? appMain.rootStore.mainModuleInst.getCommunitySectionModule().activeItem.type - : 0 - enabled: !drag.source && ( - // in chat view - (appMain.rootStore.mainModuleInst.activeSection.sectionType === Constants.appSection.chat && - ( - // in a one-to-one chat - activeChatType === Constants.chatType.oneToOne || - // in a private group chat - activeChatType === Constants.chatType.privateGroupChat - ) - ) || - // In community section - appMain.rootStore.mainModuleInst.activeSection.sectionType === Constants.appSection.community) } } diff --git a/ui/app/mainui/panels/DropAreaPanel.qml b/ui/app/mainui/panels/DropAreaPanel.qml index f4a9b00f0c..5fb1ab420f 100644 --- a/ui/app/mainui/panels/DropAreaPanel.qml +++ b/ui/app/mainui/panels/DropAreaPanel.qml @@ -6,7 +6,6 @@ DropArea { property bool enabled: false property alias droppedUrls: rptDraggedPreviews.model - property int activeChatType signal droppedOnValidScreen(var drop)