From 9a04bc6d32fa2ce65a8188769d2dd015b8ac0840 Mon Sep 17 00:00:00 2001 From: Goffi Date: Mon, 8 Sep 2014 15:50:51 +0200 Subject: [PATCH] Primitivus (file transfer): an error popup is shown when bad unicode is used in path, and an info popup is show to indicate that the file request has been sent --- frontends/src/primitivus/chat.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontends/src/primitivus/chat.py b/frontends/src/primitivus/chat.py index 70b77ecd..c7504d2f 100644 --- a/frontends/src/primitivus/chat.py +++ b/frontends/src/primitivus/chat.py @@ -18,6 +18,8 @@ # along with this program. If not, see . from sat.core.i18n import _ +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 @@ -385,6 +387,12 @@ class Chat(urwid.WidgetWrap, QuickChat): #MISC EVENTS# 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.getLastResource(unicode(self.target.bare), self.host.profile) if last_resource: @@ -393,3 +401,4 @@ class Chat(urwid.WidgetWrap, QuickChat): full_jid = self.target progress_id = self.host.bridge.sendFile(full_jid, filepath, {}, self.host.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"))