[Libreoffice-commits] online.git: loolwsd/ChildSession.cpp
Henry Castro
hcastro at collabora.com
Sun Aug 28 13:04:17 UTC 2016
loolwsd/ChildSession.cpp | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
New commits:
commit fa2a99459f2ce65a45585e70b0fc7de3fe708621
Author: Henry Castro <hcastro at collabora.com>
Date: Sun Aug 28 08:46:38 2016 -0400
loolwsd: add fake .uno:DocumentRepair
Avoid double round trip requesting command value pair
.uno.Redo, .uno:Undo
diff --git a/loolwsd/ChildSession.cpp b/loolwsd/ChildSession.cpp
index c186887..b9a2f49 100644
--- a/loolwsd/ChildSession.cpp
+++ b/loolwsd/ChildSession.cpp
@@ -407,6 +407,8 @@ bool ChildSession::getStatus(const char* /*buffer*/, int /*length*/)
bool ChildSession::getCommandValues(const char* /*buffer*/, int /*length*/, StringTokenizer& tokens)
{
+ bool success;
+ char* pValues;
std::string command;
if (tokens.count() != 2 || !getTokenString(tokens[1], "command", command))
{
@@ -419,9 +421,23 @@ bool ChildSession::getCommandValues(const char* /*buffer*/, int /*length*/, Stri
if (_multiView)
_loKitDocument->setView(_viewId);
- char* ptrValues = _loKitDocument->getCommandValues(command.c_str());
- bool success = sendTextFrame("commandvalues: " + std::string(ptrValues));
- std::free(ptrValues);
+ if (command == ".uno:DocumentRepair")
+ {
+ char* pUndo;
+ const std::string json("{\"commandName\":\".uno:DocumentRepair\",\"Redo\":%s,\"Undo\":%s}");
+ pValues = _loKitDocument->getCommandValues(".uno:Redo");
+ pUndo = _loKitDocument->getCommandValues(".uno:Undo");
+ success = sendTextFrame("commandvalues: " + Poco::format(json, std::string(pValues), std::string(pUndo)));
+ std::free(pValues);
+ std::free(pUndo);
+ }
+ else
+ {
+ pValues = _loKitDocument->getCommandValues(command.c_str());
+ success = sendTextFrame("commandvalues: " + std::string(pValues));
+ std::free(pValues);
+ }
+
return success;
}
More information about the Libreoffice-commits
mailing list