[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2-4' - loleaflet/html loleaflet/src wsd/ClientSession.cpp

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 8 08:28:41 UTC 2020


 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 eeb8b737420f22550052f7e26d540ef8cb0fa2f8
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Tue May 19 11:45:04 2020 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Jun 8 10:28:23 2020 +0200

    tdf#131123 Report back save result
    
    Change-Id: Ie3dee5d344bc65c325b95f2746c9734bdd9e2f9d
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94490
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95704
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

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"))
     {


More information about the Libreoffice-commits mailing list