From 492b812eb50c94b86c7f35a39459dab273221788 Mon Sep 17 00:00:00 2001 From: Denis Fomin Date: Thu, 3 Feb 2011 22:55:39 +0300 Subject: [PATCH] filetransfer.Ability to send multi-line comment with the file --- src/filetransfers_window.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/filetransfers_window.py b/src/filetransfers_window.py index 4a6f9bc49..899a96cab 100644 --- a/src/filetransfers_window.py +++ b/src/filetransfers_window.py @@ -239,16 +239,25 @@ class FileTransfersWindow: self.tree.get_selection().unselect_all() def show_file_send_request(self, account, contact): - desc_entry = gtk.Entry() + win = gtk.ScrolledWindow() + win.set_shadow_type(gtk.SHADOW_IN) + win.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER) + + from message_textview import MessageTextView + desc_entry = MessageTextView() + win.add(desc_entry) def on_ok(widget): file_dir = None files_path_list = dialog.get_filenames() files_path_list = gtkgui_helpers.decode_filechooser_file_paths( files_path_list) - desc = desc_entry.get_text() + text_buffer = desc_entry.get_buffer() + desc = text_buffer.get_text(text_buffer.get_start_iter(), + text_buffer.get_end_iter()) for file_path in files_path_list: - if self.send_file(account, contact, file_path, desc) and file_dir is None: + if self.send_file(account, contact, file_path, desc) \ + and file_dir is None: file_dir = os.path.dirname(file_path) if file_dir: gajim.config.set('last_send_dir', file_dir) @@ -271,7 +280,7 @@ class FileTransfersWindow: desc_hbox = gtk.HBox(False, 5) desc_hbox.pack_start(gtk.Label(_('Description: ')), False, False, 0) - desc_hbox.pack_start(desc_entry, True, True, 0) + desc_hbox.pack_start(win, True, True, 0) dialog.vbox.pack_start(desc_hbox, False, False, 0) @@ -292,7 +301,8 @@ class FileTransfersWindow: if contact.find('/') == -1: return (jid, resource) = contact.split('/', 1) - contact = gajim.contacts.create_contact(jid=jid, account=account, resource=resource) + contact = gajim.contacts.create_contact(jid=jid, account=account, + resource=resource) file_name = os.path.split(file_path)[1] file_props = self.get_send_file_props(account, contact, file_path, file_name, file_desc)