feat(Communities): Add context menu to communities view

Closes: #5842
This commit is contained in:
Boris Melnik 2022-05-25 11:57:57 +03:00 committed by Iuri Matias
parent 1f5de11069
commit 0b0fa51c89
2 changed files with 50 additions and 7 deletions

View File

@ -31,6 +31,7 @@ Rectangle {
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
propagateComposedEvents: true
onClicked: {
/* Prevents sending events to the component beneath
if Right Mouse Button is clicked. */

View File

@ -82,7 +82,8 @@ Item {
})
}
}
}
} // StatusChatInfoToolBar
Loader {
id: membershipRequests
@ -109,9 +110,10 @@ Item {
ScrollView {
id: chatGroupsContainer
anchors.top: membershipRequests.bottom
anchors.topMargin: Style.current.padding
anchors.bottom: parent.bottom
topPadding: Style.current.padding
width: parent.width
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
@ -120,6 +122,44 @@ Item {
+ bannerColumn.height
+ Style.current.bigPadding
background: MouseArea {
acceptedButtons: Qt.RightButton
onClicked: {
popup.x = mouse.x + 4
popup.y = mouse.y + 4
popup.open()
}
property var popup: StatusPopupMenu {
StatusMenuItem {
text: qsTr("Create channel")
icon.name: "channel"
enabled: communityData.amISectionAdmin
onTriggered: Global.openPopup(createChannelPopup)
}
StatusMenuItem {
text: qsTr("Create category")
icon.name: "channel-category"
enabled: communityData.amISectionAdmin
onTriggered: Global.openPopup(createCategoryPopup)
}
StatusMenuSeparator {}
StatusMenuItem {
text: qsTr("Invite people")
icon.name: "share-ios"
enabled: communityData.canManageUsers
onTriggered: Global.openPopup(inviteFriendsToCommunityPopup, {
community: communityData,
hasAddedContacts: root.hasAddedContacts,
communitySectionModule: root.communitySectionModule
})
}
}
} // MouseArea
StatusChatListAndCategories {
id: communityChatListAndCategories
anchors.horizontalCenter: parent.horizontalCenter
@ -346,7 +386,7 @@ Item {
onManageCommunityClicked: root.manageButtonClicked()
}
}
}
} // Loader
Loader {
id: channelsAndCategoriesAdminBox
@ -372,6 +412,7 @@ Item {
MouseArea {
anchors.fill: channelsAndCategoriesBanner
acceptedButtons: Qt.RightButton
propagateComposedEvents: true
onClicked: {
/* Prevents sending events to the component beneath
if Right Mouse Button is clicked. */
@ -380,7 +421,7 @@ Item {
}
}
}
}
} // Loader
Loader {
id: backUpBannerLoader
@ -411,6 +452,7 @@ Item {
MouseArea {
anchors.fill: backupBanner
acceptedButtons: Qt.RightButton
propagateComposedEvents: true
onClicked: {
/* Prevents sending events to the component beneath
if Right Mouse Button is clicked. */
@ -419,9 +461,9 @@ Item {
}
}
}
}
}
}
} // Loader
} // Column
} // ScrollView
Component {
id: createChannelPopup