changeset 1634:95ea323e7d04

primitivus: removed all file menu + temporary workaround to send full jid on C.MENU_SINGLE menu action.
author Goffi <goffi@goffi.org>
date Fri, 20 Nov 2015 01:57:18 +0100
parents 2071d5cec5d6
children 591e04f0103c
files frontends/src/primitivus/chat.py
diffstat 1 files changed, 4 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/primitivus/chat.py	Fri Nov 20 01:57:16 2015 +0100
+++ b/frontends/src/primitivus/chat.py	Fri Nov 20 01:57:18 2015 +0100
@@ -22,7 +22,6 @@
 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 @@
             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 @@
         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)