Don't refer to everything as an image in the file context menu

Instead, let's change the text based on the message component type.
This commit is contained in:
Joshua Goins
2025-05-20 16:33:43 -04:00
parent d895f8d771
commit 9cba57368e
2 changed files with 39 additions and 3 deletions

View File

@@ -266,6 +266,7 @@ Kirigami.Page {
plainText: plainText, plainText: plainText,
mimeType: mimeType, mimeType: mimeType,
progressInfo: progressInfo, progressInfo: progressInfo,
messageComponentType: messageComponentType,
}); });
contextMenu.popup(); contextMenu.popup();
} }

View File

@@ -33,6 +33,11 @@ DelegateContextMenu {
*/ */
required property var progressInfo required property var progressInfo
/**
* @brief The delegate type of the message.
*/
required property int messageComponentType
DelegateContextMenu.ReplyMessageAction {} DelegateContextMenu.ReplyMessageAction {}
Kirigami.Action { Kirigami.Action {
@@ -40,7 +45,17 @@ DelegateContextMenu {
} }
QQC2.Action { QQC2.Action {
text: i18nc("@action:inmenu", "Open Image") text: {
if (root.messageComponentType === MessageComponentType.Image) {
return i18nc("@action:inmenu", "Open Image");
} else if (root.messageComponentType === MessageComponentType.Audio) {
return i18nc("@action:inmenu", "Open Audio");
} else if (root.messageComponentType === MessageComponentType.Video) {
return i18nc("@action:inmenu", "Open Video");
} else {
return i18nc("@action:inmenu", "Open File");
}
}
icon.name: "document-open" icon.name: "document-open"
onTriggered: { onTriggered: {
currentRoom.openEventMediaExternally(root.eventId); currentRoom.openEventMediaExternally(root.eventId);
@@ -48,7 +63,17 @@ DelegateContextMenu {
} }
QQC2.Action { QQC2.Action {
text: i18nc("@action:inmenu", "Save Image…") text: {
if (root.messageComponentType === MessageComponentType.Image) {
return i18nc("@action:inmenu", "Save Image…");
} else if (root.messageComponentType === MessageComponentType.Audio) {
return i18nc("@action:inmenu", "Save Audio…");
} else if (root.messageComponentType === MessageComponentType.Video) {
return i18nc("@action:inmenu", "Save Video…");
} else {
return i18nc("@action:inmenu", "Save File…");
}
}
icon.name: "document-save" icon.name: "document-save"
onTriggered: { onTriggered: {
var dialog = saveAsDialog.createObject(QQC2.Overlay.overlay); var dialog = saveAsDialog.createObject(QQC2.Overlay.overlay);
@@ -58,7 +83,17 @@ DelegateContextMenu {
} }
QQC2.Action { QQC2.Action {
text: i18nc("@action:inmenu", "Copy Image") text: {
if (root.messageComponentType === MessageComponentType.Image) {
return i18nc("@action:inmenu", "Copy Image");
} else if (root.messageComponentType === MessageComponentType.Audio) {
return i18nc("@action:inmenu", "Copy Audio");
} else if (root.messageComponentType === MessageComponentType.Video) {
return i18nc("@action:inmenu", "Copy Video");
} else {
return i18nc("@action:inmenu", "Copy File");
}
}
icon.name: "edit-copy" icon.name: "edit-copy"
onTriggered: { onTriggered: {
currentRoom.copyEventMedia(root.eventId); currentRoom.copyEventMedia(root.eventId);