EventSource Refactor

Move showing th event source to a call to RoomManager. This means the SourceRole is no longer required in the message and search models
This commit is contained in:
James Graham
2023-09-15 10:54:04 +00:00
parent ec4c156a8c
commit c04ddfde26
13 changed files with 38 additions and 36 deletions

View File

@@ -26,8 +26,6 @@ Components.AlbumMaximizeComponent {
readonly property var currentProgressInfo: model.data(model.index(content.currentIndex, 0), MessageEventModel.ProgressInfoRole)
readonly property var currentJsonSource: model.data(model.index(content.currentIndex, 0), MessageEventModel.SourceRole)
downloadAction: Components.DownloadAction {
id: downloadAction
onTriggered: {
@@ -85,7 +83,6 @@ Components.AlbumMaximizeComponent {
const contextMenu = fileDelegateContextMenu.createObject(parent, {
author: root.currentAuthor,
eventId: root.currentEventId,
source: root.currentJsonSource,
file: parent,
progressInfo: root.currentProgressInfo,
plainText: root.currentPlainText

View File

@@ -212,11 +212,6 @@ ColumnLayout {
*/
required property bool verified
/**
* @brief The full message source JSON.
*/
required property var jsonSource
/**
* @brief The x position of the message bubble.
*
@@ -609,7 +604,6 @@ ColumnLayout {
const contextMenu = fileDelegateContextMenu.createObject(root, {
author: root.author,
eventId: root.eventId,
eventSource: root.jsonSource,
file: file,
progressInfo: root.progressInfo,
plainText: root.plainText,
@@ -625,7 +619,6 @@ ColumnLayout {
selectedText: selectedText,
author: root.author,
eventId: root.eventId,
eventSource: root.jsonSource,
eventType: root.delegateType,
plainText: root.plainText,
htmlText: root.display,

View File

@@ -90,15 +90,7 @@ MessageDelegateContextMenu {
Kirigami.Action {
text: i18n("View Source")
icon.name: "code-context"
onTriggered: {
applicationWindow().pageStack.pushDialogLayer('qrc:/MessageSourceSheet.qml', {
sourceText: root.eventSource
}, {
title: i18n("Message Source"),
width: Kirigami.Units.gridUnit * 25
});
root.closeFullscreen()
}
onTriggered: RoomManager.viewEventSource(root.eventId)
}
]

View File

@@ -16,7 +16,6 @@ Loader {
required property var author
required property string eventId
property var eventType
required property string eventSource
property string selectedText: ""
required property string plainText
property string htmlText: undefined
@@ -87,14 +86,7 @@ Loader {
visible: Config.developerTools
text: i18n("View Source")
icon.name: "code-context"
onTriggered: {
applicationWindow().pageStack.pushDialogLayer('qrc:/MessageSourceSheet.qml', {
sourceText: root.eventSource
}, {
title: i18n("Message Source"),
width: Kirigami.Units.gridUnit * 25
});
}
onTriggered: RoomManager.viewEventSource(root.eventId)
},
Kirigami.Action {
text: i18n("Copy Link")

View File

@@ -199,6 +199,15 @@ Kirigami.Page {
function onShowUserDetail(user) {
root.showUserDetail(user)
}
function onShowEventSource(eventId) {
applicationWindow().pageStack.pushDialogLayer('qrc:/MessageSourceSheet.qml', {
sourceText: root.currentRoom.getEventJsonSource(eventId)
}, {
title: i18n("Message Source"),
width: Kirigami.Units.gridUnit * 25
});
}
}
function showUserDetail(user) {