summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-06-06 09:57:57 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-06-07 19:47:52 -0700
commite00e72d430b60f8b446d295f0aa7c19f91b82fea (patch)
tree995fc8067b28a9f3c595e6679f4f31a84f2d8265
parent208d46d58e5989c40a70b76ee568b149c622bf12 (diff)
downloadsubsurface-e00e72d430b60f8b446d295f0aa7c19f91b82fea.tar.gz
mobile: add option to merge local cloud cache data
The UI is ugly, and of course this is hidden in the developer options that have to first be enabled in the advanced settings. As I mentioned in the previous commit, I believe the actual risk that something gets damaged here is very low, but still, explaining this so it makes sense to the casual user may be a bit... difficult. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--CHANGELOG.md1
-rw-r--r--mobile-widgets/qml/RecoverCache.qml76
-rw-r--r--mobile-widgets/qml/main.qml14
-rw-r--r--mobile-widgets/qml/mobile-resources.qrc2
4 files changed, 93 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8cf3a6c22..3fefcf10a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,4 @@
+Mobile: add advanved option to import dives from local cloud cache directories
Mobile: fix broken editing of location, suit, buddy, and dive master
Mobile: fix missing translations on Android
CSV export: support for multiple cylinders
diff --git a/mobile-widgets/qml/RecoverCache.qml b/mobile-widgets/qml/RecoverCache.qml
new file mode 100644
index 000000000..ef47a53e8
--- /dev/null
+++ b/mobile-widgets/qml/RecoverCache.qml
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: GPL-2.0
+import QtQuick 2.6
+import org.kde.kirigami 2.4 as Kirigami
+import org.subsurfacedivelog.mobile 1.0
+
+Kirigami.ScrollablePage {
+ id: recoverCache
+ title: qsTr("Cloud Cache Import")
+ objectName: "recoverCache"
+ background: Rectangle { color: subsurfaceTheme.backgroundColor }
+ width: parent.width
+ height: parent.height
+
+ Item {
+ TemplateLabel {
+ id: header
+ text: qsTr("Cloud Cache Import")
+ color: subsurfaceTheme.lightPrimaryTextColor
+ background: Rectangle { color: subsurfaceTheme.lightPrimaryColor }
+ font.pointSize: subsurfaceTheme.regularPointSize * 1.5
+ padding: Kirigami.Units.gridUnit
+ width: recoverCache.width - 5 * Kirigami.Units.largeSpacing
+ height: 3.5 * Kirigami.Units.gridUnit
+ }
+ Rectangle {
+ id: subheader
+ z: 5
+ width: recoverCache.width - 5 * Kirigami.Units.largeSpacing
+ height: 3 * Kirigami.Units.gridUnit
+ color: subsurfaceTheme.backgroundColor
+ anchors {
+ left: header.left
+ top: header.bottom
+ right: parent.right
+ }
+ TemplateLabel {
+ height: 2 * Kirigami.Units.gridUnit
+ text: qsTr("import data from the given cache repo")
+ anchors {
+ verticalCenter: parent.verticalCenter
+ horizontalCenter: parent.horizontalCenter
+ }
+ }
+ }
+ Rectangle {
+ id: spacer
+ anchors.top: subheader.bottom
+ height: Kirigami.Units.largeSpacing
+ width: recoverCache.width
+ color: subsurfaceTheme.backgroundColor
+ }
+
+ Rectangle {
+ anchors {
+ left: header.left
+ right: parent.right
+ top: spacer.bottom
+ }
+ z: -5
+ ListView {
+ height: recoverCache.height - 9 * Kirigami.Units.gridUnit
+ width: recoverCache.width
+ model: manager.cloudCacheList
+ delegate: TemplateButton {
+ height: 3 * Kirigami.Units.gridUnit
+ width: parent.width - 2 * Kirigami.Units.gridUnit
+ text: modelData
+ onClicked: {
+ console.log("import " + modelData)
+ manager.importCacheRepo(modelData)
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml
index 848c2f289..92ee7e075 100644
--- a/mobile-widgets/qml/main.qml
+++ b/mobile-widgets/qml/main.qml
@@ -534,6 +534,14 @@ if you have network connectivity and want to sync your data to cloud storage."),
}
}
+ Kirigami.Action {
+ text: qsTr("Access local cloud cache dirs")
+ onTriggered: {
+ globalDrawer.close()
+ showPage(recoverCache)
+ }
+ }
+
/* disable for now
Kirigami.Action {
text: qsTr("Dive planner")
@@ -822,6 +830,12 @@ if you have network connectivity and want to sync your data to cloud storage."),
id: mapPage
visible: false
}
+
+ RecoverCache {
+ id: recoverCache
+ visible: false
+ }
+
/* this shouldn't be exposed unless someone will finish the work
DivePlannerSetup {
id: divePlannerSetupWindow
diff --git a/mobile-widgets/qml/mobile-resources.qrc b/mobile-widgets/qml/mobile-resources.qrc
index 4462ab1c8..7e6f9bc06 100644
--- a/mobile-widgets/qml/mobile-resources.qrc
+++ b/mobile-widgets/qml/mobile-resources.qrc
@@ -41,6 +41,8 @@
<file>ThemeTest.qml</file>
<file>TripDetails.qml</file>
<file>StartPage.qml</file>
+ <file>RecoverCache.qml</file>
+
<file>SsrfCheckBox.qml</file>
<file>SsrfSwitch.qml</file>
<file>SsrfTextField.qml</file>