2017-04-27 18:30:36 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2017-01-22 00:22:15 +00:00
|
|
|
import QtQuick 2.6
|
2017-03-31 14:15:14 +00:00
|
|
|
import QtQuick.Controls 2.0
|
2015-11-29 16:30:41 +00:00
|
|
|
import QtQuick.Layouts 1.2
|
2015-07-10 08:40:30 +00:00
|
|
|
import QtQuick.Window 2.2
|
|
|
|
import QtQuick.Dialogs 1.2
|
2017-03-31 14:15:14 +00:00
|
|
|
import org.kde.kirigami 2.0 as Kirigami
|
2015-07-10 08:40:30 +00:00
|
|
|
import org.subsurfacedivelog.mobile 1.0
|
|
|
|
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.ScrollablePage {
|
2015-07-10 08:40:30 +00:00
|
|
|
id: page
|
2015-08-20 08:44:01 +00:00
|
|
|
objectName: "DiveList"
|
2016-05-03 19:24:00 +00:00
|
|
|
title: qsTr("Dive list")
|
2016-03-08 20:26:54 +00:00
|
|
|
background: Rectangle {
|
2017-06-21 22:47:29 +00:00
|
|
|
color: subsurfaceTheme.backgroundColor
|
2016-03-08 20:26:54 +00:00
|
|
|
}
|
2016-04-19 21:14:49 +00:00
|
|
|
width: subsurfaceTheme.columnWidth
|
2016-02-11 02:09:16 +00:00
|
|
|
property int credentialStatus: manager.credentialStatus
|
|
|
|
property int numDives: diveListView.count
|
2017-06-24 01:07:48 +00:00
|
|
|
property color textColor: subsurfaceTheme.textColor
|
2017-06-24 18:18:18 +00:00
|
|
|
property color secondaryTextColor: subsurfaceTheme.secondaryTextColor
|
2017-06-20 17:05:45 +00:00
|
|
|
property int horizontalPadding: Kirigami.Units.gridUnit / 2 - Kirigami.Units.smallSpacing + 1
|
2016-03-31 01:39:25 +00:00
|
|
|
|
2017-06-21 22:54:34 +00:00
|
|
|
supportsRefreshing: true
|
|
|
|
onRefreshingChanged: {
|
|
|
|
if (refreshing) {
|
2017-08-03 12:55:09 +00:00
|
|
|
if (manager.credentialStatus === QMLManager.CS_VERIFIED) {
|
2017-06-21 22:54:34 +00:00
|
|
|
console.log("User pulled down dive list - syncing with cloud storage")
|
|
|
|
detailsWindow.endEditMode()
|
|
|
|
manager.saveChangesCloud(true)
|
|
|
|
console.log("done syncing, turn off spinner")
|
|
|
|
refreshing = false
|
|
|
|
} else {
|
|
|
|
console.log("sync with cloud storage requested, but credentialStatus is " + manager.credentialStatus)
|
2017-06-22 09:22:21 +00:00
|
|
|
console.log("no syncing, turn off spinner")
|
|
|
|
refreshing = false
|
2017-06-21 22:54:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-10 08:40:30 +00:00
|
|
|
Component {
|
|
|
|
id: diveDelegate
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.AbstractListItem {
|
2017-06-20 16:13:12 +00:00
|
|
|
leftPadding: 0
|
|
|
|
topPadding: 0
|
2017-04-14 20:06:37 +00:00
|
|
|
id: innerListItem
|
2015-11-29 20:13:57 +00:00
|
|
|
enabled: true
|
2016-03-08 20:26:54 +00:00
|
|
|
supportsMouseEvents: true
|
2016-02-07 21:23:08 +00:00
|
|
|
checked: diveListView.currentIndex === model.index
|
2015-12-27 20:28:08 +00:00
|
|
|
width: parent.width
|
2017-06-19 00:38:03 +00:00
|
|
|
height: diveListEntry.height + Kirigami.Units.smallSpacing
|
2017-06-21 22:47:29 +00:00
|
|
|
backgroundColor: checked ? subsurfaceTheme.primaryColor : subsurfaceTheme.backgroundColor
|
2017-06-24 01:07:48 +00:00
|
|
|
textColor: checked ? subsurfaceTheme.primaryTextColor : subsurfaceTheme.textColor
|
2015-07-10 08:40:30 +00:00
|
|
|
|
|
|
|
property real detailsOpacity : 0
|
|
|
|
|
2016-01-12 00:15:02 +00:00
|
|
|
// When clicked, the mode changes to details view
|
2015-11-29 20:13:57 +00:00
|
|
|
onClicked: {
|
2016-02-14 05:28:32 +00:00
|
|
|
if (detailsWindow.state === "view") {
|
|
|
|
diveListView.currentIndex = index
|
|
|
|
detailsWindow.showDiveIndex(index);
|
|
|
|
stackView.push(detailsWindow);
|
|
|
|
}
|
2015-07-10 08:40:30 +00:00
|
|
|
}
|
|
|
|
|
2016-04-02 12:49:28 +00:00
|
|
|
property bool deleteButtonVisible: false
|
|
|
|
|
|
|
|
onPressAndHold: {
|
|
|
|
deleteButtonVisible = true
|
|
|
|
timer.restart()
|
|
|
|
}
|
2017-06-20 16:13:12 +00:00
|
|
|
Item {
|
|
|
|
Rectangle {
|
|
|
|
id: leftBarDive
|
2017-06-21 16:55:03 +00:00
|
|
|
width: dive.tripMeta == "" ? 0 : Kirigami.Units.smallSpacing
|
|
|
|
height: diveListEntry.height * 0.8
|
2017-06-21 14:39:07 +00:00
|
|
|
color: subsurfaceTheme.lightPrimaryColor
|
2017-06-20 16:13:12 +00:00
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
top: parent.top
|
2017-06-21 16:55:03 +00:00
|
|
|
leftMargin: Kirigami.Units.smallSpacing
|
|
|
|
topMargin: Kirigami.Units.smallSpacing * 2
|
|
|
|
bottomMargin: Kirigami.Units.smallSpacing * 2
|
2017-06-20 16:13:12 +00:00
|
|
|
}
|
2016-04-02 12:49:28 +00:00
|
|
|
}
|
2016-04-02 15:40:54 +00:00
|
|
|
Item {
|
|
|
|
id: diveListEntry
|
2017-04-14 20:06:37 +00:00
|
|
|
width: parent.width - Kirigami.Units.gridUnit * (innerListItem.deleteButtonVisible ? 3 : 1)
|
2016-04-02 15:40:54 +00:00
|
|
|
height: childrenRect.height - Kirigami.Units.smallSpacing
|
2017-06-20 16:13:12 +00:00
|
|
|
anchors.left: leftBarDive.right
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.Label {
|
2016-04-02 15:40:54 +00:00
|
|
|
id: locationText
|
|
|
|
text: dive.location
|
2017-06-19 00:06:53 +00:00
|
|
|
font.weight: Font.Bold
|
2016-04-02 15:40:54 +00:00
|
|
|
elide: Text.ElideRight
|
|
|
|
maximumLineCount: 1 // needed for elide to work at all
|
2016-03-22 18:36:11 +00:00
|
|
|
color: textColor
|
2016-04-02 15:40:54 +00:00
|
|
|
anchors {
|
|
|
|
left: parent.left
|
2017-06-20 17:05:45 +00:00
|
|
|
leftMargin: horizontalPadding * 2
|
2016-04-02 15:40:54 +00:00
|
|
|
top: parent.top
|
|
|
|
right: parent.right
|
|
|
|
}
|
2015-10-09 03:05:23 +00:00
|
|
|
}
|
2016-04-02 15:40:54 +00:00
|
|
|
Row {
|
|
|
|
anchors {
|
2017-06-19 00:06:53 +00:00
|
|
|
left: locationText.left
|
|
|
|
top: locationText.bottom
|
2016-04-02 15:40:54 +00:00
|
|
|
topMargin: - Kirigami.Units.smallSpacing * 2
|
2017-06-19 00:38:03 +00:00
|
|
|
bottom: numberText.bottom
|
2016-04-02 15:40:54 +00:00
|
|
|
}
|
2017-06-19 00:06:53 +00:00
|
|
|
|
2016-04-02 15:40:54 +00:00
|
|
|
Kirigami.Label {
|
2017-06-19 00:06:53 +00:00
|
|
|
id: dateLabel
|
|
|
|
text: dive.date + " " + dive.time
|
|
|
|
width: Math.max(locationText.width * 0.45, paintedWidth) // helps vertical alignment throughout listview
|
2016-04-02 15:40:54 +00:00
|
|
|
font.pointSize: subsurfaceTheme.smallPointSize
|
2017-07-25 19:47:44 +00:00
|
|
|
color: innerListItem.checked ? subsurfaceTheme.darkerPrimaryTextColor : secondaryTextColor
|
2016-04-02 15:40:54 +00:00
|
|
|
}
|
2017-06-19 00:06:53 +00:00
|
|
|
// let's try to show the depth / duration very compact
|
2016-04-02 15:40:54 +00:00
|
|
|
Kirigami.Label {
|
2017-06-19 00:06:53 +00:00
|
|
|
text: dive.depth + ' / ' + dive.duration
|
2016-04-02 15:40:54 +00:00
|
|
|
width: Math.max(Kirigami.Units.gridUnit * 3, paintedWidth) // helps vertical alignment throughout listview
|
|
|
|
font.pointSize: subsurfaceTheme.smallPointSize
|
2017-07-25 19:47:44 +00:00
|
|
|
color: innerListItem.checked ? subsurfaceTheme.darkerPrimaryTextColor : secondaryTextColor
|
2016-04-02 15:40:54 +00:00
|
|
|
}
|
2015-10-09 03:05:23 +00:00
|
|
|
}
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.Label {
|
2016-04-02 15:40:54 +00:00
|
|
|
id: numberText
|
|
|
|
text: "#" + dive.number
|
2015-11-29 22:39:14 +00:00
|
|
|
font.pointSize: subsurfaceTheme.smallPointSize
|
2017-07-25 19:47:44 +00:00
|
|
|
color: innerListItem.checked ? subsurfaceTheme.darkerPrimaryTextColor : secondaryTextColor
|
2016-04-02 15:40:54 +00:00
|
|
|
anchors {
|
|
|
|
right: parent.right
|
2017-06-19 00:06:53 +00:00
|
|
|
rightMargin: horizontalPadding
|
2016-04-02 15:40:54 +00:00
|
|
|
top: locationText.bottom
|
|
|
|
topMargin: - Kirigami.Units.smallSpacing * 2
|
|
|
|
}
|
2015-10-09 03:05:23 +00:00
|
|
|
}
|
|
|
|
}
|
2016-04-02 15:40:54 +00:00
|
|
|
Rectangle {
|
|
|
|
visible: deleteButtonVisible
|
|
|
|
height: diveListEntry.height - Kirigami.Units.smallSpacing
|
|
|
|
width: height - 3 * Kirigami.Units.smallSpacing
|
2017-06-21 14:39:07 +00:00
|
|
|
color: subsurfaceTheme.contrastAccentColor
|
2016-04-02 15:40:54 +00:00
|
|
|
antialiasing: true
|
|
|
|
radius: Kirigami.Units.smallSpacing
|
2017-06-21 14:01:37 +00:00
|
|
|
anchors {
|
|
|
|
left: diveListEntry.right
|
|
|
|
right: parent.right
|
|
|
|
}
|
2016-04-02 15:40:54 +00:00
|
|
|
Kirigami.Icon {
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
source: "trash-empty"
|
2016-04-02 12:49:28 +00:00
|
|
|
}
|
2016-04-02 15:40:54 +00:00
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
enabled: parent.visible
|
|
|
|
onClicked: {
|
|
|
|
parent.visible = false
|
|
|
|
timer.stop()
|
2017-08-10 08:33:39 +00:00
|
|
|
detailsWindow.showDiveIndex(index)
|
2016-04-02 15:40:54 +00:00
|
|
|
manager.deleteDive(dive.id)
|
|
|
|
}
|
2016-04-02 12:49:28 +00:00
|
|
|
}
|
|
|
|
}
|
2016-04-02 15:40:54 +00:00
|
|
|
Item {
|
|
|
|
Timer {
|
|
|
|
id: timer
|
|
|
|
interval: 4000
|
|
|
|
onTriggered: {
|
|
|
|
deleteButtonVisible = false
|
|
|
|
}
|
2016-04-02 12:49:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-07-10 08:40:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: tripHeading
|
2015-10-09 01:56:36 +00:00
|
|
|
Item {
|
2016-03-08 20:26:54 +00:00
|
|
|
width: page.width - Kirigami.Units.gridUnit
|
2017-06-20 16:25:07 +00:00
|
|
|
height: childrenRect.height - Kirigami.Units.smallSpacing
|
2017-06-20 14:46:55 +00:00
|
|
|
Rectangle {
|
|
|
|
id: headingBackground
|
2017-06-22 10:11:51 +00:00
|
|
|
height: section == "" ? 0 : sectionText.height + Kirigami.Units.gridUnit
|
2017-06-20 14:46:55 +00:00
|
|
|
anchors {
|
2017-06-20 23:21:47 +00:00
|
|
|
left: parent.left
|
2017-06-20 14:46:55 +00:00
|
|
|
right: parent.right
|
|
|
|
rightMargin: Kirigami.Units.gridUnit * -2
|
|
|
|
}
|
2017-06-21 14:39:07 +00:00
|
|
|
color: subsurfaceTheme.lightPrimaryColor
|
2017-06-20 16:14:05 +00:00
|
|
|
visible: section != ""
|
2017-06-24 20:13:04 +00:00
|
|
|
Rectangle {
|
|
|
|
id: dateBox
|
|
|
|
visible: section != ""
|
|
|
|
height: section == "" ? 0 : 2 * Kirigami.Units.gridUnit
|
|
|
|
width: section == "" ? 0 : 2.5 * Kirigami.Units.gridUnit
|
|
|
|
color: subsurfaceTheme.primaryColor
|
|
|
|
radius: Kirigami.Units.smallSpacing * 2
|
|
|
|
antialiasing: true
|
|
|
|
anchors {
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
left: parent.left
|
|
|
|
leftMargin: Kirigami.Units.smallSpacing
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
text: { section.replace(/.*\+\+/, "").replace(/::.*/, "").replace("@", "\n'") }
|
|
|
|
color: subsurfaceTheme.primaryTextColor
|
|
|
|
font.pointSize: subsurfaceTheme.smallPointSize
|
|
|
|
lineHeightMode: Text.FixedHeight
|
|
|
|
lineHeight: Kirigami.Units.gridUnit *.9
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-20 14:48:10 +00:00
|
|
|
Kirigami.Label {
|
|
|
|
id: sectionText
|
|
|
|
text: {
|
|
|
|
// if the tripMeta (which we get as "section") ends in ::-- we know
|
|
|
|
// that there's no trip -- otherwise strip the meta information before
|
|
|
|
// the :: and show the trip location
|
|
|
|
var shownText
|
|
|
|
var endsWithDoubleDash = /::--$/;
|
|
|
|
if (endsWithDoubleDash.test(section) || section === "--") {
|
|
|
|
shownText = ""
|
|
|
|
} else {
|
|
|
|
shownText = section.replace(/.*::/, "")
|
|
|
|
}
|
|
|
|
shownText
|
2016-01-27 04:06:30 +00:00
|
|
|
}
|
2017-06-22 10:11:51 +00:00
|
|
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
2017-06-20 14:48:10 +00:00
|
|
|
visible: text !== ""
|
|
|
|
font.weight: Font.Bold
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
2017-06-24 20:13:04 +00:00
|
|
|
left: dateBox.right
|
2017-06-20 14:48:10 +00:00
|
|
|
topMargin: Math.max(2, Kirigami.Units.gridUnit / 2)
|
2017-06-20 23:21:47 +00:00
|
|
|
leftMargin: horizontalPadding * 2
|
2017-06-20 14:48:10 +00:00
|
|
|
right: parent.right
|
|
|
|
}
|
2017-06-21 14:39:07 +00:00
|
|
|
color: subsurfaceTheme.lightPrimaryTextColor
|
2015-10-09 01:56:36 +00:00
|
|
|
}
|
2017-06-20 14:46:55 +00:00
|
|
|
}
|
2015-10-09 01:56:36 +00:00
|
|
|
Rectangle {
|
2016-03-08 20:26:54 +00:00
|
|
|
height: Math.max(2, Kirigami.Units.gridUnit / 12) // we want a thicker line
|
2015-10-09 01:56:36 +00:00
|
|
|
anchors {
|
2017-06-20 14:46:55 +00:00
|
|
|
bottom: headingBackground.top
|
2015-10-09 01:56:36 +00:00
|
|
|
left: parent.left
|
2016-03-08 20:26:54 +00:00
|
|
|
rightMargin: Kirigami.Units.gridUnit * -2
|
2015-10-09 01:56:36 +00:00
|
|
|
right: parent.right
|
|
|
|
}
|
2017-06-21 14:39:07 +00:00
|
|
|
color: subsurfaceTheme.lightPrimaryColor
|
2015-10-09 01:56:36 +00:00
|
|
|
}
|
2015-07-10 08:40:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-03 12:08:00 +00:00
|
|
|
StartPage {
|
|
|
|
id: startPage
|
2016-03-08 20:26:54 +00:00
|
|
|
anchors.fill: parent
|
2017-08-03 12:55:09 +00:00
|
|
|
opacity: credentialStatus === QMLManager.CS_NOCLOUD || (credentialStatus === QMLManager.CS_VERIFIED) ? 0 : 1
|
2016-03-08 20:26:54 +00:00
|
|
|
visible: opacity > 0
|
|
|
|
Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } }
|
2017-04-03 17:48:35 +00:00
|
|
|
function setupActions() {
|
2016-03-08 20:26:54 +00:00
|
|
|
if (visible) {
|
2016-04-19 11:51:19 +00:00
|
|
|
page.actions.main = page.saveAction
|
2016-04-21 12:21:56 +00:00
|
|
|
page.actions.right = page.offlineAction
|
2017-07-31 14:37:15 +00:00
|
|
|
page.title = qsTr("Cloud credentials")
|
2017-08-03 12:55:09 +00:00
|
|
|
} else if(manager.credentialStatus === QMLManager.CS_VERIFIED || manager.credentialStatus === QMLManager.CS_NOCLOUD) {
|
2017-06-28 04:45:17 +00:00
|
|
|
page.actions.main = page.downloadFromDCAction
|
|
|
|
page.actions.right = page.addDiveAction
|
2017-07-31 14:37:15 +00:00
|
|
|
page.title = qsTr("Dive list")
|
2016-04-22 12:19:34 +00:00
|
|
|
if (diveListView.count === 0)
|
2017-06-28 04:45:17 +00:00
|
|
|
showPassiveNotification(qsTr("Please tap the '+' button to add a dive (or download dives from a supported dive computer)"), 3000)
|
2016-04-20 13:56:01 +00:00
|
|
|
} else {
|
|
|
|
page.actions.main = null
|
2016-04-22 12:05:57 +00:00
|
|
|
page.actions.right = null
|
2017-07-31 14:37:15 +00:00
|
|
|
page.title = qsTr("Dive list")
|
2015-11-29 20:13:57 +00:00
|
|
|
}
|
|
|
|
}
|
2017-04-03 17:48:35 +00:00
|
|
|
onVisibleChanged: {
|
|
|
|
setupActions();
|
|
|
|
}
|
2017-08-03 12:55:09 +00:00
|
|
|
|
2017-04-03 17:48:35 +00:00
|
|
|
Component.onCompleted: {
|
2017-09-09 11:15:14 +00:00
|
|
|
manager.finishSetup();
|
2017-04-03 17:48:35 +00:00
|
|
|
setupActions();
|
|
|
|
}
|
2015-11-29 20:13:57 +00:00
|
|
|
}
|
2016-01-12 00:15:02 +00:00
|
|
|
|
2017-01-22 00:22:15 +00:00
|
|
|
Text {
|
|
|
|
// make sure this gets pushed far enough down so that it's not obscured by the page title
|
|
|
|
// it would be nicer to use Kirigami.Label, but due to a QML bug that isn't possible with a
|
|
|
|
// weird "component versioning" error
|
|
|
|
// using this property means that we require Qt 5.6 / QtQuick2.6
|
|
|
|
topPadding: Kirigami.Units.iconSizes.large
|
|
|
|
leftPadding: Kirigami.Units.iconSizes.large
|
|
|
|
|
2016-06-21 14:53:00 +00:00
|
|
|
text: qsTr("No dives in dive list")
|
|
|
|
visible: diveListView.visible && diveListView.count === 0
|
|
|
|
}
|
|
|
|
|
2016-03-08 20:26:54 +00:00
|
|
|
ListView {
|
|
|
|
id: diveListView
|
2015-07-10 08:40:30 +00:00
|
|
|
anchors.fill: parent
|
2017-06-24 18:19:56 +00:00
|
|
|
opacity: 1.0 - startPage.opacity
|
2016-02-11 02:09:16 +00:00
|
|
|
visible: opacity > 0
|
2016-03-08 20:26:54 +00:00
|
|
|
model: diveModel
|
|
|
|
currentIndex: -1
|
|
|
|
delegate: diveDelegate
|
2017-06-28 17:55:19 +00:00
|
|
|
boundsBehavior: Flickable.DragOverBounds
|
2016-03-08 20:26:54 +00:00
|
|
|
maximumFlickVelocity: parent.height * 5
|
|
|
|
bottomMargin: Kirigami.Units.iconSizes.medium + Kirigami.Units.gridUnit
|
|
|
|
cacheBuffer: 0 // seems to avoid empty rendered profiles
|
|
|
|
section.property: "dive.tripMeta"
|
|
|
|
section.criteria: ViewSection.FullString
|
|
|
|
section.delegate: tripHeading
|
2017-06-21 18:48:29 +00:00
|
|
|
section.labelPositioning: ViewSection.CurrentLabelAtStart | ViewSection.InlineLabels
|
2016-03-08 20:26:54 +00:00
|
|
|
Connections {
|
|
|
|
target: detailsWindow
|
|
|
|
onCurrentIndexChanged: diveListView.currentIndex = detailsWindow.currentIndex
|
|
|
|
}
|
2015-07-10 08:40:30 +00:00
|
|
|
}
|
2016-02-14 05:09:33 +00:00
|
|
|
|
2017-06-28 04:45:17 +00:00
|
|
|
property QtObject downloadFromDCAction: Kirigami.Action {
|
2017-07-08 17:05:21 +00:00
|
|
|
iconName: "downloadDC"
|
2017-06-28 04:45:17 +00:00
|
|
|
onTriggered: {
|
|
|
|
downloadFromDc.dcImportModel.clearTable()
|
|
|
|
stackView.push(downloadFromDc)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-31 14:15:14 +00:00
|
|
|
property QtObject addDiveAction: Kirigami.Action {
|
2016-04-02 03:31:33 +00:00
|
|
|
iconName: "list-add"
|
|
|
|
onTriggered: {
|
|
|
|
startAddDive()
|
|
|
|
}
|
|
|
|
}
|
2016-03-08 20:26:54 +00:00
|
|
|
|
2017-03-31 14:15:14 +00:00
|
|
|
property QtObject saveAction: Kirigami.Action {
|
2016-02-14 05:09:33 +00:00
|
|
|
iconName: "document-save"
|
|
|
|
onTriggered: {
|
2016-04-06 18:40:34 +00:00
|
|
|
Qt.inputMethod.hide()
|
2016-02-14 05:09:33 +00:00
|
|
|
startPage.saveCredentials();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-31 14:15:14 +00:00
|
|
|
property QtObject offlineAction: Kirigami.Action {
|
2016-04-21 12:21:56 +00:00
|
|
|
iconName: "qrc:/qml/nocloud.svg"
|
|
|
|
onTriggered: {
|
|
|
|
manager.syncToCloud = false
|
2017-08-03 12:55:09 +00:00
|
|
|
manager.credentialStatus = QMLManager.CS_NOCLOUD
|
2016-04-21 12:21:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-14 05:09:33 +00:00
|
|
|
onBackRequested: {
|
2017-08-03 12:55:09 +00:00
|
|
|
if (startPage.visible && diveListView.count > 0 && manager.credentialStatus !== QMLManager.CS_INCORRECT_USER_PASSWD) {
|
2016-02-14 05:09:33 +00:00
|
|
|
manager.credentialStatus = oldStatus
|
2016-02-14 20:17:24 +00:00
|
|
|
event.accepted = true;
|
2016-02-14 05:09:33 +00:00
|
|
|
}
|
2017-04-03 12:08:00 +00:00
|
|
|
if (!startPage.visible) {
|
2016-04-21 19:14:37 +00:00
|
|
|
if (Qt.platform.os != "ios") {
|
|
|
|
manager.quit()
|
|
|
|
}
|
2016-06-12 19:12:37 +00:00
|
|
|
// let's make sure Kirigami doesn't quit on our behalf
|
|
|
|
event.accepted = true
|
2016-04-15 21:42:08 +00:00
|
|
|
}
|
2016-02-14 05:09:33 +00:00
|
|
|
}
|
2015-07-10 08:40:30 +00:00
|
|
|
}
|