primitivus: removed all file menu + temporary workaround to send full jid on C.MENU_SINGLE menu action.

This commit is contained in:
Goffi 2015-11-20 01:57:18 +01:00
commit fc9b4fb02c

View file

@ -22,7 +22,6 @@ from sat.core import log as logging
log = logging.getLogger(__name__)
import urwid
from urwid_satext import sat_widgets
# from urwid_satext.files_management import FileDialog # FIXME
from sat_frontends.quick_frontend import quick_widgets
from sat_frontends.quick_frontend.quick_chat import QuickChat
from sat_frontends.quick_frontend import quick_games
@ -146,8 +145,10 @@ class Chat(PrimitivusWidget, QuickChat):
game = _("Game")
menu.addMenu(game, "Tarot", self.onTarotRequest)
elif self.type == C.CHAT_ONE2ONE:
self.host.addMenus(menu, C.MENU_SINGLE, {'jid': self.target})
menu.addMenu(_("Action"), _("Send file"), self.onSendFileRequest)
# FIXME: self.target is a bare jid, we need to check that
contact_list = self.host.contact_lists[self.profile]
full_jid = contact_list.getFullJid(self.target)
self.host.addMenus(menu, C.MENU_SINGLE, {'jid': full_jid})
return menu
def presenceListener(self, entity, show, priority, statuses, profile):
@ -376,31 +377,7 @@ class Chat(PrimitivusWidget, QuickChat):
else:
self.host.bridge.tarotGameCreate(self.target, list(self.occupants), self.profile)
def onSendFileRequest(self, menu):
# TODO: move this to core with dynamic menus
pass
# dialog = FileDialog(ok_cb=self.onFileSelected, cancel_cb=self.host.removePopUp) # FIXME: to be removed
# self.host.showPopUp(dialog, 80, 80)
# MISC EVENTS #
# FIXME: to be removed
# def onFileSelected(self, filepath):
# self.host.removePopUp()
# try:
# filepath = filepath.decode('utf-8') # FIXME: correctly manage unicode
# except UnicodeError:
# log.error("FIXME: filepath with unicode error are not managed yet")
# self.host.showDialog(_(u"File has a unicode error in its name, it's not yet managed by SàT"), title=_("Can't send file"), type_="error")
# return
# # FIXME: check last_resource: what if self.target.resource exists ?
# last_resource = self.host.bridge.getMainResource(unicode(self.target.bare), self.profile)
# if last_resource:
# full_jid = jid.JID("%s/%s" % (self.target.bare, last_resource))
# else:
# full_jid = self.target
# progress_id = self.host.bridge.sendFile(full_jid, filepath, {}, self.profile)
# self.host.addProgress(progress_id, filepath)
# self.host.showDialog(_(u"You file request has been sent, we are waiting for your contact answer"), title=_("File request sent"))
def onDelete(self):
QuickChat.onDelete(self)