2021-01-25 20:50:42 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtGraphicalEffects 1.13
|
|
|
|
import "../../../../../shared"
|
|
|
|
import "../../../../../shared/status"
|
|
|
|
import "../../../../../imports"
|
|
|
|
|
|
|
|
Rectangle {
|
2021-07-16 15:02:47 +00:00
|
|
|
id: buttonsContainer
|
2021-01-25 20:50:42 +00:00
|
|
|
property bool parentIsHovered: false
|
2021-07-09 14:18:45 +00:00
|
|
|
property bool showEdit: true
|
2021-01-25 20:50:42 +00:00
|
|
|
signal hoverChanged(bool hovered)
|
|
|
|
property int containerMargin: 2
|
2021-03-24 17:30:15 +00:00
|
|
|
property int contentType: 2
|
2021-07-16 15:02:47 +00:00
|
|
|
property var messageContextMenu
|
2021-08-06 15:44:57 +00:00
|
|
|
property bool showMoreButton: true
|
2021-01-25 20:50:42 +00:00
|
|
|
|
2021-06-10 19:20:43 +00:00
|
|
|
visible: !activityCenterMessage &&
|
|
|
|
(buttonsContainer.parentIsHovered || isMessageActive)
|
|
|
|
&& contentType !== Constants.transactionType
|
2021-01-25 20:50:42 +00:00
|
|
|
width: buttonRow.width + buttonsContainer.containerMargin * 2
|
|
|
|
height: 36
|
|
|
|
radius: Style.current.radius
|
2021-02-18 19:07:23 +00:00
|
|
|
color: Style.current.modalBackground
|
2021-01-25 20:50:42 +00:00
|
|
|
z: 52
|
|
|
|
|
|
|
|
layer.enabled: true
|
|
|
|
layer.effect: DropShadow {
|
|
|
|
width: buttonsContainer.width
|
|
|
|
height: buttonsContainer.height
|
|
|
|
x: buttonsContainer.x
|
|
|
|
y: buttonsContainer.y + 10
|
|
|
|
visible: buttonsContainer.visible
|
|
|
|
source: buttonsContainer
|
|
|
|
horizontalOffset: 0
|
|
|
|
verticalOffset: 2
|
|
|
|
radius: 10
|
|
|
|
samples: 15
|
|
|
|
color: "#22000000"
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: buttonsContainer
|
|
|
|
acceptedButtons: Qt.NoButton
|
|
|
|
hoverEnabled: true
|
|
|
|
onEntered: {
|
|
|
|
buttonsContainer.hoverChanged(true)
|
|
|
|
}
|
|
|
|
onExited: {
|
|
|
|
buttonsContainer.hoverChanged(false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Row {
|
|
|
|
id: buttonRow
|
|
|
|
spacing: buttonsContainer.containerMargin
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: buttonsContainer.containerMargin
|
|
|
|
anchors.verticalCenter: buttonsContainer.verticalCenter
|
|
|
|
height: parent.height - 2 * buttonsContainer.containerMargin
|
|
|
|
|
|
|
|
StatusIconButton {
|
|
|
|
id: emojiBtn
|
|
|
|
icon.name: "emoji"
|
|
|
|
width: 32
|
|
|
|
height: 32
|
|
|
|
onClicked: {
|
2021-04-21 15:22:49 +00:00
|
|
|
setMessageActive(messageId, true)
|
2021-08-25 20:31:00 +00:00
|
|
|
// Set parent, X & Y positions for the messageContextMenu
|
|
|
|
buttonsContainer.messageContextMenu.parent = buttonsContainer
|
|
|
|
buttonsContainer.messageContextMenu.setXPosition = function() { return (-Math.abs(buttonsContainer.width - buttonsContainer.messageContextMenu.emojiContainer.width))}
|
|
|
|
buttonsContainer.messageContextMenu.setYPosition = function() { return (-buttonsContainer.messageContextMenu.height - 4)}
|
2021-01-25 20:50:42 +00:00
|
|
|
clickMessage(false, false, false, null, true)
|
|
|
|
}
|
|
|
|
onHoveredChanged: {
|
|
|
|
buttonsContainer.hoverChanged(this.hovered)
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusToolTip {
|
|
|
|
visible: emojiBtn.hovered
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Add reaction"
|
|
|
|
text: qsTrId("add-reaction")
|
2021-01-25 20:50:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusIconButton {
|
|
|
|
id: replyBtn
|
|
|
|
icon.name: "reply"
|
|
|
|
width: 32
|
|
|
|
height: 32
|
|
|
|
onClicked: {
|
|
|
|
SelectedMessage.set(messageId, fromAuthor);
|
|
|
|
showReplyArea()
|
2021-07-22 07:47:15 +00:00
|
|
|
if (messageContextMenu.closeParentPopup) {
|
|
|
|
messageContextMenu.closeParentPopup()
|
|
|
|
}
|
2021-01-25 20:50:42 +00:00
|
|
|
}
|
|
|
|
onHoveredChanged: {
|
|
|
|
buttonsContainer.hoverChanged(this.hovered)
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusToolTip {
|
|
|
|
visible: replyBtn.hovered
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Reply"
|
|
|
|
text: qsTrId("message-reply")
|
2021-01-25 20:50:42 +00:00
|
|
|
}
|
|
|
|
}
|
2021-05-25 19:34:46 +00:00
|
|
|
|
2021-06-29 14:49:32 +00:00
|
|
|
Loader {
|
|
|
|
id: editBtn
|
2021-07-09 14:18:45 +00:00
|
|
|
active: isText && !isEdit && isCurrentUser && showEdit
|
2021-06-29 14:49:32 +00:00
|
|
|
sourceComponent: StatusIconButton {
|
|
|
|
id: btn
|
|
|
|
icon.name: "edit-message"
|
|
|
|
width: 32
|
|
|
|
height: 32
|
|
|
|
onClicked: {
|
|
|
|
isEdit = true
|
|
|
|
}
|
|
|
|
onHoveredChanged: {
|
|
|
|
buttonsContainer.hoverChanged(btn.hovered)
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusToolTip {
|
|
|
|
visible: btn.hovered
|
2021-07-16 20:22:50 +00:00
|
|
|
//% "Edit"
|
|
|
|
text: qsTrId("edit")
|
2021-06-29 14:49:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-25 19:34:46 +00:00
|
|
|
StatusIconButton {
|
|
|
|
id: otherBtn
|
2021-08-06 15:44:57 +00:00
|
|
|
visible: showMoreButton
|
2021-05-25 19:34:46 +00:00
|
|
|
icon.name: "dots-icon"
|
|
|
|
width: 32
|
|
|
|
height: 32
|
|
|
|
onClicked: {
|
|
|
|
if (typeof isMessageActive !== "undefined") {
|
2021-05-25 19:38:18 +00:00
|
|
|
setMessageActive(messageId, true)
|
2021-05-25 19:34:46 +00:00
|
|
|
}
|
2021-08-25 20:31:00 +00:00
|
|
|
// Set parent, X & Y positions for the messageContextMenu
|
|
|
|
buttonsContainer.messageContextMenu.parent = buttonsContainer
|
|
|
|
buttonsContainer.messageContextMenu.setXPosition = function() { return (-Math.abs(buttonsContainer.width - 176))}
|
|
|
|
buttonsContainer.messageContextMenu.setYPosition = function() { return (-buttonsContainer.messageContextMenu.height - 4)}
|
2021-08-03 13:54:57 +00:00
|
|
|
clickMessage(false, isSticker, false, null, false, true);
|
2021-05-25 19:34:46 +00:00
|
|
|
}
|
|
|
|
onHoveredChanged: {
|
|
|
|
buttonsContainer.hoverChanged(this.hovered)
|
|
|
|
}
|
|
|
|
StatusToolTip {
|
|
|
|
visible: otherBtn.hovered
|
2021-07-16 20:22:50 +00:00
|
|
|
//% "More"
|
|
|
|
text: qsTrId("more")
|
2021-05-25 19:34:46 +00:00
|
|
|
}
|
|
|
|
}
|
2021-01-25 20:50:42 +00:00
|
|
|
}
|
|
|
|
}
|