Spectral/qml/menu/MessageContextMenu.qml

62 lines
1.6 KiB
QML
Raw Normal View History

2018-08-07 15:41:18 +00:00
import QtQuick 2.9
import QtQuick.Controls 2.2
Menu {
2018-09-12 00:27:34 +00:00
property var row: null
property var model: null
2018-09-11 05:14:56 +00:00
2018-09-12 00:27:34 +00:00
readonly property bool isFile: model && (model.eventType === "video" || model.eventType === "audio" || model.eventType === "file" || model.eventType === "image")
id: messageContextMenu
2018-08-07 15:41:18 +00:00
MenuItem {
2018-09-11 05:14:56 +00:00
text: "View Source"
2018-09-04 13:13:14 +00:00
2018-09-11 05:14:56 +00:00
onTriggered: {
2018-09-12 00:27:34 +00:00
sourceDialog.sourceText = model.toolTip
2018-09-11 05:14:56 +00:00
sourceDialog.open()
}
2018-08-07 15:41:18 +00:00
}
2018-09-15 13:09:53 +00:00
MenuItem {
visible: model && model.userMarker.length > 0
height: visible ? undefined : 0
text: "View Receipts"
onTriggered: {
readMarkerDialog.listModel = model.userMarker
readMarkerDialog.open()
}
}
2018-08-07 15:41:18 +00:00
MenuItem {
visible: isFile
height: visible ? undefined : 0
text: "Open Externally"
2018-09-04 13:13:14 +00:00
2018-09-11 05:14:56 +00:00
onTriggered: row.openExternally()
2018-08-07 15:41:18 +00:00
}
MenuItem {
visible: isFile
height: visible ? undefined : 0
text: "Save As"
2018-09-04 13:13:14 +00:00
2018-09-11 05:14:56 +00:00
onTriggered: row.saveFileAs()
2018-08-07 15:41:18 +00:00
}
2018-09-17 03:58:02 +00:00
MenuItem {
visible: model && model.author !== currentRoom.localUser
height: visible ? undefined : 0
text: "Reply"
onTriggered: {
inputField.clear()
inputField.insert(0, "> <" + model.author.id + "><" + model.eventId + "> " + model.message + "\n\n")
}
}
2018-08-07 15:41:18 +00:00
MenuItem {
2018-09-12 00:27:34 +00:00
visible: model && model.author === currentRoom.localUser
2018-08-07 15:41:18 +00:00
height: visible ? undefined : 0
text: "Redact"
2018-09-04 13:13:14 +00:00
2018-09-12 00:27:34 +00:00
onTriggered: currentRoom.redactEvent(model.eventId)
2018-08-07 15:41:18 +00:00
}
}