loleaflet/Makefile.am | 1 + loleaflet/po/templates/loleaflet-ui.pot | 10 ++++++++++ loleaflet/src/control/Permission.js | 12 +++++++++++- loleaflet/src/core/Socket.js | 4 ++++ 4 files changed, 26 insertions(+), 1 deletion(-)
New commits: commit 0c99f6830bb651b2bfa7243e8325358c6628ed08 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Tue Jul 14 20:33:13 2020 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Mon Jul 20 15:47:53 2020 +0200 Warn user when the document could not be locked Change-Id: I66b584f5e95fd82dc5cb27d10d9629cf19cb61bd Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98782 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am index dfc9d5984..c2dc1f3c4 100644 --- a/loleaflet/Makefile.am +++ b/loleaflet/Makefile.am @@ -621,6 +621,7 @@ pot: src/control/Control.NotebookbarCalc.js \ src/control/Control.NotebookbarImpress.js \ src/control/Control.NotebookbarBuilder.js \ + src/control/Permission.js \ src/control/Ruler.js \ src/control/Signing.js \ src/control/Toolbar.js \ diff --git a/loleaflet/po/templates/loleaflet-ui.pot b/loleaflet/po/templates/loleaflet-ui.pot index 25924eda4..d715eca95 100644 --- a/loleaflet/po/templates/loleaflet-ui.pot +++ b/loleaflet/po/templates/loleaflet-ui.pot @@ -898,6 +898,16 @@ msgstr "" msgid "Start Presentation" msgstr "" +#: src/control/Permission.js:42 +msgid "The document could not be locked, and is opened in read-only mode." +msgstr "" + +#: src/control/Permission.js:44 +msgid "" +"\n" +"Server returned this reason: \"" +msgstr "" + #: src/control/Ruler.js:366 msgid "Left Margin" msgstr "" diff --git a/loleaflet/src/control/Permission.js b/loleaflet/src/control/Permission.js index 3938fbc49..1ba08d90b 100644 --- a/loleaflet/src/control/Permission.js +++ b/loleaflet/src/control/Permission.js @@ -2,7 +2,7 @@ /* * Document permission handler */ -/* global $ */ +/* global $ _ vex */ L.Map.include({ setPermission: function (perm) { if (perm === 'edit') { @@ -38,6 +38,16 @@ L.Map.include({ } }, + onLockFailed: function(reason) { + var alertMsg = _('The document could not be locked, and is opened in read-only mode.'); + if (reason) { + alertMsg += _('\nServer returned this reason: "') + reason + '"'; + } + + vex.dialog.alert({ message: alertMsg }); + this.options.canTryLock = true; + }, + _enterEditMode: function (perm) { if (this.isPermissionReadOnly() && (window.mode.isMobile() || window.mode.isTablet())) { this.sendInitUNOCommands(); diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js index 790c7885d..5c9f61382 100644 --- a/loleaflet/src/core/Socket.js +++ b/loleaflet/src/core/Socket.js @@ -334,6 +334,10 @@ L.Socket = L.Class.extend({ return; } + else if (textMsg.startsWith('lockfailed:')) { + this._map.onLockFailed(textMsg.substring('lockfailed:'.length).trim()); + return; + } else if (textMsg.startsWith('wopi: ')) { // Handle WOPI related messages var wopiInfo = JSON.parse(textMsg.substring(textMsg.indexOf('{'))); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits