2020-12-11 20:29:46 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import "../../../../shared"
|
|
|
|
import "../../../../imports"
|
|
|
|
import "../components"
|
|
|
|
import "./"
|
|
|
|
|
2021-02-17 16:31:59 +00:00
|
|
|
ListView {
|
|
|
|
id: communityListView
|
|
|
|
spacing: 12
|
|
|
|
height: childrenRect.height
|
|
|
|
visible: height > 10
|
|
|
|
width:parent.width
|
|
|
|
interactive: false
|
2020-12-11 20:29:46 +00:00
|
|
|
|
2021-02-17 16:31:59 +00:00
|
|
|
model: chatsModel.communities.joinedCommunities
|
|
|
|
delegate: CommunityButton {
|
|
|
|
communityId: model.id
|
|
|
|
name: model.name
|
|
|
|
image: model.thumbnailImage
|
2021-02-22 18:53:47 +00:00
|
|
|
unviewedMessagesCount: model.unviewedMessagesCount
|
2021-04-09 09:19:01 +00:00
|
|
|
iconColor: model.communityColor || Style.current.blue
|
2021-03-10 11:27:35 +00:00
|
|
|
useLetterIdenticon: model.thumbnailImage === ""
|
2020-12-11 20:29:46 +00:00
|
|
|
}
|
2021-03-29 19:31:18 +00:00
|
|
|
|
|
|
|
PopupMenu {
|
|
|
|
property string communityId
|
|
|
|
|
|
|
|
onAboutToShow: {
|
|
|
|
chatsModel.communities.setObservedCommunity(commnunityMenu.communityId)
|
|
|
|
}
|
|
|
|
|
|
|
|
id: commnunityMenu
|
|
|
|
Action {
|
|
|
|
text: qsTr("Invite People")
|
|
|
|
enabled: chatsModel.communities.observedCommunity.canManageUsers
|
|
|
|
icon.source: "../../../img/export.svg"
|
|
|
|
icon.width: 20
|
|
|
|
icon.height: 20
|
|
|
|
onTriggered: openPopup(inviteFriendsToCommunityPopup, {communityId: commnunityMenu.communityId})
|
|
|
|
}
|
|
|
|
Action {
|
|
|
|
text: qsTr("View Community")
|
|
|
|
icon.source: "../../../img/group.svg"
|
|
|
|
icon.width: 20
|
|
|
|
icon.height: 20
|
|
|
|
onTriggered: openPopup(communityMembersPopup, {community: chatsModel.communities.observedCommunity})
|
|
|
|
}
|
|
|
|
Separator {
|
|
|
|
height: 10
|
|
|
|
}
|
|
|
|
Action {
|
|
|
|
text: qsTr("Edit Community")
|
|
|
|
// TODO reenable this option once the edit feature is done
|
|
|
|
enabled: false//chatsModel.communities.observedCommunity.admin
|
|
|
|
icon.source: "../../../img/edit.svg"
|
|
|
|
icon.width: 20
|
|
|
|
icon.height: 20
|
|
|
|
onTriggered: openPopup(editCommunityPopup, {community: chatsModel.communities.observedCommunity})
|
|
|
|
}
|
|
|
|
Action {
|
|
|
|
text: qsTr("Leave Community")
|
|
|
|
icon.source: "../../../img/edit.svg"
|
|
|
|
icon.width: 20
|
|
|
|
icon.height: 20
|
|
|
|
onTriggered: {
|
|
|
|
chatsModel.communities.leaveCommunity(commnunityMenu.communityId)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-12-11 20:29:46 +00:00
|
|
|
}
|