diff options
Diffstat (limited to 'mobile-widgets/qml')
-rw-r--r-- | mobile-widgets/qml/CloudCredentials.qml | 11 | ||||
-rw-r--r-- | mobile-widgets/qml/DiveDetails.qml | 2 | ||||
-rw-r--r-- | mobile-widgets/qml/DiveList.qml | 28 | ||||
-rw-r--r-- | mobile-widgets/qml/StartPage.qml | 6 | ||||
-rw-r--r-- | mobile-widgets/qml/icons/nocloud.svg | 71 | ||||
-rw-r--r-- | mobile-widgets/qml/main.qml | 31 | ||||
-rw-r--r-- | mobile-widgets/qml/mobile-resources.qrc | 2 |
7 files changed, 130 insertions, 21 deletions
diff --git a/mobile-widgets/qml/CloudCredentials.qml b/mobile-widgets/qml/CloudCredentials.qml index d63227619..2bb42a6ed 100644 --- a/mobile-widgets/qml/CloudCredentials.qml +++ b/mobile-widgets/qml/CloudCredentials.qml @@ -23,6 +23,17 @@ Item { id: outerLayout width: loginWindow.width - loginWindow.leftPadding - loginWindow.rightPadding - 2 * Kirigami.Units.gridUnit + function goToNext() { + for (var i = 0; i < children.length; ++i) + if (children[i].focus) { + children[i].nextItemInFocusChain().forceActiveFocus() + break + } + } + + Keys.onReturnPressed: goToNext() + Keys.onTabPressed: goToNext() + onVisibleChanged: { if (visible && manager.accessingCloud < 0) { manager.appendTextToLog("Credential scrn: show kbd was: " + (Qt.inputMethod.isVisible ? "visible" : "invisible")) diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml index 3f42a1ed5..5735266f6 100644 --- a/mobile-widgets/qml/DiveDetails.qml +++ b/mobile-widgets/qml/DiveDetails.qml @@ -30,8 +30,6 @@ Kirigami.Page { property alias gpsCheckbox: detailsEdit.gpsCheckbox property int updateCurrentIdx: manager.updateSelectedDive - property bool contentItem: true // HACK to work around Kirigami issue - remove once that's addressed upstream - title: diveDetailsListView.currentItem ? diveDetailsListView.currentItem.modelData.dive.location : "Dive details" state: "view" leftPadding: 0 diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index 6ad3161e1..9ffb2ee88 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -211,18 +211,24 @@ Kirigami.ScrollablePage { ScrollView { id: startPageWrapper anchors.fill: parent - opacity: (diveListView.count > 0 && (credentialStatus == QMLManager.VALID || credentialStatus == QMLManager.VALID_EMAIL)) ? 0 : 1 + opacity: credentialStatus === QMLManager.NOCLOUD || (diveListView.count > 0 && (credentialStatus === QMLManager.VALID || credentialStatus === QMLManager.VALID_EMAIL)) ? 0 : 1 visible: opacity > 0 Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } } onVisibleChanged: { + print("startPageWrapper onVisibleChanged credentialStatus " + credentialStatus + " diveListView.count " + diveListView.count) if (visible) { page.actions.main = page.saveAction + page.actions.right = page.offlineAction title = "Cloud credentials" - } else if(manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL) { + } else if(manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL || manager.credentialStatus === QMLManager.NOCLOUD) { page.actions.main = page.addDiveAction + page.actions.right = null title = "Dive list" + if (diveListView.count === 0) + showPassiveNotification(qsTr("Please tap the '+' button to add a dive"), 3000) } else { page.actions.main = null + page.actions.right = null title = "Dive list" } } @@ -279,15 +285,25 @@ Kirigami.ScrollablePage { } } + property QtObject offlineAction: Action { + iconName: "qrc:/qml/nocloud.svg" + onTriggered: { + manager.syncToCloud = false + manager.credentialStatus = QMLManager.NOCLOUD + } + } + onBackRequested: { - if (startPageWrapper.visible && diveListView.count > 0 && manager.credentialStatus != QMLManager.INVALID) { + if (startPageWrapper.visible && diveListView.count > 0 && manager.credentialStatus !== QMLManager.INVALID) { manager.credentialStatus = oldStatus event.accepted = true; } if (!startPageWrapper.visible) { - manager.quit() - // we shouldn't come back from there, but just in case - event.accepted = true + if (Qt.platform.os != "ios") { + manager.quit() + // we shouldn't come back from there, but just in case + event.accepted = true + } } } } diff --git a/mobile-widgets/qml/StartPage.qml b/mobile-widgets/qml/StartPage.qml index 41fe469c2..e9c785672 100644 --- a/mobile-widgets/qml/StartPage.qml +++ b/mobile-widgets/qml/StartPage.qml @@ -16,8 +16,10 @@ ColumnLayout { Layout.fillWidth: true Layout.margins: Kirigami.Units.gridUnit Layout.topMargin: Kirigami.Units.gridUnit * 3 - text: "In order to use Subsurface-mobile you need to have a Subsurface cloud storage account " + - "(which can be created with the Subsurface desktop application)." + text: "To use Subsurface-mobile with Subsurface cloud storage, please enter " + + "your cloud credentials.\n\n" + + "To use Subsurface-mobile only with local data on this device, tap " + + "on the no cloud icon below." wrapMode: Text.WordWrap } Kirigami.Label { diff --git a/mobile-widgets/qml/icons/nocloud.svg b/mobile-widgets/qml/icons/nocloud.svg new file mode 100644 index 000000000..0661d32e6 --- /dev/null +++ b/mobile-widgets/qml/icons/nocloud.svg @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + viewBox="0 0 22 22" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + sodipodi:docname="nocloud.svg"> + <metadata + id="metadata10"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1022" + inkscape:window-height="740" + id="namedview8" + showgrid="false" + inkscape:zoom="10.727273" + inkscape:cx="-2.8898305" + inkscape:cy="11" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:current-layer="svg2" /> + <defs + id="defs3051"> + <style + type="text/css" + id="current-color-scheme"> + .ColorScheme-Text { + color:#4d4d4d; + } + </style> + </defs> + <path + style="fill:currentColor;fill-opacity:1;stroke:none" + d="M 11 4 A 6 6 0 0 0 5 10 A 6 6 0 0 0 5.0039062 10.128906 A 4 4 0 0 0 2 14 A 4 4 0 0 0 6 18 L 15 18 A 5 5 0 0 0 20 13 A 5 5 0 0 0 16.757812 8.3242188 A 6 6 0 0 0 11 4 z M 11 5 A 5 5 0 0 1 15.919922 9.1113281 A 4.0000019 4.0000019 0 0 1 19 13 A 4.0000019 4.0000019 0 0 1 15 17 L 6 17 A 2.9999979 2.9999979 0 0 1 3 14 A 2.9999979 2.9999979 0 0 1 6 11 A 2.9999979 2.9999979 0 0 1 6.1074219 11.005859 A 5 5 0 0 1 6 10 A 5 5 0 0 1 11 5 z " + class="ColorScheme-Text" + id="path6" /> + <path + style="opacity:1;fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:3.20000005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 4.0550844,20.042373 18.877119,4.0084751" + id="path3338-1" + inkscape:connector-curvature="0" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#4d4d4d;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;opacity:1" + d="M 3.8220339,19.855932 18.644068,3.8220339" + id="path3338" + inkscape:connector-curvature="0" /> +</svg> diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index e1a140635..b4ab897e9 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -124,7 +124,6 @@ Kirigami.ApplicationWindow { }, Kirigami.Action { text: "Manage dives" - enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL /* * disable for the beta to avoid confusion Action { @@ -137,6 +136,7 @@ Kirigami.ApplicationWindow { */ Kirigami.Action { text: "Add dive manually" + enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL || manager.credentialStatus === QMLManager.NOCLOUD onTriggered: { returnTopPage() // otherwise odd things happen with the page stack startAddDive() @@ -144,24 +144,34 @@ Kirigami.ApplicationWindow { } Kirigami.Action { text: "Manual sync with cloud" + enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL || manager.credentialStatus === QMLManager.NOCLOUD onTriggered: { - globalDrawer.close() - detailsWindow.endEditMode() - manager.saveChangesCloud(true); - globalDrawer.close() + if (manager.credentialStatus === QMLManager.NOCLOUD) { + returnTopPage() + oldStatus = manager.credentialStatus + manager.startPageText = "Enter valid cloud storage credentials" + manager.credentialStatus = QMLManager.UNKNOWN + globalDrawer.close() + } else { + globalDrawer.close() + detailsWindow.endEditMode() + manager.saveChangesCloud(true); + globalDrawer.close() + } } } Kirigami.Action { - text: syncToCloud ? "Disable auto cloud sync" : "Enable auto cloud sync" + text: syncToCloud ? "Offline mode" : "Enable auto cloud sync" + enabled: manager.credentialStatus !== QMLManager.NOCLOUD onTriggered: { syncToCloud = !syncToCloud if (!syncToCloud) { var alertText = "Turning off automatic sync to cloud causes all data\n" - alertText +=" to only be stored locally.\n" + alertText +="to only be stored locally.\n" alertText += "This can be very useful in situations with\n" - alertText += " limited or no network access.\n" + alertText += "limited or no network access.\n" alertText += "Please chose 'Manual sync with cloud' if you have network\n" - alertText += " connectivity and want to sync your data to cloud storage." + alertText += "connectivity and want to sync your data to cloud storage." showPassiveNotification(alertText, 10000) } } @@ -326,8 +336,7 @@ Kirigami.ApplicationWindow { DiveDetails { id: detailsWindow visible: false - width: parent.width - height: parent.height + anchors.fill: parent } DownloadFromDiveComputer { diff --git a/mobile-widgets/qml/mobile-resources.qrc b/mobile-widgets/qml/mobile-resources.qrc index 6157e3bf6..ab556789b 100644 --- a/mobile-widgets/qml/mobile-resources.qrc +++ b/mobile-widgets/qml/mobile-resources.qrc @@ -21,6 +21,7 @@ <file alias="context-menu.png">icons/context-menu.png</file> <file alias="menu-edit.png">icons/menu-edit.png</file> <file alias="menu-back.png">icons/menu-back.png</file> + <file alias="nocloud.svg">icons/nocloud.svg</file> </qresource> <qresource prefix="/imports"> <file alias="org/kde/kirigami/qmldir">kirigami/qmldir</file> @@ -48,6 +49,7 @@ <file alias="org/kde/kirigami/private/ActionButton.qml">kirigami/private/ActionButton.qml</file> <file alias="org/kde/kirigami/private/BackButton.qml">kirigami/private/BackButton.qml</file> <file alias="org/kde/kirigami/private/ContextIcon.qml">kirigami/private/ContextIcon.qml</file> + <file alias="org/kde/kirigami/private/DefaultListItemBackground.qml">kirigami/private/DefaultListItemBackground.qml</file> <file alias="org/kde/kirigami/private/EdgeShadow.qml">kirigami/private/EdgeShadow.qml</file> <file alias="org/kde/kirigami/private/MenuIcon.qml">kirigami/private/MenuIcon.qml</file> <file alias="org/kde/kirigami/private/DefaultListItemBackground.qml">kirigami/private/DefaultListItemBackground.qml</file> |