2020-12-15 16:04:19 +00:00
|
|
|
import QtQuick 2.12
|
2021-03-16 13:07:09 +00:00
|
|
|
import QtQuick.Controls 2.12
|
2021-07-15 11:15:56 +00:00
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2020-12-15 16:04:19 +00:00
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
import "../../panels/communities"
|
|
|
|
|
2021-07-15 11:15:56 +00:00
|
|
|
StatusModal {
|
2021-07-16 12:36:27 +00:00
|
|
|
|
|
|
|
property var community
|
|
|
|
|
2020-12-15 16:04:19 +00:00
|
|
|
id: popup
|
|
|
|
|
2021-03-16 13:07:09 +00:00
|
|
|
onClosed: {
|
2021-09-07 13:37:00 +00:00
|
|
|
while (contentItem.depth > 1) {
|
|
|
|
contentItem.pop()
|
2021-03-16 13:07:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-07 13:37:00 +00:00
|
|
|
header.title: contentItem.currentItem.headerTitle
|
|
|
|
header.subTitle: contentItem.currentItem.headerSubtitle || ""
|
|
|
|
header.image.source: contentItem.currentItem.headerImageSource || ""
|
|
|
|
header.icon.isLetterIdenticon: contentItem.currentItem.headerTitle == popup.community.name && !contentItem.currentItem.headerImageSource
|
2021-07-21 09:50:47 +00:00
|
|
|
header.icon.background.color: popup.community.communityColor
|
2021-02-12 16:32:04 +00:00
|
|
|
|
2021-09-02 14:40:10 +00:00
|
|
|
contentItem: StackView {
|
2021-03-16 13:07:09 +00:00
|
|
|
id: stack
|
|
|
|
initialItem: profileOverview
|
2021-07-15 11:15:56 +00:00
|
|
|
width: popup.width
|
2021-09-07 13:37:00 +00:00
|
|
|
implicitHeight: currentItem.implicitHeight || currentItem.height
|
2020-12-16 18:56:48 +00:00
|
|
|
|
2021-03-16 13:07:09 +00:00
|
|
|
pushEnter: Transition { enabled: false }
|
|
|
|
pushExit: Transition { enabled: false }
|
|
|
|
popEnter: Transition { enabled: false }
|
|
|
|
popExit: Transition { enabled: false }
|
2020-12-18 20:15:00 +00:00
|
|
|
|
2021-03-16 13:07:09 +00:00
|
|
|
Component {
|
|
|
|
id: profileOverview
|
2021-10-01 15:58:36 +00:00
|
|
|
CommunityProfilePopupOverviewPanel {
|
2021-07-15 11:15:56 +00:00
|
|
|
width: stack.width
|
|
|
|
|
2021-07-16 12:36:27 +00:00
|
|
|
headerTitle: popup.community.name
|
2021-07-15 11:15:56 +00:00
|
|
|
headerSubtitle: {
|
2021-07-16 12:36:27 +00:00
|
|
|
switch(popup.community.access) {
|
2021-03-16 13:07:09 +00:00
|
|
|
//% "Public community"
|
|
|
|
case Constants.communityChatPublicAccess: return qsTrId("public-community");
|
|
|
|
//% "Invitation only community"
|
|
|
|
case Constants.communityChatInvitationOnlyAccess: return qsTrId("invitation-only-community");
|
|
|
|
//% "On request community"
|
|
|
|
case Constants.communityChatOnRequestAccess: return qsTrId("on-request-community");
|
|
|
|
//% "Unknown community"
|
|
|
|
default: return qsTrId("unknown-community");
|
2020-12-17 13:24:33 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-16 12:36:27 +00:00
|
|
|
headerImageSource: popup.community.thumbnailImage
|
|
|
|
community: popup.community
|
2021-07-15 11:15:56 +00:00
|
|
|
|
2021-09-07 13:37:00 +00:00
|
|
|
onMembersListButtonClicked: popup.contentItem.push(membersList)
|
2021-07-15 11:15:56 +00:00
|
|
|
onNotificationsButtonClicked: {
|
2021-07-16 12:36:27 +00:00
|
|
|
chatsModel.communities.setCommunityMuted(popup.community.id, checked)
|
2021-07-15 11:15:56 +00:00
|
|
|
}
|
2021-07-16 12:36:27 +00:00
|
|
|
onEditButtonClicked: openPopup(editCommunityPopup, {
|
|
|
|
community: popup.community
|
|
|
|
})
|
2021-07-21 11:00:32 +00:00
|
|
|
onTransferOwnershipButtonClicked: openPopup(transferOwnershipPopup, {privateKey: chatsModel.communities.exportCommunity()})
|
2021-08-02 09:39:51 +00:00
|
|
|
onLeaveButtonClicked: {
|
|
|
|
chatsModel.communities.leaveCommunity(popup.community.id)
|
|
|
|
popup.close()
|
|
|
|
}
|
2021-07-16 12:36:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: transferOwnershipPopup
|
|
|
|
TransferOwnershipPopup {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
2021-07-15 11:15:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: membersList
|
2021-10-01 15:58:36 +00:00
|
|
|
CommunityProfilePopupMembersListPanel {
|
2021-07-15 11:15:56 +00:00
|
|
|
width: stack.width
|
2021-07-22 15:03:59 +00:00
|
|
|
//% "Members"
|
|
|
|
headerTitle: qsTrId("members-label")
|
2021-07-16 12:36:27 +00:00
|
|
|
headerSubtitle: popup.community.nbMembers.toString()
|
|
|
|
community: popup.community
|
2021-09-07 13:37:00 +00:00
|
|
|
onInviteButtonClicked: popup.contentItem.push(inviteFriendsView)
|
2021-07-15 11:15:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: inviteFriendsView
|
2021-10-01 15:58:36 +00:00
|
|
|
CommunityProfilePopupInviteFriendsPanel {
|
2021-07-15 11:15:56 +00:00
|
|
|
width: stack.width
|
2021-07-22 15:03:59 +00:00
|
|
|
//% "Invite friends"
|
|
|
|
headerTitle: qsTrId("invite-friends")
|
2021-07-16 12:36:27 +00:00
|
|
|
community: popup.community
|
2021-07-15 11:15:56 +00:00
|
|
|
|
|
|
|
contactListSearch.chatKey.text: ""
|
|
|
|
contactListSearch.pubKey: ""
|
|
|
|
contactListSearch.pubKeys: []
|
|
|
|
contactListSearch.ensUsername: ""
|
|
|
|
contactListSearch.existingContacts.visible: profileModel.contacts.list.hasAddedContacts()
|
|
|
|
contactListSearch.noContactsRect.visible: !contactListSearch.existingContacts.visible
|
2020-12-16 18:56:48 +00:00
|
|
|
}
|
|
|
|
}
|
2021-03-16 13:07:09 +00:00
|
|
|
}
|
2020-12-18 20:15:00 +00:00
|
|
|
|
2021-07-15 11:15:56 +00:00
|
|
|
leftButtons: [
|
2021-03-16 13:07:09 +00:00
|
|
|
StatusRoundButton {
|
2021-07-16 07:53:41 +00:00
|
|
|
id: backButton
|
2021-03-16 13:07:09 +00:00
|
|
|
icon.name: "arrow-right"
|
|
|
|
icon.height: 16
|
2021-07-15 11:15:56 +00:00
|
|
|
icon.width: 20
|
2021-03-16 13:07:09 +00:00
|
|
|
rotation: 180
|
2021-09-07 13:37:00 +00:00
|
|
|
visible: contentItem.depth > 1
|
2021-07-15 11:15:56 +00:00
|
|
|
height: !visible ? 0 : implicitHeight
|
2021-03-16 13:07:09 +00:00
|
|
|
onClicked: {
|
2021-09-07 13:37:00 +00:00
|
|
|
contentItem.pop()
|
2020-12-16 18:56:48 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-15 11:15:56 +00:00
|
|
|
]
|
2021-04-20 12:31:36 +00:00
|
|
|
|
2021-07-15 11:15:56 +00:00
|
|
|
rightButtons: [
|
2021-04-20 12:31:36 +00:00
|
|
|
StatusButton {
|
2021-07-22 15:03:59 +00:00
|
|
|
//% "Invite"
|
|
|
|
text: qsTrId("community-invite-title")
|
2021-09-07 13:37:00 +00:00
|
|
|
visible: popup.contentItem.depth > 2
|
2021-07-15 11:15:56 +00:00
|
|
|
height: !visible ? 0 : implicitHeight
|
2021-09-07 13:37:00 +00:00
|
|
|
enabled: popup.contentItem.currentItem.contactListSearch !== undefined && popup.contentItem.currentItem.contactListSearch.pubKeys.length > 0
|
2021-04-20 12:31:36 +00:00
|
|
|
onClicked: {
|
2021-09-07 13:37:00 +00:00
|
|
|
popup.contentItem.currentItem.sendInvites(popup.contentItem.currentItem.contactListSearch.pubKeys)
|
|
|
|
popup.contentItem.pop()
|
2021-04-20 12:31:36 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-15 11:15:56 +00:00
|
|
|
]
|
2020-12-15 16:04:19 +00:00
|
|
|
}
|
|
|
|
|