diff frontends/src/wix/main_window.py @ 987:3a96920c07b7

core, frontends: unify the roster management UIs in sat/stdui/ui_contact_list.py
author souliane <souliane@mailoo.org>
date Thu, 03 Apr 2014 16:10:44 +0200
parents 01342bfe9f41
children 5a6354ff468c
line wrap: on
line diff
--- a/frontends/src/wix/main_window.py	Mon Apr 07 16:24:29 2014 +0200
+++ b/frontends/src/wix/main_window.py	Thu Apr 03 16:10:44 2014 +0200
@@ -37,11 +37,9 @@
 idEXIT,\
 idABOUT,\
 idPARAM,\
-idADD_CONTACT,\
-idREMOVE_CONTACT,\
 idSHOW_PROFILE,\
 idJOIN_ROOM,\
-= range(9)
+ = range(7)
 
 class ChatList(QuickChatList):
     """This class manage the list of chat windows"""
@@ -124,10 +122,6 @@
         connectMenu.Append(idABOUT, _("A&bout"), _(" About %s") % Const.APP_NAME)
         connectMenu.Append(idEXIT,_("E&xit"),_(" Terminate the program"))
         contactMenu = wx.Menu()
-        contactMenu.Append(idADD_CONTACT, _("&Add contact"),_(" Add a contact to your list"))
-        contactMenu.Append(idREMOVE_CONTACT, _("&Remove contact"),_(" Remove the selected contact from your list"))
-        contactMenu.AppendSeparator()
-        contactMenu.Append(idSHOW_PROFILE, _("&Show profile"), _(" Show contact's profile"))
         communicationMenu = wx.Menu()
         communicationMenu.Append(idJOIN_ROOM, _("&Join Room"),_(" Join a Multi-User Chat room"))
         self.menuBar = wx.MenuBar()
@@ -163,6 +157,9 @@
 
             wx.EVT_MENU(self, item_id, event_answer)
 
+        # menu items that should be displayed after the automatically added ones
+        contactMenu.AppendSeparator()
+        contactMenu.Append(idSHOW_PROFILE, _("&Show profile"), _(" Show contact's profile"))
 
         #events
         wx.EVT_MENU(self, idCONNECT, self.onConnectRequest)
@@ -170,8 +167,6 @@
         wx.EVT_MENU(self, idPARAM, self.onParam)
         wx.EVT_MENU(self, idABOUT, self.onAbout)
         wx.EVT_MENU(self, idEXIT, self.onExit)
-        wx.EVT_MENU(self, idADD_CONTACT, self.onAddContact)
-        wx.EVT_MENU(self, idREMOVE_CONTACT, self.onRemoveContact)
         wx.EVT_MENU(self, idSHOW_PROFILE, self.onShowProfile)
         wx.EVT_MENU(self, idJOIN_ROOM, self.onJoinRoom)
 
@@ -434,45 +429,6 @@
     def onExit(self, e):
         self.Close()
 
-    def onAddContact(self, e):
-        debug(_("Add contact request"))
-        dlg = wx.TextEntryDialog(
-                self, _('Please enter new contact JID'),
-                _('Adding a contact'), _('name@server.tld'))
-
-        if dlg.ShowModal() == wx.ID_OK:
-            jid=JID(dlg.GetValue())
-            if jid.is_valid():
-                self.bridge.addContact(jid.bare, profile_key=self.profile)
-            else:
-                error (_("'%s' is an invalid JID !"), jid)
-                #TODO: notice the user
-
-        dlg.Destroy()
-
-    def onRemoveContact(self, e):
-        debug(_("Remove contact request"))
-        target = self.contact_list.getSelection()
-        if not target:
-            dlg = wx.MessageDialog(self, _("You haven't selected any contact !"),
-                                   _('Error'),
-                                   wx.OK | wx.ICON_ERROR
-                                  )
-            dlg.ShowModal()
-            dlg.Destroy()
-            return
-
-        dlg = wx.MessageDialog(self, _("Are you sure you want to delete %s from your roster list ?") % target.bare,
-                               _('Contact suppression'),
-                               wx.YES_NO | wx.ICON_QUESTION
-                              )
-
-        if dlg.ShowModal() == wx.ID_YES:
-            info(_("Unsubscribing %s presence"), target.bare)
-            self.bridge.delContact(target.bare, profile_key=self.profile)
-
-        dlg.Destroy()
-
     def onShowProfile(self, e):
         debug(_("Show contact's profile request"))
         target = self.contact_list.getSelection()