core, frontends: unify the roster management UIs in sat/stdui/ui_contact_list.py
This commit is contained in:
parent
9dcec3eab7
commit
e91a30729f
1 changed files with 278 additions and 83 deletions
|
|
@ -290,9 +290,8 @@ class PrimitivusApp(QuickApp, InputHistory):
|
|||
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 @@ class PrimitivusApp(QuickApp, InputHistory):
|
|||
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 @@ class PrimitivusApp(QuickApp, InputHistory):
|
|||
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))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue