2020-12-11 15:29:46 -05:00
|
|
|
|
import QtQuick 2.13
|
|
|
|
|
import QtQuick.Controls 2.13
|
2021-07-02 14:34:01 +02:00
|
|
|
|
import QtQuick.Dialogs 1.2
|
2021-02-10 15:37:17 -05:00
|
|
|
|
import QtGraphicalEffects 1.13
|
2020-12-11 15:29:46 -05:00
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
|
|
2022-05-13 11:27:26 -04:00
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
import StatusQ.Controls 0.1
|
2021-07-02 14:34:01 +02:00
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
|
2021-09-28 18:04:06 +03:00
|
|
|
|
import utils 1.0
|
2021-10-28 00:27:49 +03:00
|
|
|
|
import shared 1.0
|
|
|
|
|
import shared.popups 1.0
|
|
|
|
|
import shared.status 1.0
|
2021-10-01 18:58:36 +03:00
|
|
|
|
import "../popups/community"
|
|
|
|
|
import "../panels/communities"
|
2021-07-02 14:34:01 +02:00
|
|
|
|
|
|
|
|
|
Item {
|
2021-07-22 17:53:19 +03:00
|
|
|
|
id: root
|
2022-07-25 16:30:34 -04:00
|
|
|
|
objectName: "communityColumnView"
|
2021-07-22 17:53:19 +03:00
|
|
|
|
width: 304
|
|
|
|
|
height: parent.height
|
|
|
|
|
|
2021-11-26 16:37:57 +01:00
|
|
|
|
// Important:
|
|
|
|
|
// We're here in case of CommunitySection
|
|
|
|
|
// This module is set from `ChatLayout` (each `ChatLayout` has its own communitySectionModule)
|
|
|
|
|
property var communitySectionModule
|
2022-03-07 09:56:05 -05:00
|
|
|
|
property var emojiPopup
|
2021-11-26 16:37:57 +01:00
|
|
|
|
|
2021-10-22 01:39:53 +03:00
|
|
|
|
property var store
|
2022-01-10 11:44:54 -05:00
|
|
|
|
property bool hasAddedContacts: false
|
2022-01-05 10:11:26 -05:00
|
|
|
|
property var communityData: store.mainModuleInst ? store.mainModuleInst.activeSection || {} : {}
|
2022-06-21 13:44:20 +02:00
|
|
|
|
property Component membershipRequestPopup
|
2020-12-11 15:29:46 -05:00
|
|
|
|
|
2022-03-23 16:38:23 +01:00
|
|
|
|
signal infoButtonClicked
|
|
|
|
|
signal manageButtonClicked
|
|
|
|
|
|
2022-07-25 15:20:12 -04:00
|
|
|
|
MouseArea {
|
|
|
|
|
enabled: communityData.amISectionAdmin
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
z: 0
|
|
|
|
|
acceptedButtons: Qt.RightButton
|
|
|
|
|
onClicked: {
|
|
|
|
|
adminPopupMenu.showInviteButton = true
|
|
|
|
|
adminPopupMenu.x = mouse.x + 4
|
|
|
|
|
adminPopupMenu.y = mouse.y + 4
|
|
|
|
|
adminPopupMenu.open()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-13 11:27:26 -04:00
|
|
|
|
StatusChatInfoButton {
|
2020-12-11 15:29:46 -05:00
|
|
|
|
id: communityHeader
|
2022-07-21 12:16:25 -04:00
|
|
|
|
objectName: "communityHeaderButton"
|
2022-05-13 11:27:26 -04:00
|
|
|
|
title: communityData.name
|
2022-09-14 12:40:10 +02:00
|
|
|
|
subTitle: qsTr("%n Member(s)", "", communityData.members.count)
|
2022-08-11 14:55:08 +03:00
|
|
|
|
asset.name: communityData.image
|
|
|
|
|
asset.color: communityData.color
|
|
|
|
|
asset.isImage: true
|
2022-09-19 15:15:35 +02:00
|
|
|
|
onClicked: if (communityData.amISectionAdmin) { root.infoButtonClicked() }
|
2022-05-13 11:27:26 -04:00
|
|
|
|
anchors.top: parent.top
|
2022-09-16 00:17:51 +02:00
|
|
|
|
anchors.topMargin: Style.current.smallPadding
|
2022-05-13 11:27:26 -04:00
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.leftMargin: Style.current.halfPadding
|
|
|
|
|
anchors.right: (implicitWidth > parent.width - 50) ? adHocChatButton.left : undefined
|
|
|
|
|
anchors.rightMargin: Style.current.halfPadding
|
|
|
|
|
type: StatusChatInfoButton.Type.OneToOneChat
|
2022-09-19 15:15:35 +02:00
|
|
|
|
hoverEnabled: communityData.amISectionAdmin
|
2022-05-13 11:27:26 -04:00
|
|
|
|
}
|
2022-01-05 10:11:26 -05:00
|
|
|
|
|
2022-05-13 11:27:26 -04:00
|
|
|
|
StatusIconTabButton {
|
|
|
|
|
id: adHocChatButton
|
|
|
|
|
icon.name: "edit"
|
2022-07-20 14:14:50 +02:00
|
|
|
|
objectName: "startChatButton"
|
2022-05-13 11:27:26 -04:00
|
|
|
|
anchors.verticalCenter: communityHeader.verticalCenter
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.rightMargin: 14
|
|
|
|
|
checked: root.store.openCreateChat
|
|
|
|
|
highlighted: root.store.openCreateChat
|
|
|
|
|
onClicked: {
|
2022-07-22 13:24:28 +02:00
|
|
|
|
if (root.store.openCreateChat) {
|
2022-05-13 11:27:26 -04:00
|
|
|
|
Global.closeCreateChatView()
|
|
|
|
|
} else {
|
|
|
|
|
Global.openCreateChatView()
|
2021-07-02 14:34:01 +02:00
|
|
|
|
}
|
2021-05-04 14:39:36 -04:00
|
|
|
|
}
|
2022-05-25 11:57:57 +03:00
|
|
|
|
|
2022-05-13 11:27:26 -04:00
|
|
|
|
StatusToolTip {
|
|
|
|
|
text: qsTr("Start chat")
|
|
|
|
|
visible: parent.hovered
|
2022-09-14 12:40:10 +02:00
|
|
|
|
orientation: StatusToolTip.Orientation.Bottom
|
|
|
|
|
y: parent.height + 12
|
2022-05-13 11:27:26 -04:00
|
|
|
|
}
|
2022-07-25 15:20:12 -04:00
|
|
|
|
}
|
2022-05-13 11:27:26 -04:00
|
|
|
|
|
2021-02-11 14:06:39 -05:00
|
|
|
|
Loader {
|
2021-07-02 14:34:01 +02:00
|
|
|
|
id: membershipRequests
|
2021-02-10 15:37:17 -05:00
|
|
|
|
|
2022-03-07 09:56:05 -05:00
|
|
|
|
property int nbRequests: root.communityData.pendingRequestsToJoin.count || 0
|
2021-07-02 14:34:01 +02:00
|
|
|
|
|
|
|
|
|
anchors.top: communityHeader.bottom
|
|
|
|
|
anchors.topMargin: active ? 8 : 0
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
|
2022-01-21 14:18:56 -05:00
|
|
|
|
active: communityData.amISectionAdmin && nbRequests > 0
|
2021-07-20 11:50:36 +02:00
|
|
|
|
height: nbRequests > 0 ? 64 : 0
|
2021-02-11 14:06:39 -05:00
|
|
|
|
sourceComponent: Component {
|
2021-07-02 14:34:01 +02:00
|
|
|
|
StatusContactRequestsIndicatorListItem {
|
2022-04-04 13:26:30 +02:00
|
|
|
|
title: qsTr("Membership requests")
|
2021-07-02 14:34:01 +02:00
|
|
|
|
requestsCount: membershipRequests.nbRequests
|
2022-08-24 17:37:05 +03:00
|
|
|
|
onClicked: Global.openPopup(root.membershipRequestPopup, {
|
2022-01-18 15:54:14 -05:00
|
|
|
|
communitySectionModule: root.communitySectionModule
|
|
|
|
|
})
|
2021-07-02 14:34:01 +02:00
|
|
|
|
}
|
2021-02-10 15:37:17 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-25 15:20:12 -04:00
|
|
|
|
StatusPopupMenu {
|
|
|
|
|
id: adminPopupMenu
|
|
|
|
|
enabled: communityData.amISectionAdmin
|
|
|
|
|
|
2022-07-25 16:30:34 -04:00
|
|
|
|
property bool showInviteButton: false
|
|
|
|
|
|
2022-07-25 15:20:12 -04:00
|
|
|
|
onClosed: adminPopupMenu.showInviteButton = false
|
|
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
|
objectName: "createCommunityChannelBtn"
|
|
|
|
|
text: qsTr("Create channel")
|
|
|
|
|
icon.name: "channel"
|
|
|
|
|
onTriggered: Global.openPopup(createChannelPopup)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
|
objectName: "createCommunityCategoryBtn"
|
|
|
|
|
text: qsTr("Create category")
|
|
|
|
|
icon.name: "channel-category"
|
|
|
|
|
onTriggered: Global.openPopup(createCategoryPopup)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusMenuSeparator {
|
|
|
|
|
visible: invitePeopleBtn.enabled
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
|
id: invitePeopleBtn
|
|
|
|
|
text: qsTr("Invite people")
|
|
|
|
|
icon.name: "share-ios"
|
|
|
|
|
enabled: communityData.canManageUsers && adminPopupMenu.showInviteButton
|
|
|
|
|
onTriggered: Global.openPopup(inviteFriendsToCommunityPopup, {
|
|
|
|
|
community: communityData,
|
|
|
|
|
hasAddedContacts: root.hasAddedContacts,
|
|
|
|
|
communitySectionModule: root.communitySectionModule
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-13 15:29:38 +03:00
|
|
|
|
StatusScrollView {
|
2022-07-14 14:03:36 +03:00
|
|
|
|
id: scrollView
|
2021-07-02 14:34:01 +02:00
|
|
|
|
anchors.top: membershipRequests.bottom
|
2022-05-13 11:27:26 -04:00
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
|
anchors.bottom: createChatOrCommunity.top
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2021-07-02 14:34:01 +02:00
|
|
|
|
|
2022-05-25 11:57:57 +03:00
|
|
|
|
topPadding: Style.current.padding
|
|
|
|
|
|
2021-07-02 14:34:01 +02:00
|
|
|
|
width: parent.width
|
|
|
|
|
|
2020-12-11 15:29:46 -05:00
|
|
|
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
2021-07-02 14:34:01 +02:00
|
|
|
|
contentHeight: communityChatListAndCategories.height
|
2022-05-06 15:30:17 -04:00
|
|
|
|
+ bannerColumn.height
|
|
|
|
|
+ Style.current.bigPadding
|
2021-07-02 14:34:01 +02:00
|
|
|
|
|
|
|
|
|
StatusChatListAndCategories {
|
|
|
|
|
id: communityChatListAndCategories
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2022-01-05 10:11:26 -05:00
|
|
|
|
draggableItems: communityData.amISectionAdmin
|
|
|
|
|
draggableCategories: communityData.amISectionAdmin
|
2021-11-26 16:37:57 +01:00
|
|
|
|
|
|
|
|
|
model: root.communitySectionModule.model
|
2022-07-22 13:24:28 +02:00
|
|
|
|
highlightItem: !root.store.openCreateChat
|
|
|
|
|
|
2021-11-26 16:37:57 +01:00
|
|
|
|
onChatItemSelected: {
|
2022-07-22 13:24:28 +02:00
|
|
|
|
Global.closeCreateChatView()
|
|
|
|
|
|
2021-11-26 16:37:57 +01:00
|
|
|
|
if(categoryId === "")
|
|
|
|
|
root.communitySectionModule.setActiveItem(id, "")
|
|
|
|
|
else
|
|
|
|
|
root.communitySectionModule.setActiveItem(categoryId, id)
|
|
|
|
|
}
|
2021-07-28 15:40:51 +03:00
|
|
|
|
|
2022-01-05 10:11:26 -05:00
|
|
|
|
showCategoryActionButtons: communityData.amISectionAdmin
|
|
|
|
|
showPopupMenu: communityData.amISectionAdmin && communityData.canManageUsers
|
2021-07-02 14:34:01 +02:00
|
|
|
|
|
2022-09-15 01:00:18 +02:00
|
|
|
|
onChatItemUnmuted: root.communitySectionModule.unmuteChat(id)
|
2022-02-01 18:41:45 -04:00
|
|
|
|
onChatItemReordered: function(categoryId, chatId, from, to){
|
|
|
|
|
root.store.reorderCommunityChat(categoryId, chatId, to)
|
|
|
|
|
}
|
2022-01-25 10:51:38 -04:00
|
|
|
|
onChatListCategoryReordered: root.store.reorderCommunityCategories(categoryId, to)
|
2021-07-02 14:34:01 +02:00
|
|
|
|
|
2022-01-31 09:33:42 -04:00
|
|
|
|
onCategoryAddButtonClicked: Global.openPopup(createChannelPopup, {
|
|
|
|
|
categoryId: id
|
|
|
|
|
})
|
2021-07-02 14:34:01 +02:00
|
|
|
|
|
|
|
|
|
popupMenu: StatusPopupMenu {
|
|
|
|
|
StatusMenuItem {
|
2022-04-04 13:26:30 +02:00
|
|
|
|
text: qsTr("Create channel")
|
2021-07-02 14:34:01 +02:00
|
|
|
|
icon.name: "channel"
|
2022-01-05 10:11:26 -05:00
|
|
|
|
enabled: communityData.amISectionAdmin
|
2022-01-06 10:54:13 -05:00
|
|
|
|
onTriggered: Global.openPopup(createChannelPopup)
|
2021-07-02 14:34:01 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusMenuItem {
|
2022-04-04 13:26:30 +02:00
|
|
|
|
text: qsTr("Create category")
|
2021-07-02 14:34:01 +02:00
|
|
|
|
icon.name: "channel-category"
|
2022-01-05 10:11:26 -05:00
|
|
|
|
enabled: communityData.amISectionAdmin
|
2022-01-27 20:02:06 -04:00
|
|
|
|
onTriggered: Global.openPopup(createCategoryPopup)
|
2021-07-02 14:34:01 +02:00
|
|
|
|
}
|
2020-12-11 15:29:46 -05:00
|
|
|
|
|
2021-07-02 14:34:01 +02:00
|
|
|
|
StatusMenuSeparator {}
|
2021-06-25 11:13:54 +02:00
|
|
|
|
|
2021-07-02 14:34:01 +02:00
|
|
|
|
StatusMenuItem {
|
2022-04-04 13:26:30 +02:00
|
|
|
|
text: qsTr("Invite people")
|
2021-07-02 14:34:01 +02:00
|
|
|
|
icon.name: "share-ios"
|
2022-01-10 11:44:54 -05:00
|
|
|
|
enabled: communityData.canManageUsers
|
2022-05-10 19:04:25 +03:00
|
|
|
|
onTriggered: Global.openPopup(Global.inviteFriendsToCommunityPopup, {
|
2022-01-10 11:44:54 -05:00
|
|
|
|
community: communityData,
|
2022-01-19 15:07:02 -05:00
|
|
|
|
hasAddedContacts: root.hasAddedContacts,
|
|
|
|
|
communitySectionModule: root.communitySectionModule
|
2022-01-10 11:44:54 -05:00
|
|
|
|
})
|
2021-07-02 14:34:01 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
categoryPopupMenu: StatusPopupMenu {
|
|
|
|
|
|
|
|
|
|
property var categoryItem
|
|
|
|
|
|
|
|
|
|
openHandler: function (id) {
|
2022-01-31 20:32:53 -04:00
|
|
|
|
let jsonObj = root.communitySectionModule.getItemAsJson(id)
|
|
|
|
|
let obj = JSON.parse(jsonObj)
|
|
|
|
|
if (obj.error) {
|
|
|
|
|
console.error("error parsing chat item json object, id: ", id, " error: ", obj.error)
|
|
|
|
|
close()
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
categoryItem = obj
|
2021-07-02 14:34:01 +02:00
|
|
|
|
}
|
2021-06-25 11:13:54 +02:00
|
|
|
|
|
2022-06-29 17:30:40 +03:00
|
|
|
|
StatusMenuItem {
|
|
|
|
|
text: categoryItem.muted ? qsTr("Unmute category") : qsTr("Mute category")
|
|
|
|
|
icon.name: "notification"
|
|
|
|
|
onTriggered: {
|
|
|
|
|
if (categoryItem.muted) {
|
|
|
|
|
root.communitySectionModule.unmuteCategory(categoryItem.itemId)
|
|
|
|
|
} else {
|
|
|
|
|
root.communitySectionModule.muteCategory(categoryItem.itemId)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-05 10:11:26 -05:00
|
|
|
|
StatusMenuItem {
|
2022-08-16 23:39:32 +04:00
|
|
|
|
objectName: "editCategoryMenuItem"
|
2022-01-05 10:11:26 -05:00
|
|
|
|
enabled: communityData.amISectionAdmin
|
2022-04-04 13:26:30 +02:00
|
|
|
|
text: qsTr("Edit Category")
|
2021-07-02 14:34:01 +02:00
|
|
|
|
icon.name: "edit"
|
|
|
|
|
onTriggered: {
|
2022-01-31 20:32:53 -04:00
|
|
|
|
Global.openPopup(createCategoryPopup, {
|
|
|
|
|
isEdit: true,
|
2022-02-01 11:31:05 -04:00
|
|
|
|
channels: [],
|
2022-01-31 20:32:53 -04:00
|
|
|
|
categoryId: categoryItem.categoryId,
|
|
|
|
|
categoryName: categoryItem.name
|
|
|
|
|
})
|
2021-07-02 14:34:01 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-06-25 11:13:54 +02:00
|
|
|
|
|
2021-07-02 14:34:01 +02:00
|
|
|
|
StatusMenuSeparator {
|
2022-01-05 10:11:26 -05:00
|
|
|
|
visible: communityData.amISectionAdmin
|
2021-07-02 14:34:01 +02:00
|
|
|
|
}
|
2021-06-25 11:13:54 +02:00
|
|
|
|
|
2021-07-02 14:34:01 +02:00
|
|
|
|
StatusMenuItem {
|
2022-08-16 23:39:32 +04:00
|
|
|
|
objectName: "deleteCategoryMenuItem"
|
2022-01-05 10:11:26 -05:00
|
|
|
|
enabled: communityData.amISectionAdmin
|
2022-04-04 13:26:30 +02:00
|
|
|
|
text: qsTr("Delete Category")
|
2021-07-02 14:34:01 +02:00
|
|
|
|
icon.name: "delete"
|
|
|
|
|
type: StatusMenuItem.Type.Danger
|
|
|
|
|
onTriggered: {
|
2021-12-07 22:33:12 +02:00
|
|
|
|
Global.openPopup(deleteCategoryConfirmationDialogComponent, {
|
2022-04-04 13:26:30 +02:00
|
|
|
|
title: qsTr("Delete %1 category").arg(categoryItem.name),
|
|
|
|
|
confirmationText: qsTr("Are you sure you want to delete %1 category? Channels inside the category won’t be deleted.")
|
2021-07-02 14:34:01 +02:00
|
|
|
|
.arg(categoryItem.name),
|
2022-01-31 20:32:53 -04:00
|
|
|
|
categoryId: categoryItem.categoryId
|
2021-07-02 14:34:01 +02:00
|
|
|
|
})
|
|
|
|
|
}
|
2021-06-25 11:13:54 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-01 18:58:36 +03:00
|
|
|
|
chatListPopupMenu: ChatContextMenuView {
|
2021-11-03 15:35:12 -04:00
|
|
|
|
id: chatContextMenuView
|
2022-03-07 09:56:05 -05:00
|
|
|
|
emojiPopup: root.emojiPopup
|
2021-12-09 13:53:40 +01:00
|
|
|
|
|
2021-07-02 14:34:01 +02:00
|
|
|
|
openHandler: function (id) {
|
2021-12-09 13:53:40 +01:00
|
|
|
|
let jsonObj = root.communitySectionModule.getItemAsJson(id)
|
|
|
|
|
let obj = JSON.parse(jsonObj)
|
|
|
|
|
if (obj.error) {
|
|
|
|
|
console.error("error parsing chat item json object, id: ", id, " error: ", obj.error)
|
|
|
|
|
close()
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-21 10:26:13 +01:00
|
|
|
|
currentFleet = root.communitySectionModule.getCurrentFleet()
|
2021-12-09 13:53:40 +01:00
|
|
|
|
isCommunityChat = root.communitySectionModule.isCommunity()
|
2022-01-05 16:50:03 +01:00
|
|
|
|
amIChatAdmin = obj.amIChatAdmin
|
2021-12-09 13:53:40 +01:00
|
|
|
|
chatId = obj.itemId
|
|
|
|
|
chatName = obj.name
|
2021-12-21 10:26:13 +01:00
|
|
|
|
chatDescription = obj.description
|
2022-08-11 12:58:09 +02:00
|
|
|
|
chatIcon = obj.icon
|
2022-03-07 09:56:05 -05:00
|
|
|
|
chatEmoji = obj.emoji
|
2022-03-10 14:28:37 -05:00
|
|
|
|
chatColor = obj.color
|
2021-12-09 13:53:40 +01:00
|
|
|
|
chatType = obj.type
|
|
|
|
|
chatMuted = obj.muted
|
2022-01-31 13:57:05 -05:00
|
|
|
|
channelPosition = obj.position
|
|
|
|
|
chatCategoryId = obj.categoryId
|
2021-12-09 13:53:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMuteChat: {
|
2021-12-21 10:26:13 +01:00
|
|
|
|
root.communitySectionModule.muteChat(chatId)
|
2021-12-09 13:53:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onUnmuteChat: {
|
2021-12-21 10:26:13 +01:00
|
|
|
|
root.communitySectionModule.unmuteChat(chatId)
|
2021-07-02 14:34:01 +02:00
|
|
|
|
}
|
2021-12-08 12:10:34 +01:00
|
|
|
|
|
|
|
|
|
onMarkAllMessagesRead: {
|
2021-12-21 10:26:13 +01:00
|
|
|
|
root.communitySectionModule.markAllMessagesRead(chatId)
|
2021-12-08 12:10:34 +01:00
|
|
|
|
}
|
2021-12-08 14:06:31 +01:00
|
|
|
|
|
|
|
|
|
onClearChatHistory: {
|
2021-12-21 10:26:13 +01:00
|
|
|
|
root.communitySectionModule.clearChatHistory(chatId)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onRequestAllHistoricMessages: {
|
|
|
|
|
// Not Refactored Yet - Check in the `master` branch if this is applicable here.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onLeaveChat: {
|
|
|
|
|
root.communitySectionModule.leaveChat(chatId)
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-25 13:09:27 +01:00
|
|
|
|
onDeleteCommunityChat: root.store.removeCommunityChat(chatId)
|
2021-12-21 10:26:13 +01:00
|
|
|
|
|
|
|
|
|
onDownloadMessages: {
|
2022-06-22 09:43:30 +02:00
|
|
|
|
root.communitySectionModule.downloadMessages(chatId, file)
|
2021-12-21 10:26:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onDisplayProfilePopup: {
|
2022-01-05 16:50:03 +01:00
|
|
|
|
Global.openProfilePopup(publicKey)
|
2021-12-21 10:26:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onEditCommunityChannel: {
|
2022-01-31 13:57:05 -05:00
|
|
|
|
communitySectionModule.editCommunityChannel(
|
|
|
|
|
chatId,
|
|
|
|
|
newName,
|
|
|
|
|
newDescription,
|
2022-03-07 09:56:05 -05:00
|
|
|
|
newEmoji,
|
2022-03-10 14:28:37 -05:00
|
|
|
|
newColor,
|
2022-01-31 13:57:05 -05:00
|
|
|
|
newCategory,
|
|
|
|
|
channelPosition // TODO change this to the signal once it is modifiable
|
|
|
|
|
)
|
2021-12-21 10:26:13 +01:00
|
|
|
|
}
|
2021-07-02 14:34:01 +02:00
|
|
|
|
}
|
2021-05-16 11:16:42 -04:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-06 15:30:17 -04:00
|
|
|
|
Column {
|
|
|
|
|
id: bannerColumn
|
2022-07-14 14:03:36 +03:00
|
|
|
|
width: scrollView.availableWidth
|
2021-07-02 14:34:01 +02:00
|
|
|
|
anchors.top: communityChatListAndCategories.bottom
|
2022-05-06 15:30:17 -04:00
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
|
spacing: Style.current.bigPadding
|
|
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
|
active: communityData.amISectionAdmin &&
|
|
|
|
|
(!localAccountSensitiveSettings.hiddenCommunityWelcomeBanners ||
|
2022-09-16 00:17:51 +02:00
|
|
|
|
!localAccountSensitiveSettings.hiddenCommunityWelcomeBanners.includes(communityData.id))
|
2022-05-06 15:30:17 -04:00
|
|
|
|
width: parent.width
|
|
|
|
|
height: {
|
|
|
|
|
// I dont know why, the binding doesn't work well if this isn't here
|
|
|
|
|
item && item.height
|
2022-09-16 00:17:51 +02:00
|
|
|
|
return active ? item.height : 0
|
2022-05-06 15:30:17 -04:00
|
|
|
|
}
|
2022-09-16 00:17:51 +02:00
|
|
|
|
|
2022-05-06 15:30:17 -04:00
|
|
|
|
sourceComponent: Component {
|
|
|
|
|
CommunityWelcomeBannerPanel {
|
|
|
|
|
activeCommunity: communityData
|
|
|
|
|
store: root.store
|
|
|
|
|
hasAddedContacts: root.hasAddedContacts
|
|
|
|
|
communitySectionModule: root.communitySectionModule
|
|
|
|
|
onManageCommunityClicked: root.manageButtonClicked()
|
|
|
|
|
}
|
2021-10-21 03:41:54 +03:00
|
|
|
|
}
|
2022-05-25 11:57:57 +03:00
|
|
|
|
} // Loader
|
2021-07-02 14:34:01 +02:00
|
|
|
|
|
2022-05-06 15:30:17 -04:00
|
|
|
|
Loader {
|
|
|
|
|
active: communityData.amISectionAdmin &&
|
|
|
|
|
(!localAccountSensitiveSettings.hiddenCommunityChannelAndCategoriesBanners ||
|
2022-09-16 00:17:51 +02:00
|
|
|
|
!localAccountSensitiveSettings.hiddenCommunityChannelAndCategoriesBanners.includes(communityData.id))
|
2022-05-06 15:30:17 -04:00
|
|
|
|
width: parent.width
|
|
|
|
|
height: {
|
|
|
|
|
// I dont know why, the binding doesn't work well if this isn't here
|
|
|
|
|
item && item.height
|
2022-09-16 00:17:51 +02:00
|
|
|
|
return active ? item.height : 0
|
2022-05-06 15:30:17 -04:00
|
|
|
|
}
|
|
|
|
|
sourceComponent: Component {
|
|
|
|
|
CommunityChannelsAndCategoriesBannerPanel {
|
|
|
|
|
id: channelsAndCategoriesBanner
|
|
|
|
|
communityId: communityData.id
|
2022-05-10 19:04:25 +03:00
|
|
|
|
onAddMembersClicked: {
|
|
|
|
|
Global.openPopup(createChannelPopup);
|
|
|
|
|
}
|
|
|
|
|
onAddCategoriesClicked: {
|
|
|
|
|
Global.openPopup(createCategoryPopup);
|
|
|
|
|
}
|
2022-05-06 15:30:17 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-05-25 11:57:57 +03:00
|
|
|
|
} // Loader
|
2022-05-06 15:30:17 -04:00
|
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
|
active: communityData.amISectionAdmin &&
|
2022-09-16 00:17:51 +02:00
|
|
|
|
(!localAccountSensitiveSettings.hiddenCommunityBackUpBanners ||
|
|
|
|
|
!localAccountSensitiveSettings.hiddenCommunityBackUpBanners.includes(communityData.id))
|
2022-05-06 15:30:17 -04:00
|
|
|
|
width: parent.width
|
|
|
|
|
height: {
|
|
|
|
|
// I dont know why, the binding doesn't work well if this isn't here
|
|
|
|
|
item && item.height
|
2022-09-16 00:17:51 +02:00
|
|
|
|
return active ? item.height : 0
|
2022-05-06 15:30:17 -04:00
|
|
|
|
}
|
|
|
|
|
sourceComponent: Component {
|
|
|
|
|
BackUpCommuntyBannerPanel {
|
|
|
|
|
id: backupBanner
|
|
|
|
|
communityId: communityData.id
|
|
|
|
|
onBackupButtonClicked: {
|
|
|
|
|
Global.openPopup(transferOwnershipPopup, {
|
|
|
|
|
privateKey: communitySectionModule.exportCommunity(communityData.id),
|
|
|
|
|
store: root.store
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-06-29 13:42:13 -04:00
|
|
|
|
}
|
2022-05-25 11:57:57 +03:00
|
|
|
|
} // Loader
|
|
|
|
|
} // Column
|
|
|
|
|
} // ScrollView
|
2021-07-02 14:34:01 +02:00
|
|
|
|
|
2022-05-13 11:27:26 -04:00
|
|
|
|
Loader {
|
|
|
|
|
id: createChatOrCommunity
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
anchors.bottomMargin: Style.current.padding
|
|
|
|
|
active: communityData.amISectionAdmin
|
|
|
|
|
sourceComponent: Component {
|
|
|
|
|
StatusBaseText {
|
2022-07-25 15:20:12 -04:00
|
|
|
|
id: createChannelOrCategoryBtn
|
2022-07-21 12:16:25 -04:00
|
|
|
|
objectName: "createChannelOrCategoryBtn"
|
2022-05-13 11:27:26 -04:00
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
|
height: visible ? implicitHeight : 0
|
|
|
|
|
text: qsTr("Create channel or category")
|
|
|
|
|
font.underline: true
|
|
|
|
|
font.pixelSize: 13
|
|
|
|
|
textFormat: Text.RichText
|
|
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
|
onClicked: {
|
2022-07-25 15:20:12 -04:00
|
|
|
|
adminPopupMenu.showInviteButton = false
|
|
|
|
|
adminPopupMenu.popup()
|
2022-07-25 16:30:34 -04:00
|
|
|
|
adminPopupMenu.y = Qt.binding(() => root.height - adminPopupMenu.height
|
|
|
|
|
- createChannelOrCategoryBtn.height - 20)
|
2022-05-13 11:27:26 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-02 14:34:01 +02:00
|
|
|
|
Component {
|
|
|
|
|
id: createChannelPopup
|
|
|
|
|
CreateChannelPopup {
|
2021-07-07 14:45:11 +02:00
|
|
|
|
anchors.centerIn: parent
|
2022-03-07 09:56:05 -05:00
|
|
|
|
emojiPopup: root.emojiPopup
|
2022-03-10 14:28:37 -05:00
|
|
|
|
onCreateCommunityChannel: function (chName, chDescription, chEmoji, chColor,
|
|
|
|
|
chCategoryId) {
|
|
|
|
|
root.store.createCommunityChannel(chName, chDescription, chEmoji, chColor,
|
|
|
|
|
chCategoryId)
|
2022-01-05 10:11:26 -05:00
|
|
|
|
}
|
2021-07-02 14:34:01 +02:00
|
|
|
|
onClosed: {
|
|
|
|
|
destroy()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: createCategoryPopup
|
|
|
|
|
CreateCategoryPopup {
|
2021-07-09 12:09:03 +02:00
|
|
|
|
anchors.centerIn: parent
|
2021-10-22 23:49:47 +03:00
|
|
|
|
store: root.store
|
2021-07-02 14:34:01 +02:00
|
|
|
|
onClosed: {
|
|
|
|
|
destroy()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: deleteCategoryConfirmationDialogComponent
|
|
|
|
|
ConfirmationDialog {
|
|
|
|
|
property string categoryId
|
2022-08-16 23:39:32 +04:00
|
|
|
|
confirmButtonObjectName: "confirmDeleteCategoryButton"
|
2021-07-02 14:34:01 +02:00
|
|
|
|
btnType: "warn"
|
|
|
|
|
showCancelButton: true
|
|
|
|
|
onClosed: {
|
|
|
|
|
destroy()
|
|
|
|
|
}
|
|
|
|
|
onCancelButtonClicked: {
|
|
|
|
|
close();
|
|
|
|
|
}
|
|
|
|
|
onConfirmButtonClicked: function(){
|
2022-01-31 20:32:53 -04:00
|
|
|
|
const error = root.store.deleteCommunityCategory(categoryId);
|
|
|
|
|
if (error) {
|
|
|
|
|
deleteError.text = error
|
|
|
|
|
return deleteError.open()
|
|
|
|
|
}
|
|
|
|
|
close();
|
2021-07-02 14:34:01 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MessageDialog {
|
|
|
|
|
id: deleteError
|
2022-04-04 13:26:30 +02:00
|
|
|
|
title: qsTr("Error deleting the category")
|
2021-07-02 14:34:01 +02:00
|
|
|
|
icon: StandardIcon.Critical
|
|
|
|
|
standardButtons: StandardButton.Ok
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-11 11:45:59 +01:00
|
|
|
|
Component {
|
|
|
|
|
id: transferOwnershipPopup
|
|
|
|
|
TransferOwnershipPopup {
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
onClosed: {
|
|
|
|
|
let hiddenBannerIds = localAccountSensitiveSettings.hiddenCommunityBackUpBanners || []
|
|
|
|
|
if (hiddenBannerIds.includes(root.store.activeCommunity.id)) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
hiddenBannerIds.push(root.store.activeCommunity.id)
|
|
|
|
|
localAccountSensitiveSettings.hiddenCommunityBackUpBanners = hiddenBannerIds
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-02-09 18:35:59 +01:00
|
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
|
target: root.store.mainModuleInst
|
|
|
|
|
|
|
|
|
|
onOpenCommunityMembershipRequestsPopup:{
|
|
|
|
|
if(root.store.getMySectionId() != sectionId)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
Global.openPopup(membershipRequestPopup, {
|
|
|
|
|
communitySectionModule: root.communitySectionModule
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-12-11 15:29:46 -05:00
|
|
|
|
}
|