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

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 28 22:32:22 UTC 2020


 kit/ChildSession.cpp         |    2 +-
 loleaflet/src/core/Socket.js |   30 +++++++++++++++++++++++-------
 2 files changed, 24 insertions(+), 8 deletions(-)

New commits:
commit 03ba6537f150793c377ea8781dbd3849b231b507
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jul 28 12:45:01 2020 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Jul 29 00:32:03 2020 +0200

    Send Action_Save_Resp when notification was requested on save as
    
    Change-Id: Iafe06873fcd8c25e93eb9daa2eea187827e3ac47
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99610
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 71440c290..8d1fef6fb 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -2116,7 +2116,7 @@ bool ChildSession::saveAs(const char* /*buffer*/, int /*length*/, const StringVe
     if (success)
         sendTextFrame("saveas: url=" + encodedURL + " filename=" + encodedWopiFilename);
     else
-        sendTextFrameAndLogError("error: cmd=storage kind=savefailed");
+        sendTextFrameAndLogError("error: cmd=saveas kind=savefailed");
 
     return true;
 }
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index b26fd758b..05490d2bf 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -511,7 +511,19 @@ L.Socket = L.Class.extend({
 
 			return;
 		}
-		else if (textMsg.startsWith('error:') && command.errorCmd === 'storage') {
+		else if (textMsg.startsWith('error:')
+			&& (command.errorCmd === 'storage' || command.errorCmd === 'saveas')) {
+
+			if (command.errorCmd === 'saveas') {
+				this._map.fire('postMessage', {
+					msgId: 'Action_Save_Resp',
+					args: {
+						success: false,
+						result: command.errorKind
+					}
+				});
+			}
+
 			this._map.hideBusy();
 			var storageError;
 			if (command.errorKind === 'savediskfull') {
@@ -584,16 +596,16 @@ L.Socket = L.Class.extend({
 			}
 
 			// Skip empty errors (and allow for suppressing errors by making them blank).
-			if (storageError != '') {
+			if (storageError && storageError != '') {
 				// Parse the storage url as link
 				var tmpLink = document.createElement('a');
 				tmpLink.href = this._map.options.doc;
 				// Insert the storage server address to be more friendly
 				storageError = storageError.replace('%storageserver', tmpLink.host);
 				this._map.fire('warn', {msg: storageError});
-			}
 
-			return;
+				return;
+			}
 		}
 		else if (textMsg.startsWith('error:') && command.errorCmd === 'internal') {
 			this._map.hideBusy();
@@ -613,9 +625,6 @@ L.Socket = L.Class.extend({
 
 			return;
 		}
-		else if (textMsg.startsWith('error:') && command.errorCmd === 'saveas') {
-			this._map.hideBusy();
-		}
 		else if (textMsg.startsWith('error:') && command.errorCmd === 'load') {
 			this._map.hideBusy();
 			this.close();
@@ -756,6 +765,13 @@ L.Socket = L.Class.extend({
 							NewName: command.filename
 						}
 					});
+				} else if (textMsg.startsWith('saveas:')) {
+					this._map.fire('postMessage', {
+						msgId: 'Action_Save_Resp',
+						args: {
+							success: true
+						}
+					});
 				}
 			}
 			// var name = command.name; - ignored, we get the new name via the wopi's BaseFileName


More information about the Libreoffice-commits mailing list