forked from mirror/nheko
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
2.4 KiB
110 lines
2.4 KiB
import QtQuick 2.6
|
|
import QtQuick.Controls 2.3
|
|
import QtQuick.Layouts 1.2
|
|
import QtQuick.Window 2.2
|
|
|
|
import com.github.nheko 1.0
|
|
|
|
import "./delegates"
|
|
|
|
RowLayout {
|
|
property var view: chat
|
|
|
|
anchors.leftMargin: avatarSize + 4
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
|
|
implicitHeight: contentItem.childrenRect.height
|
|
|
|
MessageDelegate {
|
|
Layout.fillWidth: true
|
|
Layout.alignment: Qt.AlignTop
|
|
id: contentItem
|
|
}
|
|
|
|
StatusIndicator {
|
|
state: model.state
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
Layout.preferredHeight: 16
|
|
}
|
|
|
|
EncryptionIndicator {
|
|
visible: model.isEncrypted
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
Layout.preferredHeight: 16
|
|
}
|
|
|
|
ImageButton {
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
Layout.preferredHeight: 16
|
|
id: replyButton
|
|
|
|
image: "qrc:/icons/icons/ui/mail-reply.png"
|
|
ToolTip {
|
|
visible: replyButton.hovered
|
|
text: qsTr("Reply")
|
|
palette: colors
|
|
}
|
|
|
|
onClicked: view.model.replyAction(model.id)
|
|
}
|
|
ImageButton {
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
Layout.preferredHeight: 16
|
|
id: optionsButton
|
|
|
|
image: "qrc:/icons/icons/ui/vertical-ellipsis.png"
|
|
ToolTip {
|
|
visible: optionsButton.hovered
|
|
text: qsTr("Options")
|
|
palette: colors
|
|
}
|
|
|
|
onClicked: contextMenu.open()
|
|
|
|
Menu {
|
|
y: optionsButton.height
|
|
id: contextMenu
|
|
palette: colors
|
|
|
|
MenuItem {
|
|
text: qsTr("Read receipts")
|
|
onTriggered: view.model.readReceiptsAction(model.id)
|
|
}
|
|
MenuItem {
|
|
text: qsTr("Mark as read")
|
|
}
|
|
MenuItem {
|
|
text: qsTr("View raw message")
|
|
onTriggered: view.model.viewRawMessage(model.id)
|
|
}
|
|
MenuItem {
|
|
text: qsTr("Redact message")
|
|
onTriggered: view.model.redactEvent(model.id)
|
|
}
|
|
MenuItem {
|
|
visible: model.type == MtxEvent.ImageMessage || model.type == MtxEvent.VideoMessage || model.type == MtxEvent.AudioMessage || model.type == MtxEvent.FileMessage || model.type == MtxEvent.Sticker
|
|
text: qsTr("Save as")
|
|
onTriggered: timelineManager.saveMedia(model.url, model.filename, model.mimetype, model.type)
|
|
}
|
|
}
|
|
}
|
|
|
|
Text {
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
text: model.timestamp.toLocaleTimeString("HH:mm")
|
|
color: inactiveColors.text
|
|
|
|
MouseArea{
|
|
id: ma
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
}
|
|
|
|
ToolTip {
|
|
visible: ma.containsMouse
|
|
text: Qt.formatDateTime(model.timestamp, Qt.DefaultLocaleLongDate)
|
|
palette: colors
|
|
}
|
|
}
|
|
}
|
|
|