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: {
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
}
}
}

View File

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

View File

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

View File

@ -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})
}
}
}

View File

@ -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

View File

@ -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 \