From 34df0f0dab01e734d142be3dcb5124345c51e26a Mon Sep 17 00:00:00 2001 From: Pascal Precht Date: Fri, 25 Jun 2021 13:55:12 +0200 Subject: [PATCH] fix(StatusChatListItem): ensure chat name elides when it's too long Closes #151 --- sandbox/DemoApp.qml | 9 +++++++++ src/StatusQ/Components/StatusChatListItem.qml | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/sandbox/DemoApp.qml b/sandbox/DemoApp.qml index cbacb800..8d92ac98 100644 --- a/sandbox/DemoApp.qml +++ b/sandbox/DemoApp.qml @@ -714,6 +714,15 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I color: "Orange" unreadMessagesCount: 0 } + ListElement { + chatId: "5" + name: "channel-with-a-super-duper-long-name" + chatType: StatusChatListItem.Type.PublicChat + muted: false + hasUnreadMessages: false + color: "green" + unreadMessagesCount: 0 + } } ListModel { diff --git a/src/StatusQ/Components/StatusChatListItem.qml b/src/StatusQ/Components/StatusChatListItem.qml index d5b61a1f..3a3a3909 100644 --- a/src/StatusQ/Components/StatusChatListItem.qml +++ b/src/StatusQ/Components/StatusChatListItem.qml @@ -143,12 +143,16 @@ Rectangle { id: chatName anchors.left: statusIcon.visible ? statusIcon.right : identicon.right anchors.leftMargin: statusIcon.visible ? 1 : 8 + anchors.right: statusBadge.visible ? statusBadge.left : + mutedIcon.visible ? mutedIcon.left : parent.right + anchors.rightMargin: 6 anchors.verticalCenter: parent.verticalCenter text: statusChatListItem.type === StatusChatListItem.Type.PublicChat && !statusChatListItem.name.startsWith("#") ? "#" + statusChatListItem.name : statusChatListItem.name + elide: Text.ElideRight color: { if (statusChatListItem.muted && !sensor.containsMouse && !statusChatListItem.highlighted) { return Theme.palette.directColor5