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
|
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
|
2022-03-24 20:55:22 +00:00
|
|
|
visible: container.isMutualContact && (container.searchStr == "" || container.name.includes(container.searchStr))
|
2021-12-31 12:29:51 +00:00
|
|
|
height: visible ? implicitHeight : 0
|
|
|
|
title: container.name
|
|
|
|
image.source: container.icon
|
|
|
|
|
|
|
|
property string name: "Jotaro Kujo"
|
|
|
|
property string publicKey: "0x04d8c07dd137bd1b73a6f51df148b4f77ddaa11209d36e43d8344c0a7d6db1cad6085f27cfb75dd3ae21d86ceffebe4cf8a35b9ce8d26baa19dc264efe6d8f221b"
|
|
|
|
property string icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="
|
2022-03-24 20:55:22 +00:00
|
|
|
property bool isMutualContact: false
|
2021-12-31 12:29:51 +00:00
|
|
|
property bool isBlocked: false
|
2022-03-24 20:55:22 +00:00
|
|
|
property int verificationState: Constants.contactVerificationState.notMarked
|
|
|
|
|
2021-12-31 12:29:51 +00:00
|
|
|
property string searchStr: ""
|
2021-10-26 09:40: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
|
|
|
|
2021-12-31 12:29:51 +00:00
|
|
|
signal openProfilePopup(string publicKey)
|
2022-03-15 15:55:18 +00:00
|
|
|
signal openChangeNicknamePopup(string publicKey)
|
2021-12-31 12:29:51 +00:00
|
|
|
signal sendMessageActionTriggered(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
|
|
|
|
|
|
|
components: [
|
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: {
|
2021-10-26 09:40:22 +00:00
|
|
|
highlighted = true
|
|
|
|
contactContextMenu.popup(-contactContextMenu.width+menuButton.width, menuButton.height + 4)
|
2020-07-24 11:27:26 +00:00
|
|
|
}
|
|
|
|
|
2021-10-26 09:40:22 +00:00
|
|
|
StatusPopupMenu {
|
2020-07-24 11:27:26 +00:00
|
|
|
id: contactContextMenu
|
2021-10-26 09:40:22 +00:00
|
|
|
|
|
|
|
onClosed: {
|
|
|
|
menuButton.highlighted = false
|
|
|
|
}
|
|
|
|
|
2022-03-15 15:55:18 +00:00
|
|
|
ProfileHeader {
|
|
|
|
width: parent.width
|
|
|
|
|
|
|
|
displayName: container.name
|
|
|
|
pubkey: container.publicKey
|
|
|
|
icon: container.icon
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
height: 8
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {}
|
|
|
|
|
2021-10-26 09:40:22 +00:00
|
|
|
StatusMenuItem {
|
|
|
|
text: qsTr("View Profile")
|
|
|
|
icon.name: "profile"
|
2022-03-15 15:55:18 +00:00
|
|
|
icon.width: 16
|
|
|
|
icon.height: 16
|
2021-10-26 09:40:22 +00:00
|
|
|
onTriggered: {
|
2021-12-31 12:29:51 +00:00
|
|
|
container.openProfilePopup(container.publicKey)
|
2021-10-26 09:40:22 +00:00
|
|
|
menuButton.highlighted = false
|
|
|
|
}
|
2020-07-24 11:27:26 +00:00
|
|
|
}
|
2021-10-26 09:40:22 +00:00
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
text: qsTr("Send message")
|
|
|
|
icon.name: "chat"
|
2022-03-15 15:55:18 +00:00
|
|
|
icon.width: 16
|
|
|
|
icon.height: 16
|
2021-10-26 09:40:22 +00:00
|
|
|
onTriggered: {
|
2021-12-31 12:29:51 +00:00
|
|
|
container.sendMessageActionTriggered(container.publicKey)
|
2021-10-26 09:40:22 +00:00
|
|
|
menuButton.highlighted = false
|
|
|
|
}
|
2022-03-24 20:55:22 +00:00
|
|
|
enabled: container.isMutualContact
|
2020-07-24 11:27:26 +00:00
|
|
|
}
|
2021-10-26 09:40:22 +00:00
|
|
|
|
|
|
|
StatusMenuItem {
|
2022-03-15 15:55:18 +00:00
|
|
|
text: qsTr("Rename")
|
|
|
|
icon.name: "edit_pencil"
|
|
|
|
icon.width: 16
|
|
|
|
icon.height: 16
|
2020-07-24 11:27:26 +00:00
|
|
|
onTriggered: {
|
2022-03-15 15:55:18 +00:00
|
|
|
container.openChangeNicknamePopup(container.publicKey)
|
2021-10-26 09:40:22 +00:00
|
|
|
menuButton.highlighted = false
|
2020-07-24 11:27:26 +00:00
|
|
|
}
|
2022-03-15 15:55:18 +00:00
|
|
|
enabled: !container.isBlocked
|
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
|
|
|
|