mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-10 12:03:18 +02:00
smartlist: filter banned items when the filter string is empty
Gitlab: #418 Change-Id: I1c1a8004b8d268cb3be158a7766c5ae82d451e63
This commit is contained in:
parent
a3d287148d
commit
5bb5ce0f09
1 changed files with 7 additions and 4 deletions
|
@ -107,12 +107,15 @@ ConversationListProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex& s
|
||||||
auto registeredName = index.data(ConversationList::Role::RegisteredName).toString();
|
auto registeredName = index.data(ConversationList::Role::RegisteredName).toString();
|
||||||
auto itemProfileType = index.data(ConversationList::Role::ContactType).toInt();
|
auto itemProfileType = index.data(ConversationList::Role::ContactType).toInt();
|
||||||
auto typeFilter = static_cast<profile::Type>(itemProfileType) == currentTypeFilter_;
|
auto typeFilter = static_cast<profile::Type>(itemProfileType) == currentTypeFilter_;
|
||||||
|
bool match {false};
|
||||||
if (index.data(ConversationList::Role::IsBanned).toBool()) {
|
if (index.data(ConversationList::Role::IsBanned).toBool()) {
|
||||||
return typeFilter
|
match = !rx.isEmpty()
|
||||||
&& (rx.exactMatch(uri) || rx.exactMatch(alias) || rx.exactMatch(registeredName));
|
&& (rx.exactMatch(uri) || rx.exactMatch(alias) || rx.exactMatch(registeredName));
|
||||||
|
} else {
|
||||||
|
match = (rx.indexIn(uri) != -1 || rx.indexIn(alias) != -1
|
||||||
|
|| rx.indexIn(registeredName) != -1);
|
||||||
}
|
}
|
||||||
return typeFilter
|
return typeFilter && match;
|
||||||
&& (rx.indexIn(uri) != -1 || rx.indexIn(alias) != -1 || rx.indexIn(registeredName) != -1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
Loading…
Add table
Reference in a new issue