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 115bb1b652dc931344c4a19f0bafd7363115914b Author: mert <mert.tu...@collabora.com> AuthorDate: Thu Sep 10 17:04:36 2020 +0300 Commit: Mert Tumer <mert.tu...@collabora.com> CommitDate: Tue Sep 15 15:14:40 2020 +0200 Fix unable to open password protected documents on mobile Change-Id: Ifd67cb6f3640784176abfe483f0364c1dfe4b5d9 Signed-off-by: mert <mert.tu...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102388 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102729 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 e88a59d89..61e35ff42 100644 --- a/common/Session.hpp +++ b/common/Session.hpp @@ -193,6 +193,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 8a22e0c8d..750e98bd6 100644 --- a/loleaflet/src/core/Socket.js +++ b/loleaflet/src/core/Socket.js @@ -696,6 +696,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 60733a0c5..44b3f0271 100644 --- a/wsd/ClientSession.cpp +++ b/wsd/ClientSession.cpp @@ -395,6 +395,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(docPassword); + } + } + return loadDocument(buffer, length, tokens, docBroker); + } else if (getDocURL().empty()) { sendTextFrameAndLogError("error: cmd=" + tokens[0] + " kind=nodocloaded"); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits