diff --git a/src/qml/Component/Timeline/TimelineContainer.qml b/src/qml/Component/Timeline/TimelineContainer.qml index 816392981..8d63d592c 100644 --- a/src/qml/Component/Timeline/TimelineContainer.qml +++ b/src/qml/Component/Timeline/TimelineContainer.qml @@ -605,6 +605,7 @@ ColumnLayout { source: root.jsonSource, eventType: root.delegateType, plainText: root.plainText, + htmlText: root.display, }); contextMenu.open(); } diff --git a/src/qml/Menu/Timeline/MessageDelegateContextMenu.qml b/src/qml/Menu/Timeline/MessageDelegateContextMenu.qml index f9c072901..ee9cc9ef6 100644 --- a/src/qml/Menu/Timeline/MessageDelegateContextMenu.qml +++ b/src/qml/Menu/Timeline/MessageDelegateContextMenu.qml @@ -19,6 +19,7 @@ Loader { required property string source property string selectedText: "" required property string plainText + property string htmlText: undefined property list nestedActions @@ -40,6 +41,20 @@ Loader { currentRoom.chatBoxEditId = ""; } }, + Kirigami.Action { + text: i18nc("@action:inmenu As in 'Forward this message'", "Forward") + icon.name: "mail-forward-symbolic" + onTriggered: { + let page = applicationWindow().pageStack.pushDialogLayer("qrc:/ChooseRoomDialog.qml", {}, { + title: i18nc("@title", "Forward Message"), + width: Kirigami.Units.gridUnit * 25 + }) + page.chosen.connect(function(targetRoomId) { + Controller.activeConnection.room(targetRoomId).postHtmlMessage(loadRoot.plainText, loadRoot.htmlText ? loadRoot.htmlText : loadRoot.plainText) + page.closeDialog() + }) + } + }, Kirigami.Action { visible: author.id === currentRoom.localUser.id || currentRoom.canSendState("redact") text: i18n("Remove") diff --git a/src/qml/Page/ChooseRoomDialog.qml b/src/qml/Page/ChooseRoomDialog.qml new file mode 100644 index 000000000..f566de535 --- /dev/null +++ b/src/qml/Page/ChooseRoomDialog.qml @@ -0,0 +1,39 @@ +// SPDX-FileCopyrightText: 2023 Tobias Fella +// SPDX-License-Identifier: GPL-2.0-or-later + +import QtQuick 2.15 +import QtQuick.Controls 2.15 + +import org.kde.kirigami 2.20 as Kirigami + +import org.kde.neochat 1.0 + +import "./RoomList" + +Kirigami.ScrollablePage { + id: root + + title: i18nc("@title", "Choose a Room") + + signal chosen(string roomId) + + header: Kirigami.SearchField { + onTextChanged: sortModel.filterText = text + } + + ListView { + model: SortFilterRoomListModel { + id: sortModel + sourceModel: RoomListModel { + connection: Controller.activeConnection + } + } + delegate: RoomDelegate { + id: roomDelegate + filterText: "" + onClicked: { + root.chosen(roomDelegate.currentRoom.id) + } + } + } +} diff --git a/src/res.qrc b/src/res.qrc index 7c019b454..1d2d8a0b5 100644 --- a/src/res.qrc +++ b/src/res.qrc @@ -135,5 +135,6 @@ qml/RoomDrawer/DirectChatDrawerHeader.qml qml/RoomDrawer/GroupChatDrawerHeader.qml qml/RoomDrawer/RoomInformation.qml + qml/Page/ChooseRoomDialog.qml