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