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
|
|
|
|
2021-10-26 09:40:22 +00:00
|
|
|
StatusListItem {
|
2020-07-24 11:27:26 +00:00
|
|
|
id: container
|
2022-03-15 15:55:18 +00:00
|
|
|
width: parent.width
|
2021-12-31 12:29:51 +00:00
|
|
|
height: visible ? implicitHeight : 0
|
|
|
|
title: container.name
|
|
|
|
|
2022-07-06 19:27:04 +00:00
|
|
|
property var contactsStore
|
|
|
|
|
2021-12-31 12:29:51 +00:00
|
|
|
property string name: "Jotaro Kujo"
|
|
|
|
property string publicKey: "0x04d8c07dd137bd1b73a6f51df148b4f77ddaa11209d36e43d8344c0a7d6db1cad6085f27cfb75dd3ae21d86ceffebe4cf8a35b9ce8d26baa19dc264efe6d8f221b"
|
2022-07-26 13:05:19 +00:00
|
|
|
property string iconSource: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="
|
2022-07-06 16:51:56 +00:00
|
|
|
property bool isContact: false
|
2022-07-01 08:42:32 +00:00
|
|
|
|
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-07-01 08:42:32 +00:00
|
|
|
subTitle: Utils.getElidedCompressedPk(container.publicKey)
|
|
|
|
|
|
|
|
image {
|
|
|
|
width: 40
|
|
|
|
height: 40
|
|
|
|
source: container.iconSource
|
|
|
|
}
|
|
|
|
|
|
|
|
icon {
|
|
|
|
width: 40
|
|
|
|
height: 40
|
|
|
|
color: Utils.colorForPubkey(container.publicKey)
|
|
|
|
letterSize: Math.max(4, root.image.width / 2.4)
|
|
|
|
charactersLen: 2
|
|
|
|
isLetterIdenticon: !container.image.source.toString()
|
|
|
|
}
|
|
|
|
|
|
|
|
ringSettings {
|
|
|
|
ringSpecModel: Utils.getColorHashAsJson(container.publicKey)
|
|
|
|
ringPxSize: Math.max(icon.width / 24.0)
|
|
|
|
}
|
|
|
|
|
2021-10-26 09:40:22 +00:00
|
|
|
components: [
|
2022-06-28 18:11:18 +00:00
|
|
|
StatusFlatButton {
|
|
|
|
visible: verificationRequestStatus === Constants.verificationStatus.verifying ||
|
|
|
|
verificationRequestStatus === Constants.verificationStatus.verified
|
|
|
|
width: visible ? implicitWidth : 0
|
|
|
|
height: visible ? implicitHeight : 0
|
|
|
|
text: verificationRequestStatus === Constants.verificationStatus.verifying ?
|
|
|
|
qsTr("Respond to ID Request") :
|
|
|
|
qsTr("See ID Request")
|
|
|
|
size: StatusBaseButton.Size.Small
|
|
|
|
onClicked: container.showVerificationRequest(container.publicKey)
|
|
|
|
},
|
2022-03-15 15:55:18 +00:00
|
|
|
StatusFlatRoundButton {
|
|
|
|
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-03-15 15:55:18 +00:00
|
|
|
onClicked: container.sendMessageActionTriggered(container.publicKey)
|
|
|
|
},
|
2022-03-24 20:55:22 +00:00
|
|
|
StatusFlatRoundButton {
|
|
|
|
visible: showRejectContactRequestButton
|
|
|
|
width: visible ? 32 : 0
|
|
|
|
height: visible ? 32 : 0
|
|
|
|
icon.name: "close-circle"
|
|
|
|
icon.color: Style.current.danger
|
2022-03-25 11:33:30 +00:00
|
|
|
onClicked: container.contactRequestRejected(container.publicKey)
|
2022-03-24 20:55:22 +00:00
|
|
|
},
|
|
|
|
StatusFlatRoundButton {
|
|
|
|
visible: showAcceptContactRequestButton
|
|
|
|
width: visible ? 32 : 0
|
|
|
|
height: visible ? 32 : 0
|
|
|
|
icon.name: "checkmark-circle"
|
|
|
|
icon.color: Style.current.success
|
2022-03-25 11:33:30 +00:00
|
|
|
onClicked: container.contactRequestAccepted(container.publicKey)
|
2022-03-24 20:55:22 +00:00
|
|
|
},
|
|
|
|
StatusFlatRoundButton {
|
|
|
|
visible: showRemoveRejectionButton
|
|
|
|
width: visible ? 32 : 0
|
|
|
|
height: visible ? 32 : 0
|
|
|
|
icon.name: "cancel"
|
|
|
|
icon.color: Style.current.danger
|
2022-03-25 11:33:30 +00:00
|
|
|
onClicked: container.rejectionRemoved(container.publicKey)
|
2022-03-24 20:55:22 +00:00
|
|
|
},
|
|
|
|
StatusBaseText {
|
|
|
|
text: container.contactText
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
color: container.contactTextClickable? Theme.palette.directColor1 : Theme.palette.baseColor1
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
enabled: container.contactTextClickable
|
|
|
|
cursorShape: sensor.enabled && containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
|
|
hoverEnabled: true
|
|
|
|
onClicked: {
|
|
|
|
container.textClicked(container.publicKey)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2021-10-26 09:40:22 +00:00
|
|
|
StatusFlatRoundButton {
|
|
|
|
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-07-06 19:27:04 +00:00
|
|
|
container.openContactContextMenu(container.publicKey, container.name, container.icon)
|
2020-07-24 11:27:26 +00:00
|
|
|
}
|
|
|
|
}
|
2021-10-26 09:40:22 +00:00
|
|
|
]
|
2020-06-13 13:49:20 +00:00
|
|
|
}
|
2021-10-06 09:16:39 +00:00
|
|
|
|