[Libreoffice-commits] online.git: loolwsd/ChildSession.cpp loolwsd/ChildSession.hpp loolwsd/LOOLKit.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Aug 15 03:19:33 UTC 2016
loolwsd/ChildSession.cpp | 7 +++++++
loolwsd/ChildSession.hpp | 4 ++++
loolwsd/LOOLKit.cpp | 18 ++++++++++++++++++
3 files changed, 29 insertions(+)
New commits:
commit daad00812d6996eadaabf68975478ec0e43a0c84
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Aug 14 22:20:35 2016 -0400
loolwsd: refresh views on UI re-activation
Change-Id: I78d04abe939a91e56cb06f89184e651e7946b28b
Reviewed-on: https://gerrit.libreoffice.org/28134
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/ChildSession.cpp b/loolwsd/ChildSession.cpp
index d712c07..9ac519a 100644
--- a/loolwsd/ChildSession.cpp
+++ b/loolwsd/ChildSession.cpp
@@ -85,6 +85,13 @@ bool ChildSession::_handleInput(const char *buffer, int length)
if (_multiView)
_loKitDocument->setView(_viewId);
+ // Refresh the viewIds.
+ sendTextFrame("remallviews:");
+ for (const auto viewId : _docManager.getViewIds())
+ {
+ sendTextFrame("addview: " + std::to_string(viewId));
+ }
+
const int curPart = _loKitDocument->getPart();
sendTextFrame("curpart: part=" + std::to_string(curPart));
sendTextFrame("setpart: part=" + std::to_string(curPart));
diff --git a/loolwsd/ChildSession.hpp b/loolwsd/ChildSession.hpp
index 3cb3202..d2ffa01 100644
--- a/loolwsd/ChildSession.hpp
+++ b/loolwsd/ChildSession.hpp
@@ -36,6 +36,10 @@ public:
/// if it is the last and only.
virtual
void onUnload(const std::string& sessionId) = 0;
+
+ /// Get a list of all current view IDs.
+ virtual
+ std::vector<unsigned> getViewIds() const = 0;
};
/// Represents a client session, with the socket end-point,
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index e4fdb44..69bc462 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -893,6 +893,24 @@ private:
}
}
+ std::vector<unsigned> getViewIds() const override
+ {
+ std::unique_lock<std::mutex> lock(_mutex);
+
+ std::vector<unsigned> v;
+ v.reserve(_connections.size());
+ for (const auto& connection : _connections)
+ {
+ const auto& session = connection.second->getSession();
+ if (session)
+ {
+ v.push_back(session->getViewId());
+ }
+ }
+
+ return v;
+ }
+
private:
std::shared_ptr<lok::Document> load(const std::string& sessionId,
More information about the Libreoffice-commits
mailing list