Skip to content
Snippets Groups Projects
Unverified Commit 4a25228e authored by Sébastien Blin's avatar Sébastien Blin
Browse files

messagesadapter: use conversation.typers to build current typing status

Change-Id: I9d38c2a9938bed02ed48f7a141ef0b53b423e1e4
GitLab: #589
parent 8aa90f07
Branches
Tags
No related merge requests found
......@@ -54,7 +54,10 @@ MessagesAdapter::MessagesAdapter(AppSettingsManager* settingsManager,
const auto& conversation = lrcInstance_->getConversationFromConvUid(convId);
filteredMsgListModel_->setSourceModel(conversation.interactions.get());
set_messageListModel(QVariant::fromValue(filteredMsgListModel_));
set_currentConvComposingList({});
if (!conversation.typers.empty())
set_currentConvComposingList(conversationTypersUrlToName(conversation.typers));
else
set_currentConvComposingList({});
});
connect(previewEngine_, &PreviewEngine::infoReady, this, &MessagesAdapter::onPreviewInfoReady);
......@@ -434,15 +437,24 @@ MessagesAdapter::onComposingStatusChanged(const QString& convId,
const QString& contactUri,
bool isComposing)
{
Q_UNUSED(contactUri)
if (lrcInstance_->get_selectedConvUid() == convId) {
auto name = lrcInstance_->getCurrentContactModel()->bestNameForContact(contactUri);
if (isComposing)
currentConvComposingList_.append(name);
else
currentConvComposingList_.removeOne(name);
const QString& accId = lrcInstance_->get_currentAccountId();
auto& conversation = lrcInstance_->getConversationFromConvUid(convId, accId);
set_currentConvComposingList(conversationTypersUrlToName(conversation.typers));
}
}
Q_EMIT currentConvComposingListChanged();
QList<QString>
MessagesAdapter::conversationTypersUrlToName(const QSet<QString>& typersSet)
{
QList<QString> nameList;
for (const auto& id : typersSet) {
auto name = lrcInstance_->getCurrentContactModel()->bestNameForContact(id);
nameList.append(name);
}
return nameList;
}
bool
......
......@@ -129,6 +129,8 @@ private Q_SLOTS:
bool isComposing);
private:
QList<QString> conversationTypersUrlToName(const QSet<QString>& typersSet);
AppSettingsManager* settingsManager_;
PreviewEngine* previewEngine_;
FilteredMsgListModel* filteredMsgListModel_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment