quick frontends (contact list): cache is not cleared anymore on QuickContactList.fill, avoiding the accidental removal of cached values like avatars

This commit is contained in:
Goffi 2015-05-27 19:08:16 +02:00
commit 2602e4efbb

View file

@ -139,7 +139,7 @@ class QuickContactList(QuickWidget):
Contacts will be cleared before refilling them
"""
self.clearContacts()
self.clearContacts(keep_cache=True)
def gotContacts(contacts):
for contact in contacts:
self.host.newContactHandler(*contact, profile=self.profile)
@ -259,10 +259,14 @@ class QuickContactList(QuickWidget):
return self._special_extras
return set([extra for extra in self._special_extras if extra.bare in self.getSpecials(special_type)])
def clearContacts(self):
"""Clear all the contact list"""
def clearContacts(self, keep_cache=False):
"""Clear all the contact list
@param keep_cache: if True, don't reset the cache
"""
self.unselectAll()
self._cache.clear()
if not keep_cache:
self._cache.clear()
self._groups.clear()
self._specials.clear()
self._special_extras.clear()