diff frontends/src/wix/contact_list.py @ 685:0b9bd47dffcd

primitivus, wix: auto-display MUC dialog after it has been joined: - a patch will follow to add a parameter for the user to choose between "always open", "never open" and "ask each time".
author souliane <souliane@mailoo.org>
date Mon, 28 Oct 2013 18:29:34 +0100
parents 84a6e83157c2
children f7878ad3c846
line wrap: on
line diff
--- a/frontends/src/wix/contact_list.py	Thu Oct 24 08:47:45 2013 +0200
+++ b/frontends/src/wix/contact_list.py	Mon Oct 28 18:29:34 2013 +0100
@@ -166,8 +166,24 @@
                 if _present:
                     self.Insert(_present, gp_idx+1, contact)
 
-    def setSpecial(self, special_jid, special_type):
-        QuickContactList.setSpecial(self, special_jid, special_type)
+    def setSpecial(self, special_jid, special_type, show=False):
+        """Set entity as a special
+        @param jid: jid of the entity
+        @param _type: special type (e.g.: "MUC")
+        @param show: True to display the dialog to chat with this entity
+        """
+        QuickContactList.setSpecial(self, special_jid, special_type, show)
+        if show:
+            self._showDialog(special_jid)
+
+    def _showDialog(self, jid):
+        """Show the dialog associated to the given jid."""
+        indexes = self.__find_idx(jid)
+        if not indexes:
+            return
+        self.DeselectAll()
+        self.SetSelection(indexes[0])
+        self.onActivated(wx.MouseEvent())
 
     def remove(self, contact):
         """remove a contact from the list"""