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

mert (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 10 19:58:25 UTC 2020


 android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java |    4 +++
 common/Session.hpp                                                   |    4 +++
 loleaflet/src/core/Socket.js                                         |    3 ++
 wsd/ClientSession.cpp                                                |   13 ++++++++++
 4 files changed, 24 insertions(+)

New commits:
commit 2500b10564bc37140b45ffc7abe641841fc6ec72
Author:     mert <mert.tumer at collabora.com>
AuthorDate: Thu Sep 10 17:04:36 2020 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Sep 10 21:57:55 2020 +0200

    Fix unable to open password protected documents on mobile
    
    Change-Id: Ifd67cb6f3640784176abfe483f0364c1dfe4b5d9
    Signed-off-by: mert <mert.tumer at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102388
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.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 88b1fdafd..2066a1fd6 100644
--- a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
+++ b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
@@ -943,6 +943,10 @@ public class LOActivity extends AppCompatActivity {
                 }
                 return false;
             }
+            case "loadwithpassword": {
+                mProgressDialog.determinate(R.string.loading);
+                return true;
+            }
         }
         return true;
     }
diff --git a/common/Session.hpp b/common/Session.hpp
index 34a566b3c..523b45b12 100644
--- a/common/Session.hpp
+++ b/common/Session.hpp
@@ -180,6 +180,10 @@ public:
 
     bool getHaveDocPassword() const { return _haveDocPassword; }
 
+    void setHaveDocPassword(const bool val) { _haveDocPassword = val; }
+
+    void setDocPassword(const std::string& password) { _docPassword = password; }
+
     const std::string& getDocPassword() const { return _docPassword; }
 
     const std::string& getUserExtraInfo() const { return _userExtraInfo; }
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 32a601aca..ce834a21f 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -683,6 +683,9 @@ L.Socket = L.Class.extend({
 					callback: L.bind(function(data) {
 						if (data) {
 							this._map._docPassword = data.password;
+							if (window.ThisIsAMobileApp) {
+								window.postMobileMessage('loadwithpassword password=' + data.password);
+							}
 							this._map.loadDocument();
 						} else if (passwordType === 'to-modify') {
 							this._map._docPassword = '';
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index b24f9b655..c00c7dbea 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -392,6 +392,19 @@ bool ClientSession::_handleInput(const char *buffer, int length)
 
         return loadDocument(buffer, length, tokens, docBroker);
     }
+    else if (tokens.equals(0, "loadwithpassword"))
+    {
+        std::string docPassword;
+        if (tokens.size() > 1 && getTokenString(tokens[1], "password", docPassword))
+        {
+            if (!docPassword.empty())
+            {
+                setHaveDocPassword(true);
+                setDocPassword(tokens[1]);
+            }
+        }
+        return loadDocument(buffer, length, tokens, docBroker);
+    }
     else if (tokens[0] != "canceltiles" &&
              tokens[0] != "tileprocessed" &&
              tokens[0] != "clientzoom" &&


More information about the Libreoffice-commits mailing list