Add max file size (http_upload) to tooltip and server info

This commit is contained in:
Daniel Brötzmann 2019-04-26 20:15:31 +02:00 committed by Philipp Hörist
parent a8bd8abe11
commit 2f5f32257d
2 changed files with 13 additions and 1 deletions

View File

@ -495,6 +495,10 @@ class GroupchatControl(ChatControlBase):
if self.is_connected and httpupload.get_enabled():
tooltip_text = _('Send File…')
max_file_size = con.get_module('HTTPUpload').max_file_size
if max_file_size is not None:
max_file_size = max_file_size / (1024 * 1024)
tooltip_text = _('Send File (max. %s MiB)…') % max_file_size
else:
tooltip_text = _('No File Transfer available')
self.sendfile_button.set_tooltip_text(tooltip_text)

View File

@ -166,6 +166,13 @@ class ServerInfoDialog(Gtk.Dialog):
Feature = namedtuple('Feature',
['name', 'available', 'tooltip', 'enabled'])
# HTTP File Upload
max_file_size = con.get_module('HTTPUpload').max_file_size
tooltip_size = ''
if max_file_size is not None:
max_file_size = max_file_size / (1024 * 1024)
tooltip_size = ' (max. %s MiB)' % max_file_size
return [
Feature('XEP-0016: Privacy Lists',
con.get_module('PrivacyLists').supported, '', None),
@ -192,7 +199,8 @@ class ServerInfoDialog(Gtk.Dialog):
con.get_module('MAM').archiving_namespace, None),
Feature('XEP-0363: HTTP File Upload',
con.get_module('HTTPUpload').available,
con.get_module('HTTPUpload').httpupload_namespace, None),
con.get_module('HTTPUpload').httpupload_namespace + \
tooltip_size, None),
Feature('XEP-0398: Avatar Conversion',
con.avatar_conversion, '', None),
Feature('XEP-0411: Bookmarks Conversion',