mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	QML UI: use action button and Android back button to save / go back
This is more consistent with the rest of our UI To make this work you once again need changes to the mobile components that aren't upstream, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									ae116c5bc8
								
							
						
					
					
						commit
						5952b09b51
					
				
					 3 changed files with 34 additions and 29 deletions
				
			
		| 
						 | 
					@ -14,6 +14,13 @@ Item {
 | 
				
			||||||
	property string password: password.text;
 | 
						property string password: password.text;
 | 
				
			||||||
	property bool issave: savePassword.checked;
 | 
						property bool issave: savePassword.checked;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						function saveCredentials() {
 | 
				
			||||||
 | 
							manager.cloudUserName = login.text
 | 
				
			||||||
 | 
							manager.cloudPassword = password.text
 | 
				
			||||||
 | 
							manager.saveCloudPassword = savePassword.checked
 | 
				
			||||||
 | 
							manager.saveCloudCredentials()
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ColumnLayout {
 | 
						ColumnLayout {
 | 
				
			||||||
		id: outerLayout
 | 
							id: outerLayout
 | 
				
			||||||
		width: subsurfaceTheme.columnWidth - 2 * MobileComponents.Units.gridUnit
 | 
							width: subsurfaceTheme.columnWidth - 2 * MobileComponents.Units.gridUnit
 | 
				
			||||||
| 
						 | 
					@ -71,34 +78,5 @@ Item {
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		Item { width: MobileComponents.Units.gridUnit; height: width }
 | 
							Item { width: MobileComponents.Units.gridUnit; height: width }
 | 
				
			||||||
		RowLayout {
 | 
					 | 
				
			||||||
			Item {
 | 
					 | 
				
			||||||
				height: saveButton.height
 | 
					 | 
				
			||||||
				width: saveButton.width
 | 
					 | 
				
			||||||
				SubsurfaceButton {
 | 
					 | 
				
			||||||
					id: saveButton
 | 
					 | 
				
			||||||
					text: "Save"
 | 
					 | 
				
			||||||
					onClicked: {
 | 
					 | 
				
			||||||
						manager.cloudUserName = login.text
 | 
					 | 
				
			||||||
						manager.cloudPassword = password.text
 | 
					 | 
				
			||||||
						manager.saveCloudPassword = savePassword.checked
 | 
					 | 
				
			||||||
						manager.saveCloudCredentials()
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			Item {
 | 
					 | 
				
			||||||
				height: backButton.height
 | 
					 | 
				
			||||||
				width: backButton.width
 | 
					 | 
				
			||||||
				visible: diveListView.count > 0 && manager.credentialStatus != QMLManager.INVALID
 | 
					 | 
				
			||||||
				SubsurfaceButton {
 | 
					 | 
				
			||||||
					id: backButton
 | 
					 | 
				
			||||||
					text: "Back to dive list"
 | 
					 | 
				
			||||||
					onClicked: {
 | 
					 | 
				
			||||||
						manager.credentialStatus = oldStatus
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -184,13 +184,37 @@ MobileComponents.Page {
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						property QtObject saveAction: Action {
 | 
				
			||||||
 | 
							iconName: "document-save"
 | 
				
			||||||
 | 
							onTriggered: {
 | 
				
			||||||
 | 
								startPage.saveCredentials();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						onBackRequested: {
 | 
				
			||||||
 | 
							if (diveListView.count > 0 && manager.credentialStatus != QMLManager.INVALID) {
 | 
				
			||||||
 | 
								manager.credentialStatus = oldStatus
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							event.accepted = true;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ScrollView {
 | 
						ScrollView {
 | 
				
			||||||
		id: startPageWrapper
 | 
							id: startPageWrapper
 | 
				
			||||||
		anchors.fill: parent
 | 
							anchors.fill: parent
 | 
				
			||||||
		opacity: (diveListView.count > 0 && (credentialStatus == QMLManager.VALID || credentialStatus == QMLManager.VALID_EMAIL)) ? 0 : 1
 | 
							opacity: (diveListView.count > 0 && (credentialStatus == QMLManager.VALID || credentialStatus == QMLManager.VALID_EMAIL)) ? 0 : 1
 | 
				
			||||||
		visible: opacity > 0
 | 
							visible: opacity > 0
 | 
				
			||||||
		Behavior on opacity { NumberAnimation { duration: MobileComponents.Units.shortDuration } }
 | 
							Behavior on opacity { NumberAnimation { duration: MobileComponents.Units.shortDuration } }
 | 
				
			||||||
 | 
							onVisibleChanged: {
 | 
				
			||||||
 | 
								if (visible) {
 | 
				
			||||||
 | 
									page.mainAction = page.saveAction
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									page.mainAction = null
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		StartPage {
 | 
							StartPage {
 | 
				
			||||||
 | 
								id: startPage
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,6 +13,8 @@ ColumnLayout {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	property int buttonWidth: width * 0.9
 | 
						property int buttonWidth: width * 0.9
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						function saveCredentials() { cloudCredentials.saveCredentials() }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	MobileComponents.Heading {
 | 
						MobileComponents.Heading {
 | 
				
			||||||
		Layout.bottomMargin: MobileComponents.Units.largeSpacing
 | 
							Layout.bottomMargin: MobileComponents.Units.largeSpacing
 | 
				
			||||||
			text: "Subsurface-mobile"
 | 
								text: "Subsurface-mobile"
 | 
				
			||||||
| 
						 | 
					@ -32,6 +34,7 @@ ColumnLayout {
 | 
				
			||||||
		wrapMode: Text.WordWrap
 | 
							wrapMode: Text.WordWrap
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	CloudCredentials {
 | 
						CloudCredentials {
 | 
				
			||||||
 | 
							id: cloudCredentials
 | 
				
			||||||
		Layout.fillWidth: true
 | 
							Layout.fillWidth: true
 | 
				
			||||||
		Layout.margins: MobileComponents.Units.gridUnit
 | 
							Layout.margins: MobileComponents.Units.gridUnit
 | 
				
			||||||
		Layout.topMargin: MobileComponents.Units.gridUnit * 2
 | 
							Layout.topMargin: MobileComponents.Units.gridUnit * 2
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue