fix(StatusChatListItem): ensure chat name elides when it's too long

Closes #151
This commit is contained in:
Pascal Precht 2021-06-25 13:55:12 +02:00 committed by Pascal Precht
parent 141872c2a5
commit 34df0f0dab
2 changed files with 13 additions and 0 deletions

View File

@ -714,6 +714,15 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
color: "Orange" color: "Orange"
unreadMessagesCount: 0 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 { ListModel {

View File

@ -143,12 +143,16 @@ Rectangle {
id: chatName id: chatName
anchors.left: statusIcon.visible ? statusIcon.right : identicon.right anchors.left: statusIcon.visible ? statusIcon.right : identicon.right
anchors.leftMargin: statusIcon.visible ? 1 : 8 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 anchors.verticalCenter: parent.verticalCenter
text: statusChatListItem.type === StatusChatListItem.Type.PublicChat && text: statusChatListItem.type === StatusChatListItem.Type.PublicChat &&
!statusChatListItem.name.startsWith("#") ? !statusChatListItem.name.startsWith("#") ?
"#" + statusChatListItem.name : "#" + statusChatListItem.name :
statusChatListItem.name statusChatListItem.name
elide: Text.ElideRight
color: { color: {
if (statusChatListItem.muted && !sensor.containsMouse && !statusChatListItem.highlighted) { if (statusChatListItem.muted && !sensor.containsMouse && !statusChatListItem.highlighted) {
return Theme.palette.directColor5 return Theme.palette.directColor5