[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2-3' - android/lib kit/ChildSession.cpp loleaflet/src wsd/ClientSession.cpp

Jan Holesovsky (via logerrit) logerrit at kemper.freedesktop.org
Fri May 8 09:10:57 UTC 2020


 android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java |    8 ++++++
 kit/ChildSession.cpp                                                 |    7 +++--
 loleaflet/src/control/Control.JSDialogBuilder.js                     |    7 ++++-
 loleaflet/src/layer/tile/TileLayer.js                                |    2 +
 wsd/ClientSession.cpp                                                |   12 ----------
 5 files changed, 20 insertions(+), 16 deletions(-)

New commits:
commit 870a7ec5620eb742bd8fb2a9680ff67101a37dd7
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Thu May 7 16:16:03 2020 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Fri May 8 11:10:37 2020 +0200

    function bar: Index the function by name, not by index.
    
    Depends on a core change that changes the ABI of the completeFunction().
    
    Change-Id: I27daf31d49347c4a308518e14a9b8b97f3b48991
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93667
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>

diff --git a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
index ca60f9b5c..5074d637a 100644
--- a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
+++ b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
@@ -813,6 +813,14 @@ public class LOActivity extends AppCompatActivity {
         mWebView.post(new Runnable() {
             public void run() {
                 Log.i(TAG, "Forwarding to the WebView: " + message);
+
+                /* Debug only: in case the message is too long, truncated in the logcat, and you need to see it.
+                final int size = 80;
+                for (int start = 0; start < message.length(); start += size) {
+                    Log.i(TAG, "split: " + message.substring(start, Math.min(message.length(), start + size)));
+                }
+                */
+
                 mWebView.loadUrl("javascript:window.TheFakeWebSocket.onmessage({'data':" + message + "});");
             }
         });
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index f576f2785..b02e7a17a 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -1428,10 +1428,11 @@ bool ChildSession::dialogEvent(const char* /*buffer*/, int /*length*/, const Str
 
 bool ChildSession::completeFunction(const char* /*buffer*/, int /*length*/, const StringVector& tokens)
 {
-    int index;
+    std::string functionName;
 
     if (tokens.size() != 2 ||
-        !getTokenInteger(tokens[1], "index", index))
+        !getTokenString(tokens[1], "name", functionName) ||
+        functionName.empty())
     {
         sendTextFrameAndLogError("error: cmd=completefunction kind=syntax");
         return false;
@@ -1439,7 +1440,7 @@ bool ChildSession::completeFunction(const char* /*buffer*/, int /*length*/, cons
 
     getLOKitDocument()->setView(_viewId);
 
-    getLOKitDocument()->completeFunction(index);
+    getLOKitDocument()->completeFunction(functionName.c_str());
     return true;
 }
 
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index b4179fa60..b5705601b 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -488,14 +488,17 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		$(contentDiv).hide();
 		if (builder.wizard) {
 			var that = this;
+			var functionName = data.functionName;
 			$(rightDiv).click(function() {
 				builder.wizard.goLevelDown(contentDiv);
 				if (contentNode.onshow)
 					contentNode.onshow();
 			});
 			$(leftDiv).click(function() {
-				that.map._socket.sendMessage('completefunction index=' + data.index);
-				that.map.fire('closemobilewizard');
+				if (functionName !== '') {
+					that.map._socket.sendMessage('completefunction name=' + functionName);
+					that.map.fire('closemobilewizard');
+				}
 			});
 		} else {
 			console.debug('Builder used outside of mobile wizard: please implement the click handler');
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 1947bc894..1b413f9d7 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -824,6 +824,7 @@ L.TileLayer = L.GridLayer.extend({
 				id: '',
 				type: 'calcfuncpanel',
 				text: name,
+				functionName: name,
 				index: func.index,
 				enabled: true,
 				children: []
@@ -863,6 +864,7 @@ L.TileLayer = L.GridLayer.extend({
 				id: '',
 				type: 'calcfuncpanel',
 				text: name,
+				functionName: name,
 				index: func.index,
 				category: func.category,
 				enabled: true,
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index c4c6ec7cb..64ae23deb 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -720,17 +720,7 @@ bool ClientSession::_handleInput(const char *buffer, int length)
     }
     else if (tokens.equals(0, "completefunction"))
     {
-        int temp;
-        if (tokens.size() != 2 ||
-            !getTokenInteger(tokens[1], "index", temp))
-        {
-            LOG_WRN("Invalid syntax for '" << tokens[0] << "' message: [" << firstLine << "].");
-            return true;
-        }
-        else
-        {
-            return forwardToChild(std::string(buffer, length), docBroker);
-        }
+        return forwardToChild(std::string(buffer, length), docBroker);
     }
     else
     {


More information about the Libreoffice-commits mailing list