[tibg] ability to add a description when we send a file. Fixes #3491
This commit is contained in:
parent
bc1b27c45e
commit
100360fe3e
|
@ -224,13 +224,17 @@ _('Connection with peer cannot be established.'))
|
||||||
self.tree.get_selection().unselect_all()
|
self.tree.get_selection().unselect_all()
|
||||||
|
|
||||||
def show_file_send_request(self, account, contact):
|
def show_file_send_request(self, account, contact):
|
||||||
|
|
||||||
|
desc_entry = gtk.Entry()
|
||||||
|
|
||||||
def on_ok(widget):
|
def on_ok(widget):
|
||||||
file_dir = None
|
file_dir = None
|
||||||
files_path_list = dialog.get_filenames()
|
files_path_list = dialog.get_filenames()
|
||||||
files_path_list = gtkgui_helpers.decode_filechooser_file_paths(
|
files_path_list = gtkgui_helpers.decode_filechooser_file_paths(
|
||||||
files_path_list)
|
files_path_list)
|
||||||
|
desc = desc_entry.get_text()
|
||||||
for file_path in files_path_list:
|
for file_path in files_path_list:
|
||||||
if self.send_file(account, contact, file_path) 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)
|
file_dir = os.path.dirname(file_path)
|
||||||
if file_dir:
|
if file_dir:
|
||||||
gajim.config.set('last_send_dir', file_dir)
|
gajim.config.set('last_send_dir', file_dir)
|
||||||
|
@ -250,9 +254,17 @@ _('Connection with peer cannot be established.'))
|
||||||
# FIXME: add send icon to this button (JUMP_TO)
|
# FIXME: add send icon to this button (JUMP_TO)
|
||||||
dialog.add_action_widget(btn, gtk.RESPONSE_OK)
|
dialog.add_action_widget(btn, gtk.RESPONSE_OK)
|
||||||
dialog.set_default_response(gtk.RESPONSE_OK)
|
dialog.set_default_response(gtk.RESPONSE_OK)
|
||||||
btn.show()
|
|
||||||
|
|
||||||
def send_file(self, account, contact, file_path):
|
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)
|
||||||
|
|
||||||
|
dialog.vbox.pack_start(desc_hbox, False, False, 0)
|
||||||
|
|
||||||
|
btn.show()
|
||||||
|
desc_hbox.show_all()
|
||||||
|
|
||||||
|
def send_file(self, account, contact, file_path, file_desc=None):
|
||||||
''' start the real transfer(upload) of the file '''
|
''' start the real transfer(upload) of the file '''
|
||||||
if gtkgui_helpers.file_is_locked(file_path):
|
if gtkgui_helpers.file_is_locked(file_path):
|
||||||
pritext = _('Gajim cannot access this file')
|
pritext = _('Gajim cannot access this file')
|
||||||
|
@ -268,7 +280,7 @@ _('Connection with peer cannot be established.'))
|
||||||
resource = resource)
|
resource = resource)
|
||||||
(file_dir, file_name) = os.path.split(file_path)
|
(file_dir, file_name) = os.path.split(file_path)
|
||||||
file_props = self.get_send_file_props(account, contact,
|
file_props = self.get_send_file_props(account, contact,
|
||||||
file_path, file_name)
|
file_path, file_name, file_desc)
|
||||||
if file_props is None:
|
if file_props is None:
|
||||||
return False
|
return False
|
||||||
self.add_transfer(account, contact, file_props)
|
self.add_transfer(account, contact, file_props)
|
||||||
|
@ -539,11 +551,11 @@ _('Connection with peer cannot be established.'))
|
||||||
return iter
|
return iter
|
||||||
iter = self.model.iter_next(iter)
|
iter = self.model.iter_next(iter)
|
||||||
|
|
||||||
def get_send_file_props(self, account, contact, file_path, file_name):
|
def get_send_file_props(self, account, contact, file_path, file_name, file_desc=None):
|
||||||
''' create new file_props dict and set initial file transfer
|
''' create new file_props dict and set initial file transfer
|
||||||
properties in it'''
|
properties in it'''
|
||||||
file_props = {'file-name' : file_path, 'name' : file_name,
|
file_props = {'file-name' : file_path, 'name' : file_name,
|
||||||
'type' : 's'}
|
'type' : 's', 'desc' : file_desc}
|
||||||
if os.path.isfile(file_path):
|
if os.path.isfile(file_path):
|
||||||
stat = os.stat(file_path)
|
stat = os.stat(file_path)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -628,6 +628,8 @@ class FileTransfersTooltip(BaseTooltip):
|
||||||
else:
|
else:
|
||||||
status = _('Not started')
|
status = _('Not started')
|
||||||
properties.append((_('Status: '), status))
|
properties.append((_('Status: '), status))
|
||||||
|
file_desc = file_props['desc']
|
||||||
|
properties.append((_('Description: '), gobject.markup_escape_text(file_desc)))
|
||||||
while properties:
|
while properties:
|
||||||
property = properties.pop(0)
|
property = properties.pop(0)
|
||||||
current_row += 1
|
current_row += 1
|
||||||
|
|
Loading…
Reference in New Issue