2020-06-17 19:18:31 +00:00
|
|
|
|
import QtQuick 2.13
|
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
|
import QtQuick.Layouts 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
2022-03-21 15:33:14 +00:00
|
|
|
|
import StatusQ.Core 0.1
|
2021-10-26 14:21:08 +00:00
|
|
|
|
import StatusQ.Components 0.1
|
2021-10-25 19:37:44 +00:00
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
|
2021-09-28 15:04:06 +00:00
|
|
|
|
import utils 1.0
|
2021-10-26 14:21:08 +00:00
|
|
|
|
|
2021-10-27 21:27:49 +00:00
|
|
|
|
import shared.views 1.0
|
|
|
|
|
import shared.panels 1.0
|
|
|
|
|
import shared.popups 1.0
|
|
|
|
|
import shared.controls 1.0
|
2021-10-06 09:16:39 +00:00
|
|
|
|
|
2021-12-31 12:29:51 +00:00
|
|
|
|
import "../stores"
|
2021-10-06 09:16:39 +00:00
|
|
|
|
import "../panels"
|
|
|
|
|
import "../popups"
|
2022-03-15 15:55:18 +00:00
|
|
|
|
// TODO remove this import when the ContactRequestPanel is moved to the the Profile completely
|
|
|
|
|
import "../../Chat/panels"
|
2020-05-27 21:28:25 +00:00
|
|
|
|
|
|
|
|
|
Item {
|
2021-10-06 09:16:39 +00:00
|
|
|
|
id: root
|
|
|
|
|
|
2021-12-31 12:29:51 +00:00
|
|
|
|
property ContactsStore contactsStore
|
2021-12-09 13:28:02 +00:00
|
|
|
|
property int profileContentWidth
|
2021-10-06 09:16:39 +00:00
|
|
|
|
|
2020-07-24 11:27:26 +00:00
|
|
|
|
property alias searchStr: searchBox.text
|
2020-09-17 08:47:14 +00:00
|
|
|
|
property bool isPending: false
|
2021-01-14 20:09:07 +00:00
|
|
|
|
height: parent.height
|
|
|
|
|
Layout.fillWidth: true
|
2021-04-08 15:44:58 +00:00
|
|
|
|
clip: true
|
2020-05-27 21:28:25 +00:00
|
|
|
|
|
2021-01-14 20:09:07 +00:00
|
|
|
|
Item {
|
2022-03-07 20:34:59 +00:00
|
|
|
|
height: parent.height
|
2021-12-09 13:28:02 +00:00
|
|
|
|
width: profileContentWidth
|
2021-04-08 15:44:58 +00:00
|
|
|
|
|
2021-03-18 09:33:39 +00:00
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2020-07-21 21:03:22 +00:00
|
|
|
|
|
2022-03-07 20:34:59 +00:00
|
|
|
|
StatusFlatButton {
|
|
|
|
|
icon.name: "arrow-left"
|
|
|
|
|
icon.width: 20
|
|
|
|
|
icon.height: 20
|
|
|
|
|
text: qsTr("Messaging")
|
|
|
|
|
size: StatusBaseButton.Size.Large
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.topMargin: 8
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.leftMargin: -40
|
|
|
|
|
onClicked: Global.changeAppSectionBySectionType(Constants.appSection.profile,
|
2022-03-24 20:55:22 +00:00
|
|
|
|
Constants.settingsSubsection.messaging)
|
2022-03-07 20:34:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-28 14:42:26 +00:00
|
|
|
|
RowLayout {
|
|
|
|
|
id: contactsHeader
|
2022-03-07 20:34:59 +00:00
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.topMargin: 56
|
2022-03-28 14:42:26 +00:00
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
text: qsTr("Contacts")
|
|
|
|
|
font.weight: Font.Bold
|
|
|
|
|
font.pixelSize: 28
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusButton {
|
|
|
|
|
text: qsTr("Send contact request to chat key")
|
|
|
|
|
onClicked: {
|
|
|
|
|
sendContactRequest.open()
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-07 20:34:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-14 20:09:07 +00:00
|
|
|
|
SearchBox {
|
|
|
|
|
id: searchBox
|
2022-03-28 14:42:26 +00:00
|
|
|
|
anchors.top: contactsHeader.bottom
|
2022-03-07 20:34:59 +00:00
|
|
|
|
anchors.topMargin: 32
|
2022-03-21 17:43:42 +00:00
|
|
|
|
width: parent.width
|
|
|
|
|
input.implicitHeight: 44
|
|
|
|
|
input.placeholderText: qsTr("Search by a display name or chat key")
|
2020-07-21 21:03:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-15 15:55:18 +00:00
|
|
|
|
TabBar {
|
|
|
|
|
id: contactsTabBar
|
|
|
|
|
width: parent.width
|
2021-01-14 20:09:07 +00:00
|
|
|
|
anchors.top: searchBox.bottom
|
2022-03-15 15:55:18 +00:00
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
|
height: contactsBtn.height
|
|
|
|
|
background: Rectangle {
|
|
|
|
|
color: Style.current.transparent
|
2020-07-21 21:03:22 +00:00
|
|
|
|
}
|
2022-03-15 15:55:18 +00:00
|
|
|
|
StatusTabButton {
|
|
|
|
|
id: contactsBtn
|
2022-03-24 20:55:22 +00:00
|
|
|
|
addToWidth: Style.current.bigPadding
|
2022-03-15 15:55:18 +00:00
|
|
|
|
btnText: qsTr("Contacts")
|
2021-01-14 20:09:07 +00:00
|
|
|
|
}
|
2022-03-15 15:55:18 +00:00
|
|
|
|
StatusTabButton {
|
|
|
|
|
id: pendingRequestsBtn
|
2022-03-24 20:55:22 +00:00
|
|
|
|
addToWidth: Style.current.bigPadding
|
|
|
|
|
enabled: root.contactsStore.receivedContactRequestsModel.count > 0 ||
|
|
|
|
|
root.contactsStore.sentContactRequestsModel.count > 0
|
2022-03-15 15:55:18 +00:00
|
|
|
|
btnText: qsTr("Pending Requests")
|
2022-03-21 15:33:14 +00:00
|
|
|
|
badge.value: contactList.count
|
2022-03-15 15:55:18 +00:00
|
|
|
|
}
|
2022-03-24 20:55:22 +00:00
|
|
|
|
StatusTabButton {
|
|
|
|
|
id: rejectedRequestsBtn
|
|
|
|
|
addToWidth: Style.current.bigPadding
|
|
|
|
|
enabled: root.contactsStore.receivedButRejectedContactRequestsModel.count > 0 ||
|
|
|
|
|
root.contactsStore.sentButRejectedContactRequestsModel.count > 0
|
|
|
|
|
btnText: qsTr("Rejected Requests")
|
|
|
|
|
}
|
2022-03-15 15:55:18 +00:00
|
|
|
|
StatusTabButton {
|
|
|
|
|
id: blockedBtn
|
2022-03-24 20:55:22 +00:00
|
|
|
|
addToWidth: Style.current.bigPadding
|
2022-03-15 15:55:18 +00:00
|
|
|
|
enabled: root.contactsStore.blockedContactsModel.count > 0
|
|
|
|
|
btnText: qsTr("Blocked")
|
2021-01-14 20:09:07 +00:00
|
|
|
|
}
|
2020-07-24 11:27:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-15 15:55:18 +00:00
|
|
|
|
StackLayout {
|
|
|
|
|
id: stackLayout
|
2021-09-17 15:08:16 +00:00
|
|
|
|
width: parent.width
|
2022-03-15 15:55:18 +00:00
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
anchors.top: contactsTabBar.bottom
|
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
|
currentIndex: contactsTabBar.currentIndex
|
|
|
|
|
|
|
|
|
|
// CONTACTS
|
|
|
|
|
Item {
|
2022-03-24 20:55:22 +00:00
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
|
|
ColumnLayout {
|
2022-03-15 15:55:18 +00:00
|
|
|
|
anchors.fill: parent
|
2021-01-14 20:09:07 +00:00
|
|
|
|
|
2022-03-24 20:55:22 +00:00
|
|
|
|
ContactsListPanel {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: parent.height * 0.5
|
|
|
|
|
contactsModel: root.contactsStore.myContactsModel
|
|
|
|
|
clip: true
|
|
|
|
|
title: qsTr("Identity Verified Contacts")
|
|
|
|
|
searchString: searchBox.text
|
|
|
|
|
panelUsage: Constants.contactsPanelUsage.verifiedMutualContacts
|
|
|
|
|
|
|
|
|
|
onOpenProfilePopup: {
|
|
|
|
|
Global.openProfilePopup(publicKey)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onSendMessageActionTriggered: {
|
|
|
|
|
root.contactsStore.joinPrivateChat(publicKey)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onOpenChangeNicknamePopup: {
|
|
|
|
|
Global.openProfilePopup(publicKey, null, true)
|
|
|
|
|
}
|
2022-03-15 15:55:18 +00:00
|
|
|
|
}
|
2020-07-24 11:27:26 +00:00
|
|
|
|
|
2022-03-24 20:55:22 +00:00
|
|
|
|
ContactsListPanel {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: parent.height * 0.5
|
|
|
|
|
contactsModel: root.contactsStore.myContactsModel
|
|
|
|
|
clip: true
|
|
|
|
|
title: qsTr("Contacts")
|
|
|
|
|
searchString: searchBox.text
|
|
|
|
|
panelUsage: Constants.contactsPanelUsage.mutualContacts
|
|
|
|
|
|
|
|
|
|
onOpenProfilePopup: {
|
|
|
|
|
Global.openProfilePopup(publicKey)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onSendMessageActionTriggered: {
|
|
|
|
|
root.contactsStore.joinPrivateChat(publicKey)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onOpenChangeNicknamePopup: {
|
|
|
|
|
Global.openProfilePopup(publicKey, null, true)
|
|
|
|
|
}
|
2022-03-15 15:55:18 +00:00
|
|
|
|
}
|
2022-03-24 20:55:22 +00:00
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
2022-03-15 15:55:18 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-21 21:03:22 +00:00
|
|
|
|
|
2022-03-15 15:55:18 +00:00
|
|
|
|
NoFriendsRectangle {
|
|
|
|
|
visible: root.contactsStore.myContactsModel.count === 0
|
|
|
|
|
//% "You don’t have any contacts yet"
|
|
|
|
|
text: qsTrId("you-don-t-have-any-contacts-yet")
|
|
|
|
|
width: parent.width
|
2022-03-24 20:55:22 +00:00
|
|
|
|
anchors.centerIn: parent
|
2022-03-15 15:55:18 +00:00
|
|
|
|
}
|
2021-09-17 15:08:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-15 15:55:18 +00:00
|
|
|
|
// PENDING REQUESTS
|
|
|
|
|
Item {
|
2022-03-24 20:55:22 +00:00
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
|
|
ContactsListPanel {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: parent.height * 0.5
|
|
|
|
|
clip: true
|
|
|
|
|
title: qsTr("Received")
|
|
|
|
|
searchString: searchBox.text
|
|
|
|
|
contactsModel: root.contactsStore.receivedContactRequestsModel
|
|
|
|
|
panelUsage: Constants.contactsPanelUsage.receivedContactRequest
|
|
|
|
|
|
|
|
|
|
onOpenProfilePopup: {
|
|
|
|
|
Global.openProfilePopup(publicKey)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onOpenChangeNicknamePopup: {
|
|
|
|
|
Global.openProfilePopup(publicKey, null, true)
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-25 11:33:30 +00:00
|
|
|
|
onContactRequestAccepted: {
|
2022-03-24 20:55:22 +00:00
|
|
|
|
root.contactsStore.acceptContactRequest(publicKey)
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-25 11:33:30 +00:00
|
|
|
|
onContactRequestRejected: {
|
2022-03-24 20:55:22 +00:00
|
|
|
|
root.contactsStore.rejectContactRequest(publicKey)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContactsListPanel {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: parent.height * 0.5
|
|
|
|
|
clip: true
|
|
|
|
|
title: qsTr("Sent")
|
|
|
|
|
searchString: searchBox.text
|
|
|
|
|
contactsModel: root.contactsStore.sentContactRequestsModel
|
|
|
|
|
panelUsage: Constants.contactsPanelUsage.sentContactRequest
|
|
|
|
|
|
|
|
|
|
onOpenProfilePopup: {
|
|
|
|
|
Global.openProfilePopup(publicKey)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onOpenChangeNicknamePopup: {
|
|
|
|
|
Global.openProfilePopup(publicKey, null, true)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// REJECTED REQUESTS
|
|
|
|
|
Item {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
2022-03-15 15:55:18 +00:00
|
|
|
|
|
2022-03-24 20:55:22 +00:00
|
|
|
|
ColumnLayout {
|
2022-03-15 15:55:18 +00:00
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
2022-03-24 20:55:22 +00:00
|
|
|
|
ContactsListPanel {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: parent.height * 0.5
|
|
|
|
|
clip: true
|
|
|
|
|
title: qsTr("Received")
|
|
|
|
|
searchString: searchBox.text
|
|
|
|
|
contactsModel: root.contactsStore.receivedButRejectedContactRequestsModel
|
|
|
|
|
panelUsage: Constants.contactsPanelUsage.rejectedReceivedContactRequest
|
2022-03-15 15:55:18 +00:00
|
|
|
|
|
|
|
|
|
onOpenProfilePopup: {
|
2022-03-24 20:55:22 +00:00
|
|
|
|
Global.openProfilePopup(publicKey)
|
2022-03-15 15:55:18 +00:00
|
|
|
|
}
|
2022-03-24 20:55:22 +00:00
|
|
|
|
|
|
|
|
|
onOpenChangeNicknamePopup: {
|
|
|
|
|
Global.openProfilePopup(publicKey, null, true)
|
2022-03-15 15:55:18 +00:00
|
|
|
|
}
|
2022-03-24 20:55:22 +00:00
|
|
|
|
|
2022-03-25 11:33:30 +00:00
|
|
|
|
onRejectionRemoved: {
|
2022-03-24 20:55:22 +00:00
|
|
|
|
root.contactsStore.removeContactRequestRejection(publicKey)
|
2022-03-15 15:55:18 +00:00
|
|
|
|
}
|
2022-03-24 20:55:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContactsListPanel {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: parent.height * 0.5
|
|
|
|
|
clip: true
|
|
|
|
|
title: qsTr("Sent")
|
|
|
|
|
searchString: searchBox.text
|
|
|
|
|
contactsModel: root.contactsStore.sentButRejectedContactRequestsModel
|
|
|
|
|
panelUsage: Constants.contactsPanelUsage.rejectedSentContactRequest
|
|
|
|
|
|
|
|
|
|
onOpenProfilePopup: {
|
|
|
|
|
Global.openProfilePopup(publicKey)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onOpenChangeNicknamePopup: {
|
|
|
|
|
Global.openProfilePopup(publicKey, null, true)
|
2022-03-15 15:55:18 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-24 20:55:22 +00:00
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
}
|
2021-01-14 20:09:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-15 15:55:18 +00:00
|
|
|
|
// BLOCKED
|
2021-10-06 09:16:39 +00:00
|
|
|
|
ContactsListPanel {
|
2022-03-24 20:55:22 +00:00
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
2022-03-11 13:22:21 +00:00
|
|
|
|
clip: true
|
2022-03-24 20:55:22 +00:00
|
|
|
|
searchString: searchBox.text
|
2021-12-31 12:29:51 +00:00
|
|
|
|
contactsModel: root.contactsStore.blockedContactsModel
|
2022-03-24 20:55:22 +00:00
|
|
|
|
panelUsage: Constants.contactsPanelUsage.blockedContacts
|
2021-12-31 12:29:51 +00:00
|
|
|
|
|
|
|
|
|
onOpenProfilePopup: {
|
2022-03-24 20:55:22 +00:00
|
|
|
|
Global.openProfilePopup(publicKey)
|
2021-12-31 12:29:51 +00:00
|
|
|
|
}
|
2021-01-14 20:09:07 +00:00
|
|
|
|
}
|
2020-09-17 08:47:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-14 20:09:07 +00:00
|
|
|
|
Component {
|
|
|
|
|
id: loadingIndicator
|
2021-04-26 10:25:01 +00:00
|
|
|
|
StatusLoadingIndicator {
|
2021-01-14 20:09:07 +00:00
|
|
|
|
width: 12
|
|
|
|
|
height: 12
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-05-27 21:28:25 +00:00
|
|
|
|
}
|
2020-06-16 18:04:56 +00:00
|
|
|
|
|
2021-10-06 09:16:39 +00:00
|
|
|
|
// TODO: Make BlockContactConfirmationDialog a dynamic component on a future refactor
|
|
|
|
|
BlockContactConfirmationDialog {
|
|
|
|
|
id: blockContactConfirmationDialog
|
|
|
|
|
onBlockButtonClicked: {
|
2021-12-31 12:29:51 +00:00
|
|
|
|
root.contactsStore.blockContact(blockContactConfirmationDialog.contactAddress)
|
2021-10-06 09:16:39 +00:00
|
|
|
|
blockContactConfirmationDialog.close()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Make ConfirmationDialog a dynamic component on a future refactor
|
|
|
|
|
ConfirmationDialog {
|
|
|
|
|
id: removeContactConfirmationDialog
|
|
|
|
|
//% "Remove contact"
|
|
|
|
|
header.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: {
|
2022-01-04 12:06:05 +00:00
|
|
|
|
if (Utils.getContactDetailsAsJson(removeContactConfirmationDialog.value).isContact) {
|
2022-03-24 20:55:22 +00:00
|
|
|
|
root.contactsStore.removeContact(removeContactConfirmationDialog.value);
|
2021-10-06 09:16:39 +00:00
|
|
|
|
}
|
|
|
|
|
removeContactConfirmationDialog.close()
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-28 14:42:26 +00:00
|
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
|
id: sendContactRequest
|
|
|
|
|
active: false
|
|
|
|
|
|
|
|
|
|
function open() {
|
|
|
|
|
active = true
|
|
|
|
|
sendContactRequest.item.open()
|
|
|
|
|
}
|
|
|
|
|
function close() {
|
|
|
|
|
active = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sourceComponent: SendContactRequestModal {
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
contactsStore: root.contactsStore
|
|
|
|
|
|
|
|
|
|
onClosed: {
|
|
|
|
|
sendContactRequest.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-06-16 18:04:56 +00:00
|
|
|
|
}
|
2021-10-06 09:16:39 +00:00
|
|
|
|
|