2020-12-17 23:12:05 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import "../../../../imports"
|
|
|
|
import "../../../../shared"
|
|
|
|
import "../../../../shared/status"
|
|
|
|
import "./"
|
|
|
|
import "../components"
|
|
|
|
|
|
|
|
ModalPopup {
|
|
|
|
id: popup
|
2021-03-29 19:31:18 +00:00
|
|
|
property QtObject community: chatsModel.communities.activeCommunity
|
2020-12-17 23:12:05 +00:00
|
|
|
|
|
|
|
header: Item {
|
|
|
|
height: childrenRect.height
|
|
|
|
width: parent.width
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: groupName
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Members"
|
|
|
|
text: qsTrId("members-title")
|
2020-12-17 23:12:05 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 2
|
|
|
|
anchors.left: parent.left
|
|
|
|
font.bold: true
|
|
|
|
font.pixelSize: 14
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2021-02-11 19:06:39 +00:00
|
|
|
id: nbMembersText
|
2020-12-17 23:12:05 +00:00
|
|
|
text: community.nbMembers.toString()
|
|
|
|
width: 160
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.top: groupName.bottom
|
|
|
|
anchors.topMargin: 2
|
|
|
|
font.pixelSize: 14
|
2021-03-04 15:53:42 +00:00
|
|
|
color: Style.current.secondaryText
|
2020-12-17 23:12:05 +00:00
|
|
|
}
|
2021-02-11 19:06:39 +00:00
|
|
|
|
|
|
|
Separator {
|
|
|
|
anchors.top: nbMembersText.bottom
|
|
|
|
anchors.topMargin: Style.current.padding
|
2021-03-04 15:53:42 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: -Style.current.padding
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: -Style.current.padding
|
2021-02-11 19:06:39 +00:00
|
|
|
}
|
2020-12-17 23:12:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CommunityPopupButton {
|
|
|
|
id: inviteBtn
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Invite People"
|
|
|
|
label: qsTrId("invite-people")
|
2021-03-04 15:53:42 +00:00
|
|
|
width: parent.width
|
2020-12-17 23:12:05 +00:00
|
|
|
iconName: "invite"
|
2021-03-29 19:31:18 +00:00
|
|
|
onClicked: openPopup(inviteFriendsToCommunityPopup)
|
2020-12-17 23:12:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
id: sep
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.top: inviteBtn.bottom
|
|
|
|
anchors.topMargin: Style.current.smallPadding
|
2021-02-12 15:26:57 +00:00
|
|
|
anchors.leftMargin: -Style.current.padding
|
|
|
|
anchors.rightMargin: -Style.current.padding
|
2021-02-11 19:06:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MembershipRequestsButton {
|
|
|
|
id: membershipRequestsBtn
|
|
|
|
anchors.top: sep.bottom
|
|
|
|
anchors.topMargin: visible ? Style.current.smallPadding : 0
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2021-02-12 15:26:57 +00:00
|
|
|
anchors.leftMargin: -Style.current.padding
|
|
|
|
anchors.rightMargin: -Style.current.padding
|
2020-12-17 23:12:05 +00:00
|
|
|
}
|
|
|
|
|
2021-02-11 19:06:39 +00:00
|
|
|
Separator {
|
|
|
|
id: sep2
|
|
|
|
visible: membershipRequestsBtn.visible
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.top: membershipRequestsBtn.bottom
|
|
|
|
anchors.topMargin: Style.current.smallPadding
|
2021-02-12 15:26:57 +00:00
|
|
|
anchors.leftMargin: -Style.current.padding
|
|
|
|
anchors.rightMargin: -Style.current.padding
|
2021-02-11 19:06:39 +00:00
|
|
|
}
|
|
|
|
|
2020-12-17 23:12:05 +00:00
|
|
|
ListView {
|
|
|
|
id: memberList
|
2021-02-11 19:06:39 +00:00
|
|
|
anchors.top: sep2.visible ? sep2.bottom : sep.bottom
|
2020-12-17 23:12:05 +00:00
|
|
|
anchors.topMargin: Style.current.smallPadding
|
2021-03-04 15:53:42 +00:00
|
|
|
anchors.bottom: parent.bottom
|
2020-12-17 23:12:05 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.bottomMargin: Style.current.halfPadding
|
|
|
|
spacing: 4
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
model: community.members
|
2021-04-30 18:15:50 +00:00
|
|
|
clip: true
|
2020-12-17 23:12:05 +00:00
|
|
|
delegate: Item {
|
|
|
|
id: contactRow
|
|
|
|
width: parent.width
|
|
|
|
height: identicon.height
|
|
|
|
|
2021-01-14 16:03:00 +00:00
|
|
|
property string nickname: appMain.getUserNickname(model.pubKey)
|
2020-12-17 23:12:05 +00:00
|
|
|
|
|
|
|
StatusImageIdenticon {
|
|
|
|
id: identicon
|
|
|
|
anchors.left: parent.left
|
|
|
|
source: model.identicon
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
text: !model.userName.endsWith(".eth") && !!contactRow.nickname ?
|
|
|
|
contactRow.nickname : Utils.removeStatusEns(model.userName)
|
|
|
|
anchors.left: identicon.right
|
|
|
|
anchors.leftMargin: Style.current.smallPadding
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.smallPadding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
font.pixelSize: 13
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: moreActionsBtn
|
|
|
|
text: "..."
|
|
|
|
font.letterSpacing: 0.5
|
|
|
|
font.bold: true
|
|
|
|
lineHeight: 1.4
|
|
|
|
font.pixelSize: 25
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.smallPadding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: contextMenu.popup(-contextMenu.width / 2 + moreActionsBtn.width / 2, moreActionsBtn.height)
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
PopupMenu {
|
|
|
|
id: contextMenu
|
|
|
|
Action {
|
|
|
|
icon.source: "../../../img/communities/menu/view-profile.svg"
|
|
|
|
icon.width: 16
|
|
|
|
icon.height: 16
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "View Profile"
|
|
|
|
text: qsTrId("view-profile")
|
2020-12-17 23:12:05 +00:00
|
|
|
onTriggered: openProfilePopup(model.userName, model.pubKey, model.identicon, '', contactRow.nickname)
|
|
|
|
}
|
|
|
|
Action {
|
|
|
|
icon.source: "../../../img/communities/menu/roles.svg"
|
|
|
|
icon.width: 16
|
|
|
|
icon.height: 16
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Roles"
|
|
|
|
text: qsTrId("roles")
|
2021-05-24 15:11:52 +00:00
|
|
|
enabled: chatsModel.communities.activeCommunity.admin
|
2020-12-17 23:12:05 +00:00
|
|
|
onTriggered: console.log("TODO")
|
|
|
|
}
|
2021-05-24 15:11:52 +00:00
|
|
|
Separator {
|
|
|
|
visible: chatsModel.communities.activeCommunity.admin
|
|
|
|
}
|
2020-12-17 23:12:05 +00:00
|
|
|
Action {
|
|
|
|
icon.source: "../../../img/communities/menu/kick.svg"
|
|
|
|
icon.width: 16
|
|
|
|
icon.height: 16
|
|
|
|
icon.color: Style.current.red
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Kick"
|
|
|
|
text: qsTrId("kick")
|
2021-05-24 15:11:52 +00:00
|
|
|
enabled: chatsModel.communities.activeCommunity.admin
|
2021-04-20 16:03:58 +00:00
|
|
|
onTriggered: chatsModel.communities.removeUserFromCommunity(model.pubKey)
|
2020-12-17 23:12:05 +00:00
|
|
|
}
|
|
|
|
Action {
|
|
|
|
icon.source: "../../../img/communities/menu/ban.svg"
|
|
|
|
icon.width: 16
|
|
|
|
icon.height: 16
|
|
|
|
icon.color: Style.current.red
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Ban"
|
|
|
|
text: qsTrId("ban")
|
2021-05-24 15:11:52 +00:00
|
|
|
enabled: chatsModel.communities.activeCommunity.admin
|
2020-12-17 23:12:05 +00:00
|
|
|
onTriggered: console.log("TODO")
|
|
|
|
}
|
2021-05-24 15:11:52 +00:00
|
|
|
Separator {
|
|
|
|
visible: chatsModel.communities.activeCommunity.admin
|
|
|
|
}
|
2020-12-17 23:12:05 +00:00
|
|
|
Action {
|
|
|
|
icon.source: "../../../img/communities/menu/transfer-ownership.svg"
|
|
|
|
icon.width: 16
|
|
|
|
icon.height: 16
|
|
|
|
icon.color: Style.current.red
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Transfer ownership"
|
|
|
|
text: qsTrId("transfer-ownership")
|
2021-05-24 15:11:52 +00:00
|
|
|
enabled: chatsModel.communities.activeCommunity.admin
|
2020-12-17 23:12:05 +00:00
|
|
|
onTriggered: console.log("TODO")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|