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
|
|
|
|
|
2022-05-07 11:45:15 +00:00
|
|
|
|
SettingsContentBase {
|
2021-10-06 09:16:39 +00:00
|
|
|
|
id: root
|
|
|
|
|
|
2021-12-31 12:29:51 +00:00
|
|
|
|
property ContactsStore contactsStore
|
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
|
2022-03-28 14:42:26 +00:00
|
|
|
|
|
2022-05-07 11:45:15 +00:00
|
|
|
|
headerComponents: [
|
|
|
|
|
StatusButton {
|
|
|
|
|
text: qsTr("Send contact request to chat key")
|
|
|
|
|
onClicked: {
|
|
|
|
|
sendContactRequest.open()
|
2022-03-28 14:42:26 +00:00
|
|
|
|
}
|
2022-03-07 20:34:59 +00:00
|
|
|
|
}
|
2022-05-07 11:45:15 +00:00
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
spacing: 0
|
|
|
|
|
width: root.contentWidth
|
2022-05-11 11:44:41 +00:00
|
|
|
|
height: root.height
|
2022-03-07 20:34:59 +00:00
|
|
|
|
|
2021-01-14 20:09:07 +00:00
|
|
|
|
SearchBox {
|
|
|
|
|
id: searchBox
|
2022-05-07 11:45:15 +00:00
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.leftMargin: Style.current.padding
|
|
|
|
|
Layout.rightMargin: Style.current.padding
|
2022-03-21 17:43:42 +00:00
|
|
|
|
input.implicitHeight: 44
|
|
|
|
|
input.placeholderText: qsTr("Search by a display name or chat key")
|
2020-07-21 21:03:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-23 11:45:29 +00:00
|
|
|
|
StatusTabBar {
|
2022-03-15 15:55:18 +00:00
|
|
|
|
id: contactsTabBar
|
2022-05-07 11:45:15 +00:00
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.leftMargin: Style.current.padding
|
|
|
|
|
Layout.rightMargin: Style.current.padding
|
2022-04-06 09:23:59 +00:00
|
|
|
|
Layout.topMargin: 2 * Style.current.padding
|
2022-05-23 11:45:29 +00:00
|
|
|
|
|
2022-03-15 15:55:18 +00:00
|
|
|
|
StatusTabButton {
|
|
|
|
|
id: contactsBtn
|
2022-05-23 11:45:29 +00:00
|
|
|
|
width: implicitWidth
|
|
|
|
|
text: qsTr("Contacts")
|
2021-01-14 20:09:07 +00:00
|
|
|
|
}
|
2022-03-15 15:55:18 +00:00
|
|
|
|
StatusTabButton {
|
|
|
|
|
id: pendingRequestsBtn
|
2022-05-23 11:45:29 +00:00
|
|
|
|
width: implicitWidth
|
2022-03-24 20:55:22 +00:00
|
|
|
|
enabled: root.contactsStore.receivedContactRequestsModel.count > 0 ||
|
|
|
|
|
root.contactsStore.sentContactRequestsModel.count > 0
|
2022-05-23 11:45:29 +00:00
|
|
|
|
text: qsTr("Pending Requests")
|
2022-05-16 15:02:03 +00:00
|
|
|
|
badge.value: root.contactsStore.receivedContactRequestsModel.count
|
2022-03-15 15:55:18 +00:00
|
|
|
|
}
|
2022-04-08 20:17:16 +00:00
|
|
|
|
// Temporary commented until we provide appropriate flags on the `status-go` side to cover all sections.
|
2022-05-07 11:45:15 +00:00
|
|
|
|
// StatusTabButton {
|
|
|
|
|
// id: rejectedRequestsBtn
|
2022-05-23 11:45:29 +00:00
|
|
|
|
// width: implicitWidth
|
2022-05-07 11:45:15 +00:00
|
|
|
|
// 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-05-23 11:45:29 +00:00
|
|
|
|
width: implicitWidth
|
2022-03-15 15:55:18 +00:00
|
|
|
|
enabled: root.contactsStore.blockedContactsModel.count > 0
|
2022-05-23 11:45:29 +00:00
|
|
|
|
text: 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
|
2022-05-07 11:45:15 +00:00
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
2022-03-15 15:55:18 +00:00
|
|
|
|
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
|
2022-05-07 11:45:15 +00:00
|
|
|
|
Layout.preferredHeight: root.height * 0.5
|
2022-03-24 20:55:22 +00:00
|
|
|
|
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: {
|
2022-06-20 14:48:38 +00:00
|
|
|
|
Global.openProfilePopup(publicKey, null, "openNickname")
|
2022-03-24 20:55:22 +00:00
|
|
|
|
}
|
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
|
2022-05-07 11:45:15 +00:00
|
|
|
|
Layout.preferredHeight: root.height * 0.5
|
2022-03-24 20:55:22 +00:00
|
|
|
|
contactsModel: root.contactsStore.myContactsModel
|
|
|
|
|
clip: true
|
|
|
|
|
searchString: searchBox.text
|
|
|
|
|
panelUsage: Constants.contactsPanelUsage.mutualContacts
|
|
|
|
|
|
|
|
|
|
onOpenProfilePopup: {
|
|
|
|
|
Global.openProfilePopup(publicKey)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onSendMessageActionTriggered: {
|
|
|
|
|
root.contactsStore.joinPrivateChat(publicKey)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onOpenChangeNicknamePopup: {
|
2022-06-20 14:48:38 +00:00
|
|
|
|
Global.openProfilePopup(publicKey, null, "openNickname")
|
2022-03-24 20:55:22 +00:00
|
|
|
|
}
|
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
|
2022-05-07 11:45:15 +00:00
|
|
|
|
Layout.preferredHeight: root.height * 0.5
|
2022-03-24 20:55:22 +00:00
|
|
|
|
clip: true
|
|
|
|
|
title: qsTr("Received")
|
|
|
|
|
searchString: searchBox.text
|
|
|
|
|
contactsModel: root.contactsStore.receivedContactRequestsModel
|
|
|
|
|
panelUsage: Constants.contactsPanelUsage.receivedContactRequest
|
|
|
|
|
|
|
|
|
|
onOpenProfilePopup: {
|
|
|
|
|
Global.openProfilePopup(publicKey)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onOpenChangeNicknamePopup: {
|
2022-06-20 14:48:38 +00:00
|
|
|
|
Global.openProfilePopup(publicKey, null, "openNickname")
|
2022-03-24 20:55:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
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-05-27 08:57:18 +00:00
|
|
|
|
root.contactsStore.dismissContactRequest(publicKey)
|
2022-03-24 20:55:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContactsListPanel {
|
|
|
|
|
Layout.fillWidth: true
|
2022-05-07 11:45:15 +00:00
|
|
|
|
Layout.preferredHeight: root.height * 0.5
|
2022-03-24 20:55:22 +00:00
|
|
|
|
clip: true
|
|
|
|
|
title: qsTr("Sent")
|
|
|
|
|
searchString: searchBox.text
|
|
|
|
|
contactsModel: root.contactsStore.sentContactRequestsModel
|
|
|
|
|
panelUsage: Constants.contactsPanelUsage.sentContactRequest
|
|
|
|
|
|
|
|
|
|
onOpenProfilePopup: {
|
|
|
|
|
Global.openProfilePopup(publicKey)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onOpenChangeNicknamePopup: {
|
2022-06-20 14:48:38 +00:00
|
|
|
|
Global.openProfilePopup(publicKey, null, "openNickname")
|
2022-03-24 20:55:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-08 20:17:16 +00:00
|
|
|
|
// Temporary commented until we provide appropriate flags on the `status-go` side to cover all sections.
|
2022-05-07 11:45:15 +00:00
|
|
|
|
// // REJECTED REQUESTS
|
|
|
|
|
// Item {
|
|
|
|
|
// Layout.fillWidth: true
|
|
|
|
|
// Layout.fillHeight: true
|
|
|
|
|
|
|
|
|
|
// ColumnLayout {
|
|
|
|
|
// anchors.fill: parent
|
|
|
|
|
|
|
|
|
|
// ContactsListPanel {
|
|
|
|
|
// Layout.fillWidth: true
|
|
|
|
|
// Layout.preferredHeight: root.height * 0.5
|
|
|
|
|
// clip: true
|
|
|
|
|
// title: qsTr("Received")
|
|
|
|
|
// searchString: searchBox.text
|
|
|
|
|
// contactsModel: root.contactsStore.receivedButRejectedContactRequestsModel
|
|
|
|
|
// panelUsage: Constants.contactsPanelUsage.rejectedReceivedContactRequest
|
|
|
|
|
|
|
|
|
|
// onOpenProfilePopup: {
|
|
|
|
|
// Global.openProfilePopup(publicKey)
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// onOpenChangeNicknamePopup: {
|
|
|
|
|
// Global.openProfilePopup(publicKey, null, true)
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// onRejectionRemoved: {
|
|
|
|
|
// root.contactsStore.removeContactRequestRejection(publicKey)
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// ContactsListPanel {
|
|
|
|
|
// Layout.fillWidth: true
|
|
|
|
|
// Layout.preferredHeight: root.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)
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// 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-06-16 18:04:56 +00:00
|
|
|
|
|
2022-05-07 11:45:15 +00:00
|
|
|
|
// TODO: Make BlockContactConfirmationDialog a dynamic component on a future refactor
|
|
|
|
|
BlockContactConfirmationDialog {
|
|
|
|
|
id: blockContactConfirmationDialog
|
|
|
|
|
onBlockButtonClicked: {
|
|
|
|
|
root.contactsStore.blockContact(blockContactConfirmationDialog.contactAddress)
|
|
|
|
|
blockContactConfirmationDialog.close()
|
|
|
|
|
}
|
2021-10-06 09:16:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-05-07 11:45:15 +00:00
|
|
|
|
// 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: {
|
|
|
|
|
if (Utils.getContactDetailsAsJson(removeContactConfirmationDialog.value).isContact) {
|
|
|
|
|
root.contactsStore.removeContact(removeContactConfirmationDialog.value);
|
|
|
|
|
}
|
|
|
|
|
removeContactConfirmationDialog.close()
|
2021-10-06 09:16:39 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-28 14:42:26 +00:00
|
|
|
|
|
2022-05-07 11:45:15 +00:00
|
|
|
|
Loader {
|
|
|
|
|
id: sendContactRequest
|
2022-05-16 10:31:24 +00:00
|
|
|
|
width: parent.width
|
|
|
|
|
height: parent.height
|
2022-05-07 11:45:15 +00:00
|
|
|
|
active: false
|
2022-03-28 14:42:26 +00:00
|
|
|
|
|
2022-05-07 11:45:15 +00:00
|
|
|
|
function open() {
|
|
|
|
|
active = true
|
|
|
|
|
sendContactRequest.item.open()
|
|
|
|
|
}
|
|
|
|
|
function close() {
|
|
|
|
|
active = false
|
|
|
|
|
}
|
2022-03-28 14:42:26 +00:00
|
|
|
|
|
2022-05-07 11:45:15 +00:00
|
|
|
|
sourceComponent: SendContactRequestModal {
|
2022-05-16 10:31:24 +00:00
|
|
|
|
anchors.centerIn: parent
|
2022-05-07 11:45:15 +00:00
|
|
|
|
contactsStore: root.contactsStore
|
|
|
|
|
onClosed: {
|
|
|
|
|
sendContactRequest.close();
|
|
|
|
|
}
|
2022-03-28 14:42:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-06-16 18:04:56 +00:00
|
|
|
|
}
|
2021-10-06 09:16:39 +00:00
|
|
|
|
|