[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 6 18:53:05 UTC 2020


 wsd/DocumentBroker.cpp |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit 293f4913d2cdfe5385e2cdc0e3bebde281da1578
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Mon Apr 6 12:37:12 2020 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Mon Apr 6 20:52:47 2020 +0200

    On iOS, make the document show up as modified also after auto or explicit save
    
    It is not enough to just have the core code rewrite the document file.
    We need to do the same dance as in -[DocumentViewController bye].
    
    I wonder if it would be cleaner to copy the document file to some
    temporary location when opening it, and use only that copy in Online
    and core, and then after core has saved it (either for an auto-save,
    an explicit save, or when closing the document) do the -[UIDocument
    saveToURL:forSaveOperation:completionHandler] thing?
    
    Change-Id: I78fec08a90424780dc6e794347a0acf2c64e1dab
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91741
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 0c28b94bd..0d5ce909d 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -39,6 +39,10 @@
 #include <common/Unit.hpp>
 #include <common/FileUtil.hpp>
 
+#ifdef IOS
+#import "DocumentViewController.h"
+#endif
+
 #include <sys/types.h>
 #include <sys/wait.h>
 
@@ -1284,6 +1288,17 @@ bool DocumentBroker::sendUnoSave(const std::string& sessionId, bool dontTerminat
         const auto command = "uno .uno:Save " + saveArgs;
         forwardToChild(sessionId, command);
         _lastSaveRequestTime = std::chrono::steady_clock::now();
+#ifdef IOS
+        // We need to do this so that file provider extensions notice. Just like in
+        // -[DocumentViewController bye] I suspect that will read the file and then overwrite it
+        // with the same contents, but oh well.
+        CODocument *document = [[DocumentViewController singleton] document];
+        [document saveToURL:[[[DocumentViewController singleton] document] fileURL]
+           forSaveOperation:UIDocumentSaveForOverwriting
+          completionHandler:^(BOOL success) {
+                LOG_TRC("save completion handler gets " << (success?"YES":"NO"));
+            }];
+#endif
         return true;
     }
 


More information about the Libreoffice-commits mailing list