loleaflet/html/framed.doc.html | 2 ++ loleaflet/src/core/Socket.js | 19 ++++++++++--------- wsd/ClientSession.cpp | 13 ++++++++----- 3 files changed, 20 insertions(+), 14 deletions(-)
New commits: commit 665b1629de30a4a402c6b10dd542de158db1f428 Author: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> AuthorDate: Tue May 19 11:45:04 2020 +0200 Commit: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> CommitDate: Fri May 29 08:39:46 2020 +0200 tdf#131123 Report back save result Change-Id: Ie3dee5d344bc65c325b95f2746c9734bdd9e2f9d Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94490 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> diff --git a/loleaflet/html/framed.doc.html b/loleaflet/html/framed.doc.html index 0b68c698d..c58d306c9 100644 --- a/loleaflet/html/framed.doc.html +++ b/loleaflet/html/framed.doc.html @@ -107,6 +107,8 @@ if (msg.Values) { if (msg.Values.success == true) { document.getElementById("ModifiedStatus").innerHTML = "Saved"; + } else { + document.getElementById("ModifiedStatus").innerHTML = "Error during save"; } } } diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js index a5e394c67..9f48d3145 100644 --- a/loleaflet/src/core/Socket.js +++ b/loleaflet/src/core/Socket.js @@ -358,9 +358,16 @@ L.Socket = L.Class.extend({ } else if (textMsg.startsWith('commandresult: ')) { var commandresult = JSON.parse(textMsg.substring(textMsg.indexOf('{'))); - if (commandresult['command'] === 'savetostorage' && commandresult['success']) { - // Close any open confirmation dialogs - vex.closeAll(); + if (commandresult['command'] === 'savetostorage' || commandresult['command'] === 'save') { + if (commandresult['success']) { + // Close any open confirmation dialogs + vex.closeAll(); + } + + var postMessageObj = { + success: commandresult['success'] + }; + this._map.fire('postMessage', {msgId: 'Action_Save_Resp', args: postMessageObj}); } return; } @@ -744,12 +751,6 @@ L.Socket = L.Class.extend({ } }); } - - // Issue the save response to be consistent with normal save. - var postMessageObj = { - success: true - }; - this._map.fire('postMessage', {msgId: 'Action_Save_Resp', args: postMessageObj}); } // var name = command.name; - ignored, we get the new name via the wopi's BaseFileName } diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp index 20b1ed011..3f37c88c4 100644 --- a/wsd/ClientSession.cpp +++ b/wsd/ClientSession.cpp @@ -552,8 +552,11 @@ bool ClientSession::_handleInput(const char *buffer, int length) constexpr bool isAutosave = false; constexpr bool isExitSave = false; - docBroker->sendUnoSave(getId(), dontTerminateEdit != 0, dontSaveIfUnmodified != 0, + bool result = docBroker->sendUnoSave(getId(), dontTerminateEdit != 0, dontSaveIfUnmodified != 0, isAutosave, isExitSave, extendedData); + std::string resultstr = result ? "true" : "false"; + std::string msg = "commandresult: { \"command\": \"save\", \"success\": " + resultstr + " }"; + docBroker->broadcastMessage(msg); } } else if (tokens.equals(0, "savetostorage")) @@ -562,10 +565,10 @@ bool ClientSession::_handleInput(const char *buffer, int length) if (tokens.size() > 1) getTokenInteger(tokens[1], "force", force); - if (docBroker->saveToStorage(getId(), true, "" /* This is irrelevant when success is true*/, true)) - { - docBroker->broadcastMessage("commandresult: { \"command\": \"savetostorage\", \"success\": true }"); - } + bool result = docBroker->saveToStorage(getId(), true, "" /* This is irrelevant when success is true*/, true); + std::string resultstr = result ? "true" : "false"; + std::string msg = "commandresult: { \"command\": \"savetostorage\", \"success\": " + resultstr + " }"; + docBroker->broadcastMessage(msg); } else if (tokens.equals(0, "clientvisiblearea")) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits