2021-05-26 13:36:24 -04:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import QtGraphicalEffects 1.13
|
2021-09-28 18:04:06 +03:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-19 13:56:35 +02:00
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
2021-10-28 00:27:49 +03:00
|
|
|
import shared.popups 1.0
|
2021-05-26 13:36:24 -04:00
|
|
|
|
2021-10-01 18:58:36 +03:00
|
|
|
import "../panels"
|
|
|
|
|
2021-10-14 11:50:59 +02:00
|
|
|
// TODO: Replace with StatusModal
|
2021-05-26 13:36:24 -04:00
|
|
|
ModalPopup {
|
|
|
|
id: popup
|
|
|
|
|
2021-10-22 23:49:47 +03:00
|
|
|
property var store
|
2022-01-10 10:16:48 +01:00
|
|
|
|
2021-07-16 22:22:50 +02:00
|
|
|
//% "Contact requests"
|
|
|
|
title: qsTrId("contact-requests")
|
2021-05-26 13:36:24 -04:00
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: contactList
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.leftMargin: -Style.current.halfPadding
|
|
|
|
anchors.rightMargin: -Style.current.halfPadding
|
|
|
|
|
2022-01-04 13:06:05 +01:00
|
|
|
model: popup.store.contactRequestsModel
|
2021-05-26 13:36:24 -04:00
|
|
|
clip: true
|
|
|
|
|
2021-10-01 18:58:36 +03:00
|
|
|
delegate: ContactRequestPanel {
|
2022-04-07 21:05:33 +02:00
|
|
|
contactPubKey: model.pubKey
|
2022-01-04 13:06:05 +01:00
|
|
|
contactName: model.name
|
|
|
|
contactIcon: model.icon
|
2022-04-07 21:05:33 +02:00
|
|
|
|
2022-01-04 13:06:05 +01:00
|
|
|
onOpenProfilePopup: {
|
|
|
|
Global.openProfilePopup(model.pubKey)
|
2021-05-26 13:36:24 -04:00
|
|
|
}
|
|
|
|
onBlockContactActionTriggered: {
|
2022-01-04 13:06:05 +01:00
|
|
|
blockContactConfirmationDialog.contactName = model.name
|
|
|
|
blockContactConfirmationDialog.contactAddress = model.pubKey
|
2021-05-26 13:36:24 -04:00
|
|
|
blockContactConfirmationDialog.open()
|
|
|
|
}
|
2021-10-01 18:58:36 +03:00
|
|
|
onAcceptClicked: {
|
2022-01-04 13:06:05 +01:00
|
|
|
popup.store.acceptContactRequest(model.pubKey)
|
2021-10-01 18:58:36 +03:00
|
|
|
}
|
|
|
|
onDeclineClicked: {
|
2022-01-04 13:06:05 +01:00
|
|
|
popup.store.rejectContactRequest(model.pubKey)
|
2021-10-01 18:58:36 +03:00
|
|
|
}
|
2021-05-26 13:36:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
footer: Item {
|
|
|
|
width: parent.width
|
|
|
|
height: children[0].height
|
|
|
|
|
|
|
|
BlockContactConfirmationDialog {
|
|
|
|
id: blockContactConfirmationDialog
|
|
|
|
onBlockButtonClicked: {
|
2022-01-04 13:06:05 +01:00
|
|
|
popup.store.blockContact(blockContactConfirmationDialog.contactAddress)
|
2021-05-26 13:36:24 -04:00
|
|
|
blockContactConfirmationDialog.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ConfirmationDialog {
|
|
|
|
id: declineAllDialog
|
2021-07-16 22:22:50 +02:00
|
|
|
//% "Decline all contacts"
|
2021-09-09 11:10:29 +02:00
|
|
|
header.title: qsTrId("decline-all-contacts")
|
2021-07-16 22:22:50 +02:00
|
|
|
//% "Are you sure you want to decline all these contact requests"
|
|
|
|
confirmationText: qsTrId("are-you-sure-you-want-to-decline-all-these-contact-requests")
|
2021-05-26 13:36:24 -04:00
|
|
|
onConfirmButtonClicked: {
|
2022-01-04 13:06:05 +01:00
|
|
|
popup.store.rejectAllContactRequests()
|
2021-05-26 13:36:24 -04:00
|
|
|
declineAllDialog.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ConfirmationDialog {
|
|
|
|
id: acceptAllDialog
|
2021-07-16 22:22:50 +02:00
|
|
|
//% "Accept all contacts"
|
2021-09-09 11:10:29 +02:00
|
|
|
header.title: qsTrId("accept-all-contacts")
|
2021-07-16 22:22:50 +02:00
|
|
|
//% "Are you sure you want to accept all these contact requests"
|
|
|
|
confirmationText: qsTrId("are-you-sure-you-want-to-accept-all-these-contact-requests")
|
2021-05-26 13:36:24 -04:00
|
|
|
onConfirmButtonClicked: {
|
2022-01-04 13:06:05 +01:00
|
|
|
popup.store.acceptAllContactRequests()
|
2021-05-26 13:36:24 -04:00
|
|
|
acceptAllDialog.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusButton {
|
|
|
|
id: blockBtn
|
2021-05-26 16:04:42 -04:00
|
|
|
enabled: contactList.count > 0
|
2021-05-26 13:36:24 -04:00
|
|
|
anchors.right: addToContactsButton.left
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
anchors.bottom: parent.bottom
|
2021-10-19 13:56:35 +02:00
|
|
|
type: StatusBaseButton.Type.Danger
|
2021-07-16 22:22:50 +02:00
|
|
|
//% "Decline all"
|
|
|
|
text: qsTrId("decline-all")
|
2021-05-26 13:36:24 -04:00
|
|
|
onClicked: declineAllDialog.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusButton {
|
|
|
|
id: addToContactsButton
|
2021-05-26 16:04:42 -04:00
|
|
|
enabled: contactList.count > 0
|
2021-05-26 13:36:24 -04:00
|
|
|
anchors.right: parent.right
|
2021-07-16 22:22:50 +02:00
|
|
|
//% "Accept all"
|
|
|
|
text: qsTrId("accept-all")
|
2021-05-26 13:36:24 -04:00
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
onClicked: acceptAllDialog.open()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|