Commit 588a6979 authored by Dan Pascu's avatar Dan Pascu

Improved contact filtering to not depend on the order of the tokens

parent bc6a5ad5
...@@ -293,8 +293,9 @@ class ContactSearchModel(QSortFilterProxyModel): ...@@ -293,8 +293,9 @@ class ContactSearchModel(QSortFilterProxyModel):
item = source_model.data(source_index, Qt.DisplayRole) item = source_model.data(source_index, Qt.DisplayRole)
if type(item) is ContactGroup: if type(item) is ContactGroup:
return False return False
search_string = unicode(self.filterRegExp().pattern()).lower() search_tokens = unicode(self.filterRegExp().pattern()).lower().split()
return search_string in item.name.lower() or search_string in item.uri.lower() searched_item = unicode(item).lower()
return all(token in searched_item for token in search_tokens)
def lessThan(self, left_index, right_index): def lessThan(self, left_index, right_index):
left_item = left_index.model().data(left_index, Qt.DisplayRole) left_item = left_index.model().data(left_index, Qt.DisplayRole)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment