From 6500863964b506235938974b843cfe20fa34929d Mon Sep 17 00:00:00 2001 From: link2xt Date: Mon, 22 Feb 2021 02:55:46 +0300 Subject: ChatlistPage: display chat avatars --- qml/ChatlistPage.qml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/qml/ChatlistPage.qml b/qml/ChatlistPage.qml index a6efee1..911ab48 100644 --- a/qml/ChatlistPage.qml +++ b/qml/ChatlistPage.qml @@ -2,7 +2,7 @@ import QtQuick 2.12 import QtQuick.Controls 2.12 import QtQuick.Layouts 1.12 import QtQml.Models 2.1 -import org.kde.kirigami 2.12 as Kirigami +import org.kde.kirigami 2.13 as Kirigami import DeltaChat 1.0 @@ -37,11 +37,15 @@ Kirigami.Page { for (let i = 0; i < chatlist.getChatCount(); i++) { const summary = chatlist.getSummary(i) const chatId = chatlist.getChatId(i) + const chat = chatlistPage.context.getChat(chatId) + const profileImage = chat.getProfileImage() const item = { chatId: chatId, msgId: chatlist.getMsgId(i), - username: (summary.text1 != "" ? summary.text1 + ": " : "") + summary.text2 + username: (summary.text1 != "" ? summary.text1 + ": " : "") + summary.text2, + avatarSource: profileImage ? "file:" + profileImage : "", + chatName: chat.name } let j; @@ -100,6 +104,12 @@ Kirigami.Page { label: chatlistPage.context.getChat(model.chatId).getName() subtitle: model.username + + leading: Kirigami.Avatar { + source: model.avatarSource + name: model.chatName + implicitWidth: height + } } ScrollBar.vertical: ScrollBar {} -- cgit v1.2.3-70-g09d2