| 
									
										
										
										
											2017-01-21 16:22:15 -08:00
										 |  |  | import QtQuick 2.6 | 
					
						
							| 
									
										
										
										
											2017-03-31 16:15:14 +02:00
										 |  |  | import QtQuick.Controls 2.0 | 
					
						
							| 
									
										
										
										
											2015-11-29 17:30:41 +01:00
										 |  |  | import QtQuick.Layouts 1.2 | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | import QtQuick.Window 2.2 | 
					
						
							|  |  |  | import QtQuick.Dialogs 1.2 | 
					
						
							| 
									
										
										
										
											2017-03-31 16:15:14 +02:00
										 |  |  | import org.kde.kirigami 2.0 as Kirigami | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | import org.subsurfacedivelog.mobile 1.0 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | Kirigami.ScrollablePage { | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 	id: page | 
					
						
							| 
									
										
										
										
											2015-08-20 11:44:01 +03:00
										 |  |  | 	objectName: "DiveList" | 
					
						
							| 
									
										
										
										
											2016-05-03 21:24:00 +02:00
										 |  |  | 	title: qsTr("Dive list") | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 	background: Rectangle { | 
					
						
							|  |  |  | 		color: Kirigami.Theme.viewBackgroundColor | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2016-04-19 14:14:49 -07:00
										 |  |  | 	width: subsurfaceTheme.columnWidth | 
					
						
							| 
									
										
										
										
											2016-02-10 18:09:16 -08:00
										 |  |  | 	property int credentialStatus: manager.credentialStatus | 
					
						
							|  |  |  | 	property int numDives: diveListView.count | 
					
						
							| 
									
										
										
										
											2016-03-22 11:36:11 -07:00
										 |  |  | 	property color textColor: subsurfaceTheme.diveListTextColor | 
					
						
							| 
									
										
										
										
											2016-03-30 20:39:25 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 	Component { | 
					
						
							|  |  |  | 		id: diveDelegate | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 		Kirigami.AbstractListItem { | 
					
						
							| 
									
										
										
										
											2017-04-14 13:06:37 -07:00
										 |  |  | 			id: innerListItem | 
					
						
							| 
									
										
										
										
											2015-11-29 21:13:57 +01:00
										 |  |  | 			enabled: true | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 			supportsMouseEvents: true | 
					
						
							| 
									
										
										
										
											2016-02-07 22:23:08 +01:00
										 |  |  | 			checked: diveListView.currentIndex === model.index | 
					
						
							| 
									
										
										
										
											2015-12-27 12:28:08 -08:00
										 |  |  | 			width: parent.width | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			property real detailsOpacity : 0 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 			property int horizontalPadding: Kirigami.Units.gridUnit / 2 - Kirigami.Units.smallSpacing  + 1 | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-12 01:15:02 +01:00
										 |  |  | 			// When clicked, the mode changes to details view
 | 
					
						
							| 
									
										
										
										
											2015-11-29 21:13:57 +01:00
										 |  |  | 			onClicked: { | 
					
						
							| 
									
										
										
										
											2016-02-13 21:28:32 -08:00
										 |  |  | 				if (detailsWindow.state === "view") { | 
					
						
							|  |  |  | 					diveListView.currentIndex = index | 
					
						
							|  |  |  | 					detailsWindow.showDiveIndex(index); | 
					
						
							|  |  |  | 					stackView.push(detailsWindow); | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-02 07:49:28 -05:00
										 |  |  | 			property bool deleteButtonVisible: false | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			onPressAndHold: { | 
					
						
							|  |  |  | 				deleteButtonVisible = true | 
					
						
							|  |  |  | 				timer.restart() | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			Row { | 
					
						
							| 
									
										
										
										
											2016-06-13 00:35:06 +02:00
										 |  |  | 				width: parent.width | 
					
						
							| 
									
										
										
										
											2017-04-14 13:06:37 -07:00
										 |  |  | 				height: childrenRect.height + Kirigami.Units.smallSpacing | 
					
						
							| 
									
										
										
										
											2016-04-02 07:49:28 -05:00
										 |  |  | 				spacing: horizontalPadding | 
					
						
							| 
									
										
										
										
											2017-04-14 13:06:37 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-02 07:49:28 -05:00
										 |  |  | 				add: Transition { | 
					
						
							|  |  |  | 					NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 400 } | 
					
						
							|  |  |  | 					NumberAnimation { property: "scale"; from: 0; to: 1.0; duration: 400 } | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2016-04-02 10:40:54 -05:00
										 |  |  | 				Item { | 
					
						
							|  |  |  | 					id: diveListEntry | 
					
						
							| 
									
										
										
										
											2017-04-14 13:06:37 -07:00
										 |  |  | 					width: parent.width - Kirigami.Units.gridUnit * (innerListItem.deleteButtonVisible ? 3 : 1) | 
					
						
							| 
									
										
										
										
											2016-04-02 10:40:54 -05:00
										 |  |  | 					height: childrenRect.height - Kirigami.Units.smallSpacing | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 					Kirigami.Label { | 
					
						
							| 
									
										
										
										
											2016-04-02 10:40:54 -05:00
										 |  |  | 						id: locationText | 
					
						
							|  |  |  | 						text: dive.location | 
					
						
							|  |  |  | 						font.weight: Font.Light | 
					
						
							|  |  |  | 						elide: Text.ElideRight | 
					
						
							|  |  |  | 						maximumLineCount: 1 // needed for elide to work at all
 | 
					
						
							| 
									
										
										
										
											2016-03-22 11:36:11 -07:00
										 |  |  | 						color: textColor | 
					
						
							| 
									
										
										
										
											2016-04-02 10:40:54 -05:00
										 |  |  | 						anchors { | 
					
						
							|  |  |  | 							left: parent.left | 
					
						
							|  |  |  | 							leftMargin: horizontalPadding | 
					
						
							|  |  |  | 							top: parent.top | 
					
						
							|  |  |  | 							right: dateLabel.left | 
					
						
							|  |  |  | 						} | 
					
						
							| 
									
										
										
										
											2015-10-09 05:05:23 +02:00
										 |  |  | 					} | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 					Kirigami.Label { | 
					
						
							| 
									
										
										
										
											2016-04-02 10:40:54 -05:00
										 |  |  | 						id: dateLabel | 
					
						
							|  |  |  | 						text: dive.date + " " + dive.time | 
					
						
							| 
									
										
										
										
											2015-11-29 23:39:14 +01:00
										 |  |  | 						font.pointSize: subsurfaceTheme.smallPointSize | 
					
						
							| 
									
										
										
										
											2016-03-22 11:36:11 -07:00
										 |  |  | 						color: textColor | 
					
						
							| 
									
										
										
										
											2016-04-02 10:40:54 -05:00
										 |  |  | 						anchors { | 
					
						
							|  |  |  | 							right: parent.right | 
					
						
							|  |  |  | 							top: parent.top | 
					
						
							|  |  |  | 						} | 
					
						
							| 
									
										
										
										
											2015-10-09 05:05:23 +02:00
										 |  |  | 					} | 
					
						
							| 
									
										
										
										
											2016-04-02 10:40:54 -05:00
										 |  |  | 					Row { | 
					
						
							|  |  |  | 						anchors { | 
					
						
							|  |  |  | 							left: parent.left | 
					
						
							|  |  |  | 							leftMargin: horizontalPadding | 
					
						
							|  |  |  | 							right: parent.right | 
					
						
							|  |  |  | 							rightMargin: horizontalPadding | 
					
						
							|  |  |  | 							topMargin: - Kirigami.Units.smallSpacing * 2 | 
					
						
							|  |  |  | 							bottom: numberText.bottom | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 						Kirigami.Label { | 
					
						
							| 
									
										
										
										
											2016-05-03 21:24:00 +02:00
										 |  |  | 							text: qsTr('Depth: ') | 
					
						
							| 
									
										
										
										
											2016-04-02 10:40:54 -05:00
										 |  |  | 							font.pointSize: subsurfaceTheme.smallPointSize | 
					
						
							|  |  |  | 							color: textColor | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 						Kirigami.Label { | 
					
						
							|  |  |  | 							text: dive.depth | 
					
						
							|  |  |  | 							width: Math.max(Kirigami.Units.gridUnit * 3, paintedWidth) // helps vertical alignment throughout listview
 | 
					
						
							|  |  |  | 							font.pointSize: subsurfaceTheme.smallPointSize | 
					
						
							|  |  |  | 							color: textColor | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 						Kirigami.Label { | 
					
						
							| 
									
										
										
										
											2016-05-03 21:24:00 +02:00
										 |  |  | 							text: qsTr('Duration: ') | 
					
						
							| 
									
										
										
										
											2016-04-02 10:40:54 -05:00
										 |  |  | 							font.pointSize: subsurfaceTheme.smallPointSize | 
					
						
							|  |  |  | 							color: textColor | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 						Kirigami.Label { | 
					
						
							|  |  |  | 							text: dive.duration | 
					
						
							|  |  |  | 							font.pointSize: subsurfaceTheme.smallPointSize | 
					
						
							|  |  |  | 							color: textColor | 
					
						
							|  |  |  | 						} | 
					
						
							| 
									
										
										
										
											2015-10-09 05:05:23 +02:00
										 |  |  | 					} | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 					Kirigami.Label { | 
					
						
							| 
									
										
										
										
											2016-04-02 10:40:54 -05:00
										 |  |  | 						id: numberText | 
					
						
							|  |  |  | 						text: "#" + dive.number | 
					
						
							| 
									
										
										
										
											2015-11-29 23:39:14 +01:00
										 |  |  | 						font.pointSize: subsurfaceTheme.smallPointSize | 
					
						
							| 
									
										
										
										
											2016-03-22 11:36:11 -07:00
										 |  |  | 						color: textColor | 
					
						
							| 
									
										
										
										
											2016-04-02 10:40:54 -05:00
										 |  |  | 						anchors { | 
					
						
							|  |  |  | 							right: parent.right | 
					
						
							|  |  |  | 							top: locationText.bottom | 
					
						
							|  |  |  | 							topMargin: - Kirigami.Units.smallSpacing * 2 | 
					
						
							|  |  |  | 						} | 
					
						
							| 
									
										
										
										
											2015-10-09 05:05:23 +02:00
										 |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2016-04-02 10:40:54 -05:00
										 |  |  | 				Rectangle { | 
					
						
							|  |  |  | 					visible: deleteButtonVisible | 
					
						
							|  |  |  | 					height: diveListEntry.height - Kirigami.Units.smallSpacing | 
					
						
							|  |  |  | 					width: height - 3 * Kirigami.Units.smallSpacing | 
					
						
							|  |  |  | 					color: "#FF3030" | 
					
						
							|  |  |  | 					antialiasing: true | 
					
						
							|  |  |  | 					radius: Kirigami.Units.smallSpacing | 
					
						
							|  |  |  | 					Kirigami.Icon { | 
					
						
							|  |  |  | 						anchors { | 
					
						
							|  |  |  | 							horizontalCenter: parent.horizontalCenter | 
					
						
							|  |  |  | 							verticalCenter: parent.verticalCenter | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 						source: "trash-empty" | 
					
						
							| 
									
										
										
										
											2016-04-02 07:49:28 -05:00
										 |  |  | 					} | 
					
						
							| 
									
										
										
										
											2016-04-02 10:40:54 -05:00
										 |  |  | 					MouseArea { | 
					
						
							|  |  |  | 						anchors.fill: parent | 
					
						
							|  |  |  | 						enabled: parent.visible | 
					
						
							|  |  |  | 						onClicked: { | 
					
						
							|  |  |  | 							parent.visible = false | 
					
						
							|  |  |  | 							timer.stop() | 
					
						
							|  |  |  | 							manager.deleteDive(dive.id) | 
					
						
							|  |  |  | 						} | 
					
						
							| 
									
										
										
										
											2016-04-02 07:49:28 -05:00
										 |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2016-04-02 10:40:54 -05:00
										 |  |  | 				Item { | 
					
						
							|  |  |  | 					Timer { | 
					
						
							|  |  |  | 						id: timer | 
					
						
							|  |  |  | 						interval: 4000 | 
					
						
							|  |  |  | 						onTriggered: { | 
					
						
							|  |  |  | 							deleteButtonVisible = false | 
					
						
							|  |  |  | 						} | 
					
						
							| 
									
										
										
										
											2016-04-02 07:49:28 -05:00
										 |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	Component { | 
					
						
							|  |  |  | 		id: tripHeading | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 		Item { | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 			width: page.width - Kirigami.Units.gridUnit | 
					
						
							|  |  |  | 			height: childrenRect.height + Kirigami.Units.smallSpacing * 2 + Math.max(2, Kirigami.Units.gridUnit / 2) | 
					
						
							| 
									
										
										
										
											2016-03-30 20:16:50 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 			Kirigami.Heading { | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 				id: sectionText | 
					
						
							| 
									
										
										
										
											2016-01-26 20:06:30 -08:00
										 |  |  | 				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 = /::--$/; | 
					
						
							| 
									
										
										
										
											2016-01-28 21:58:27 -08:00
										 |  |  | 					if (endsWithDoubleDash.test(section) || section === "--") { | 
					
						
							| 
									
										
										
										
											2016-01-26 20:06:30 -08:00
										 |  |  | 						shownText = "" | 
					
						
							|  |  |  | 					} else { | 
					
						
							|  |  |  | 						shownText = section.replace(/.*::/, "") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					shownText | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2016-04-05 16:02:47 -07:00
										 |  |  | 				visible: text !== "" | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 				anchors { | 
					
						
							|  |  |  | 					top: parent.top | 
					
						
							|  |  |  | 					left: parent.left | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 					topMargin: Math.max(2, Kirigami.Units.gridUnit / 2) | 
					
						
							|  |  |  | 					leftMargin: Kirigami.Units.gridUnit / 2 | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 					right: parent.right | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2016-03-30 20:16:50 -05:00
										 |  |  | 				color: textColor | 
					
						
							| 
									
										
										
										
											2015-11-29 21:13:57 +01:00
										 |  |  | 				level: 2 | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 			Rectangle { | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 				height: Math.max(2, Kirigami.Units.gridUnit / 12) // we want a thicker line
 | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 				anchors { | 
					
						
							| 
									
										
										
										
											2016-03-30 20:16:50 -05:00
										 |  |  | 					top: sectionText.bottom | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 					left: parent.left | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 					leftMargin: Kirigami.Units.gridUnit * -2 | 
					
						
							|  |  |  | 					rightMargin: Kirigami.Units.gridUnit * -2 | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 					right: parent.right | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2015-11-29 19:21:27 +01:00
										 |  |  | 				color: subsurfaceTheme.accentColor | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-03 14:08:00 +02:00
										 |  |  | 	StartPage { | 
					
						
							|  |  |  | 		id: startPage | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 		anchors.fill: parent | 
					
						
							| 
									
										
										
										
											2016-06-14 12:03:19 -07:00
										 |  |  | 		opacity: credentialStatus === QMLManager.NOCLOUD || (credentialStatus === QMLManager.VALID || credentialStatus === QMLManager.VALID_EMAIL) ? 0 : 1 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 		visible: opacity > 0 | 
					
						
							|  |  |  | 		Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } } | 
					
						
							| 
									
										
										
										
											2017-04-03 10:48:35 -07:00
										 |  |  | 		function setupActions() { | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 			if (visible) { | 
					
						
							| 
									
										
										
										
											2016-04-19 04:51:19 -07:00
										 |  |  | 				page.actions.main = page.saveAction | 
					
						
							| 
									
										
										
										
											2016-04-21 05:21:56 -07:00
										 |  |  | 				page.actions.right = page.offlineAction | 
					
						
							| 
									
										
										
										
											2016-05-03 21:24:00 +02:00
										 |  |  | 				title = qsTr("Cloud credentials") | 
					
						
							| 
									
										
										
										
											2016-04-22 05:19:34 -07:00
										 |  |  | 			} else if(manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL || manager.credentialStatus === QMLManager.NOCLOUD) { | 
					
						
							| 
									
										
										
										
											2016-04-19 04:51:19 -07:00
										 |  |  | 				page.actions.main = page.addDiveAction | 
					
						
							| 
									
										
										
										
											2016-04-22 05:05:57 -07:00
										 |  |  | 				page.actions.right = null | 
					
						
							| 
									
										
										
										
											2016-05-03 21:24:00 +02:00
										 |  |  | 				title = qsTr("Dive list") | 
					
						
							| 
									
										
										
										
											2016-04-22 05:19:34 -07:00
										 |  |  | 				if (diveListView.count === 0) | 
					
						
							|  |  |  | 					showPassiveNotification(qsTr("Please tap the '+' button to add a dive"), 3000) | 
					
						
							| 
									
										
										
										
											2016-04-20 06:56:01 -07:00
										 |  |  | 			} else { | 
					
						
							|  |  |  | 				page.actions.main = null | 
					
						
							| 
									
										
										
										
											2016-04-22 05:05:57 -07:00
										 |  |  | 				page.actions.right = null | 
					
						
							| 
									
										
										
										
											2016-05-03 21:24:00 +02:00
										 |  |  | 				title = qsTr("Dive list") | 
					
						
							| 
									
										
										
										
											2015-11-29 21:13:57 +01:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-04-03 10:48:35 -07:00
										 |  |  | 		onVisibleChanged: { | 
					
						
							|  |  |  | 			setupActions(); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		Component.onCompleted: { | 
					
						
							|  |  |  | 			setupActions(); | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-11-29 21:13:57 +01:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2016-01-12 01:15:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-21 16:22:15 -08: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 16:53:00 +02:00
										 |  |  | 		text: qsTr("No dives in dive list") | 
					
						
							|  |  |  | 		visible: diveListView.visible && diveListView.count === 0 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 	ListView { | 
					
						
							|  |  |  | 		id: diveListView | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 		anchors.fill: parent | 
					
						
							| 
									
										
										
										
											2017-04-03 14:08:00 +02:00
										 |  |  | 		opacity: 0.8 - startPage.opacity | 
					
						
							| 
									
										
										
										
											2016-02-10 18:09:16 -08:00
										 |  |  | 		visible: opacity > 0 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 		model: diveModel | 
					
						
							|  |  |  | 		currentIndex: -1 | 
					
						
							|  |  |  | 		delegate: diveDelegate | 
					
						
							|  |  |  | 		//boundsBehavior: Flickable.StopAtBounds
 | 
					
						
							|  |  |  | 		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 | 
					
						
							|  |  |  | 		Connections { | 
					
						
							|  |  |  | 			target: detailsWindow | 
					
						
							|  |  |  | 			onCurrentIndexChanged: diveListView.currentIndex = detailsWindow.currentIndex | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2016-02-13 21:09:33 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-31 16:15:14 +02:00
										 |  |  | 	property QtObject addDiveAction: Kirigami.Action { | 
					
						
							| 
									
										
										
										
											2016-04-01 22:31:33 -05:00
										 |  |  | 		iconName: "list-add" | 
					
						
							|  |  |  | 		onTriggered: { | 
					
						
							|  |  |  | 			startAddDive() | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-31 16:15:14 +02:00
										 |  |  | 	property QtObject saveAction: Kirigami.Action { | 
					
						
							| 
									
										
										
										
											2016-02-13 21:09:33 -08:00
										 |  |  | 		iconName: "document-save" | 
					
						
							|  |  |  | 		onTriggered: { | 
					
						
							| 
									
										
										
										
											2016-04-06 11:40:34 -07:00
										 |  |  | 			Qt.inputMethod.hide() | 
					
						
							| 
									
										
										
										
											2016-02-13 21:09:33 -08:00
										 |  |  | 			startPage.saveCredentials(); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-31 16:15:14 +02:00
										 |  |  | 	property QtObject offlineAction: Kirigami.Action { | 
					
						
							| 
									
										
										
										
											2016-04-21 05:21:56 -07:00
										 |  |  | 		iconName: "qrc:/qml/nocloud.svg" | 
					
						
							|  |  |  | 		onTriggered: { | 
					
						
							|  |  |  | 			manager.syncToCloud = false | 
					
						
							| 
									
										
										
										
											2016-04-22 05:19:34 -07:00
										 |  |  | 			manager.credentialStatus = QMLManager.NOCLOUD | 
					
						
							| 
									
										
										
										
											2016-04-21 05:21:56 -07:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-13 21:09:33 -08:00
										 |  |  | 	onBackRequested: { | 
					
						
							| 
									
										
										
										
											2017-04-03 14:08:00 +02:00
										 |  |  | 		if (startPage.visible && diveListView.count > 0 && manager.credentialStatus !== QMLManager.INVALID) { | 
					
						
							| 
									
										
										
										
											2016-02-13 21:09:33 -08:00
										 |  |  | 			manager.credentialStatus = oldStatus | 
					
						
							| 
									
										
										
										
											2016-02-14 12:17:24 -08:00
										 |  |  | 			event.accepted = true; | 
					
						
							| 
									
										
										
										
											2016-02-13 21:09:33 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-04-03 14:08:00 +02:00
										 |  |  | 		if (!startPage.visible) { | 
					
						
							| 
									
										
										
										
											2016-04-21 12:14:37 -07:00
										 |  |  | 			if (Qt.platform.os != "ios") { | 
					
						
							|  |  |  | 				manager.quit() | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2016-06-12 12:12:37 -07:00
										 |  |  | 			// let's make sure Kirigami doesn't quit on our behalf
 | 
					
						
							|  |  |  | 			event.accepted = true | 
					
						
							| 
									
										
										
										
											2016-04-15 14:42:08 -07:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2016-02-13 21:09:33 -08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | } |