diff browser_side/dialog.py @ 271:d868181d0649

browser_side: update contacts in "group and contact chooser" when the a user connect/disconnect
author souliane <souliane@mailoo.org>
date Tue, 19 Nov 2013 21:21:49 +0100
parents 79970bf6af93
children 0cb9869b42b6
line wrap: on
line diff
--- a/browser_side/dialog.py	Sun Nov 17 22:20:12 2013 +0100
+++ b/browser_side/dialog.py	Tue Nov 19 21:21:49 2013 +0100
@@ -185,6 +185,9 @@
         self.setHTML(title)
         self.show()
 
+        # needed to update the contacts list when someone logged in/out
+        self.host.room_contacts_chooser = self
+
     def getRoom(self, asSuffix=False):
         room = self.room_panel.getRoom()
         if asSuffix:
@@ -206,9 +209,10 @@
             sender.setStackText(0, self.title_room + ("" if visible else self.getRoom(True)))
         elif index == 1:
             sender.setStackText(1, self.title_invite + ("" if visible else self.getContacts(True)))
-            if visible:
-                # update the contacts list in case someone recently logged in/out
-                self.contact_panel.setContacts(self.getContacts())
+
+    def resetContacts(self):
+        """Called when someone log in/out to update the list"""
+        self.contact_panel.setContacts(self.getContacts())
 
     def onOK(self, sender):
         room_jid = self.getRoom()
@@ -220,6 +224,10 @@
     def onCancel(self, sender):
         self.hide()
 
+    def hide(self):
+        self.host.room_contacts_chooser = None
+        DialogBox.hide(self, autoClosed=True)
+
 
 class GenericConfirmDialog(DialogBox):