2022-03-23 15:38:23 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import Qt.labs.settings 1.0
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.popups 1.0
|
|
|
|
import shared.status 1.0
|
|
|
|
import shared.views.chat 1.0
|
|
|
|
|
|
|
|
import StatusQ.Layout 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
2022-08-09 15:08:39 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2022-03-23 15:38:23 +00:00
|
|
|
|
|
|
|
import "."
|
|
|
|
import "../panels"
|
|
|
|
import "../panels/communities"
|
|
|
|
import "../popups"
|
|
|
|
import "../helpers"
|
|
|
|
import "../controls"
|
|
|
|
import "../stores"
|
|
|
|
|
2022-08-09 15:08:39 +00:00
|
|
|
StatusSectionLayout {
|
2022-03-23 15:38:23 +00:00
|
|
|
id: root
|
|
|
|
|
|
|
|
property var contactsStore
|
|
|
|
property bool hasAddedContacts: root.contactsStore.myContactsModel.count > 0
|
|
|
|
|
|
|
|
property RootStore rootStore
|
|
|
|
|
2022-06-21 11:44:20 +00:00
|
|
|
property Component membershipRequestPopup
|
2022-03-23 15:38:23 +00:00
|
|
|
property var emojiPopup
|
2022-11-14 20:21:00 +00:00
|
|
|
property var stickersPopup
|
2022-03-23 15:38:23 +00:00
|
|
|
property bool stickersLoaded: false
|
|
|
|
|
|
|
|
signal communityInfoButtonClicked()
|
|
|
|
signal communityManageButtonClicked()
|
|
|
|
signal profileButtonClicked()
|
|
|
|
signal openAppSearch()
|
2022-05-10 16:04:25 +00:00
|
|
|
signal importCommunityClicked()
|
|
|
|
signal createCommunityClicked()
|
2022-03-23 15:38:23 +00:00
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: root.rootStore.stickersStore.stickersModule
|
2022-07-22 11:24:28 +00:00
|
|
|
|
|
|
|
function onStickerPacksLoaded() {
|
2022-03-23 15:38:23 +00:00
|
|
|
root.stickersLoaded = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: root.rootStore.chatCommunitySectionModule
|
2022-05-16 15:02:03 +00:00
|
|
|
ignoreUnknownSignals: true
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-07-22 11:24:28 +00:00
|
|
|
function onActiveItemChanged() {
|
|
|
|
Global.closeCreateChatView()
|
2022-05-13 15:27:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-09 15:08:39 +00:00
|
|
|
notificationButton.tooltip.offset: localAccountSensitiveSettings.expandUsersList && headerContent.membersButton.visible ? 0 : 14
|
|
|
|
onNotificationButtonClicked: Global.openActivityCenterPopup()
|
2022-10-26 16:00:20 +00:00
|
|
|
notificationCount: activityCenterStore.unreadNotificationsCount
|
2022-08-09 15:08:39 +00:00
|
|
|
|
|
|
|
headerContent: ChatHeaderContentView {
|
|
|
|
id: headerContent
|
|
|
|
visible: !!root.rootStore.currentChatContentModule()
|
|
|
|
rootStore: root.rootStore
|
2022-09-14 10:38:25 +00:00
|
|
|
emojiPopup: root.emojiPopup
|
2022-08-09 15:08:39 +00:00
|
|
|
onSearchButtonClicked: root.openAppSearch()
|
|
|
|
}
|
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
leftPanel: Loader {
|
|
|
|
id: contactColumnLoader
|
|
|
|
sourceComponent: root.rootStore.chatCommunitySectionModule.isCommunity()?
|
|
|
|
communtiyColumnComponent :
|
|
|
|
contactsColumnComponent
|
|
|
|
}
|
|
|
|
|
|
|
|
centerPanel: ChatColumnView {
|
|
|
|
id: chatColumn
|
2022-08-09 15:08:39 +00:00
|
|
|
anchors.fill: parent
|
2022-03-23 15:38:23 +00:00
|
|
|
parentModule: root.rootStore.chatCommunitySectionModule
|
|
|
|
rootStore: root.rootStore
|
|
|
|
contactsStore: root.contactsStore
|
|
|
|
stickersLoaded: root.stickersLoaded
|
|
|
|
emojiPopup: root.emojiPopup
|
2022-11-14 20:21:00 +00:00
|
|
|
stickersPopup: root.stickersPopup
|
2022-03-23 15:38:23 +00:00
|
|
|
onOpenStickerPackPopup: {
|
|
|
|
Global.openPopup(statusStickerPackClickPopup, {packId: stickerPackId} )
|
|
|
|
}
|
|
|
|
onOpenAppSearch: {
|
|
|
|
root.openAppSearch();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
showRightPanel: {
|
|
|
|
if (root.rootStore.openCreateChat ||
|
2022-08-09 15:08:39 +00:00
|
|
|
!localAccountSensitiveSettings.showOnlineUsers ||
|
|
|
|
!localAccountSensitiveSettings.expandUsersList) {
|
2022-03-23 15:38:23 +00:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
let chatContentModule = root.rootStore.currentChatContentModule()
|
2023-01-20 19:01:32 +00:00
|
|
|
if (!chatContentModule) {
|
2022-03-23 15:38:23 +00:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
// Check if user list is available as an option for particular chat content module
|
|
|
|
return chatContentModule.chatDetails.isUsersListAvailable
|
|
|
|
}
|
|
|
|
|
2022-08-09 15:08:39 +00:00
|
|
|
rightPanel: Component {
|
2022-03-23 15:38:23 +00:00
|
|
|
id: userListComponent
|
|
|
|
UserListPanel {
|
2022-05-09 20:56:45 +00:00
|
|
|
label: qsTr("Members")
|
2022-03-23 15:38:23 +00:00
|
|
|
messageContextMenu: quickActionMessageOptionsMenu
|
2022-11-16 09:41:32 +00:00
|
|
|
usersModel: {
|
2022-03-23 15:38:23 +00:00
|
|
|
let chatContentModule = root.rootStore.currentChatContentModule()
|
|
|
|
if (!chatContentModule || !chatContentModule.usersModule) {
|
|
|
|
// New communities have no chats, so no chatContentModule
|
2022-12-13 10:45:26 +00:00
|
|
|
return null
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
2022-11-16 09:41:32 +00:00
|
|
|
return chatContentModule.usersModule.model
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: contactsColumnComponent
|
|
|
|
ContactsColumnView {
|
|
|
|
chatSectionModule: root.rootStore.chatCommunitySectionModule
|
|
|
|
store: root.rootStore
|
|
|
|
contactsStore: root.contactsStore
|
|
|
|
emojiPopup: root.emojiPopup
|
|
|
|
onOpenProfileClicked: {
|
|
|
|
root.profileButtonClicked();
|
|
|
|
}
|
|
|
|
|
|
|
|
onOpenAppSearch: {
|
|
|
|
root.openAppSearch()
|
|
|
|
}
|
2022-05-10 16:04:25 +00:00
|
|
|
onImportCommunityClicked: {
|
|
|
|
root.importCommunityClicked();
|
|
|
|
}
|
|
|
|
onCreateCommunityClicked: {
|
|
|
|
root.createCommunityClicked();
|
|
|
|
}
|
2023-01-17 17:13:03 +00:00
|
|
|
onAddRemoveGroupMemberClicked: {
|
|
|
|
headerContent.addRemoveGroupMember()
|
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: communtiyColumnComponent
|
|
|
|
CommunityColumnView {
|
|
|
|
communitySectionModule: root.rootStore.chatCommunitySectionModule
|
|
|
|
store: root.rootStore
|
|
|
|
emojiPopup: root.emojiPopup
|
|
|
|
hasAddedContacts: root.hasAddedContacts
|
2022-06-21 11:44:20 +00:00
|
|
|
membershipRequestPopup: root.membershipRequestPopup
|
2022-03-23 15:38:23 +00:00
|
|
|
onInfoButtonClicked: root.communityInfoButtonClicked()
|
|
|
|
onManageButtonClicked: root.communityManageButtonClicked()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: statusStickerPackClickPopup
|
|
|
|
StatusStickerPackClickPopup{
|
|
|
|
store: root.rootStore
|
|
|
|
onClosed: {
|
|
|
|
destroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MessageContextMenuView {
|
|
|
|
id: quickActionMessageOptionsMenu
|
|
|
|
store: root.rootStore
|
|
|
|
|
|
|
|
onOpenProfileClicked: {
|
2022-09-27 21:26:26 +00:00
|
|
|
Global.openProfilePopup(publicKey, null)
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
onCreateOneToOneChat: {
|
|
|
|
Global.changeAppSectionBySectionType(Constants.appSection.chat)
|
|
|
|
root.rootStore.chatCommunitySectionModule.createOneToOneChat(communityId, chatId, ensName)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|