status-desktop/ui/app/AppLayouts/Chat/ChatLayout.qml

184 lines
5.5 KiB
QML
Raw Normal View History

2020-06-17 19:18:31 +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
import "views"
import "panels"
import "panels/communities"
import "popups"
import "helpers"
import "controls"
import "stores"
StatusAppThreePanelLayout {
id: root
2020-05-27 17:10:50 +00:00
handle: SplitViewHandle { implicitWidth: 5 }
property var contactsStore
property bool hasAddedContacts: root.contactsStore.myContactsModel.count > 0
// Not Refactored
property var messageStore
property RootStore rootStore: RootStore {
messageStore: root.messageStore
}
property Component pinnedMessagesListPopupComponent
property bool stickersLoaded: false
signal profileButtonClicked()
signal openAppSearch()
// Not Refactored
// Connections {
// target: root.rootStore.chatsModelInst.stickers
// onStickerPacksLoaded: {
// stickersLoaded = true;
// }
// }
// property var onActivated: function () {
// root.rootStore.chatsModelInst.channelView.restorePreviousActiveChannel();
// chatColumn.onActivated();
// }
leftPanel: Loader {
2020-12-11 20:29:46 +00:00
id: contactColumnLoader
sourceComponent: root.rootStore.chatCommunitySectionModule.isCommunity()?
communtiyColumnComponent :
contactsColumnComponent
2020-12-11 20:29:46 +00:00
}
2021-10-28 10:01:10 +00:00
centerPanel: ChatColumnView {
id: chatColumn
parentModule: root.rootStore.chatCommunitySectionModule
rootStore: root.rootStore
contactsStore: root.contactsStore
pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent
stickersLoaded: root.stickersLoaded
//chatGroupsListViewCount: contactColumnLoader.item.chatGroupsListViewCount
onOpenStickerPackPopup: {
Global.openPopup(statusStickerPackClickPopup, {packId: stickerPackId} )
}
onOpenAppSearch: {
root.openAppSearch()
}
}
showRightPanel: {
// Check if user list is available as an option for particular chat content module.
let usersListAvailable = root.rootStore.currentChatContentModule().chatDetails.isUsersListAvailable
return localAccountSensitiveSettings.showOnlineUsers && usersListAvailable && localAccountSensitiveSettings.expandUsersList
}
rightPanel: localAccountSensitiveSettings.communitiesEnabled && root.rootStore.chatCommunitySectionModule.isCommunity()?
communityUserListComponent :
userListComponent
Component {
id: communityUserListComponent
CommunityUserListPanel {
messageContextMenu: quickActionMessageOptionsMenu
usersModule: {
let chatContentModule = root.rootStore.currentChatContentModule()
return chatContentModule.usersModule
}
}
}
Component {
id: userListComponent
UserListPanel {
messageContextMenu: quickActionMessageOptionsMenu
usersModule: {
let chatContentModule = root.rootStore.currentChatContentModule()
return chatContentModule.usersModule
}
}
}
2020-12-11 20:29:46 +00:00
Component {
id: contactsColumnComponent
ContactsColumnView {
chatSectionModule: root.rootStore.chatCommunitySectionModule
store: root.rootStore
contactsStore: root.contactsStore
onOpenProfileClicked: {
root.profileButtonClicked();
}
onOpenAppSearch: {
root.openAppSearch()
}
2020-12-11 20:29:46 +00:00
}
}
Component {
id: communtiyColumnComponent
CommunityColumnView {
communitySectionModule: root.rootStore.chatCommunitySectionModule
store: root.rootStore
hasAddedContacts: root.hasAddedContacts
pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent
2021-06-02 19:43:33 +00:00
}
}
Component {
id: groupInfoPopupComponent
2021-05-25 19:38:18 +00:00
GroupInfoPopup {
// Not Refactored
store: root.rootStore
pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent
2021-05-25 19:38:18 +00:00
}
}
Component {
id: statusStickerPackClickPopup
StatusStickerPackClickPopup{
onClosed: {
destroy();
}
}
}
2020-10-02 13:02:56 +00:00
ConfirmationDialog {
id: removeContactConfirmationDialog
// % "Remove contact"
header.title: qsTrId("remove-contact")
2020-10-02 13:02:56 +00:00
//% "Are you sure you want to remove this contact?"
confirmationText: qsTrId("are-you-sure-you-want-to-remove-this-contact-")
onConfirmButtonClicked: {
let pk = chatColumn.contactToRemove
if (Utils.getContactDetailsAsJson(pk).isContact) {
root.contactsStore.removeContact(pk)
}
removeContactConfirmationDialog.parentPopup.close();
removeContactConfirmationDialog.close();
2020-10-02 13:02:56 +00:00
}
}
MessageContextMenuView {
id: quickActionMessageOptionsMenu
store: root.rootStore
onOpenProfileClicked: {
Global.openProfilePopup(publicKey)
}
onCreateOneToOneChat: {
Global.changeAppSectionBySectionType(Constants.appSection.chat)
root.rootStore.chatCommunitySectionModule.createOneToOneChat(chatId, ensName)
}
}
}