mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-10 12:03:18 +02:00
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
This commit is contained in:
parent
37c45c27a5
commit
275530746a
2 changed files with 39 additions and 10 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue