[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - 2 commits - loleaflet/src wsd/ClientSession.cpp wsd/ClientSession.hpp wsd/DocumentBroker.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu Apr 20 08:34:09 UTC 2017


 loleaflet/src/control/Control.ContextMenu.js |    4 +---
 wsd/ClientSession.cpp                        |    4 +++-
 wsd/ClientSession.hpp                        |   10 +++++++++-
 wsd/DocumentBroker.cpp                       |    1 +
 4 files changed, 14 insertions(+), 5 deletions(-)

New commits:
commit c1dbc3a117ef77557db10c98a9d5ca43bb2065f6
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Thu Apr 20 00:08:13 2017 -0400

    wsd: rely only on loaded sessions for saving
    
    If a session is not loaded, it might never
    do so. We should skip them when deciding
    whether to save using a disconnecting
    session or rely on another.
    
    This is to avoid failing to save when
    the remaining sessions never really load
    the document at all, and are therefore useless.
    
    Change-Id: I4e7127e12960a31e9f66e835bb63fb2347390711
    Reviewed-on: https://gerrit.libreoffice.org/36710
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    (cherry picked from commit f326a058d41f6a0cc334f8458d98ca68cc40f189)
    Reviewed-on: https://gerrit.libreoffice.org/36713
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 414f8b94..8be60603 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -37,7 +37,8 @@ ClientSession::ClientSession(const std::string& id,
     _docBroker(docBroker),
     _uriPublic(uriPublic),
     _isDocumentOwner(false),
-    _isAttached(false)
+    _isAttached(false),
+    _isLoaded(false)
 {
     const size_t curConnections = ++LOOLWSD::NumConnections;
     LOG_INF("ClientSession ctor [" << getName() << "], current number of connections: " << curConnections);
@@ -631,6 +632,7 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
         }
         else if (tokens[0] == "status:")
         {
+            setLoaded();
             docBroker->setLoaded();
 
             // Forward the status response to the client.
diff --git a/wsd/ClientSession.hpp b/wsd/ClientSession.hpp
index 9cd67533..58ca0bb0 100644
--- a/wsd/ClientSession.hpp
+++ b/wsd/ClientSession.hpp
@@ -34,10 +34,14 @@ public:
 
     void setReadOnly() override;
 
-    /// Returns true if a document is loaded (i.e. we got status message).
+    /// Returns true if this session is added to a DocBroker.
     bool isAttached() const { return _isAttached; }
     void setAttached() { _isAttached = true; }
 
+    /// Returns true if this session has loaded a view (i.e. we got status message).
+    bool isLoaded() const { return _isLoaded; }
+    void setLoaded() { _isLoaded = true; }
+
     const std::string getUserId() const { return _userId; }
     void setUserId(const std::string& userId) { _userId = userId; }
     void setUserName(const std::string& userName) { _userName = userName; }
@@ -139,8 +143,12 @@ private:
     /// The socket to which the converted (saveas) doc is sent.
     std::shared_ptr<StreamSocket> _saveAsSocket;
 
+    /// If we are added to a DocBroker.
     bool _isAttached;
 
+    /// If we have loaded a view.
+    bool _isLoaded;
+
     /// Wopi FileInfo object
     std::unique_ptr<WopiStorage::WOPIFileInfo> _wopiFileInfo;
 
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 1afd30f0..0c60326d 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1216,6 +1216,7 @@ void DocumentBroker::destroyIfLastEditor(const std::string& id)
         for (const auto& it : _sessions)
         {
             if (it.second->getId() != id &&
+                it.second->isLoaded() &&
                 !it.second->isReadOnly())
             {
                 // Found another editable.
commit e51611f289ecbc64813dc019b2a9e015d6fa0a6a
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed Apr 19 20:14:00 2017 -0400

    loleaflet: remove unnecessary spreadsheet context menu items
    
    It is replaced by interactive client side annotations
    
    Change-Id: Ib21926bea1cf125c82b9254c536d70ec94d95f91
    Reviewed-on: https://gerrit.libreoffice.org/36706
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/src/control/Control.ContextMenu.js b/loleaflet/src/control/Control.ContextMenu.js
index 4961f892..70f726f9 100644
--- a/loleaflet/src/control/Control.ContextMenu.js
+++ b/loleaflet/src/control/Control.ContextMenu.js
@@ -35,9 +35,7 @@ L.Control.ContextMenu = L.Control.extend({
 				   'UpdateCurIndex','RemoveTableOf',
 				   'ReplyComment', 'DeleteComment', 'DeleteAuthor', 'DeleteAllNotes'],
 
-			spreadsheet: ['MergeCells', 'SplitCells',
-						  'InsertAnnotation', 'EditAnnotation', 'DeleteNote', 'ShowNote', 'HideNote',
-						  'RecalcPivotTable'],
+			spreadsheet: ['MergeCells', 'SplitCells', 'RecalcPivotTable'],
 
 			presentation: [],
 			drawing: []


More information about the Libreoffice-commits mailing list