2021-05-26 17:36:24 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2021-05-28 17:35:21 +00:00
|
|
|
import "../../../../imports"
|
|
|
|
import "../../../../shared"
|
|
|
|
import "../../../../shared/status"
|
2021-05-26 17:36:24 +00:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
property string name
|
|
|
|
property string address
|
|
|
|
property string identicon
|
|
|
|
property string localNickname
|
|
|
|
property var profileClick: function() {}
|
|
|
|
signal blockContactActionTriggered(name: string, address: string)
|
|
|
|
property bool isHovered: false
|
|
|
|
id: container
|
|
|
|
|
|
|
|
height: visible ? 64 : 0
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.left: parent.left
|
|
|
|
border.width: 0
|
|
|
|
radius: Style.current.radius
|
|
|
|
color: isHovered ? Style.current.backgroundHover : Style.current.transparent
|
|
|
|
|
|
|
|
StatusImageIdenticon {
|
|
|
|
id: accountImage
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
source: identicon
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: usernameText
|
|
|
|
text: name
|
|
|
|
elide: Text.ElideRight
|
|
|
|
font.pixelSize: 17
|
|
|
|
anchors.top: accountImage.top
|
|
|
|
anchors.topMargin: Style.current.smallPadding
|
|
|
|
anchors.left: accountImage.right
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
anchors.right: declineBtn.left
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
acceptedButtons: Qt.RightButton
|
|
|
|
onClicked: {
|
|
|
|
if (mouse.button === Qt.RightButton) {
|
|
|
|
contactContextMenu.popup()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HoverHandler {
|
|
|
|
onHoveredChanged: container.isHovered = hovered
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusIconButton {
|
|
|
|
id: declineBtn
|
|
|
|
icon.name: "close"
|
|
|
|
onClicked: profileModel.contacts.rejectContactRequest(container.address)
|
|
|
|
width: 32
|
|
|
|
height: 32
|
|
|
|
padding: 6
|
|
|
|
iconColor: Style.current.danger
|
|
|
|
hoveredIconColor: Style.current.danger
|
|
|
|
highlightedBackgroundColor: Utils.setColorAlpha(Style.current.danger, 0.1)
|
|
|
|
anchors.right: acceptBtn.left
|
|
|
|
anchors.rightMargin: Style.current.halfPadding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusIconButton {
|
|
|
|
id: acceptBtn
|
|
|
|
icon.name: "check-circle"
|
2021-05-26 20:04:42 +00:00
|
|
|
onClicked: {
|
2021-06-17 22:09:00 +00:00
|
|
|
chatsModel.channelView.joinPrivateChat(container.address, "")
|
2021-05-26 20:04:42 +00:00
|
|
|
profileModel.contacts.addContact(container.address)
|
|
|
|
}
|
2021-05-26 17:36:24 +00:00
|
|
|
width: 32
|
|
|
|
height: 32
|
|
|
|
padding: 6
|
|
|
|
iconColor: Style.current.success
|
|
|
|
hoveredIconColor: Style.current.success
|
|
|
|
highlightedBackgroundColor: Utils.setColorAlpha(Style.current.success, 0.1)
|
|
|
|
anchors.right: menuButton.left
|
|
|
|
anchors.rightMargin: Style.current.halfPadding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusContextMenuButton {
|
|
|
|
property int iconSize: 14
|
|
|
|
id: menuButton
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
MouseArea {
|
|
|
|
id: mouseArea
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
contactContextMenu.popup()
|
|
|
|
}
|
|
|
|
|
|
|
|
PopupMenu {
|
|
|
|
id: contactContextMenu
|
|
|
|
hasArrow: false
|
|
|
|
Action {
|
2021-05-28 17:35:21 +00:00
|
|
|
icon.source: "../../../img/profileActive.svg"
|
2021-05-26 17:36:24 +00:00
|
|
|
icon.width: menuButton.iconSize
|
|
|
|
icon.height: menuButton.iconSize
|
|
|
|
//% "View Profile"
|
|
|
|
text: qsTrId("view-profile")
|
|
|
|
onTriggered: profileClick(true, name, address, identicon, "", localNickname)
|
|
|
|
enabled: true
|
|
|
|
}
|
|
|
|
Separator {}
|
|
|
|
Action {
|
2021-05-28 17:35:21 +00:00
|
|
|
icon.source: "../../../img/block-icon.svg"
|
2021-05-26 17:36:24 +00:00
|
|
|
icon.width: menuButton.iconSize
|
|
|
|
icon.height: menuButton.iconSize
|
|
|
|
icon.color: Style.current.danger
|
|
|
|
text: qsTr("Decline and block")
|
|
|
|
onTriggered: container.blockContactActionTriggered(name, address)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|