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
|
|
|
|
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()
|
|
|
|
notificationCount: root.rootStore.unreadNotificationsCount
|
|
|
|
|
|
|
|
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
|
|
|
|
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()
|
|
|
|
if (!chatContentModule
|
|
|
|
|| chatContentModule.chatDetails.type === Constants.chatType.publicChat)
|
|
|
|
{
|
|
|
|
// New communities have no chats, so no chatContentModule or it is a public chat
|
|
|
|
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 {
|
|
|
|
rootStore: root.rootStore
|
2022-05-09 20:56:45 +00:00
|
|
|
label: qsTr("Members")
|
2022-03-23 15:38:23 +00:00
|
|
|
messageContextMenu: quickActionMessageOptionsMenu
|
|
|
|
usersModule: {
|
|
|
|
let chatContentModule = root.rootStore.currentChatContentModule()
|
|
|
|
if (!chatContentModule || !chatContentModule.usersModule) {
|
|
|
|
// New communities have no chats, so no chatContentModule
|
|
|
|
return {}
|
|
|
|
}
|
|
|
|
return chatContentModule.usersModule
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ConfirmationDialog {
|
|
|
|
id: removeContactConfirmationDialog
|
2022-04-04 11:26:30 +00:00
|
|
|
header.title: qsTr("Remove contact")
|
|
|
|
confirmationText: qsTr("Are you sure you want to remove this contact?")
|
2022-03-23 15:38:23 +00:00
|
|
|
onConfirmButtonClicked: {
|
|
|
|
let pk = chatColumn.contactToRemove
|
2022-07-06 16:51:56 +00:00
|
|
|
if (Utils.getContactDetailsAsJson(pk).isAdded) {
|
2022-03-23 15:38:23 +00:00
|
|
|
root.contactsStore.removeContact(pk)
|
|
|
|
}
|
|
|
|
removeContactConfirmationDialog.parentPopup.close();
|
|
|
|
removeContactConfirmationDialog.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MessageContextMenuView {
|
|
|
|
id: quickActionMessageOptionsMenu
|
|
|
|
store: root.rootStore
|
|
|
|
|
|
|
|
onOpenProfileClicked: {
|
2022-06-20 14:48:38 +00:00
|
|
|
Global.openProfilePopup(publicKey, null, state)
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
onCreateOneToOneChat: {
|
|
|
|
Global.changeAppSectionBySectionType(Constants.appSection.chat)
|
|
|
|
root.rootStore.chatCommunitySectionModule.createOneToOneChat(communityId, chatId, ensName)
|
|
|
|
}
|
|
|
|
}
|
2022-05-10 16:04:25 +00:00
|
|
|
|
2022-09-13 14:20:10 +00:00
|
|
|
Component.onCompleted: {
|
|
|
|
rootStore.groupInfoPopupComponent = groupInfoPopupComponent;
|
2022-08-09 15:08:39 +00:00
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|