wsd/DocumentBroker.cpp | 3 +++ wsd/Storage.cpp | 1 + wsd/Storage.hpp | 9 ++++++++- wsd/reference.txt | 11 +++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-)
New commits: commit 5fe34b8e84ad4550f9cc4c80ef436e30a73d5a2a Author: Jan Holesovsky <ke...@collabora.com> Date: Mon Sep 25 19:16:48 2017 +0200 PutFile ext: X-LOOL-WOPI-IsModifiedByUser header to indicate modifications. Change-Id: I5d69903211045969d678df695717eae7452e7f04 Reviewed-on: https://gerrit.libreoffice.org/42852 Reviewed-by: pranavk <pran...@collabora.co.uk> Tested-by: pranavk <pran...@collabora.co.uk> diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index 7ee65646..e8cc862d 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -808,6 +808,9 @@ bool DocumentBroker::sendUnoSave(const std::string& sessionId, bool dontTerminat // arguments end oss << "}"; + assert(_storage); + _storage->setUserModified(_isModified); + const auto saveArgs = oss.str(); LOG_TRC(".uno:Save arguments: " << saveArgs); const auto command = "uno .uno:Save " + saveArgs; diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp index 526d8783..dc2e6ac5 100644 --- a/wsd/Storage.cpp +++ b/wsd/Storage.cpp @@ -684,6 +684,7 @@ StorageBase::SaveResult WopiStorage::saveLocalFileToStorage(const Authorization& Poco::DateTimeFormatter::format(Poco::DateTime(_fileInfo._modifiedTime), Poco::DateTimeFormat::ISO8601_FRAC_FORMAT)); } + request.set("X-LOOL-WOPI-IsModifiedByUser", _isUserModified? "true": "false"); request.setContentType("application/octet-stream"); request.setContentLength(size); diff --git a/wsd/Storage.hpp b/wsd/Storage.hpp index badaa306..0d5a6cbb 100644 --- a/wsd/Storage.hpp +++ b/wsd/Storage.hpp @@ -78,7 +78,8 @@ public: _jailPath(jailPath), _fileInfo("", "lool", Poco::Timestamp::fromEpochTime(0), 0), _isLoaded(false), - _forceSave(false) + _forceSave(false), + _isUserModified(false) { LOG_DBG("Storage ctor: " << uri.toString()); } @@ -94,6 +95,9 @@ public: /// even if document turned out to be changed in storage void forceSave() { _forceSave = true; } + /// To be able to set the WOPI extension header appropriately. + void setUserModified(bool isUserModified) { _isUserModified = isUserModified; } + /// Returns the basic information about the file. const FileInfo& getFileInfo() const { return _fileInfo; } @@ -129,6 +133,9 @@ protected: bool _isLoaded; bool _forceSave; + /// The document has been modified by the user. + bool _isUserModified; + static bool FilesystemEnabled; static bool WopiEnabled; /// Allowed/denied WOPI hosts, if any and if WOPI is enabled. diff --git a/wsd/reference.txt b/wsd/reference.txt index 2206f89a..0df894d6 100644 --- a/wsd/reference.txt +++ b/wsd/reference.txt @@ -62,3 +62,14 @@ WatermarkText Note that it is possible to just hide print,save,export options while still being able to access them from WOPI hosts using PostMessage API (see loleaflet/reference.html) + +PutFile headers +--------------- + +PutFile additionally indicates whether the user has modified the document +before the save, or if they just pressed the Save button without any +modification. The following header: + + X-LOOL-WOPI-IsModifiedByUser + +will have the value 'true' or 'false' accordingly. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits