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
|
2020-05-19 19:44:45 +00:00
|
|
|
import "../../../imports"
|
2020-06-23 18:51:10 +00:00
|
|
|
import "../../../shared"
|
2020-05-25 20:34:26 +00:00
|
|
|
import "."
|
2020-10-02 13:02:56 +00:00
|
|
|
import "components"
|
2020-05-13 17:27:06 +00:00
|
|
|
|
|
|
|
SplitView {
|
2020-06-23 20:49:04 +00:00
|
|
|
id: chatView
|
2020-06-23 18:51:10 +00:00
|
|
|
handle: SplitViewHandle {}
|
2020-05-27 17:10:50 +00:00
|
|
|
|
2020-11-19 18:30:09 +00:00
|
|
|
property alias chatColumn: chatColumn
|
|
|
|
|
2020-09-23 07:28:20 +00:00
|
|
|
property var onActivated: function () {
|
|
|
|
chatColumn.onActivated()
|
|
|
|
}
|
|
|
|
|
2020-09-15 19:47:13 +00:00
|
|
|
Connections {
|
2020-09-16 14:28:03 +00:00
|
|
|
target: applicationWindow
|
2020-09-15 19:47:13 +00:00
|
|
|
onSettingsLoaded: {
|
|
|
|
// Add recent
|
|
|
|
chatView.restoreState(appSettings.chatSplitView)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Component.onDestruction: appSettings.chatSplitView = this.saveState()
|
2020-06-23 20:49:04 +00:00
|
|
|
|
2020-05-25 20:34:26 +00:00
|
|
|
ContactsColumn {
|
2020-05-13 17:27:06 +00:00
|
|
|
id: contactsColumn
|
2020-07-02 15:14:31 +00:00
|
|
|
SplitView.preferredWidth: Style.current.leftTabPrefferedSize
|
|
|
|
SplitView.minimumWidth: Style.current.leftTabMinimumWidth
|
|
|
|
SplitView.maximumWidth: Style.current.leftTabMaximumWidth
|
2020-05-13 17:27:06 +00:00
|
|
|
}
|
|
|
|
|
2020-05-25 20:34:26 +00:00
|
|
|
ChatColumn {
|
2020-05-13 17:27:06 +00:00
|
|
|
id: chatColumn
|
2020-05-26 18:16:07 +00:00
|
|
|
chatGroupsListViewCount: contactsColumn.chatGroupsListViewCount
|
2020-05-13 17:27:06 +00:00
|
|
|
}
|
2020-10-02 13:02:56 +00:00
|
|
|
|
2020-11-30 17:03:52 +00:00
|
|
|
function getProfileImage(pubkey, isCurrentUser, useLargeImage) {
|
|
|
|
if (isCurrentUser || (isCurrentUser === undefined && pubkey === profileModel.profile.pubKey)) {
|
|
|
|
return profileModel.profile.thumbnailImage
|
|
|
|
}
|
|
|
|
|
|
|
|
const index = profileModel.contacts.list.getContactIndexByPubkey(pubkey)
|
|
|
|
if (index === -1) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
return profileModel.contacts.list.rowData(index, useLargeImage ? "largeImage" : "thumbnailImage")
|
|
|
|
}
|
|
|
|
|
2020-10-02 13:02:56 +00:00
|
|
|
function openProfilePopup(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam, parentPopup){
|
|
|
|
var popup = profilePopupComponent.createObject(chatView);
|
|
|
|
if(parentPopup){
|
|
|
|
popup.parentPopup = parentPopup;
|
|
|
|
}
|
|
|
|
popup.openPopup(profileModel.profile.pubKey !== fromAuthorParam, userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam);
|
|
|
|
}
|
|
|
|
|
|
|
|
property Component profilePopupComponent: ProfilePopup {
|
|
|
|
id: profilePopup
|
|
|
|
height: 450
|
|
|
|
onClosed: {
|
|
|
|
if(profilePopup.parentPopup){
|
|
|
|
profilePopup.parentPopup.close();
|
|
|
|
}
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ConfirmationDialog {
|
|
|
|
id: removeContactConfirmationDialog
|
|
|
|
// % "Remove contact"
|
|
|
|
title: qsTrId("remove-contact")
|
|
|
|
//% "Are you sure you want to remove this contact?"
|
|
|
|
confirmationText: qsTrId("are-you-sure-you-want-to-remove-this-contact-")
|
|
|
|
onConfirmButtonClicked: {
|
2020-12-06 22:15:51 +00:00
|
|
|
if (profileModel.contacts.isAdded(chatColumn.contactToRemove)) {
|
|
|
|
profileModel.contacts.removeContact(chatColumn.contactToRemove)
|
2020-10-02 13:02:56 +00:00
|
|
|
}
|
|
|
|
removeContactConfirmationDialog.parentPopup.close();
|
|
|
|
removeContactConfirmationDialog.close();
|
|
|
|
}
|
|
|
|
}
|
2020-05-13 17:27:06 +00:00
|
|
|
}
|
2020-05-25 20:34:26 +00:00
|
|
|
|
2020-05-13 17:27:06 +00:00
|
|
|
/*##^##
|
|
|
|
Designer {
|
2020-06-23 18:51:10 +00:00
|
|
|
D{i:0;formeditorColor:"#ffffff";formeditorZoom:1.25;height:770;width:1152}
|
2020-05-13 17:27:06 +00:00
|
|
|
}
|
|
|
|
##^##*/
|