Skip to content
Snippets Groups Projects
Commit 27553074 authored by Andreas Traczyk's avatar Andreas Traczyk
Browse files

smartlist: filter conversation update/reselection

Filter either the same conv id or peer list of the currently
selected item when responding to the conversationReady signal.

For dialogs we make sure the peer list(1) is same and for all other
swarm conversations we match the conv id.

This will prevent programmatic auto-selection of the smartlist
during account sync.

Depends on: https://review.jami.net/c/ring-lrc/+/18793

Change-Id: I6cedb8494f7c001bf886fe36dd03adffd201bb51
parent 37c45c27
No related branches found
No related tags found
No related merge requests found
......@@ -311,14 +311,30 @@ ConversationsAdapter::onSearchResultUpdated()
}
void
ConversationsAdapter::updateConversation(const QString& convId)
ConversationsAdapter::onConversationReady(const QString& convId)
{
// a conversation request has been accepted or a contact has
// been added, so select the conversation and notify the UI to:
// - switch tabs to the conversation filter tab
// - clear search bar
Q_EMIT conversationReady(convId);
lrcInstance_->selectConversation(convId);
auto convModel = lrcInstance_->getCurrentConversationModel();
auto& convInfo = lrcInstance_->getConversationFromConvUid(convId);
auto selectedConvId = lrcInstance_->get_selectedConvUid();
// for one to one conversations including legacy mode, we can prevent
// undesired selection by filtering for a conversation peer match,
// and for all other swarm convs, we can match the conv's id
if (convInfo.isCoreDialog()) {
auto peers = convModel->peersForConversation(convId);
auto selectedPeers = convModel->peersForConversation(selectedConvId);
if (peers != selectedPeers)
return;
} else if (convId != selectedConvId)
return;
updateConversation(convId);
}
void
ConversationsAdapter::onNeedsSyncingSet(const QString& convId)
{
updateConversation(convId);
}
void
......@@ -334,6 +350,17 @@ ConversationsAdapter::onBannedStatusChanged(const QString& uri, bool banned)
lrcInstance_->set_selectedConvUid();
}
void
ConversationsAdapter::updateConversation(const QString& convId)
{
// a conversation request has been accepted or a contact has
// been added, so select the conversation and notify the UI to:
// - switch tabs to the conversation filter tab
// - clear search bar
Q_EMIT conversationReady(convId);
lrcInstance_->selectConversation(convId);
}
void
ConversationsAdapter::updateConversationFilterData()
{
......@@ -463,13 +490,13 @@ ConversationsAdapter::connectConversationModel()
QObject::connect(currentConversationModel,
&ConversationModel::conversationReady,
this,
&ConversationsAdapter::updateConversation,
&ConversationsAdapter::onConversationReady,
Qt::UniqueConnection);
QObject::connect(currentConversationModel,
&ConversationModel::needsSyncingSet,
this,
&ConversationsAdapter::updateConversation,
&ConversationsAdapter::onNeedsSyncingSet,
Qt::UniqueConnection);
QObject::connect(lrcInstance_->getCurrentContactModel(),
......
......@@ -81,9 +81,11 @@ private Q_SLOTS:
void onConversationCleared(const QString&);
void onSearchStatusChanged(const QString&);
void onSearchResultUpdated();
void updateConversation(const QString&);
void onConversationReady(const QString&);
void onNeedsSyncingSet(const QString&);
void onBannedStatusChanged(const QString&, bool);
void updateConversation(const QString&);
void updateConversationFilterData();
private:
......
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