1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-03 14:25:38 +02:00

conversationsadapter: recover avatar update for conversations

1. Remove unused conversationSmartListModel
2. Properly update conversation model by using onProfileUpdated

Change-Id: I8d6f3a3a5fea2cee38258ca0cc5bd6ca6f447395
This commit is contained in:
Ming Rui Zhang 2021-06-16 16:21:13 -04:00
parent 872fbeb5d3
commit 1e7f407e3c
2 changed files with 8 additions and 18 deletions

View file

@ -135,12 +135,6 @@ ConversationsAdapter::safeInit()
{
// TODO: remove these safeInits, they are possibly called
// multiple times during qml component inits
conversationSmartListModel_ = new SmartListModel(this,
SmartListModel::Type::CONVERSATION,
lrcInstance_);
Q_EMIT modelChanged(QVariant::fromValue(conversationSmartListModel_));
connect(&lrcInstance_->behaviorController(),
&BehaviorController::newUnreadInteraction,
this,
@ -276,16 +270,20 @@ ConversationsAdapter::onTrustRequestTreated(const QString& accountId, const QStr
void
ConversationsAdapter::onModelChanged()
{
conversationSmartListModel_->fillConversationsList();
updateConversationFilterData();
}
void
ConversationsAdapter::onProfileUpdated(const QString& contactUri)
{
// TODO: this will need a dataChanged call to keep the avatar
// updated. previously, 'reload-smartlist' was invoked here
conversationSmartListModel_->updateContactAvatarUid(contactUri);
auto& convInfo = lrcInstance_->getConversationFromPeerUri(contactUri);
if (convInfo.uid.isEmpty())
return;
auto row = lrcInstance_->indexOf(convInfo.uid);
const auto index = convSrcModel_->index(row, 0);
convSrcModel_->updateContactAvatarUid(contactUri);
Q_EMIT convSrcModel_->dataChanged(index, index);
}
void
@ -297,7 +295,6 @@ ConversationsAdapter::onConversationUpdated(const QString&)
void
ConversationsAdapter::onFilterChanged()
{
conversationSmartListModel_->fillConversationsList();
updateConversationFilterData();
if (!lrcInstance_->get_selectedConvUid().isEmpty())
Q_EMIT indexRepositionRequested();
@ -306,7 +303,6 @@ ConversationsAdapter::onFilterChanged()
void
ConversationsAdapter::onNewConversation(const QString& convUid)
{
conversationSmartListModel_->fillConversationsList();
updateConversationForNewContact(convUid);
}
@ -329,9 +325,6 @@ ConversationsAdapter::onSearchStatusChanged(const QString& status)
void
ConversationsAdapter::onSearchResultUpdated()
{
// currently for contact pickers
conversationSmartListModel_->fillConversationsList();
// smartlist search results
searchSrcModel_->onSearchResultsUpdated();
}

View file

@ -56,7 +56,6 @@ Q_SIGNALS:
void showConversation(const QString& accountId, const QString& convUid);
void showSearchStatus(const QString& status);
void modelChanged(const QVariant& model);
void navigateToWelcomePageRequested();
void indexRepositionRequested();
@ -89,8 +88,6 @@ private Q_SLOTS:
private:
void updateConversationForNewContact(const QString& convUid);
SmartListModel* conversationSmartListModel_;
SystemTray* systemTray_;
QScopedPointer<ConversationListModel> convSrcModel_;