diff browser_side/panels.py @ 57:e552a67b933d

Contact update + add dedication in About dialog
author Goffi <goffi@goffi.org>
date Sun, 29 May 2011 16:07:46 +0200
parents 5fa710058e2d
children 4fa3d57f72f8
line wrap: on
line diff
--- a/browser_side/panels.py	Sun May 29 15:25:46 2011 +0200
+++ b/browser_side/panels.py	Sun May 29 16:07:46 2011 +0200
@@ -112,6 +112,7 @@
 Project page: <a href="http://wiki.goffi.org/wiki/Salut_à_Toi"target="_blank">http://wiki.goffi.org/wiki/Salut_à_Toi</a><br />
 <br />
 Any help welcome :)
+<p style='font-size:x-small;text-align:center'>This project is dedicated to Roger Poisson</p>
 """)
         _dialog = dialog.GenericDialog("About", _about)
         _dialog.show()
@@ -137,7 +138,28 @@
         _dialog.show()
 
     def onUpdateContact(self):
-        pass
+        _dialog = None
+        _contacts_list = ListBox()
+
+        def updateContactCb(sender):
+            _jid = _contacts_list.getValue(_contacts_list.getSelectedIndex())
+            self.host.bridge.call('updateContact', None, _jid, '', _dialog.getSelectedGroups())
+            print "contactUpdated"
+
+        def onContactChange(_list):
+            _jid = _contacts_list.getValue(_contacts_list.getSelectedIndex())
+            groups = self.host.contact_panel.getContactGroups(_jid)
+            _dialog.setGroupsSelected(groups)
+
+        for contact in self.host.contact_panel.getContacts():
+            _contacts_list.addItem(contact)
+        _contacts_list.addChangeListener(onContactChange)
+        _jid = _contacts_list.getValue(_contacts_list.getSelectedIndex())
+        _selected_groups = self.host.contact_panel.getContactGroups(_jid)
+        _dialog = dialog.GroupSelector([Label('Which contact do you want to update ?'), _contacts_list],
+                                       self.host.contact_panel.getGroups(), _selected_groups, updateContactCb)
+        _dialog.setHTML('<b>Updating contact</b>')
+        _dialog.show()
 
     def onRemoveContact(self):
         _dialog = None