2020-12-11 20:29:46 +00:00
|
|
|
|
import QtQuick 2.13
|
|
|
|
|
import QtQuick.Controls 2.13
|
2021-07-02 12:34:01 +00:00
|
|
|
|
import QtQuick.Dialogs 1.2
|
2021-02-10 20:37:17 +00:00
|
|
|
|
import QtGraphicalEffects 1.13
|
2020-12-11 20:29:46 +00:00
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
|
|
2021-07-02 12:34:01 +00:00
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
|
import shared 1.0
|
|
|
|
|
import shared.popups 1.0
|
|
|
|
|
import shared.status 1.0
|
2021-10-01 15:58:36 +00:00
|
|
|
|
import "../popups/community"
|
|
|
|
|
import "../panels/communities"
|
2021-07-02 12:34:01 +00:00
|
|
|
|
|
|
|
|
|
Item {
|
2021-07-22 14:53:19 +00:00
|
|
|
|
id: root
|
|
|
|
|
width: 304
|
|
|
|
|
height: parent.height
|
|
|
|
|
|
2021-11-26 15:37:57 +00:00
|
|
|
|
// Important:
|
|
|
|
|
// We're here in case of CommunitySection
|
|
|
|
|
// This module is set from `ChatLayout` (each `ChatLayout` has its own communitySectionModule)
|
|
|
|
|
property var communitySectionModule
|
|
|
|
|
|
2021-10-21 22:39:53 +00:00
|
|
|
|
property var store
|
2022-01-10 16:44:54 +00:00
|
|
|
|
property bool hasAddedContacts: false
|
2022-01-05 15:11:26 +00:00
|
|
|
|
property var communityData: store.mainModuleInst ? store.mainModuleInst.activeSection || {} : {}
|
2020-12-11 20:29:46 +00:00
|
|
|
|
// TODO unhardcode
|
2021-11-26 15:37:57 +00:00
|
|
|
|
// Not Refactored Yet
|
|
|
|
|
//property int chatGroupsListViewCount: communityChatListAndCategories.chatList.count
|
2021-06-02 19:43:33 +00:00
|
|
|
|
property Component pinnedMessagesPopupComponent
|
2020-12-11 20:29:46 +00:00
|
|
|
|
|
2021-07-02 12:34:01 +00:00
|
|
|
|
StatusChatInfoToolBar {
|
2020-12-11 20:29:46 +00:00
|
|
|
|
id: communityHeader
|
|
|
|
|
anchors.top: parent.top
|
2021-07-02 12:34:01 +00:00
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
|
2022-01-05 15:11:26 +00:00
|
|
|
|
chatInfoButton.title: communityData.name
|
2022-01-11 21:53:18 +00:00
|
|
|
|
chatInfoButton.subTitle: communityData.members.count <= 1 ?
|
2022-01-05 15:11:26 +00:00
|
|
|
|
//% "1 Member"
|
|
|
|
|
qsTrId("1-member") :
|
|
|
|
|
//% "%1 Members"
|
2022-01-11 21:53:18 +00:00
|
|
|
|
qsTrId("-1-members").arg(communityData.members.count)
|
2022-01-05 15:11:26 +00:00
|
|
|
|
|
|
|
|
|
chatInfoButton.image.source: communityData.image
|
|
|
|
|
chatInfoButton.icon.color: communityData.color
|
2022-01-06 15:54:13 +00:00
|
|
|
|
menuButton.visible: communityData.amISectionAdmin && communityData.canManageUsers
|
2022-01-10 16:44:54 +00:00
|
|
|
|
chatInfoButton.onClicked: Global.openPopup(communityProfilePopup, {
|
|
|
|
|
store: root.store,
|
2022-01-18 20:54:14 +00:00
|
|
|
|
community: communityData,
|
|
|
|
|
communitySectionModule: root.communitySectionModule
|
2022-01-10 16:44:54 +00:00
|
|
|
|
})
|
2021-07-16 12:36:27 +00:00
|
|
|
|
|
2021-07-02 12:34:01 +00:00
|
|
|
|
popupMenu: StatusPopupMenu {
|
|
|
|
|
StatusMenuItem {
|
2021-07-16 20:22:50 +00:00
|
|
|
|
//% "Create channel"
|
|
|
|
|
text: qsTrId("create-channel")
|
2021-07-02 12:34:01 +00:00
|
|
|
|
icon.name: "channel"
|
2022-01-05 15:11:26 +00:00
|
|
|
|
enabled: communityData.amISectionAdmin
|
|
|
|
|
onTriggered: Global.openPopup(createChannelPopup)
|
2020-12-11 20:29:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-07-02 12:34:01 +00:00
|
|
|
|
StatusMenuItem {
|
2021-07-16 20:22:50 +00:00
|
|
|
|
//% "Create category"
|
|
|
|
|
text: qsTrId("create-category")
|
2021-07-02 12:34:01 +00:00
|
|
|
|
icon.name: "channel-category"
|
2022-01-05 15:11:26 +00:00
|
|
|
|
enabled: communityData.amISectionAdmin
|
2022-01-28 00:02:06 +00:00
|
|
|
|
onTriggered: Global.openPopup(createCategoryPopup)
|
2021-07-02 12:34:01 +00:00
|
|
|
|
}
|
2021-05-04 18:39:36 +00:00
|
|
|
|
|
2021-07-16 08:36:34 +00:00
|
|
|
|
StatusMenuSeparator {}
|
2021-05-04 18:39:36 +00:00
|
|
|
|
|
2021-07-02 12:34:01 +00:00
|
|
|
|
StatusMenuItem {
|
2021-07-16 20:22:50 +00:00
|
|
|
|
//% "Invite people"
|
|
|
|
|
text: qsTrId("invite-people")
|
2021-07-02 12:34:01 +00:00
|
|
|
|
icon.name: "share-ios"
|
2022-01-05 15:11:26 +00:00
|
|
|
|
enabled: communityData.canManageUsers
|
2022-01-10 16:44:54 +00:00
|
|
|
|
onTriggered: Global.openPopup(inviteFriendsToCommunityPopup, {
|
|
|
|
|
community: communityData,
|
2022-01-19 20:07:02 +00:00
|
|
|
|
hasAddedContacts: root.hasAddedContacts,
|
|
|
|
|
communitySectionModule: root.communitySectionModule
|
2022-01-10 16:44:54 +00:00
|
|
|
|
})
|
2021-07-02 12:34:01 +00:00
|
|
|
|
}
|
2021-05-04 18:39:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-02-11 19:06:39 +00:00
|
|
|
|
Loader {
|
2021-07-02 12:34:01 +00:00
|
|
|
|
id: membershipRequests
|
2021-02-10 20:37:17 +00:00
|
|
|
|
|
2022-01-21 19:18:56 +00:00
|
|
|
|
property int nbRequests: root.communityData.pendingRequestsToJoin.count
|
2021-07-02 12:34:01 +00:00
|
|
|
|
|
|
|
|
|
anchors.top: communityHeader.bottom
|
|
|
|
|
anchors.topMargin: active ? 8 : 0
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
|
2022-01-21 19:18:56 +00:00
|
|
|
|
active: communityData.amISectionAdmin && nbRequests > 0
|
2021-07-20 09:50:36 +00:00
|
|
|
|
height: nbRequests > 0 ? 64 : 0
|
2021-02-11 19:06:39 +00:00
|
|
|
|
sourceComponent: Component {
|
2021-07-02 12:34:01 +00:00
|
|
|
|
StatusContactRequestsIndicatorListItem {
|
2021-07-16 20:22:50 +00:00
|
|
|
|
//% "Membership requests"
|
|
|
|
|
title: qsTrId("membership-requests")
|
2021-07-02 12:34:01 +00:00
|
|
|
|
requestsCount: membershipRequests.nbRequests
|
2022-01-18 20:54:14 +00:00
|
|
|
|
sensor.onClicked: Global.openPopup(membershipRequestPopup, {
|
|
|
|
|
communitySectionModule: root.communitySectionModule
|
|
|
|
|
})
|
2021-07-02 12:34:01 +00:00
|
|
|
|
}
|
2021-02-10 20:37:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-11 20:29:46 +00:00
|
|
|
|
ScrollView {
|
|
|
|
|
id: chatGroupsContainer
|
2021-07-02 12:34:01 +00:00
|
|
|
|
anchors.top: membershipRequests.bottom
|
2020-12-11 20:29:46 +00:00
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
|
anchors.bottom: parent.bottom
|
2021-07-02 12:34:01 +00:00
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
|
|
2020-12-11 20:29:46 +00:00
|
|
|
|
leftPadding: Style.current.halfPadding
|
|
|
|
|
rightPadding: Style.current.halfPadding
|
2021-07-02 12:34:01 +00:00
|
|
|
|
|
2020-12-11 20:29:46 +00:00
|
|
|
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
|
|
|
|
clip: true
|
2021-07-02 12:34:01 +00:00
|
|
|
|
contentHeight: communityChatListAndCategories.height
|
|
|
|
|
+ emptyViewAndSuggestionsLoader.height
|
2022-01-05 15:11:26 +00:00
|
|
|
|
+ backUpBannerLoader.height
|
2021-07-02 12:34:01 +00:00
|
|
|
|
+ 16
|
|
|
|
|
|
|
|
|
|
StatusChatListAndCategories {
|
|
|
|
|
id: communityChatListAndCategories
|
|
|
|
|
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
width: root.width
|
|
|
|
|
height: {
|
|
|
|
|
if (!emptyViewAndSuggestionsLoader.active &&
|
|
|
|
|
!backUpBannerLoader.active) {
|
|
|
|
|
return implicitHeight > (root.height - 82) ? implicitHeight + 8 : root.height - 82
|
|
|
|
|
}
|
|
|
|
|
return implicitHeight
|
|
|
|
|
}
|
2022-01-05 15:11:26 +00:00
|
|
|
|
|
|
|
|
|
draggableItems: communityData.amISectionAdmin
|
|
|
|
|
draggableCategories: communityData.amISectionAdmin
|
2021-11-26 15:37:57 +00:00
|
|
|
|
//chatList.model: root.store.chatsModelInst.communities.activeCommunity.chats
|
|
|
|
|
|
|
|
|
|
//categoryList.model: root.store.chatsModelInst.communities.activeCommunity.categories
|
|
|
|
|
model: root.communitySectionModule.model
|
|
|
|
|
onChatItemSelected: {
|
|
|
|
|
if(categoryId === "")
|
|
|
|
|
root.communitySectionModule.setActiveItem(id, "")
|
|
|
|
|
else
|
|
|
|
|
root.communitySectionModule.setActiveItem(categoryId, id)
|
|
|
|
|
}
|
2021-07-28 12:40:51 +00:00
|
|
|
|
|
2022-01-05 15:11:26 +00:00
|
|
|
|
showCategoryActionButtons: communityData.amISectionAdmin
|
|
|
|
|
showPopupMenu: communityData.amISectionAdmin && communityData.canManageUsers
|
2021-11-26 15:37:57 +00:00
|
|
|
|
//selectedChatId: root.store.chatsModelInst.channelView.activeChannel.id
|
2021-07-02 12:34:01 +00:00
|
|
|
|
|
2021-11-26 15:37:57 +00:00
|
|
|
|
// onChatItemSelected: root.store.chatsModelInst.channelView.setActiveChannel(id)
|
|
|
|
|
// onChatItemUnmuted: root.store.chatsModelInst.channelView.unmuteChatItem(id)
|
|
|
|
|
// onChatItemReordered: function (categoryId, id, from, to) {
|
|
|
|
|
// root.store.chatsModelInst.communities.reorderCommunityChannel(chatsModel.communities.activeCommunity.id, categoryId, id, to);
|
|
|
|
|
// }
|
|
|
|
|
// onChatListCategoryReordered: function (categoryId, from, to) {
|
|
|
|
|
// root.store.chatsModelInst.communities.reorderCommunityCategories(chatsModel.communities.activeCommunity.id, categoryId, to);
|
|
|
|
|
// }
|
2021-07-02 12:34:01 +00:00
|
|
|
|
|
2021-12-07 20:33:12 +00:00
|
|
|
|
// onCategoryAddButtonClicked: Global.openPopup(createChannelPopup, {
|
2021-11-26 15:37:57 +00:00
|
|
|
|
// communityId: root.store.chatsModelInst.communities.activeCommunity.id,
|
|
|
|
|
// categoryId: id
|
|
|
|
|
// })
|
2021-07-02 12:34:01 +00:00
|
|
|
|
|
|
|
|
|
popupMenu: StatusPopupMenu {
|
|
|
|
|
StatusMenuItem {
|
2021-07-16 20:22:50 +00:00
|
|
|
|
//% "Create channel"
|
|
|
|
|
text: qsTrId("create-channel")
|
2021-07-02 12:34:01 +00:00
|
|
|
|
icon.name: "channel"
|
2021-12-13 14:24:21 +00:00
|
|
|
|
// Not Refactored Yet
|
2022-01-05 15:11:26 +00:00
|
|
|
|
enabled: communityData.amISectionAdmin
|
2022-01-06 15:54:13 +00:00
|
|
|
|
onTriggered: Global.openPopup(createChannelPopup)
|
2021-07-02 12:34:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusMenuItem {
|
2021-07-16 20:22:50 +00:00
|
|
|
|
//% "Create category"
|
|
|
|
|
text: qsTrId("create-category")
|
2021-07-02 12:34:01 +00:00
|
|
|
|
icon.name: "channel-category"
|
2022-01-05 15:11:26 +00:00
|
|
|
|
enabled: communityData.amISectionAdmin
|
2022-01-28 00:02:06 +00:00
|
|
|
|
onTriggered: Global.openPopup(createCategoryPopup)
|
2021-07-02 12:34:01 +00:00
|
|
|
|
}
|
2020-12-11 20:29:46 +00:00
|
|
|
|
|
2021-07-02 12:34:01 +00:00
|
|
|
|
StatusMenuSeparator {}
|
2021-06-25 09:13:54 +00:00
|
|
|
|
|
2021-07-02 12:34:01 +00:00
|
|
|
|
StatusMenuItem {
|
2021-07-16 20:22:50 +00:00
|
|
|
|
//% "Invite people"
|
|
|
|
|
text: qsTrId("invite-people")
|
2021-07-02 12:34:01 +00:00
|
|
|
|
icon.name: "share-ios"
|
2022-01-10 16:44:54 +00:00
|
|
|
|
enabled: communityData.canManageUsers
|
|
|
|
|
onTriggered: Global.openPopup(inviteFriendsToCommunityPopup, {
|
|
|
|
|
community: communityData,
|
2022-01-19 20:07:02 +00:00
|
|
|
|
hasAddedContacts: root.hasAddedContacts,
|
|
|
|
|
communitySectionModule: root.communitySectionModule
|
2022-01-10 16:44:54 +00:00
|
|
|
|
})
|
2021-07-02 12:34:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
categoryPopupMenu: StatusPopupMenu {
|
|
|
|
|
|
|
|
|
|
property var categoryItem
|
|
|
|
|
|
|
|
|
|
openHandler: function (id) {
|
2021-12-13 14:24:21 +00:00
|
|
|
|
// Not Refactored Yet
|
|
|
|
|
// categoryItem = root.store.chatsModelInst.communities.activeCommunity.getCommunityCategoryItemById(id)
|
2021-07-02 12:34:01 +00:00
|
|
|
|
}
|
2021-06-25 09:13:54 +00:00
|
|
|
|
|
2022-01-05 15:11:26 +00:00
|
|
|
|
StatusMenuItem {
|
2021-11-26 15:37:57 +00:00
|
|
|
|
// Not Refactored Yet
|
2022-01-05 15:11:26 +00:00
|
|
|
|
enabled: communityData.amISectionAdmin
|
2021-07-16 20:22:50 +00:00
|
|
|
|
//% "Edit Category"
|
|
|
|
|
text: qsTrId("edit-category")
|
2021-07-02 12:34:01 +00:00
|
|
|
|
icon.name: "edit"
|
|
|
|
|
onTriggered: {
|
2021-12-13 14:24:21 +00:00
|
|
|
|
// Not Refactored Yet
|
|
|
|
|
// Global.openPopup(createCategoryPopup, {
|
|
|
|
|
// communityId: root.store.chatsModelInst.communities.activeCommunity.id,
|
|
|
|
|
// isEdit: true,
|
|
|
|
|
// categoryId: categoryItem.id,
|
|
|
|
|
// categoryName: categoryItem.name
|
|
|
|
|
// })
|
2021-07-02 12:34:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-06-25 09:13:54 +00:00
|
|
|
|
|
2021-07-02 12:34:01 +00:00
|
|
|
|
StatusMenuSeparator {
|
2022-01-05 15:11:26 +00:00
|
|
|
|
visible: communityData.amISectionAdmin
|
2021-07-02 12:34:01 +00:00
|
|
|
|
}
|
2021-06-25 09:13:54 +00:00
|
|
|
|
|
2021-07-02 12:34:01 +00:00
|
|
|
|
StatusMenuItem {
|
2022-01-05 15:11:26 +00:00
|
|
|
|
enabled: communityData.amISectionAdmin
|
2021-07-16 20:22:50 +00:00
|
|
|
|
//% "Delete Category"
|
|
|
|
|
text: qsTrId("delete-category")
|
2021-07-02 12:34:01 +00:00
|
|
|
|
icon.name: "delete"
|
|
|
|
|
type: StatusMenuItem.Type.Danger
|
|
|
|
|
onTriggered: {
|
2021-12-07 20:33:12 +00:00
|
|
|
|
Global.openPopup(deleteCategoryConfirmationDialogComponent, {
|
2021-07-16 20:22:50 +00:00
|
|
|
|
//% "Delete %1 category"
|
|
|
|
|
title: qsTrId("delete--1-category").arg(categoryItem.name),
|
|
|
|
|
//% "Are you sure you want to delete %1 category? Channels inside the category won’t be deleted."
|
|
|
|
|
confirmationText: qsTrId("are-you-sure-you-want-to-delete--1-category--channels-inside-the-category-won-t-be-deleted-")
|
2021-07-02 12:34:01 +00:00
|
|
|
|
.arg(categoryItem.name),
|
|
|
|
|
categoryId: categoryItem.id
|
|
|
|
|
})
|
|
|
|
|
}
|
2021-06-25 09:13:54 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
|
chatListPopupMenu: ChatContextMenuView {
|
2021-11-03 19:35:12 +00:00
|
|
|
|
id: chatContextMenuView
|
2021-12-09 12:53:40 +00:00
|
|
|
|
|
2021-07-02 12:34:01 +00:00
|
|
|
|
openHandler: function (id) {
|
2021-12-09 12:53:40 +00: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 09:26:13 +00:00
|
|
|
|
currentFleet = root.communitySectionModule.getCurrentFleet()
|
2021-12-09 12:53:40 +00:00
|
|
|
|
isCommunityChat = root.communitySectionModule.isCommunity()
|
2022-01-05 15:50:03 +00:00
|
|
|
|
amIChatAdmin = obj.amIChatAdmin
|
2021-12-09 12:53:40 +00:00
|
|
|
|
chatId = obj.itemId
|
|
|
|
|
chatName = obj.name
|
2021-12-21 09:26:13 +00:00
|
|
|
|
chatDescription = obj.description
|
2021-12-09 12:53:40 +00:00
|
|
|
|
chatType = obj.type
|
|
|
|
|
chatMuted = obj.muted
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMuteChat: {
|
2021-12-21 09:26:13 +00:00
|
|
|
|
root.communitySectionModule.muteChat(chatId)
|
2021-12-09 12:53:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onUnmuteChat: {
|
2021-12-21 09:26:13 +00:00
|
|
|
|
root.communitySectionModule.unmuteChat(chatId)
|
2021-07-02 12:34:01 +00:00
|
|
|
|
}
|
2021-12-08 11:10:34 +00:00
|
|
|
|
|
|
|
|
|
onMarkAllMessagesRead: {
|
2021-12-21 09:26:13 +00:00
|
|
|
|
root.communitySectionModule.markAllMessagesRead(chatId)
|
2021-12-08 11:10:34 +00:00
|
|
|
|
}
|
2021-12-08 13:06:31 +00:00
|
|
|
|
|
|
|
|
|
onClearChatHistory: {
|
2021-12-21 09:26:13 +00: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 12:09:27 +00:00
|
|
|
|
onDeleteCommunityChat: root.store.removeCommunityChat(chatId)
|
2021-12-21 09:26:13 +00:00
|
|
|
|
|
|
|
|
|
onDownloadMessages: {
|
|
|
|
|
// Not Refactored Yet
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onDisplayProfilePopup: {
|
2022-01-05 15:50:03 +00:00
|
|
|
|
Global.openProfilePopup(publicKey)
|
2021-12-21 09:26:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onDisplayGroupInfoPopup: {
|
|
|
|
|
// Not Refactored Yet
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onEditCommunityChannel: {
|
|
|
|
|
// Not Refactored Yet
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onOpenPinnedMessagesList: {
|
|
|
|
|
chatCommunitySectionModule.prepareChatContentModuleForChatId(chatId)
|
|
|
|
|
let chatContentModule = chatCommunitySectionModule.getChatContentModule()
|
|
|
|
|
Global.openPopup(pinnedMessagesPopupComponent, {
|
2022-01-19 15:59:08 +00:00
|
|
|
|
store: root.store,
|
2021-12-21 09:26:13 +00:00
|
|
|
|
messageStore: messageStore,
|
|
|
|
|
pinnedMessagesModel: chatContentModule.pinnedMessagesModel,
|
|
|
|
|
messageToPin: ""
|
|
|
|
|
})
|
2021-12-08 13:06:31 +00:00
|
|
|
|
}
|
2021-07-02 12:34:01 +00:00
|
|
|
|
}
|
2021-05-16 15:16:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-28 19:03:41 +00:00
|
|
|
|
Loader {
|
|
|
|
|
id: emptyViewAndSuggestionsLoader
|
2022-01-05 15:11:26 +00:00
|
|
|
|
active: communityData.amISectionAdmin &&
|
|
|
|
|
(!localAccountSensitiveSettings.hiddenCommunityWelcomeBanners ||
|
|
|
|
|
!localAccountSensitiveSettings.hiddenCommunityWelcomeBanners.includes(communityData.id))
|
2020-12-11 20:29:46 +00:00
|
|
|
|
width: parent.width
|
2022-01-05 15:11:26 +00:00
|
|
|
|
height: {
|
|
|
|
|
// I dont know why, the binding doesn't work well if this isn't here
|
2022-01-17 18:49:30 +00:00
|
|
|
|
item && item.height
|
2022-01-05 15:11:26 +00:00
|
|
|
|
return this.active ? item.height : 0
|
|
|
|
|
}
|
2021-07-02 12:34:01 +00:00
|
|
|
|
anchors.top: communityChatListAndCategories.bottom
|
2021-04-28 19:03:41 +00:00
|
|
|
|
anchors.topMargin: active ? Style.current.padding : 0
|
|
|
|
|
sourceComponent: Component {
|
2021-10-21 00:41:54 +00:00
|
|
|
|
CommunityWelcomeBannerPanel {
|
2022-01-06 15:54:13 +00:00
|
|
|
|
activeCommunity: communityData
|
2021-11-02 19:39:18 +00:00
|
|
|
|
store: root.store
|
2022-01-10 16:44:54 +00:00
|
|
|
|
hasAddedContacts: root.hasAddedContacts
|
2022-01-18 20:54:14 +00:00
|
|
|
|
communitySectionModule: root.communitySectionModule
|
2021-10-21 00:41:54 +00:00
|
|
|
|
}
|
2021-04-28 19:03:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-02 12:34:01 +00:00
|
|
|
|
|
2021-04-28 19:03:41 +00:00
|
|
|
|
Loader {
|
|
|
|
|
id: backUpBannerLoader
|
2022-01-05 15:11:26 +00:00
|
|
|
|
active: communityData.amISectionAdmin &&
|
|
|
|
|
(!localAccountSensitiveSettings.hiddenCommunityBackUpBanners ||
|
|
|
|
|
!localAccountSensitiveSettings.hiddenCommunityBackUpBanners.includes(communityData.id))
|
2021-04-28 19:03:41 +00:00
|
|
|
|
width: parent.width
|
|
|
|
|
height: active ? item.height : 0
|
|
|
|
|
anchors.top: emptyViewAndSuggestionsLoader.bottom
|
|
|
|
|
anchors.topMargin: active ? Style.current.padding : 0
|
|
|
|
|
sourceComponent: Component {
|
2021-06-29 17:42:13 +00:00
|
|
|
|
Item {
|
|
|
|
|
width: parent.width
|
|
|
|
|
height: backupBanner.height
|
|
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
|
BackUpCommuntyBannerPanel {
|
2021-06-29 17:42:13 +00:00
|
|
|
|
id: backupBanner
|
2022-01-06 15:54:13 +00:00
|
|
|
|
activeCommunity: communityData
|
2021-11-11 10:45:59 +00:00
|
|
|
|
onBackupButtonClicked: {
|
2021-12-07 20:33:12 +00:00
|
|
|
|
Global.openPopup(transferOwnershipPopup, {
|
2022-01-19 20:07:02 +00:00
|
|
|
|
privateKey: communitySectionModule.exportCommunity(communityData.id),
|
2021-11-11 10:45:59 +00:00
|
|
|
|
store: root.store
|
|
|
|
|
})
|
|
|
|
|
}
|
2021-06-29 17:42:13 +00:00
|
|
|
|
}
|
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: backupBanner
|
|
|
|
|
acceptedButtons: Qt.RightButton
|
|
|
|
|
onClicked: {
|
|
|
|
|
/* Prevents sending events to the component beneath
|
|
|
|
|
if Right Mouse Button is clicked. */
|
|
|
|
|
mouse.accepted = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-28 19:03:41 +00:00
|
|
|
|
}
|
2020-12-11 20:29:46 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-02 12:34:01 +00:00
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: createChannelPopup
|
|
|
|
|
CreateChannelPopup {
|
2021-07-07 12:45:11 +00:00
|
|
|
|
anchors.centerIn: parent
|
2022-01-05 15:11:26 +00:00
|
|
|
|
onCreateCommunityChannel: function (chName, chDescription) {
|
2022-01-18 20:54:14 +00:00
|
|
|
|
root.store.createCommunityChannel(chName, chDescription)
|
2022-01-05 15:11:26 +00:00
|
|
|
|
}
|
2021-07-02 12:34:01 +00:00
|
|
|
|
onClosed: {
|
|
|
|
|
destroy()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: createCategoryPopup
|
|
|
|
|
CreateCategoryPopup {
|
2021-07-09 10:09:03 +00:00
|
|
|
|
anchors.centerIn: parent
|
2021-10-22 20:49:47 +00:00
|
|
|
|
store: root.store
|
2021-07-02 12:34:01 +00:00
|
|
|
|
onClosed: {
|
|
|
|
|
destroy()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: deleteCategoryConfirmationDialogComponent
|
|
|
|
|
ConfirmationDialog {
|
|
|
|
|
property string categoryId
|
|
|
|
|
btnType: "warn"
|
|
|
|
|
showCancelButton: true
|
|
|
|
|
onClosed: {
|
|
|
|
|
destroy()
|
|
|
|
|
}
|
|
|
|
|
onCancelButtonClicked: {
|
|
|
|
|
close();
|
|
|
|
|
}
|
|
|
|
|
onConfirmButtonClicked: function(){
|
2021-12-13 14:24:21 +00:00
|
|
|
|
// Not Refactored Yet
|
|
|
|
|
// const error = root.store.chatsModelInst.communities.deleteCommunityCategory(root.store.chatsModelInst.communities.activeCommunity.id, categoryId)
|
|
|
|
|
// if (error) {
|
|
|
|
|
// creatingError.text = error
|
|
|
|
|
// return creatingError.open()
|
|
|
|
|
// }
|
|
|
|
|
// close();
|
2021-07-02 12:34:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MessageDialog {
|
|
|
|
|
id: deleteError
|
2021-07-16 20:22:50 +00:00
|
|
|
|
//% "Error deleting the category"
|
|
|
|
|
title: qsTrId("error-deleting-the-category")
|
2021-07-02 12:34:01 +00:00
|
|
|
|
icon: StandardIcon.Critical
|
|
|
|
|
standardButtons: StandardButton.Ok
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-20 09:50:36 +00:00
|
|
|
|
Component {
|
2021-07-02 12:34:01 +00:00
|
|
|
|
id: membershipRequestPopup
|
2021-07-20 09:50:36 +00:00
|
|
|
|
MembershipRequestsPopup {
|
|
|
|
|
anchors.centerIn: parent
|
2021-10-22 20:49:47 +00:00
|
|
|
|
store: root.store
|
2022-01-21 19:18:56 +00:00
|
|
|
|
pendingRequestsToJoin: root.communityData.pendingRequestsToJoin
|
2021-07-20 09:50:36 +00:00
|
|
|
|
onClosed: {
|
|
|
|
|
destroy()
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-02 12:34:01 +00:00
|
|
|
|
}
|
2021-07-20 09:50:36 +00:00
|
|
|
|
|
2021-11-11 10:45:59 +00: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
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-12-11 20:29:46 +00:00
|
|
|
|
}
|