2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
2020-06-23 18:51:10 +00:00
|
|
|
import QtQuick.Controls 2.13
|
2020-06-23 20:49:04 +00:00
|
|
|
import Qt.labs.settings 1.0
|
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.panels 1.0
|
|
|
|
import shared.popups 1.0
|
|
|
|
import shared.status 1.0
|
2021-10-28 20:23:30 +00:00
|
|
|
import shared.views.chat 1.0
|
|
|
|
|
|
|
|
import StatusQ.Layout 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
2021-10-01 15:58:36 +00:00
|
|
|
|
|
|
|
import "views"
|
|
|
|
import "panels"
|
|
|
|
import "panels/communities"
|
|
|
|
import "popups"
|
|
|
|
import "helpers"
|
|
|
|
import "controls"
|
|
|
|
import "stores"
|
2020-05-13 17:27:06 +00:00
|
|
|
|
2021-07-22 14:53:19 +00:00
|
|
|
StatusAppThreePanelLayout {
|
2021-10-21 22:39:53 +00:00
|
|
|
id: root
|
2020-05-27 17:10:50 +00:00
|
|
|
|
2021-07-22 14:53:19 +00:00
|
|
|
handle: SplitViewHandle { implicitWidth: 5 }
|
|
|
|
|
2022-01-04 12:06:05 +00:00
|
|
|
property var contactsStore
|
2022-01-10 16:44:54 +00:00
|
|
|
property bool hasAddedContacts: root.contactsStore.myContactsModel.count > 0
|
2021-11-01 20:10:50 +00:00
|
|
|
|
2021-11-11 16:11:40 +00:00
|
|
|
// Not Refactored
|
2021-11-25 17:12:19 +00:00
|
|
|
property var messageStore
|
2021-11-11 16:11:40 +00:00
|
|
|
|
|
|
|
property RootStore rootStore: RootStore {
|
|
|
|
messageStore: root.messageStore
|
|
|
|
}
|
2021-11-15 15:15:21 +00:00
|
|
|
|
2021-12-21 09:26:13 +00:00
|
|
|
property Component pinnedMessagesListPopupComponent
|
2021-03-08 19:24:39 +00:00
|
|
|
property bool stickersLoaded: false
|
2021-07-20 15:22:09 +00:00
|
|
|
signal profileButtonClicked()
|
2021-11-10 08:09:31 +00:00
|
|
|
signal openAppSearch()
|
2021-03-08 19:24:39 +00:00
|
|
|
|
2021-11-10 12:48:22 +00:00
|
|
|
// Not Refactored
|
|
|
|
// Connections {
|
|
|
|
// target: root.rootStore.chatsModelInst.stickers
|
|
|
|
// onStickerPacksLoaded: {
|
|
|
|
// stickersLoaded = true;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// property var onActivated: function () {
|
|
|
|
// root.rootStore.chatsModelInst.channelView.restorePreviousActiveChannel();
|
|
|
|
// chatColumn.onActivated();
|
|
|
|
// }
|
2020-09-23 07:28:20 +00:00
|
|
|
|
2021-06-11 13:23:41 +00:00
|
|
|
leftPanel: Loader {
|
2020-12-11 20:29:46 +00:00
|
|
|
id: contactColumnLoader
|
2022-01-04 12:06:05 +00:00
|
|
|
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 {
|
2021-06-11 13:23:41 +00:00
|
|
|
id: chatColumn
|
2022-01-04 12:06:05 +00:00
|
|
|
parentModule: root.rootStore.chatCommunitySectionModule
|
2021-11-11 16:11:40 +00:00
|
|
|
rootStore: root.rootStore
|
2022-01-04 12:06:05 +00:00
|
|
|
contactsStore: root.contactsStore
|
2021-12-21 09:26:13 +00:00
|
|
|
pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent
|
2021-12-08 21:20:43 +00:00
|
|
|
stickersLoaded: root.stickersLoaded
|
2021-11-26 15:37:57 +00:00
|
|
|
//chatGroupsListViewCount: contactColumnLoader.item.chatGroupsListViewCount
|
2021-12-08 21:20:43 +00:00
|
|
|
onOpenStickerPackPopup: {
|
|
|
|
Global.openPopup(statusStickerPackClickPopup, {packId: stickerPackId} )
|
|
|
|
}
|
2021-11-10 08:09:31 +00:00
|
|
|
onOpenAppSearch: {
|
|
|
|
root.openAppSearch()
|
|
|
|
}
|
2021-06-11 13:23:41 +00:00
|
|
|
}
|
|
|
|
|
2021-11-30 14:49:45 +00:00
|
|
|
showRightPanel: {
|
|
|
|
// Check if user list is available as an option for particular chat content module.
|
2022-01-04 12:06:05 +00:00
|
|
|
let usersListAvailable = root.rootStore.currentChatContentModule().chatDetails.isUsersListAvailable
|
2021-11-30 14:49:45 +00:00
|
|
|
return localAccountSensitiveSettings.showOnlineUsers && usersListAvailable && localAccountSensitiveSettings.expandUsersList
|
|
|
|
}
|
|
|
|
|
2022-01-04 12:06:05 +00:00
|
|
|
rightPanel: localAccountSensitiveSettings.communitiesEnabled && root.rootStore.chatCommunitySectionModule.isCommunity()?
|
|
|
|
communityUserListComponent :
|
|
|
|
userListComponent
|
2021-07-22 14:53:19 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: communityUserListComponent
|
2021-10-01 15:58:36 +00:00
|
|
|
CommunityUserListPanel {
|
|
|
|
messageContextMenu: quickActionMessageOptionsMenu
|
2021-11-30 14:49:45 +00:00
|
|
|
usersModule: {
|
2022-01-04 12:06:05 +00:00
|
|
|
let chatContentModule = root.rootStore.currentChatContentModule()
|
2021-12-14 14:19:55 +00:00
|
|
|
return chatContentModule.usersModule
|
2021-11-30 14:49:45 +00:00
|
|
|
}
|
2021-10-01 15:58:36 +00:00
|
|
|
}
|
2021-07-22 14:53:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: userListComponent
|
2021-10-01 15:58:36 +00:00
|
|
|
UserListPanel {
|
|
|
|
messageContextMenu: quickActionMessageOptionsMenu
|
2021-11-30 14:49:45 +00:00
|
|
|
usersModule: {
|
2022-01-04 12:06:05 +00:00
|
|
|
let chatContentModule = root.rootStore.currentChatContentModule()
|
2021-12-14 14:19:55 +00:00
|
|
|
return chatContentModule.usersModule
|
2021-11-30 14:49:45 +00:00
|
|
|
}
|
2021-10-01 15:58:36 +00:00
|
|
|
}
|
2021-07-22 14:53:19 +00:00
|
|
|
}
|
|
|
|
|
2020-12-11 20:29:46 +00:00
|
|
|
Component {
|
|
|
|
id: contactsColumnComponent
|
2021-10-01 15:58:36 +00:00
|
|
|
ContactsColumnView {
|
2022-01-04 12:06:05 +00:00
|
|
|
chatSectionModule: root.rootStore.chatCommunitySectionModule
|
2021-11-11 16:11:40 +00:00
|
|
|
store: root.rootStore
|
2022-01-04 12:06:05 +00:00
|
|
|
contactsStore: root.contactsStore
|
2021-07-20 15:22:09 +00:00
|
|
|
onOpenProfileClicked: {
|
2021-10-21 22:39:53 +00:00
|
|
|
root.profileButtonClicked();
|
2021-07-20 15:22:09 +00:00
|
|
|
}
|
2021-11-10 08:09:31 +00:00
|
|
|
|
|
|
|
onOpenAppSearch: {
|
|
|
|
root.openAppSearch()
|
|
|
|
}
|
2020-12-11 20:29:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: communtiyColumnComponent
|
2021-10-01 15:58:36 +00:00
|
|
|
CommunityColumnView {
|
2022-01-04 12:06:05 +00:00
|
|
|
communitySectionModule: root.rootStore.chatCommunitySectionModule
|
2021-11-26 15:37:57 +00:00
|
|
|
store: root.rootStore
|
2022-01-10 16:44:54 +00:00
|
|
|
hasAddedContacts: root.hasAddedContacts
|
2021-12-21 09:26:13 +00:00
|
|
|
pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent
|
2021-06-02 19:43:33 +00:00
|
|
|
}
|
2020-05-13 17:27:06 +00:00
|
|
|
}
|
|
|
|
|
2021-02-17 20:36:10 +00:00
|
|
|
Component {
|
|
|
|
id: groupInfoPopupComponent
|
2021-05-25 19:38:18 +00:00
|
|
|
GroupInfoPopup {
|
2021-11-15 15:15:21 +00:00
|
|
|
// Not Refactored
|
2021-11-11 16:11:40 +00:00
|
|
|
store: root.rootStore
|
2021-12-21 09:26:13 +00:00
|
|
|
pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent
|
2021-05-25 19:38:18 +00:00
|
|
|
}
|
2021-02-17 20:36:10 +00:00
|
|
|
}
|
|
|
|
|
2021-03-08 19:24:39 +00:00
|
|
|
Component {
|
|
|
|
id: statusStickerPackClickPopup
|
|
|
|
StatusStickerPackClickPopup{
|
|
|
|
onClosed: {
|
|
|
|
destroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-02 13:02:56 +00:00
|
|
|
ConfirmationDialog {
|
|
|
|
id: removeContactConfirmationDialog
|
|
|
|
// % "Remove contact"
|
2021-09-09 09:10:29 +00:00
|
|
|
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: {
|
2022-01-04 12:06:05 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|
2021-09-01 17:38:39 +00:00
|
|
|
|
2021-10-21 00:41:54 +00:00
|
|
|
MessageContextMenuView {
|
2021-09-01 17:38:39 +00:00
|
|
|
id: quickActionMessageOptionsMenu
|
2022-01-19 15:59:08 +00:00
|
|
|
store: root.rootStore
|
2020-05-25 20:34:26 +00:00
|
|
|
|
2021-12-14 14:19:55 +00:00
|
|
|
onOpenProfileClicked: {
|
2021-12-31 12:29:51 +00:00
|
|
|
Global.openProfilePopup(publicKey)
|
2021-12-14 14:19:55 +00:00
|
|
|
}
|
|
|
|
onCreateOneToOneChat: {
|
|
|
|
Global.changeAppSectionBySectionType(Constants.appSection.chat)
|
2022-01-04 12:06:05 +00:00
|
|
|
root.rootStore.chatCommunitySectionModule.createOneToOneChat(chatId, ensName)
|
2021-12-14 14:19:55 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-13 17:27:06 +00:00
|
|
|
}
|