From e03c81a976a88af2babf869d8e9d9aef69700ace Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 15 Jan 2020 14:02:26 +0200 Subject: [PATCH] Show the document file name in the mobile apps, too Show it in the same text input field that is used in the WOPI-like case. Make the text input field non-editable and not even focusable. Show the file name as it should be displayed to the user. I.e. reverse two layers of URL encoding. At least for the iOS app this is necessary. Change-Id: Ifc3c8c0907178ecb419f3108ffc558a05a16313d Reviewed-on: https://gerrit.libreoffice.org/c/online/+/86840 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tor Lillqvist --- loleaflet/src/control/Control.Toolbar.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js index 0074e9585..b8f74b279 100644 --- a/loleaflet/src/control/Control.Toolbar.js +++ b/loleaflet/src/control/Control.Toolbar.js @@ -1681,7 +1681,10 @@ function onDocLayerInit() { nUsers = '%n'; oneUser = '1'; noUser = '0'; - $('#document-name-input').hide(); + if (!window.ThisIsAMobileApp) + $('#document-name-input').hide(); + else + $('#document-name-input').show(); } else { nUsers = _('%n users'); oneUser = _('1 user'); @@ -1695,6 +1698,16 @@ function onDocLayerInit() { if (statusbar) statusbar.refresh(); + if (window.ThisIsAMobileApp) { + // We can now set the document name in the menu bar + $('#document-name-input').prop('disabled', false); + $('#document-name-input').removeClass('editable'); + $('#document-name-input').focus(function() { $(this).blur(); }); + // Call decodecodeURIComponent twice: Reverse both our encoding and the encoding of + // the name in the file system. + $('#document-name-input').val(decodeURIComponent(decodeURIComponent(map.options.doc.replace(/.*\//, '')))); + } + if (!window.ThisIsTheiOSApp && window.mode.isTablet()) { map.hideMenubar();