mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-29 06:08:48 +03:00
show forward menu item only for relevant events, changes to ui
This commit is contained in:
parent
ce8246238e
commit
6893e3a8d5
4 changed files with 32 additions and 7 deletions
|
@ -2,16 +2,19 @@
|
|||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import "./delegates/"
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.3
|
||||
import im.nheko 1.0
|
||||
|
||||
Popup {
|
||||
Dialog {
|
||||
id: forwardMessagePopup
|
||||
title: qsTr("Forward Message")
|
||||
x: 400
|
||||
y: 400
|
||||
|
||||
width: 200
|
||||
height: replyPreview.height + roomTextInput.height + completerPopup.height + implicitFooterHeight + implicitHeaderHeight
|
||||
|
||||
property var mid
|
||||
|
||||
|
@ -24,19 +27,27 @@ Popup {
|
|||
completerPopup.close();
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
border.color: "#444"
|
||||
}
|
||||
|
||||
function setMessageEventId(mid_in) {
|
||||
mid = mid_in;
|
||||
}
|
||||
|
||||
Reply {
|
||||
id: replyPreview
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
modelData: TimelineManager.timeline ? TimelineManager.timeline.getDump(mid, "") : {
|
||||
}
|
||||
userColor: TimelineManager.userColor(modelData.userId, colors.window)
|
||||
}
|
||||
|
||||
MatrixTextField {
|
||||
id: roomTextInput
|
||||
|
||||
width: forwardMessagePopup.width - forwardMessagePopup.leftPadding * 2
|
||||
|
||||
anchors.top: replyPreview.bottom
|
||||
|
||||
color: colors.text
|
||||
onTextEdited: {
|
||||
completerPopup.completer.searchString = text;
|
||||
|
@ -58,7 +69,8 @@ Popup {
|
|||
Completer {
|
||||
id: completerPopup
|
||||
|
||||
y: roomTextInput.height + roomTextInput.bottomPadding
|
||||
y: replyPreview.height + roomTextInput.height + roomTextInput.bottomPadding
|
||||
|
||||
width: forwardMessagePopup.width - forwardMessagePopup.leftPadding * 2
|
||||
completerName: "room"
|
||||
avatarHeight: 24
|
||||
|
|
|
@ -141,11 +141,12 @@ Page {
|
|||
}
|
||||
|
||||
Platform.MenuItem {
|
||||
visible: messageContextMenu.eventType == MtxEvent.ImageMessage || messageContextMenu.eventType == MtxEvent.VideoMessage || messageContextMenu.eventType == MtxEvent.AudioMessage || messageContextMenu.eventType == MtxEvent.FileMessage || messageContextMenu.eventType == MtxEvent.Sticker || messageContextMenu.eventType == MtxEvent.TextMessage|| messageContextMenu.eventType == MtxEvent.LocationMessage || messageContextMenu.eventType == MtxEvent.EmoteMessage || messageContextMenu.eventType == MtxEvent.NoticeMessage
|
||||
text: qsTr("Forward")
|
||||
onTriggered: {
|
||||
var forwardMess = forwardCompleterComponent.createObject(timelineRoot);
|
||||
forwardMess.setMessageEventId(messageContextMenu.eventId);
|
||||
forwardMess.open();
|
||||
forwardMess.setMessageEventId(messageContextMenu.eventId)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -832,6 +832,17 @@ TimelineModel::forwardMessage(QString eventId, QString roomId)
|
|||
emit forwardToRoom(e, roomId, cache::isRoomEncrypted(room_id_.toStdString()));
|
||||
}
|
||||
|
||||
QString
|
||||
TimelineModel::messageContent(QString eventId)
|
||||
{
|
||||
auto e = events.get(eventId.toStdString(), "");
|
||||
if (!e)
|
||||
return "";
|
||||
|
||||
auto content = mtx::accessors::body(*e);
|
||||
return QString::fromStdString(content);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineModel::viewDecryptedRawMessage(QString id) const
|
||||
{
|
||||
|
|
|
@ -220,6 +220,7 @@ public:
|
|||
|
||||
Q_INVOKABLE void viewRawMessage(QString id) const;
|
||||
Q_INVOKABLE void forwardMessage(QString eventId, QString roomId);
|
||||
Q_INVOKABLE QString messageContent(QString eventId);
|
||||
Q_INVOKABLE void viewDecryptedRawMessage(QString id) const;
|
||||
Q_INVOKABLE void openUserProfile(QString userid, bool global = false);
|
||||
Q_INVOKABLE void openRoomSettings();
|
||||
|
|
Loading…
Reference in a new issue