From 5cf6125fd0e81ec0cc36ba91d1fcab998f8223eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Thu, 30 Jun 2022 10:10:39 -0400 Subject: [PATCH] chatviewheader: show description with title For multiple swarms, the description will be shown from the profile, for core dialogs, the best Id is used. Change-Id: Ieb7d5f143c1a85c4c629a5a8a03850fa1ebddf63 --- src/app/conversationsadapter.cpp | 1 + src/app/mainview/MainView.qml | 1 + src/app/mainview/components/ChatView.qml | 2 ++ src/libclient/conversationmodel.cpp | 9 +++++++-- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/app/conversationsadapter.cpp b/src/app/conversationsadapter.cpp index b1a5aa5ba..de792930b 100644 --- a/src/app/conversationsadapter.cpp +++ b/src/app/conversationsadapter.cpp @@ -430,6 +430,7 @@ ConversationsAdapter::getConvInfoMap(const QString& convId) return {{"convId", convId}, {"bestId", bestId}, {"title", lrcInstance_->getCurrentConversationModel()->title(convId)}, + {"description", lrcInstance_->getCurrentConversationModel()->description(convId)}, {"uri", peerUri}, {"uris", accountInfo.conversationModel->peersForConversation(convId)}, {"isSwarm", convInfo.isSwarm()}, diff --git a/src/app/mainview/MainView.qml b/src/app/mainview/MainView.qml index 231025209..e2a7fee3a 100644 --- a/src/app/mainview/MainView.qml +++ b/src/app/mainview/MainView.qml @@ -182,6 +182,7 @@ Rectangle { if (item.convId === undefined) return chatView.headerUserAliasLabelText = item.title + chatView.headerUserUserNameLabelText = item.description if (item.callStackViewShouldShow) { if (inSettingsView) { toggleSettingsView() diff --git a/src/app/mainview/components/ChatView.qml b/src/app/mainview/components/ChatView.qml index 0dfc8f6d8..1cca05915 100644 --- a/src/app/mainview/components/ChatView.qml +++ b/src/app/mainview/components/ChatView.qml @@ -33,6 +33,7 @@ Rectangle { id: root property string headerUserAliasLabelText: "" + property string headerUserUserNameLabelText: "" property bool allMessagesLoaded @@ -63,6 +64,7 @@ Rectangle { Layout.minimumWidth: JamiTheme.chatViewHeaderMinimumWidth userAliasLabelText: headerUserAliasLabelText + userUserNameLabelText: headerUserUserNameLabelText DropArea { anchors.fill: parent diff --git a/src/libclient/conversationmodel.cpp b/src/libclient/conversationmodel.cpp index 6f0029066..879e9f5a7 100644 --- a/src/libclient/conversationmodel.cpp +++ b/src/libclient/conversationmodel.cpp @@ -1082,10 +1082,15 @@ QString ConversationModel::description(const QString& conversationId) const { auto conversationOpt = getConversationForUid(conversationId); - if (!conversationOpt.has_value()) { + if (!conversationOpt.has_value()) return {}; - } auto& conversation = conversationOpt->get(); + if (conversation.isCoreDialog()) { + auto peer = pimpl_->peersForConversation(conversation); + if (peer.isEmpty()) + return {}; + return owner.contactModel->bestIdForContact(peer.front()); + } return conversation.infos["description"]; } -- GitLab