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-15 15:55:18 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2021-10-20 22:47:23 +00:00
|
|
|
import StatusQ.Components 0.1
|
2021-10-26 09:40:22 +00:00
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
2022-03-15 15:55:18 +00:00
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.status 1.0
|
|
|
|
import shared.views 1.0
|
|
|
|
import shared.controls.chat 1.0
|
2022-06-10 11:12:03 +00:00
|
|
|
import shared.controls.chat.menuItems 1.0
|
2021-10-20 22:47:23 +00:00
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
import AppLayouts.Profile.stores 1.0
|
|
|
|
|
2021-10-26 09:40:22 +00:00
|
|
|
StatusListItem {
|
2022-08-16 11:12:57 +00:00
|
|
|
id: root
|
|
|
|
|
2022-03-15 15:55:18 +00:00
|
|
|
width: parent.width
|
2021-12-31 12:29:51 +00:00
|
|
|
height: visible ? implicitHeight : 0
|
2022-08-16 11:12:57 +00:00
|
|
|
title: root.name
|
2021-12-31 12:29:51 +00:00
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
property ContactsStore contactsStore
|
2022-07-06 19:27:04 +00:00
|
|
|
|
2022-10-26 20:00:40 +00:00
|
|
|
property string name
|
|
|
|
property string publicKey
|
|
|
|
property string compressedPk // Needed for the tests + probably gonna be used more in the future
|
|
|
|
property string iconSource
|
2022-12-05 09:56:44 +00:00
|
|
|
property bool ensVerified
|
2022-07-01 08:42:32 +00:00
|
|
|
|
2022-12-05 09:56:44 +00:00
|
|
|
property bool isContact: false
|
2021-12-31 12:29:51 +00:00
|
|
|
property bool isBlocked: false
|
2022-06-03 13:24:49 +00:00
|
|
|
property bool isVerified: false
|
|
|
|
property bool isUntrustworthy: false
|
2022-06-28 18:11:18 +00:00
|
|
|
property int verificationRequestStatus: 0
|
2022-03-24 20:55:22 +00:00
|
|
|
|
2022-03-15 15:55:18 +00:00
|
|
|
property bool showSendMessageButton: false
|
2022-03-24 20:55:22 +00:00
|
|
|
property bool showRejectContactRequestButton: false
|
|
|
|
property bool showAcceptContactRequestButton: false
|
|
|
|
property bool showRemoveRejectionButton: false
|
|
|
|
property string contactText: ""
|
|
|
|
property bool contactTextClickable: false
|
2022-03-15 15:55:18 +00:00
|
|
|
|
2022-07-06 19:27:04 +00:00
|
|
|
signal openContactContextMenu(string publicKey, string name, string icon)
|
2021-12-31 12:29:51 +00:00
|
|
|
signal sendMessageActionTriggered(string publicKey)
|
2022-06-28 18:11:18 +00:00
|
|
|
signal showVerificationRequest(string publicKey)
|
2022-03-25 11:33:30 +00:00
|
|
|
signal contactRequestAccepted(string publicKey)
|
|
|
|
signal contactRequestRejected(string publicKey)
|
|
|
|
signal rejectionRemoved(string publicKey)
|
2022-03-24 20:55:22 +00:00
|
|
|
signal textClicked(string publicKey)
|
2021-10-26 09:40:22 +00:00
|
|
|
|
2022-12-05 09:56:44 +00:00
|
|
|
subTitle: root.ensVerified ? "" : Utils.getElidedCompressedPk(root.publicKey)
|
2022-07-01 08:42:32 +00:00
|
|
|
|
2022-08-11 11:55:08 +00:00
|
|
|
asset.width: 40
|
|
|
|
asset.height: 40
|
|
|
|
asset.color: Utils.colorForPubkey(root.publicKey)
|
2022-09-22 22:18:15 +00:00
|
|
|
asset.letterSize: asset._twoLettersSize
|
2022-08-11 11:55:08 +00:00
|
|
|
asset.charactersLen: 2
|
|
|
|
asset.name: root.iconSource
|
|
|
|
asset.isLetterIdenticon: root.iconSource.toString() === ""
|
2022-07-01 08:42:32 +00:00
|
|
|
ringSettings {
|
2022-12-05 09:56:44 +00:00
|
|
|
ringSpecModel: Utils.getColorHashAsJson(root.publicKey, root.ensVerified)
|
2022-09-21 23:48:30 +00:00
|
|
|
ringPxSize: Math.max(asset.width / 24.0)
|
2022-07-01 08:42:32 +00:00
|
|
|
}
|
|
|
|
|
2021-10-26 09:40:22 +00:00
|
|
|
components: [
|
2022-06-28 18:11:18 +00:00
|
|
|
StatusFlatButton {
|
2024-10-18 13:57:07 +00:00
|
|
|
objectName: "idVerifyBtn"
|
2022-06-28 18:11:18 +00:00
|
|
|
visible: verificationRequestStatus === Constants.verificationStatus.verifying ||
|
|
|
|
verificationRequestStatus === Constants.verificationStatus.verified
|
|
|
|
width: visible ? implicitWidth : 0
|
|
|
|
height: visible ? implicitHeight : 0
|
|
|
|
text: verificationRequestStatus === Constants.verificationStatus.verifying ?
|
2024-02-26 18:54:05 +00:00
|
|
|
qsTr("Reply to ID verification request") :
|
|
|
|
qsTr("Review ID verification reply")
|
2022-06-28 18:11:18 +00:00
|
|
|
size: StatusBaseButton.Size.Small
|
2022-08-16 11:12:57 +00:00
|
|
|
onClicked: root.showVerificationRequest(root.publicKey)
|
2022-06-28 18:11:18 +00:00
|
|
|
},
|
2022-03-15 15:55:18 +00:00
|
|
|
StatusFlatRoundButton {
|
2024-10-18 13:57:07 +00:00
|
|
|
objectName: "chatBtn"
|
2022-03-15 15:55:18 +00:00
|
|
|
visible: showSendMessageButton
|
|
|
|
width: visible ? 32 : 0
|
|
|
|
height: visible ? 32 : 0
|
|
|
|
icon.name: "chat"
|
2022-05-31 12:05:40 +00:00
|
|
|
icon.color: Theme.palette.directColor1
|
2022-08-16 11:12:57 +00:00
|
|
|
onClicked: root.sendMessageActionTriggered(root.publicKey)
|
2022-03-15 15:55:18 +00:00
|
|
|
},
|
2022-03-24 20:55:22 +00:00
|
|
|
StatusFlatRoundButton {
|
2024-10-18 13:57:07 +00:00
|
|
|
objectName: "declineBtn"
|
2022-03-24 20:55:22 +00:00
|
|
|
visible: showRejectContactRequestButton
|
|
|
|
width: visible ? 32 : 0
|
|
|
|
height: visible ? 32 : 0
|
|
|
|
icon.name: "close-circle"
|
|
|
|
icon.color: Style.current.danger
|
2022-08-16 11:12:57 +00:00
|
|
|
onClicked: root.contactRequestRejected(root.publicKey)
|
2022-03-24 20:55:22 +00:00
|
|
|
},
|
|
|
|
StatusFlatRoundButton {
|
2024-10-18 13:57:07 +00:00
|
|
|
objectName: "acceptBtn"
|
2022-03-24 20:55:22 +00:00
|
|
|
visible: showAcceptContactRequestButton
|
|
|
|
width: visible ? 32 : 0
|
|
|
|
height: visible ? 32 : 0
|
|
|
|
icon.name: "checkmark-circle"
|
|
|
|
icon.color: Style.current.success
|
2022-08-16 11:12:57 +00:00
|
|
|
onClicked: root.contactRequestAccepted(root.publicKey)
|
2022-03-24 20:55:22 +00:00
|
|
|
},
|
|
|
|
StatusFlatRoundButton {
|
2024-10-18 13:57:07 +00:00
|
|
|
objectName: "removeRejectBtn"
|
2022-03-24 20:55:22 +00:00
|
|
|
visible: showRemoveRejectionButton
|
|
|
|
width: visible ? 32 : 0
|
|
|
|
height: visible ? 32 : 0
|
|
|
|
icon.name: "cancel"
|
|
|
|
icon.color: Style.current.danger
|
2022-08-16 11:12:57 +00:00
|
|
|
onClicked: root.rejectionRemoved(root.publicKey)
|
2022-03-24 20:55:22 +00:00
|
|
|
},
|
|
|
|
StatusBaseText {
|
2022-08-16 11:12:57 +00:00
|
|
|
text: root.contactText
|
2022-03-24 20:55:22 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2022-08-16 11:12:57 +00:00
|
|
|
color: root.contactTextClickable? Theme.palette.directColor1 : Theme.palette.baseColor1
|
2022-03-24 20:55:22 +00:00
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
2022-08-16 11:12:57 +00:00
|
|
|
enabled: root.contactTextClickable
|
2022-03-24 20:55:22 +00:00
|
|
|
cursorShape: sensor.enabled && containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
|
|
hoverEnabled: true
|
|
|
|
onClicked: {
|
2022-08-16 11:12:57 +00:00
|
|
|
root.textClicked(root.publicKey)
|
2022-03-24 20:55:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2021-10-26 09:40:22 +00:00
|
|
|
StatusFlatRoundButton {
|
2024-10-18 13:57:07 +00:00
|
|
|
objectName: "moreBtn"
|
2021-10-26 09:40:22 +00:00
|
|
|
id: menuButton
|
|
|
|
width: 32
|
|
|
|
height: 32
|
|
|
|
icon.name: "more"
|
2022-05-31 12:05:40 +00:00
|
|
|
icon.color: Theme.palette.directColor1
|
2020-07-24 11:27:26 +00:00
|
|
|
onClicked: {
|
2022-09-21 23:48:30 +00:00
|
|
|
root.openContactContextMenu(root.publicKey, root.name, root.iconSource)
|
2020-07-24 11:27:26 +00:00
|
|
|
}
|
|
|
|
}
|
2021-10-26 09:40:22 +00:00
|
|
|
]
|
2020-06-13 13:49:20 +00:00
|
|
|
}
|