Makefile.fetch | 1 RepositoryExternal.mk | 16 -- android/source/res/values-de/strings.xml | 1 android/source/res/values/strings.xml | 1 android/source/src/java/org/libreoffice/InvalidationHandler.java | 2 android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java | 60 +++++++++- configure.ac | 3 download.lst | 2 external/Module_external.mk | 1 external/owncloud-android-lib/ExternalProject_owncloud_android_lib.mk | 23 --- external/owncloud-android-lib/Makefile | 7 - external/owncloud-android-lib/Module_owncloud-android-lib.mk | 19 --- external/owncloud-android-lib/README | 7 - external/owncloud-android-lib/UnpackedTarball_owncloud_android_lib.mk | 16 -- external/owncloud-android-lib/build.gradle | 57 --------- readlicense_oo/license/license.xml | 17 -- 16 files changed, 62 insertions(+), 171 deletions(-)
New commits: commit 2df8b776e635efc5e59aaf6c8a5a7f4c218d74d0 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Mar 19 13:07:41 2021 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Mar 22 07:56:13 2021 +0100 tdf#129833 android: Allow editing writable docs passed by Intent When a document is passed by an Intent in Android Viewer, allow editing if the Intent has flag 'Intent.FLAG_GRANT_WRITE_URI_PERMISSION' set. Since LibreOffice operates on a temporary copy in this case, write the content of the temporary file back to the original URI when saving. This in particular allows editing documents passed from third-party apps, e.g. opened from Android's "Files" app or the NextCloud app. The online-based Android app already does something similar. Change-Id: Icf252a95dd9a8089ca8610ccf3edfbeee2682e1a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112767 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/android/source/res/values-de/strings.xml b/android/source/res/values-de/strings.xml index ff58b14babc5..64eaa844a754 100644 --- a/android/source/res/values-de/strings.xml +++ b/android/source/res/values-de/strings.xml @@ -96,6 +96,7 @@ <string name="message_saved">Speichern beendet</string> <string name="message_saving">Dokument wird gespeichert…</string> <string name="message_save_incomplete">Speichern unvollständig. Gab es Änderungen?</string> + <string name="message_saving_failed">Speichern des Dokuments ist fehlgeschlagen.</string> <string name="create_new_file_success">"Neue Datei angelegt - "</string> <string name="create_new_file_error">Neue Datei konnte nicht angelegt weden, bitte Prüfen Sie den eingegeben Dateinamen.</string> diff --git a/android/source/res/values/strings.xml b/android/source/res/values/strings.xml index aa32497862f6..a44d81ee5faf 100644 --- a/android/source/res/values/strings.xml +++ b/android/source/res/values/strings.xml @@ -95,6 +95,7 @@ <!-- Feedback messages --> <string name="message_saved">Save complete</string> <string name="message_saving">Saving the document…</string> + <string name="message_saving_failed">Saving the document failed.</string> <string name="message_save_incomplete">Save incomplete. Were there any changes?</string> <string name="create_new_file_success">"Created new file - "</string> <string name="create_new_file_error">Unable to create new file, please check entered file name.</string> diff --git a/android/source/src/java/org/libreoffice/InvalidationHandler.java b/android/source/src/java/org/libreoffice/InvalidationHandler.java index 32e9b56656dd..588fec9f5372 100644 --- a/android/source/src/java/org/libreoffice/InvalidationHandler.java +++ b/android/source/src/java/org/libreoffice/InvalidationHandler.java @@ -139,7 +139,7 @@ public class InvalidationHandler implements Document.MessageCallback, Office.Mes JSONObject payloadObject = new JSONObject(payload); if (payloadObject.getString("commandName").equals(".uno:Save")) { if (payloadObject.getString("success").equals("true")) { - mContext.saveFilesToCloud(); + mContext.saveFileToOriginalSource(); } }else if(payloadObject.getString("commandName").equals(".uno:Name") || payloadObject.getString("commandName").equals(".uno:RenamePage")){ diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java index b640fa404973..bf6108edc8af 100644 --- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java +++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java @@ -46,9 +46,11 @@ import org.mozilla.gecko.gfx.GeckoLayerClient; import org.mozilla.gecko.gfx.LayerView; import java.io.File; +import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; +import java.io.OutputStream; import java.net.URI; import java.nio.ByteBuffer; import java.nio.channels.Channels; @@ -191,7 +193,8 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin if (getIntent().getData().getScheme().equals(ContentResolver.SCHEME_CONTENT)) { if (copyFileToTemp() && mTempFile != null) { mInputFile = mTempFile; - mbISReadOnlyMode = true; + boolean isReadOnlyDoc = (getIntent().getFlags() & Intent.FLAG_GRANT_WRITE_URI_PERMISSION) == 0; + mbISReadOnlyMode = !isExperimentalMode() || isReadOnlyDoc; Log.d(LOGTAG, "SCHEME_CONTENT: getPath(): " + getIntent().getData().getPath()); String displayName = extractDisplayNameFromIntent(); @@ -355,6 +358,61 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND_NOTIFY, ".uno:Save", true)); } + public void saveFileToOriginalSource() { + if (documentUri != null) { + // case where file was opened using IDocumentProvider from within LO app + saveFilesToCloud(); + } else { + // case where file was passed via Intent + if (isReadOnlyMode() || mInputFile == null || getIntent().getData() == null || !getIntent().getData().getScheme().equals(ContentResolver.SCHEME_CONTENT)) + return; + + Uri uri = getIntent().getData(); + FileInputStream inputStream = null; + OutputStream outputStream = null; + + try { + inputStream = new FileInputStream(mInputFile); + // OutputStream for the actual (original) location + outputStream = getContentResolver().openOutputStream(uri); + + byte[] buffer = new byte[4096]; + int readBytes = inputStream.read(buffer); + while (readBytes != -1) { + outputStream.write(buffer, 0, readBytes); + readBytes = inputStream.read(buffer); + } + + runOnUiThread(new Runnable() { + @Override + public void run() { + Toast.makeText(LibreOfficeMainActivity.this, R.string.message_saved, + Toast.LENGTH_SHORT).show(); + } + }); + setDocumentChanged(false); + } catch (Exception e) { + runOnUiThread(new Runnable() { + @Override + public void run() { + Toast.makeText(LibreOfficeMainActivity.this, R.string.message_saving_failed, + Toast.LENGTH_SHORT).show(); + } + }); + e.printStackTrace(); + } finally { + try { + if (inputStream != null) + inputStream.close(); + if (outputStream != null) + outputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + public void saveFilesToCloud(){ final Activity activity = LibreOfficeMainActivity.this; final AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>() { commit 2fa33c89ffcf0bb5aa013ee71a06b12676b42997 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Mar 17 12:54:01 2021 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Mar 22 07:55:52 2021 +0100 Drop external owncloud-android-lib It's no longer used by Android Viewer and use in the online-based Android app has already been removed in online commit commit 2a52d768dd61f2ef8fedccb32f015c9095915935 Date: Wed Feb 19 09:05:56 2020 +0100 android shell: Remove the 'storage framework', we have content providers. Change-Id: I468c7121eb495eb8b1a8892f14f2c289b94b7a93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112766 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/Makefile.fetch b/Makefile.fetch index b5596520d5fa..a69a5161ff6e 100644 --- a/Makefile.fetch +++ b/Makefile.fetch @@ -201,7 +201,6 @@ $(WORKDIR)/download: $(BUILDDIR)/config_$(gb_Side).mk $(SRCDIR)/download.lst $(S $(call fetch_Optional,OPENLDAP,OPENLDAP_TARBALL) \ $(call fetch_Optional,OPENSSL,OPENSSL_TARBALL) \ $(call fetch_Optional,ORCUS,ORCUS_TARBALL) \ - $(call fetch_Optional,OWNCLOUD_ANDROID_LIB,OWNCLOUD_ANDROID_LIB_TARBALL) \ $(call fetch_Optional,PAGEMAKER,PAGEMAKER_TARBALL) \ $(call fetch_Optional,PDFIUM,PDFIUM_TARBALL) \ $(call fetch_Optional,POPPLER,POPPLER_TARBALL) \ diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index 5303d120a88f..a40710e91ab6 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -4103,22 +4103,6 @@ endef endif -ifeq (OWNCLOUD_ANDROID_LIB,$(filter OWNCLOUD_ANDROID_LIB,$(BUILD_TYPE))) - -$(eval $(call gb_Helper_register_jars,OXT,\ - owncloud-android-library \ -)) - -define gb_Jar__use_owncloud_android_lib -$(call gb_Jar_use_external_project,$(1),owncloud-android-lib) -$(call gb_Jar_use_external_jar,$(1),$(call gb_UnpackedTarball_get_dir,owncloud-android-lib)/bin/owncloud-android-library.jar) -endef -define gb_ExternalProject__use_owncloud_android_lib -$(call gb_ExternalProject_use_external_project,$(1),owncloud_android_lib) -endef - -endif - ifneq ($(ENABLE_ONLINE_UPDATE_MAR),) ifneq ($(SYSTEM_BZIP2),) diff --git a/configure.ac b/configure.ac index 5e80cbfdb791..2eb0e423ab4e 100644 --- a/configure.ac +++ b/configure.ac @@ -751,9 +751,6 @@ if test -n "$with_android_ndk"; then CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS" CXX_BASE="clang++" fi - - # remember to download the ownCloud Android library later - BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB" fi AC_SUBST(ANDROID_NDK_HOME) AC_SUBST(ANDROID_APP_ABI) diff --git a/download.lst b/download.lst index 7de2e67b7360..b433fb9b4848 100644 --- a/download.lst +++ b/download.lst @@ -208,8 +208,6 @@ export OPENSSL_SHA256SUM := e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de6 export OPENSSL_TARBALL := openssl-1.1.1i.tar.gz export ORCUS_SHA256SUM := c700d1325f744104d9fca0d5a019434901e9d51a16eedfb05792f90a298587a4 export ORCUS_TARBALL := liborcus-0.16.1.tar.bz2 -export OWNCLOUD_ANDROID_LIB_SHA256SUM := b18b3e3ef7fae6a79b62f2bb43cc47a5346b6330f6a383dc4be34439aca5e9fb -export OWNCLOUD_ANDROID_LIB_TARBALL := owncloud-android-library-0.9.4-no-binary-deps.tar.gz export PAGEMAKER_SHA256SUM := 66adacd705a7d19895e08eac46d1e851332adf2e736c566bef1164e7a442519d export PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz export PDFIUM_SHA256SUM := 7676aba84cb064e5e6f3a5173284087372761d1f704b0626570fce0445de520e diff --git a/external/Module_external.mk b/external/Module_external.mk index ae54d6f48794..2282f5956b67 100644 --- a/external/Module_external.mk +++ b/external/Module_external.mk @@ -83,7 +83,6 @@ $(eval $(call gb_Module_add_moduledirs,external,\ $(call gb_Helper_optional,OPENLDAP,openldap) \ $(call gb_Helper_optional,OPENSSL,openssl) \ $(call gb_Helper_optional,ORCUS,liborcus) \ - $(call gb_Helper_optional,OWNCLOUD_ANDROID_LIB,owncloud-android-lib) \ $(call gb_Helper_optional,PAGEMAKER,libpagemaker) \ $(call gb_Helper_optional,PDFIUM,pdfium) \ $(call gb_Helper_optional,POPPLER,poppler) \ diff --git a/external/owncloud-android-lib/ExternalProject_owncloud_android_lib.mk b/external/owncloud-android-lib/ExternalProject_owncloud_android_lib.mk deleted file mode 100644 index 149becee9209..000000000000 --- a/external/owncloud-android-lib/ExternalProject_owncloud_android_lib.mk +++ /dev/null @@ -1,23 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# - -$(eval $(call gb_ExternalProject_ExternalProject,owncloud_android_lib)) - -$(eval $(call gb_ExternalProject_register_targets,owncloud_android_lib,\ - build \ -)) - -$(call gb_ExternalProject_get_state_target,owncloud_android_lib,build) : - $(call gb_Trace_StartRange,owncloud_android_lib,EXTERNAL) - $(call gb_ExternalProject_run,build,\ - ANDROID_HOME=$(ANDROID_SDK_HOME) $(SRCDIR)/android/source/gradlew assemble \ - ) - $(call gb_Trace_EndRange,owncloud_android_lib,EXTERNAL) - -# vim: set noet sw=4 ts=4: diff --git a/external/owncloud-android-lib/Makefile b/external/owncloud-android-lib/Makefile deleted file mode 100644 index e4968cf85fb6..000000000000 --- a/external/owncloud-android-lib/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- - -module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) - -include $(module_directory)/../../solenv/gbuild/partial_build.mk - -# vim: set noet sw=4 ts=4: diff --git a/external/owncloud-android-lib/Module_owncloud-android-lib.mk b/external/owncloud-android-lib/Module_owncloud-android-lib.mk deleted file mode 100644 index a57e70a79b84..000000000000 --- a/external/owncloud-android-lib/Module_owncloud-android-lib.mk +++ /dev/null @@ -1,19 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# - -$(eval $(call gb_Module_Module,owncloud_android_lib)) - -ifneq ($(ENABLE_JAVA),) -$(eval $(call gb_Module_add_targets,owncloud_android_lib, \ - ExternalProject_owncloud_android_lib \ - UnpackedTarball_owncloud_android_lib \ -)) -endif - -# vim: set noet sw=4 ts=4: diff --git a/external/owncloud-android-lib/README b/external/owncloud-android-lib/README deleted file mode 100644 index 921619d630cc..000000000000 --- a/external/owncloud-android-lib/README +++ /dev/null @@ -1,7 +0,0 @@ -Library required to access ownCloud servers from Android. - -Code from https://github.com/jaragunde/owncloud-android-library, release 0.9.4. -Notice it is a fork from the official repository at -https://github.com/owncloud/android-library, the test and example projects have -been removed and the binary jars have been replaced with the sources of the -required libraries. diff --git a/external/owncloud-android-lib/UnpackedTarball_owncloud_android_lib.mk b/external/owncloud-android-lib/UnpackedTarball_owncloud_android_lib.mk deleted file mode 100644 index b9038cd1c961..000000000000 --- a/external/owncloud-android-lib/UnpackedTarball_owncloud_android_lib.mk +++ /dev/null @@ -1,16 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# - -$(eval $(call gb_UnpackedTarball_UnpackedTarball,owncloud_android_lib)) - -$(eval $(call gb_UnpackedTarball_set_tarball,owncloud_android_lib,$(OWNCLOUD_ANDROID_LIB_TARBALL))) - -$(eval $(call gb_UnpackedTarball_add_file,owncloud_android_lib,build.gradle,external/owncloud-android-lib/build.gradle)) - -# vim: set noet sw=4 ts=4: diff --git a/external/owncloud-android-lib/build.gradle b/external/owncloud-android-lib/build.gradle deleted file mode 100644 index 9203dc45a549..000000000000 --- a/external/owncloud-android-lib/build.gradle +++ /dev/null @@ -1,57 +0,0 @@ -apply plugin: 'com.android.library' -buildscript { - repositories { - jcenter() - google() - } - dependencies { - classpath 'com.android.tools.build:gradle:3.1.3' - } -} - -allprojects { - repositories { - jcenter() - google() - } -} - -android { - useLibrary 'org.apache.http.legacy' - - compileOptions { - encoding 'ISO8859-1' - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - } - - compileSdkVersion 26 - buildToolsVersion "27.0.3" - - defaultConfig { - minSdkVersion 16 - targetSdkVersion 26 - } - - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java { - srcDirs = [ - 'libs/commons-codec-1.9/src/main/java', - 'libs/commons-httpclient-3.1/src/java', - 'libs/jackrabbit-webdav-2.7.2/src/main/java', - 'libs/slf4j-1.7.12/src/java', - 'libs/tomcat-7.0.40/java', - 'src' - ] - } - resources { - srcDirs = [ - 'libs/tomcat-7.0.40/java', - 'libs/jackrabbit-webdav-2.7.2/src/main/java' - ] - } - } - } -} diff --git a/readlicense_oo/license/license.xml b/readlicense_oo/license/license.xml index f78a1a742df8..bfcbc224ecc8 100644 --- a/readlicense_oo/license/license.xml +++ b/readlicense_oo/license/license.xml @@ -1575,23 +1575,6 @@ changed. i.e. this code cannot simply be copied and put under another distribution license [including the GNU Public License.]</p> </div> - <div class="OWNCLOUD_ANDROID_LIB"> - <h2>ownCloud Android Library</h2> - <p>The following software may be included in this product: ownCloud Android Library. ownCloud Android Library - is available under MIT license.</p> - <p>Copyright (C) 2019 ownCloud GmbH. Copyright (C) 2012 Bartek Przybylski</p> - <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated - documentation files (the "Software"), to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, - and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p> - <p>The above copyright notice and this permission notice shall be included in all copies or substantial - portions of the Software.</p> - <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT - LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT - SHALL THE AUTHORS OR COPYRIGHT HOLDERSBE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE.</p> - </div> <div class="PDFIUM"> <h2>PDFium</h2> <p>The following software may be included in this product: PDFium. Use of any of this software is governed by _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits