fix: fix group info popup warning and don't load popup immediately

This commit is contained in:
Jonathan Rainville 2021-02-17 15:36:10 -05:00 committed by Iuri Matias
parent 3d8f7ad463
commit 7dc3bf7e87
6 changed files with 17 additions and 19 deletions

View File

@ -37,8 +37,8 @@ Rectangle {
onClicked: { onClicked: {
switch (chatsModel.activeChannel.chatType) { switch (chatsModel.activeChannel.chatType) {
case Constants.chatTypePrivateGroupChat: case Constants.chatTypePrivateGroupChat:
groupInfoPopup.openMenu(chatsModel.activeChannel, chatsModel.getActiveChannelIdx()) openPopup(groupInfoPopupComponent, {channel: chatsModel.activeChannel})
break; break;
case Constants.chatTypeOneToOne: case Constants.chatTypeOneToOne:
const profileImage = appMain.getProfileImage(chatsModel.activeChannel.id) const profileImage = appMain.getProfileImage(chatsModel.activeChannel.id)
@ -120,7 +120,6 @@ Rectangle {
ChannelContextMenu { ChannelContextMenu {
id: chatContextMenu id: chatContextMenu
groupInfoPopup: groupInfoPopup
} }
PopupMenu { PopupMenu {
@ -132,7 +131,7 @@ Rectangle {
icon.height: chatTopBarContent.iconSize icon.height: chatTopBarContent.iconSize
//% "Group Information" //% "Group Information"
text: qsTrId("group-information") text: qsTrId("group-information")
onTriggered: groupInfoPopup.openMenu(chatsModel.activeChannel, chatsModel.getActiveChannelIdx()) onTriggered: openPopup(groupInfoPopupComponent, {channel: chatsModel.activeChannel})
} }
Action { Action {
icon.source: "../../../img/close.svg" icon.source: "../../../img/close.svg"
@ -159,10 +158,6 @@ Rectangle {
} }
} }
} }
GroupInfoPopup {
id: groupInfoPopup
}
} }
} }

View File

@ -75,6 +75,11 @@ SplitView {
CommunityColumn {} CommunityColumn {}
} }
Component {
id: groupInfoPopupComponent
GroupInfoPopup {}
}
ChatColumn { ChatColumn {
id: chatColumn id: chatColumn
chatGroupsListViewCount: contactColumnLoader.item.chatGroupsListViewCount chatGroupsListViewCount: contactColumnLoader.item.chatGroupsListViewCount

View File

@ -76,13 +76,8 @@ Item {
} }
} }
GroupInfoPopup {
id: groupInfoPopup
}
ChannelContextMenu { ChannelContextMenu {
id: channelContextMenu id: channelContextMenu
groupInfoPopup: groupInfoPopup
} }
Connections { Connections {

View File

@ -8,7 +8,6 @@ import "../../../../imports"
PopupMenu { PopupMenu {
property int channelIndex property int channelIndex
property var contextChannel property var contextChannel
property var groupInfoPopup
id: channelContextMenu id: channelContextMenu
width: 175 width: 175
@ -61,7 +60,7 @@ PopupMenu {
) )
} }
if (channelContextMenu.contextChannel.chatType === Constants.chatTypePrivateGroupChat) { if (channelContextMenu.contextChannel.chatType === Constants.chatTypePrivateGroupChat) {
return groupInfoPopup.openMenu(channelContextMenu.contextChannel) return openPopup(groupInfoPopupComponent, {channel: channelContextMenu.contextChannel})
} }
} }
} }

View File

@ -33,9 +33,8 @@ ModalPopup {
}) })
} }
function openMenu(channel) { onClosed: {
popup.channel = channel popup.destroy();
popup.open()
} }
onOpened: { onOpened: {
@ -193,12 +192,16 @@ ModalPopup {
Separator { Separator {
id: separator id: separator
visible: !addMembers visible: !addMembers
anchors.left: parent.left
anchors.leftMargin: -Style.current.padding
anchors.right: parent.right
anchors.rightMargin: -Style.current.padding
} }
ListView { ListView {
id: memberList id: memberList
anchors.fill: parent anchors.fill: parent
anchors.top: memberLabel.bottom anchors.top: separator.bottom
anchors.bottom: popup.bottom anchors.bottom: popup.bottom
anchors.topMargin: addMembers ? 30 : 15 anchors.topMargin: addMembers ? 30 : 15
anchors.bottomMargin: Style.current.padding anchors.bottomMargin: Style.current.padding

View File

@ -156,6 +156,7 @@ DISTFILES += \
app/AppLayouts/Chat/components/MessageContextMenu.qml \ app/AppLayouts/Chat/components/MessageContextMenu.qml \
app/AppLayouts/Chat/components/NicknamePopup.qml \ app/AppLayouts/Chat/components/NicknamePopup.qml \
app/AppLayouts/Chat/components/SuggestedChannels.qml \ app/AppLayouts/Chat/components/SuggestedChannels.qml \
app/AppLayouts/Chat/components/GroupInfoPopup.qml \
app/AppLayouts/Chat/data/channelList.js \ app/AppLayouts/Chat/data/channelList.js \
app/AppLayouts/Profile/LeftTab/Constants.js \ app/AppLayouts/Profile/LeftTab/Constants.js \
app/AppLayouts/Profile/LeftTab/components/MenuButton.qml \ app/AppLayouts/Profile/LeftTab/components/MenuButton.qml \