Cleanup the list of required properties for MessageDelegateContextMenu
This commit is contained in:
@@ -63,7 +63,6 @@ QHash<int, QByteArray> MessageEventModel::roleNames() const
|
|||||||
roles[ShowReactionsRole] = "showReactions";
|
roles[ShowReactionsRole] = "showReactions";
|
||||||
roles[SourceRole] = "source";
|
roles[SourceRole] = "source";
|
||||||
roles[MimeTypeRole] = "mimeType";
|
roles[MimeTypeRole] = "mimeType";
|
||||||
roles[FormattedBodyRole] = "formattedBody";
|
|
||||||
roles[AuthorIdRole] = "authorId";
|
roles[AuthorIdRole] = "authorId";
|
||||||
roles[VerifiedRole] = "verified";
|
roles[VerifiedRole] = "verified";
|
||||||
roles[DisplayNameForInitialsRole] = "displayNameForInitials";
|
roles[DisplayNameForInitialsRole] = "displayNameForInitials";
|
||||||
@@ -480,16 +479,6 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
|||||||
return m_currentRoom->eventToGenericString(evt);
|
return m_currentRoom->eventToGenericString(evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (role == FormattedBodyRole) {
|
|
||||||
if (auto e = eventCast<const RoomMessageEvent>(&evt)) {
|
|
||||||
if (e->hasTextContent() && e->mimeType().name() != "text/plain") {
|
|
||||||
return static_cast<const Quotient::EventContent::TextContent *>(e->content())->body;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (role == PlainText) {
|
if (role == PlainText) {
|
||||||
return m_currentRoom->eventToString(evt);
|
return m_currentRoom->eventToString(evt);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ public:
|
|||||||
HighlightRole, /**< Whether the event should be highlighted. */
|
HighlightRole, /**< Whether the event should be highlighted. */
|
||||||
SpecialMarksRole, /**< Whether the event is hidden or not. */
|
SpecialMarksRole, /**< Whether the event is hidden or not. */
|
||||||
ProgressInfoRole, /**< Progress info when downloading files. */
|
ProgressInfoRole, /**< Progress info when downloading files. */
|
||||||
FormattedBodyRole, /**< The formatted body of a rich message. */
|
|
||||||
GenericDisplayRole, /**< A generic string based upon the message type. */
|
GenericDisplayRole, /**< A generic string based upon the message type. */
|
||||||
|
|
||||||
ShowLinkPreviewRole, /**< Whether a link preview should be shown. */
|
ShowLinkPreviewRole, /**< Whether a link preview should be shown. */
|
||||||
|
|||||||
@@ -78,13 +78,12 @@ Components.AlbumMaximizeComponent {
|
|||||||
onItemRightClicked: {
|
onItemRightClicked: {
|
||||||
const contextMenu = fileDelegateContextMenu.createObject(parent, {
|
const contextMenu = fileDelegateContextMenu.createObject(parent, {
|
||||||
author: root.author,
|
author: root.author,
|
||||||
message: root.plainText,
|
|
||||||
eventId: root.eventId,
|
eventId: root.eventId,
|
||||||
source: root.source,
|
source: root.source,
|
||||||
file: parent,
|
file: parent,
|
||||||
mimeType: root.mimeType,
|
mimeType: root.mimeType,
|
||||||
progressInfo: root.progressInfo,
|
progressInfo: root.progressInfo,
|
||||||
plainMessage: root.plainText,
|
plainText: root.plainText,
|
||||||
});
|
});
|
||||||
contextMenu.closeFullscreen.connect(root.close)
|
contextMenu.closeFullscreen.connect(root.close)
|
||||||
contextMenu.open();
|
contextMenu.open();
|
||||||
|
|||||||
@@ -79,11 +79,6 @@ ColumnLayout {
|
|||||||
*/
|
*/
|
||||||
required property string plainText
|
required property string plainText
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The formatted body of the message.
|
|
||||||
*/
|
|
||||||
required property string formattedBody
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The date of the event as a string.
|
* @brief The date of the event as a string.
|
||||||
*/
|
*/
|
||||||
@@ -600,13 +595,12 @@ ColumnLayout {
|
|||||||
function openFileContext(file) {
|
function openFileContext(file) {
|
||||||
const contextMenu = fileDelegateContextMenu.createObject(root, {
|
const contextMenu = fileDelegateContextMenu.createObject(root, {
|
||||||
author: root.author,
|
author: root.author,
|
||||||
message: root.plainText,
|
|
||||||
eventId: root.eventId,
|
eventId: root.eventId,
|
||||||
source: root.source,
|
source: root.source,
|
||||||
file: file,
|
file: file,
|
||||||
mimeType: root.mimeType,
|
mimeType: root.mimeType,
|
||||||
progressInfo: root.progressInfo,
|
progressInfo: root.progressInfo,
|
||||||
plainMessage: root.plainText,
|
plainText: root.plainText,
|
||||||
});
|
});
|
||||||
contextMenu.open();
|
contextMenu.open();
|
||||||
}
|
}
|
||||||
@@ -616,12 +610,10 @@ ColumnLayout {
|
|||||||
const contextMenu = messageDelegateContextMenu.createObject(root, {
|
const contextMenu = messageDelegateContextMenu.createObject(root, {
|
||||||
selectedText: selectedText,
|
selectedText: selectedText,
|
||||||
author: root.author,
|
author: root.author,
|
||||||
message: root.plainText,
|
|
||||||
eventId: root.eventId,
|
eventId: root.eventId,
|
||||||
formattedBody: root.formattedBody,
|
|
||||||
source: root.source,
|
source: root.source,
|
||||||
eventType: root.delegateType,
|
eventType: root.delegateType,
|
||||||
plainMessage: root.plainText,
|
plainText: root.plainText,
|
||||||
});
|
});
|
||||||
contextMenu.open();
|
contextMenu.open();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,13 +13,11 @@ Loader {
|
|||||||
id: loadRoot
|
id: loadRoot
|
||||||
|
|
||||||
required property var author
|
required property var author
|
||||||
required property string message
|
|
||||||
required property string eventId
|
required property string eventId
|
||||||
property var eventType
|
property var eventType
|
||||||
property string formattedBody: ""
|
|
||||||
required property string source
|
required property string source
|
||||||
property string selectedText: ""
|
property string selectedText: ""
|
||||||
required property string plainMessage
|
required property string plainText
|
||||||
|
|
||||||
property list<Kirigami.Action> nestedActions
|
property list<Kirigami.Action> nestedActions
|
||||||
|
|
||||||
@@ -54,7 +52,7 @@ Loader {
|
|||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("Copy")
|
text: i18n("Copy")
|
||||||
icon.name: "edit-copy"
|
icon.name: "edit-copy"
|
||||||
onTriggered: Clipboard.saveText(loadRoot.selectedText === "" ? loadRoot.plainMessage : loadRoot.selectedText)
|
onTriggered: Clipboard.saveText(loadRoot.selectedText === "" ? loadRoot.plainText : loadRoot.selectedText)
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18nc("@action:button 'Report' as in 'Report this event to the administrators'", "Report")
|
text: i18nc("@action:button 'Report' as in 'Report this event to the administrators'", "Report")
|
||||||
@@ -136,7 +134,7 @@ Loader {
|
|||||||
Instantiator {
|
Instantiator {
|
||||||
model: WebShortcutModel {
|
model: WebShortcutModel {
|
||||||
id: webshortcutmodel
|
id: webshortcutmodel
|
||||||
selectedText: loadRoot.selectedText ? loadRoot.selectedText : loadRoot.plainMessage
|
selectedText: loadRoot.selectedText ? loadRoot.selectedText : loadRoot.plainText
|
||||||
onOpenUrl: RoomManager.visitNonMatrix(url)
|
onOpenUrl: RoomManager.visitNonMatrix(url)
|
||||||
}
|
}
|
||||||
delegate: QQC2.MenuItem {
|
delegate: QQC2.MenuItem {
|
||||||
@@ -240,7 +238,7 @@ Loader {
|
|||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
}
|
}
|
||||||
QQC2.Label {
|
QQC2.Label {
|
||||||
text: message
|
text: plainText
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user