From 80b6e9782421223f7abf84f4eb7e4c824804f67f Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Sun, 4 Jun 2017 23:40:18 -0400 Subject: [PATCH] Set EverModified on saving the document When saving while editing a cell, the document is saved with the new cell contents (as the cell editing is interrupted and applied), but the modified status is not published to the client (loleaflet). This has the unfortunate side-effect that the EverModified flag is not set in this scenario. To avoid this, this patch sets the EverModified upon successful saving. This is easier than forcing LO Core to emit ModifiedStatus=true in the scenario above. Though it suffers from the false-positive result when the user forces a save. Although this is probably defensible, since technically the document changes upon saving (though not the content if there was nothing new to save). On the other hand, it's less harmful to signal modification due to save than to ignore genuine modification to the document. Change-Id: I7ccba62731f534b69819f7924eeb9231d874c111 Reviewed-on: https://gerrit.libreoffice.org/38398 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian --- loleaflet/dist/toolbar/toolbar.js | 10 +++++++--- wsd/ClientSession.cpp | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js index 4b97fd619..ea3ab1d21 100644 --- a/loleaflet/dist/toolbar/toolbar.js +++ b/loleaflet/dist/toolbar/toolbar.js @@ -1421,10 +1421,14 @@ map.on('commandresult', function (e) { var commandName = e.commandName; if (commandName === '.uno:Save' && e.success === true) { + // Saved a new version; the document is modified. + map._everModified = true; + // owncloud integration - if (typeof window.parent.documentsMain !== 'undefined') { - window.parent.documentsMain.saveDocumentBack(); - } + //FIXME: CSP Violation. + //if (typeof window.parent.documentsMain !== 'undefined') { + // window.parent.documentsMain.saveDocumentBack(); + // } } else if ((commandName === '.uno:Undo' || commandName === '.uno:Redo') && e.success === true && e.result.value && !isNaN(e.result.value)) { /*UNDO_CONFLICT*/ diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp index 20b50b22e..125b24ee0 100644 --- a/wsd/ClientSession.cpp +++ b/wsd/ClientSession.cpp @@ -561,6 +561,7 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt // Save to Storage and log result. std::string id = getId(); docBroker->saveToStorage(id, success, result); + forwardToClient(payload); return true; } }