Skip to content
Snippets Groups Projects
Commit 1e7f407e authored by Ming Rui Zhang's avatar Ming Rui Zhang
Browse files

conversationsadapter: recover avatar update for conversations

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

Change-Id: I8d6f3a3a5fea2cee38258ca0cc5bd6ca6f447395
parent 872fbeb5
No related branches found
No related tags found
No related merge requests found
......@@ -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();
}
......
......@@ -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_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment