From b0fe0251d1d31bfa07383ed319fe700acda98ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Tue, 20 Feb 2024 10:54:16 -0500 Subject: [PATCH] Reply: ellide too long display names GitLab: #1550 Change-Id: I0234d9c6993438fe4580961a85d86632def1c354 --- src/app/commoncomponents/SBSMessageBase.qml | 20 +++++++++++++++++-- .../mainview/components/ReplyingContainer.qml | 9 ++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/app/commoncomponents/SBSMessageBase.qml b/src/app/commoncomponents/SBSMessageBase.qml index 5dabb60e4..0f61ff34f 100644 --- a/src/app/commoncomponents/SBSMessageBase.qml +++ b/src/app/commoncomponents/SBSMessageBase.qml @@ -150,7 +150,15 @@ Control { Label { id: replyTo - text: isOutgoing ? JamiStrings.inReplyTo : UtilsAdapter.getBestNameForUri(CurrentAccount.id, Author) + JamiStrings.repliedTo + wrapMode: Text.NoWrap + text: textMetricsUsername1.elidedText + TextMetrics { + id: textMetricsUsername1 + text: isOutgoing ? JamiStrings.inReplyTo : UtilsAdapter.getBestNameForUri(CurrentAccount.id, Author) + JamiStrings.repliedTo + elideWidth: 200 + elide: Qt.ElideMiddle + } + color: JamiTheme.messageReplyColor font.pointSize: JamiTheme.textFontSize font.kerning: true @@ -175,7 +183,15 @@ Control { Label { id: replyToUserName - text: replyItem.isSelf ? JamiStrings.inReplyToMe : replyToLayout.replyUserName + wrapMode: Text.NoWrap + text: textMetricsUsername2.elidedText + TextMetrics { + id: textMetricsUsername2 + text: replyItem.isSelf ? JamiStrings.inReplyToMe : replyToLayout.replyUserName + elideWidth: 200 + elide: Qt.ElideMiddle + } + color: JamiTheme.messageReplyColor font.pointSize: JamiTheme.textFontSize font.kerning: true diff --git a/src/app/mainview/components/ReplyingContainer.qml b/src/app/mainview/components/ReplyingContainer.qml index 5d1d368ea..2ee8a46ea 100644 --- a/src/app/mainview/components/ReplyingContainer.qml +++ b/src/app/mainview/components/ReplyingContainer.qml @@ -78,7 +78,14 @@ Rectangle { Label { id: username - text: author === CurrentAccount.uri ? CurrentAccount.bestName : UtilsAdapter.getBestNameForUri(CurrentAccount.id, author) + wrapMode: Text.NoWrap + text: textMetricsUsername.elidedText + TextMetrics { + id: textMetricsUsername + text: author === CurrentAccount.uri ? CurrentAccount.bestName : UtilsAdapter.getBestNameForUri(CurrentAccount.id, author) + elideWidth: 200 + elide: Qt.ElideMiddle + } color: UtilsAdapter.luma(root.color) ? JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorDark font.pointSize: JamiTheme.textFontSize -- GitLab