changeset 1430:ba09cd879343

quick frontends (contact list): cache is not cleared anymore on QuickContactList.fill, avoiding the accidental removal of cached values like avatars
author Goffi <goffi@goffi.org>
date Wed, 27 May 2015 19:08:16 +0200 (2015-05-27)
parents 798e5e38516b
children 70abe871eac3
files frontends/src/quick_frontend/quick_contact_list.py
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_contact_list.py	Fri May 22 22:31:37 2015 +0200
+++ b/frontends/src/quick_frontend/quick_contact_list.py	Wed May 27 19:08:16 2015 +0200
@@ -139,7 +139,7 @@
 
         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 @@
             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()