Give DelegateContextMenu an actual room
This allows me to hide the "Reply" action for read-only rooms. Don't ask me how it even worked before, I don't know.
This commit is contained in:
@@ -349,8 +349,9 @@ Kirigami.Page {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onShowDelegateMenu(parent: QtObject, eventId: string, author, messageComponentType, plainText: string, richText: string, mimeType: string, progressInfo, selectedText: string, hoveredLink: string) {
|
function onShowDelegateMenu(parent: QtObject, room: NeoChatRoom, eventId: string, author, messageComponentType, plainText: string, richText: string, mimeType: string, progressInfo, selectedText: string, hoveredLink: string) {
|
||||||
(delegateContextMenu.createObject(parent, {
|
(delegateContextMenu.createObject(parent, {
|
||||||
|
room: room,
|
||||||
author: author,
|
author: author,
|
||||||
eventId: eventId,
|
eventId: eventId,
|
||||||
plainText: plainText,
|
plainText: plainText,
|
||||||
|
|||||||
@@ -290,6 +290,7 @@ void RoomManager::viewEventMenu(QObject *parent, const RoomEvent *event, NeoChat
|
|||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT showDelegateMenu(parent,
|
Q_EMIT showDelegateMenu(parent,
|
||||||
|
room,
|
||||||
event->id(),
|
event->id(),
|
||||||
room->qmlSafeMember(event->senderId()),
|
room->qmlSafeMember(event->senderId()),
|
||||||
MessageComponentType::typeForEvent(*event),
|
MessageComponentType::typeForEvent(*event),
|
||||||
|
|||||||
@@ -308,6 +308,7 @@ Q_SIGNALS:
|
|||||||
* @brief Request to show a menu for the given event.
|
* @brief Request to show a menu for the given event.
|
||||||
*/
|
*/
|
||||||
void showDelegateMenu(QObject *parent,
|
void showDelegateMenu(QObject *parent,
|
||||||
|
NeoChatRoom *room,
|
||||||
const QString &eventId,
|
const QString &eventId,
|
||||||
const NeochatRoomMember *author,
|
const NeochatRoomMember *author,
|
||||||
MessageComponentType::Type messageComponentType,
|
MessageComponentType::Type messageComponentType,
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ KirigamiComponents.ConvergentContextMenu {
|
|||||||
|
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
id: replyAction
|
id: replyAction
|
||||||
visible: root.messageComponentType !== MessageComponentType.Other || NeoChatConfig.relateAnyEvent
|
visible: !root.room.readOnly && (root.messageComponentType !== MessageComponentType.Other || NeoChatConfig.relateAnyEvent)
|
||||||
text: i18nc("@action:inmenu", "Reply")
|
text: i18nc("@action:inmenu", "Reply")
|
||||||
icon.name: "mail-replied-symbolic"
|
icon.name: "mail-replied-symbolic"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
|
|||||||
Reference in New Issue
Block a user