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 {
|
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
|
|
|
|
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-08-16 11:12:57 +00:00
|
|
|
subTitle: 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)
|
|
|
|
asset.letterSize: Math.max(4, root.asset.width / 2.4)
|
|
|
|
asset.charactersLen: 2
|
|
|
|
asset.name: root.iconSource
|
|
|
|
asset.isImage: asset.name.includes("data")
|
|
|
|
asset.isLetterIdenticon: root.iconSource.toString() === ""
|
2022-07-01 08:42:32 +00:00
|
|
|
ringSettings {
|
2022-08-16 11:12:57 +00:00
|
|
|
ringSpecModel: Utils.getColorHashAsJson(root.publicKey)
|
2022-07-01 08:42:32 +00:00
|
|
|
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
|
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 {
|
|
|
|
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 {
|
|
|
|
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 {
|
|
|
|
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 {
|
|
|
|
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 {
|
|
|
|
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-08-16 11:12:57 +00:00
|
|
|
root.openContactContextMenu(root.publicKey, root.name, root.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
|
|
|
|