Use ImageComponent for replies

This automatically gives us the image hiding safety feature

BUG: 503442
This commit is contained in:
Tobias Fella
2025-06-11 21:14:07 +02:00
committed by Tobias Fella
parent d14eda2ca0
commit 29abe0bacb
2 changed files with 8 additions and 16 deletions

View File

@@ -46,6 +46,11 @@ Item {
*/
required property var fileTransferInfo
/**
* The maximum height of the image. Can be left undefined most of the times. Passed to MediaSizeHelper::contentMaxHeight.
*/
property int contentMaxHeight: undefined
implicitWidth: mediaSizeHelper.currentSize.width
implicitHeight: mediaSizeHelper.currentSize.height
@@ -164,6 +169,7 @@ Item {
MediaSizeHelper {
id: mediaSizeHelper
contentMaxWidth: root.Message.maxContentWidth
contentMaxHeight: root.contentMaxHeight
mediaWidth: root?.mediaInfo.isSticker ? 256 : (root?.mediaInfo.width ?? 0)
mediaHeight: root?.mediaInfo.isSticker ? 256 : (root?.mediaInfo.height ?? 0)
}

View File

@@ -41,22 +41,8 @@ DelegateChooser {
DelegateChoice {
roleValue: MessageComponentType.Image
delegate: Image {
id: image
required property var mediaInfo
Layout.maximumWidth: mediaSizeHelper.currentSize.width
Layout.maximumHeight: mediaSizeHelper.currentSize.height
source: image.mediaInfo.source
MediaSizeHelper {
id: mediaSizeHelper
contentMaxWidth: Message.maxContentWidth
contentMaxHeight: Kirigami.Units.gridUnit * 5
mediaWidth: image.mediaInfo.width ?? 0
mediaHeight: image.mediaInfo.height ?? 0
}
delegate: ImageComponent {
contentMaxHeight: Kirigami.Units.gridUnit * 5
}
}