From 7dc3bf7e8789e1f19b7a859ef819f1061cbd76a8 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 17 Feb 2021 15:36:10 -0500 Subject: [PATCH] fix: fix group info popup warning and don't load popup immediately --- ui/app/AppLayouts/Chat/ChatColumn/TopBar.qml | 11 +++-------- ui/app/AppLayouts/Chat/ChatLayout.qml | 5 +++++ ui/app/AppLayouts/Chat/ContactsColumn/ChannelList.qml | 5 ----- .../AppLayouts/Chat/components/ChannelContextMenu.qml | 3 +-- ui/app/AppLayouts/Chat/components/GroupInfoPopup.qml | 11 +++++++---- ui/nim-status-client.pro | 1 + 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/ui/app/AppLayouts/Chat/ChatColumn/TopBar.qml b/ui/app/AppLayouts/Chat/ChatColumn/TopBar.qml index 20b7cf1e5a..39a3b1822f 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/TopBar.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/TopBar.qml @@ -37,8 +37,8 @@ Rectangle { onClicked: { switch (chatsModel.activeChannel.chatType) { - case Constants.chatTypePrivateGroupChat: - groupInfoPopup.openMenu(chatsModel.activeChannel, chatsModel.getActiveChannelIdx()) + case Constants.chatTypePrivateGroupChat: + openPopup(groupInfoPopupComponent, {channel: chatsModel.activeChannel}) break; case Constants.chatTypeOneToOne: const profileImage = appMain.getProfileImage(chatsModel.activeChannel.id) @@ -120,7 +120,6 @@ Rectangle { ChannelContextMenu { id: chatContextMenu - groupInfoPopup: groupInfoPopup } PopupMenu { @@ -132,7 +131,7 @@ Rectangle { icon.height: chatTopBarContent.iconSize //% "Group Information" text: qsTrId("group-information") - onTriggered: groupInfoPopup.openMenu(chatsModel.activeChannel, chatsModel.getActiveChannelIdx()) + onTriggered: openPopup(groupInfoPopupComponent, {channel: chatsModel.activeChannel}) } Action { icon.source: "../../../img/close.svg" @@ -159,10 +158,6 @@ Rectangle { } } } - - GroupInfoPopup { - id: groupInfoPopup - } } } diff --git a/ui/app/AppLayouts/Chat/ChatLayout.qml b/ui/app/AppLayouts/Chat/ChatLayout.qml index 569b3a41b0..0ac777fde8 100644 --- a/ui/app/AppLayouts/Chat/ChatLayout.qml +++ b/ui/app/AppLayouts/Chat/ChatLayout.qml @@ -75,6 +75,11 @@ SplitView { CommunityColumn {} } + Component { + id: groupInfoPopupComponent + GroupInfoPopup {} + } + ChatColumn { id: chatColumn chatGroupsListViewCount: contactColumnLoader.item.chatGroupsListViewCount diff --git a/ui/app/AppLayouts/Chat/ContactsColumn/ChannelList.qml b/ui/app/AppLayouts/Chat/ContactsColumn/ChannelList.qml index 7aabdbe8c6..1ed4d33881 100644 --- a/ui/app/AppLayouts/Chat/ContactsColumn/ChannelList.qml +++ b/ui/app/AppLayouts/Chat/ContactsColumn/ChannelList.qml @@ -76,13 +76,8 @@ Item { } } - GroupInfoPopup { - id: groupInfoPopup - } - ChannelContextMenu { id: channelContextMenu - groupInfoPopup: groupInfoPopup } Connections { diff --git a/ui/app/AppLayouts/Chat/components/ChannelContextMenu.qml b/ui/app/AppLayouts/Chat/components/ChannelContextMenu.qml index e5bb19a665..8315fca068 100644 --- a/ui/app/AppLayouts/Chat/components/ChannelContextMenu.qml +++ b/ui/app/AppLayouts/Chat/components/ChannelContextMenu.qml @@ -8,7 +8,6 @@ import "../../../../imports" PopupMenu { property int channelIndex property var contextChannel - property var groupInfoPopup id: channelContextMenu width: 175 @@ -61,7 +60,7 @@ PopupMenu { ) } if (channelContextMenu.contextChannel.chatType === Constants.chatTypePrivateGroupChat) { - return groupInfoPopup.openMenu(channelContextMenu.contextChannel) + return openPopup(groupInfoPopupComponent, {channel: channelContextMenu.contextChannel}) } } } diff --git a/ui/app/AppLayouts/Chat/components/GroupInfoPopup.qml b/ui/app/AppLayouts/Chat/components/GroupInfoPopup.qml index cf626406ab..1127ade93c 100644 --- a/ui/app/AppLayouts/Chat/components/GroupInfoPopup.qml +++ b/ui/app/AppLayouts/Chat/components/GroupInfoPopup.qml @@ -33,9 +33,8 @@ ModalPopup { }) } - function openMenu(channel) { - popup.channel = channel - popup.open() + onClosed: { + popup.destroy(); } onOpened: { @@ -193,12 +192,16 @@ ModalPopup { Separator { id: separator visible: !addMembers + anchors.left: parent.left + anchors.leftMargin: -Style.current.padding + anchors.right: parent.right + anchors.rightMargin: -Style.current.padding } ListView { id: memberList anchors.fill: parent - anchors.top: memberLabel.bottom + anchors.top: separator.bottom anchors.bottom: popup.bottom anchors.topMargin: addMembers ? 30 : 15 anchors.bottomMargin: Style.current.padding diff --git a/ui/nim-status-client.pro b/ui/nim-status-client.pro index 13d2fa9ea7..a3af5ec2a6 100644 --- a/ui/nim-status-client.pro +++ b/ui/nim-status-client.pro @@ -156,6 +156,7 @@ DISTFILES += \ app/AppLayouts/Chat/components/MessageContextMenu.qml \ app/AppLayouts/Chat/components/NicknamePopup.qml \ app/AppLayouts/Chat/components/SuggestedChannels.qml \ + app/AppLayouts/Chat/components/GroupInfoPopup.qml \ app/AppLayouts/Chat/data/channelList.js \ app/AppLayouts/Profile/LeftTab/Constants.js \ app/AppLayouts/Profile/LeftTab/components/MenuButton.qml \