summaryrefslogtreecommitdiff
path: root/android/source/src
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2021-04-23 13:31:52 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2021-04-23 15:01:31 +0200
commit3199182588fecac8a1c1fe202ca55702a3aab6ab (patch)
tree0feb4b0af4f3f3479ffb6c7a27741eaa4b1af78a /android/source/src
parent95b6907d8e49729b4c47cf637049cc91b45c838e (diff)
android: Offer 'Save As' in readonly mode
Provide the "Save As..." menu entry in Android Viewer also if read-only mode is used, either because the experimental editing mode is disabled or there is no write access to the document. This way, a copy of the original document can be saved elsewhere. In case experimental mode is enabled, editing is allowed after saving the document. Call 'ToolbarController#setEditMode' in 'ToolbarController#switchToEditMode' right away instead of posting it to the main handler in a Runnable along with the other commands (that change the UI), so the new state is already taken into account in 'LibreOfficeMainActivity#onResume' and the toolbar isn't switched back to view mode there right away. Change-Id: I321e42d0833463b31c7b39336d66b29bd51d9890 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114539 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'android/source/src')
-rw-r--r--android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java2
-rw-r--r--android/source/src/java/org/libreoffice/ToolbarController.java5
2 files changed, 4 insertions, 3 deletions
diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
index f7f5f6ae0ed6..28427b51435b 100644
--- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -339,7 +339,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
String displayName = FileUtilities.retrieveDisplayNameForDocumentUri(getContentResolver(), mDocumentUri);
toolbarTop.setTitle(displayName);
- // make sure that "Save" menu item is enabled
+ mbISReadOnlyMode = !isExperimentalMode();
getToolbarController().setupToolbars();
}
diff --git a/android/source/src/java/org/libreoffice/ToolbarController.java b/android/source/src/java/org/libreoffice/ToolbarController.java
index d4985aee180e..c97d84f0f329 100644
--- a/android/source/src/java/org/libreoffice/ToolbarController.java
+++ b/android/source/src/java/org/libreoffice/ToolbarController.java
@@ -72,6 +72,8 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
void switchToEditMode() {
if (!LOKitShell.isEditingEnabled())
return;
+
+ setEditModeOn(true);
// Ensure the change is done on UI thread
LOKitShell.getMainHandler().post(new Runnable() {
@Override
@@ -89,7 +91,6 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
}
mToolbarTop.setNavigationIcon(R.drawable.ic_check);
mToolbarTop.setLogo(null);
- setEditModeOn(true);
}
});
}
@@ -251,7 +252,7 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
if (LibreOfficeMainActivity.isReadOnlyMode()) {
// show message in case experimental mode is enabled (i.e. editing is supported in general),
// but current document is readonly
- Toast.makeText(mContext, mContext.getString(R.string.temp_file_saving_disabled), Toast.LENGTH_LONG).show();
+ Toast.makeText(mContext, mContext.getString(R.string.readonly_file), Toast.LENGTH_LONG).show();
}
}
mMainMenu.findItem(R.id.action_parts).setVisible(mContext.isDrawerEnabled());