diff frontends/src/primitivus/primitivus @ 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 a9401694d2dc
children 6f1e03068b5f
line wrap: on
line diff
--- a/frontends/src/primitivus/primitivus	Mon Apr 07 16:24:29 2014 +0200
+++ b/frontends/src/primitivus/primitivus	Thu Apr 03 16:10:44 2014 +0200
@@ -290,9 +290,8 @@
         menu.addMenu(general, _("Parameters"), self.onParam)
         menu.addMenu(general, _("About"), self.onAboutRequest)
         menu.addMenu(general, _("Exit"), self.onExitRequest, 'ctrl x')
-        contact = _("Contact")
-        menu.addMenu(contact, _("Add contact"), self.onAddContactRequest)
-        menu.addMenu(contact, _("Remove contact"), self.onRemoveContactRequest)
+        contact = _("Contacts")
+        menu.addMenu(contact)
         communication = _("Communication")
         menu.addMenu(communication, _("Join room"), self.onJoinRoomRequest, 'meta j')
         #additionals menus
@@ -550,21 +549,6 @@
             error (message)
             self.showPopUp(sat_widgets.Alert(_("Error"), message, ok_cb=self.removePopUp))
 
-    def onAddContact(self, button, edit):
-        self.removePopUp()
-        jid=JID(edit.get_edit_text())
-        if jid.is_valid():
-            self.bridge.addContact(jid.bare, profile_key=self.profile)
-        else:
-            message = _("'%s' is an invalid JID !") % jid
-            error (message)
-            self.showPopUp(sat_widgets.Alert(_("Error"), message, ok_cb=self.removePopUp))
-
-    def onRemoveContact(self, button):
-        self.removePopUp()
-        info(_("Unsubscribing %s presence"),self.contact_list.getContact())
-        self.bridge.delContact(self.contact_list.getContact(), profile_key=self.profile)
-
     #MENU EVENTS#
     def onConnectRequest(self, menu):
         self.bridge.connect(self.profile)
@@ -589,18 +573,6 @@
         pop_up_widget = sat_widgets.InputDialog(_("Entering a MUC room"), _("Please enter MUC's JID"), default_txt = 'room@muc_service.server.tld', cancel_cb=self.removePopUp, ok_cb=self.onJoinRoom)
         self.showPopUp(pop_up_widget)
 
-    def onAddContactRequest(self, menu):
-        pop_up_widget = sat_widgets.InputDialog(_("Adding a contact"), _("Please enter new contact JID"), default_txt = 'name@server.tld', cancel_cb=self.removePopUp, ok_cb=self.onAddContact)
-        self.showPopUp(pop_up_widget)
-
-    def onRemoveContactRequest(self, menu):
-        contact = self.contact_list.getContact()
-        if not contact:
-            self.showPopUp(sat_widgets.Alert(_("Error"), _("You have not selected any contact to delete !"), ok_cb=self.removePopUp))
-        else:
-            pop_up_widget = sat_widgets.ConfirmDialog(_("Are you sure you want to delete the contact [%s] ?" % contact), yes_cb=self.onRemoveContact, no_cb=self.removePopUp)
-            self.showPopUp(pop_up_widget)
-
     def onAboutRequest(self, menu):
         self.showPopUp(sat_widgets.Alert(_("About"), Const.APP_NAME + " v" + self.bridge.getVersion(), ok_cb=self.removePopUp))