summary refs log tree commit diff
path: root/resources
diff options
context:
space:
mode:
authortargetakhil <targetakhil@gmail.com>2021-04-11 20:01:49 +0530
committertargetakhil <targetakhil@gmail.com>2021-04-15 22:37:41 +0530
commit603ff33ea68b7c9e06578adf96fb6d824aa465df (patch)
treeb54aaaba1c517e652ac54906f3e54fdcb42f58e5 /resources
parentMerge branch 'master' of ssh://github.com/Nheko-Reborn/nheko (diff)
downloadnheko-603ff33ea68b7c9e06578adf96fb6d824aa465df.tar.xz
added basic forwarding
Diffstat (limited to 'resources')
-rw-r--r--resources/qml/TimelineView.qml81
1 files changed, 81 insertions, 0 deletions
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml

index 481561d2..2b6a8f26 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml
@@ -79,6 +79,78 @@ Page { } + Component { + id: forwardCompleter + + Popup { + id: forwardMessagePopup + x: 400 + y: 400 + + property var mid + + onOpened: { + completerPopup.open(); + roomTextInput.forceActiveFocus(); + } + + background: Rectangle { + border.color: "#444" + } + + function setMessageEventId(mid_in) { + mid = mid_in; + } + + MatrixTextField { + id: roomTextInput + + width: 100 + + color: colors.text + onTextEdited: { + completerPopup.completer.searchString = text; + } + Keys.onPressed: { + if (event.key == Qt.Key_Up && completerPopup.opened) { + event.accepted = true; + completerPopup.up(); + } else if (event.key == Qt.Key_Down && completerPopup.opened) { + event.accepted = true; + completerPopup.down(); + } else if (event.matches(StandardKey.InsertParagraphSeparator)) { + completerPopup.finishCompletion(); + event.accepted = true; + } + } + } + + Completer { + id: completerPopup + + y: 50 + width: 100 + completerName: "room" + avatarHeight: 24 + avatarWidth: 24 + bottomToTop: false + closePolicy: Popup.NoAutoClose + } + + Connections { + onCompletionSelected: { + TimelineManager.timeline.forwardMessage(messageContextMenu.eventId, id); + forwardMessagePopup.close(); + } + onCountChanged: { + if (completerPopup.count > 0 && (completerPopup.currentIndex < 0 || completerPopup.currentIndex >= completerPopup.count)) + completerPopup.currentIndex = 0; + } + target: completerPopup + } + } + } + Shortcut { sequence: "Ctrl+K" onActivated: { @@ -134,6 +206,15 @@ Page { } Platform.MenuItem { + text: qsTr("Forward") + onTriggered: { + var forwardMess = forwardCompleter.createObject(timelineRoot); + forwardMess.open(); + forwardMess.setMessageEventId(messageContextMenu.eventId) + } + } + + Platform.MenuItem { text: qsTr("Mark as read") }