diff browser_side/panels.py @ 52:4419ef07bb2b

browser side: adding contact, first draft
author Goffi <goffi@goffi.org>
date Fri, 27 May 2011 01:52:29 +0200
parents 9f19e16187ff
children f25c4077f6b9
line wrap: on
line diff
--- a/browser_side/panels.py	Thu May 26 23:03:45 2011 +0200
+++ b/browser_side/panels.py	Fri May 27 01:52:29 2011 +0200
@@ -33,6 +33,7 @@
 from pyjamas.ui.AutoComplete import AutoCompleteTextBox
 from pyjamas.ui.MenuBar import MenuBar
 from pyjamas.ui.MenuItem import MenuItem
+from pyjamas.ui.ListBox import ListBox
 from pyjamas.ui.Label import Label
 from pyjamas.ui.TextBox import TextBox
 from pyjamas.ui.Button import Button
@@ -115,9 +116,21 @@
     #Contact menu
     def onAddContact(self):
         """Q&D contact addition"""
-        Window.alert("Add contact !")
+        _dialog = None
+        edit = TextBox()
+
+        def addContactCb(sender):
+            if not edit.getText():
+                Window.alert('You must enter a contact JID')
+                _dialog.show()
 
-    
+        label = Label("new contact identifier (JID):")
+        edit.setText('@libervia.org')
+        edit.setWidth('100%')
+        _dialog = dialog.GroupSelector([label, edit], self.host.contact_panel.getGroups(), [], addContactCb)
+        _dialog.setHTML('<b>Adding contact</b>')
+        _dialog.show()
+
     #Group menu
     def onJoinRoom(self):
         _dialog = None