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