Page MenuHomePhorge

D98.1732489350.diff
No OneTemporary

Size
5 KB
Referenced Files
None
Subscribers
None

D98.1732489350.diff

diff --git a/src/contents/ui/event-types/Image.qml b/src/contents/ui/event-types/Image.qml
--- a/src/contents/ui/event-types/Image.qml
+++ b/src/contents/ui/event-types/Image.qml
@@ -38,6 +38,14 @@
property var mtxSdk: matrixSdk
property var isSticker: event.type === 'm.sticker'
+ summaryItem: Label {
+ objectName: 'summaryLabel'
+ Layout.alignment: Qt.AlignLeft
+ Layout.fillWidth: true
+ elide: Text.ElideRight
+ text: l10n.get(isSticker ? 'event-summary-sticker-sent' : 'event-summary-image-sent', { gender, body})
+ }
+
Kazv.FileHandler {
id: fileHandler
eventContent: event.content
@@ -52,10 +60,12 @@
eventContent: event.content
property var label: Kazv.SelectableText {
+ objectName: 'bodyLabel'
Layout.fillWidth: true
wrapMode: Text.Wrap
- text: isSticker ? '' : l10n.get('event-message-image-sent', { gender, body })
+ text: l10n.get(isSticker ? 'event-message-sticker-sent' : 'event-message-image-sent', { gender, body})
+ visible: !compactMode
}
property var image: Image {
diff --git a/src/contents/ui/event-types/Simple.qml b/src/contents/ui/event-types/Simple.qml
--- a/src/contents/ui/event-types/Simple.qml
+++ b/src/contents/ui/event-types/Simple.qml
@@ -18,6 +18,8 @@
default property var children
property var isSelected
+ /// The item shown after the username, in compact mode
+ property var summaryItem: Item {}
property var nameProvider: Kazv.UserNameProvider {
user: sender
@@ -98,7 +100,7 @@
id: userNicknameText
objectName: 'userNicknameText'
text: senderNickname
- Layout.fillWidth: true
+ Layout.fillWidth: !compactMode
property var reasonableWidth: Math.max(contentWidth, Kirigami.Units.gridUnit)
@@ -111,6 +113,12 @@
}
}
}
+
+ RowLayout {
+ objectName: 'compactModeSummary'
+ visible: compactMode
+ data: [summaryItem]
+ }
}
RowLayout {
diff --git a/src/l10n/cmn-Hans/100-ui.ftl b/src/l10n/cmn-Hans/100-ui.ftl
--- a/src/l10n/cmn-Hans/100-ui.ftl
+++ b/src/l10n/cmn-Hans/100-ui.ftl
@@ -139,6 +139,9 @@
state-room-encryption-activated = 对本房间启用了加密。
event-message-image-sent = 发送了图片「{ $body }」。
+event-message-sticker-sent = 发送了贴纸「{ $body }」。
+event-summary-image-sent = 发送了图片「{ $body }」。
+event-summary-sticker-sent = 发送了贴纸「{ $body }」。
event-message-file-sent = 发送了文件「{ $body }」。
event-message-video-sent = 发送了视频「{ $body }」。
event-message-audio-sent = 发送了音频「{ $body }」。
diff --git a/src/l10n/en/100-ui.ftl b/src/l10n/en/100-ui.ftl
--- a/src/l10n/en/100-ui.ftl
+++ b/src/l10n/en/100-ui.ftl
@@ -151,6 +151,9 @@
state-room-encryption-activated = enabled encryption for this room.
event-message-image-sent = sent an image "{ $body }".
+event-message-sticker-sent = sent a sticker "{ $body }".
+event-summary-image-sent = sent an image "{ $body }".
+event-summary-sticker-sent = sent a sticker "{ $body }".
event-message-file-sent = sent a file "{ $body }".
event-message-video-sent = sent a video "{ $body }".
event-message-audio-sent = sent an audio "{ $body }".
diff --git a/src/tests/quick-tests/tst_EventView.qml b/src/tests/quick-tests/tst_EventView.qml
--- a/src/tests/quick-tests/tst_EventView.qml
+++ b/src/tests/quick-tests/tst_EventView.qml
@@ -144,6 +144,17 @@
formattedTime: '4:06 P.M.',
})
+ property var stickerEvent: ({
+ eventId: '',
+ sender: '@foo:tusooa.xyz',
+ type: 'm.sticker',
+ stateKey: '',
+ content: {
+ body: 'some body',
+ },
+ formattedTime: '4:06 P.M.',
+ })
+
property var eventBySomeoneElse: ({
eventId: '',
sender: '@bar:tusooa.xyz',
@@ -356,6 +367,32 @@
event: item.eventTextBySomeoneElse
sender: item.senderOther
}
+
+ Kazv.EventView {
+ id: eventViewImage
+ event: item.imageEvent
+ sender: item.sender
+ }
+
+ Kazv.EventView {
+ id: eventViewImageCompact
+ compactMode: true
+ event: item.imageEvent
+ sender: item.sender
+ }
+
+ Kazv.EventView {
+ id: eventViewSticker
+ event: item.stickerEvent
+ sender: item.sender
+ }
+
+ Kazv.EventView {
+ id: eventViewStickerCompact
+ compactMode: true
+ event: item.stickerEvent
+ sender: item.sender
+ }
}
TestCase {
@@ -542,5 +579,16 @@
// verify that the user id is passed
verify(item.activateUserPage.lastArgs()[2] === '@foo:tusooa.xyz');
}
+
+ function test_imageEvent() {
+ verify(!findChild(eventViewImage, 'summaryLabel').visible);
+ verify(findChild(eventViewImage, 'bodyLabel').visible);
+ verify(findChild(eventViewImageCompact, 'summaryLabel').visible);
+ verify(!findChild(eventViewImageCompact, 'bodyLabel').visible);
+ verify(!findChild(eventViewSticker, 'summaryLabel').visible);
+ verify(findChild(eventViewSticker, 'bodyLabel').visible);
+ verify(findChild(eventViewStickerCompact, 'summaryLabel').visible);
+ verify(!findChild(eventViewStickerCompact, 'bodyLabel').visible);
+ }
}
}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 3:02 PM (8 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39933
Default Alt Text
D98.1732489350.diff (5 KB)

Event Timeline