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
|
|
|
|
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
|
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
|
2020-06-13 13:49:20 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.left: parent.left
|
2021-01-21 16:46:00 +00:00
|
|
|
anchors.leftMargin: -Style.current.padding
|
|
|
|
anchors.rightMargin: -Style.current.padding
|
2021-12-31 12:29:51 +00:00
|
|
|
visible: container.isContact && (searchStr == "" || container.name.includes(searchStr))
|
|
|
|
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="
|
|
|
|
property bool isIdenticon
|
|
|
|
|
|
|
|
property bool isContact: true
|
|
|
|
property bool isBlocked: false
|
|
|
|
property string searchStr: ""
|
2021-10-26 09:40:22 +00:00
|
|
|
|
2021-12-31 12:29:51 +00:00
|
|
|
signal openProfilePopup(string publicKey)
|
|
|
|
signal sendMessageActionTriggered(string publicKey)
|
|
|
|
signal unblockContactActionTriggered(string publicKey)
|
|
|
|
signal blockContactActionTriggered(string publicKey)
|
|
|
|
signal removeContactActionTriggered(string publicKey)
|
2021-10-26 09:40:22 +00:00
|
|
|
|
|
|
|
components: [
|
|
|
|
StatusFlatRoundButton {
|
|
|
|
id: menuButton
|
|
|
|
width: 32
|
|
|
|
height: 32
|
|
|
|
icon.name: "more"
|
|
|
|
type: StatusFlatRoundButton.Type.Secondary
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
text: qsTr("View Profile")
|
|
|
|
icon.name: "profile"
|
|
|
|
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"
|
|
|
|
onTriggered: {
|
2021-12-31 12:29:51 +00:00
|
|
|
container.sendMessageActionTriggered(container.publicKey)
|
2021-10-26 09:40:22 +00:00
|
|
|
menuButton.highlighted = false
|
|
|
|
}
|
2020-07-24 11:27:26 +00:00
|
|
|
enabled: !container.isBlocked
|
|
|
|
}
|
2021-10-26 09:40:22 +00:00
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
text: qsTr("Block User")
|
|
|
|
icon.name: "cancel"
|
2020-07-24 11:27:26 +00:00
|
|
|
enabled: !container.isBlocked
|
2021-10-26 09:40:22 +00:00
|
|
|
type: StatusMenuItem.Type.Danger
|
2020-07-24 11:27:26 +00:00
|
|
|
onTriggered: {
|
2021-12-31 12:29:51 +00:00
|
|
|
container.blockContactActionTriggered(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("Remove contact")
|
|
|
|
icon.name: "remove-contact"
|
2020-07-24 11:27:26 +00:00
|
|
|
enabled: container.isContact
|
2021-10-26 09:40:22 +00:00
|
|
|
type: StatusMenuItem.Type.Danger
|
2020-08-10 12:15:57 +00:00
|
|
|
onTriggered: {
|
2021-12-31 12:29:51 +00:00
|
|
|
container.removeContactActionTriggered(container.publicKey)
|
2021-10-26 09:40:22 +00:00
|
|
|
menuButton.highlighted = false
|
2020-08-10 12:15:57 +00:00
|
|
|
}
|
2020-07-24 11:27:26 +00:00
|
|
|
}
|
2021-10-26 09:40:22 +00:00
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
text: qsTr("Unblock user")
|
|
|
|
icon.name: "cancel"
|
2020-07-24 11:27:26 +00:00
|
|
|
enabled: container.isBlocked
|
2021-10-26 09:40:22 +00:00
|
|
|
type: StatusMenuItem.Type.Danger
|
2020-07-24 11:27:26 +00:00
|
|
|
onTriggered: {
|
2021-12-31 12:29:51 +00:00
|
|
|
container.unblockContactActionTriggered(container.publicKey)
|
2021-10-26 09:40:22 +00:00
|
|
|
menuButton.highlighted = false
|
|
|
|
contactContextMenu.close()
|
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
|
|
|
|