| 
									
										
										
										
											2017-04-27 20:30:36 +02:00
										 |  |  | // SPDX-License-Identifier: GPL-2.0
 | 
					
						
							| 
									
										
										
										
											2015-12-03 14:06:52 -08:00
										 |  |  | import QtQuick 2.3 | 
					
						
							| 
									
										
										
										
											2017-03-31 16:15:14 +02:00
										 |  |  | import QtQuick.Controls 2.0 | 
					
						
							| 
									
										
										
										
											2015-12-03 14:06:52 -08:00
										 |  |  | import QtQuick.Window 2.2 | 
					
						
							|  |  |  | import QtQuick.Dialogs 1.2 | 
					
						
							|  |  |  | import QtQuick.Layouts 1.1 | 
					
						
							| 
									
										
										
										
											2017-03-31 16:15:14 +02:00
										 |  |  | import org.kde.kirigami 2.0 as Kirigami | 
					
						
							| 
									
										
										
										
											2015-12-03 14:06:52 -08:00
										 |  |  | import org.subsurfacedivelog.mobile 1.0 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Item { | 
					
						
							|  |  |  | 	id: loginWindow | 
					
						
							| 
									
										
										
										
											2017-07-20 19:39:55 +02:00
										 |  |  | 	height: outerLayout.height | 
					
						
							| 
									
										
										
										
											2015-12-03 14:06:52 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	property string username: login.text; | 
					
						
							|  |  |  | 	property string password: password.text; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-13 21:09:33 -08:00
										 |  |  | 	function saveCredentials() { | 
					
						
							|  |  |  | 		manager.cloudUserName = login.text | 
					
						
							|  |  |  | 		manager.cloudPassword = password.text | 
					
						
							| 
									
										
										
										
											2016-06-13 16:42:36 -07:00
										 |  |  | 		manager.cloudPin = pin.text | 
					
						
							| 
									
										
										
										
											2016-02-13 21:09:33 -08:00
										 |  |  | 		manager.saveCloudCredentials() | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 14:06:52 -08:00
										 |  |  | 	ColumnLayout { | 
					
						
							| 
									
										
										
										
											2016-02-11 07:01:24 -08:00
										 |  |  | 		id: outerLayout | 
					
						
							| 
									
										
										
										
											2017-08-03 15:47:37 -07:00
										 |  |  | 		width: loginWindow.width - Kirigami.Units.gridUnit // to ensure the full input fields are visible
 | 
					
						
							| 
									
										
										
										
											2016-03-26 21:27:48 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-21 14:00:37 -07:00
										 |  |  | 		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() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-26 21:27:48 -07:00
										 |  |  | 		onVisibleChanged: { | 
					
						
							| 
									
										
										
										
											2016-04-03 19:00:49 -05:00
										 |  |  | 			if (visible && manager.accessingCloud < 0) { | 
					
						
							| 
									
										
										
										
											2016-03-26 21:27:48 -07:00
										 |  |  | 				Qt.inputMethod.show() | 
					
						
							|  |  |  | 				login.forceActiveFocus() | 
					
						
							|  |  |  | 			} else { | 
					
						
							|  |  |  | 				Qt.inputMethod.hide() | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 		Kirigami.Heading { | 
					
						
							| 
									
										
										
										
											2016-05-03 21:24:00 +02:00
										 |  |  | 			text: qsTr("Cloud credentials") | 
					
						
							| 
									
										
										
										
											2016-02-10 04:53:55 -08:00
										 |  |  | 			level: headingLevel | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 			Layout.bottomMargin: Kirigami.Units.largeSpacing / 2 | 
					
						
							| 
									
										
										
										
											2015-12-03 14:06:52 -08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 		Kirigami.Label { | 
					
						
							| 
									
										
										
										
											2016-05-03 21:24:00 +02:00
										 |  |  | 			text: qsTr("Email") | 
					
						
							| 
									
										
										
										
											2017-08-03 15:31:23 -07:00
										 |  |  | 			font.pointSize: subsurfaceTheme.smallPointSize | 
					
						
							|  |  |  | 			color: subsurfaceTheme.secondaryTextColor | 
					
						
							| 
									
										
										
										
											2015-12-03 14:06:52 -08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-31 16:15:14 +02:00
										 |  |  | 		TextField { | 
					
						
							| 
									
										
										
										
											2015-12-03 14:06:52 -08:00
										 |  |  | 			id: login | 
					
						
							|  |  |  | 			text: manager.cloudUserName | 
					
						
							|  |  |  | 			Layout.fillWidth: true | 
					
						
							| 
									
										
										
										
											2015-12-27 12:19:51 -08:00
										 |  |  | 			inputMethodHints: Qt.ImhEmailCharactersOnly | | 
					
						
							|  |  |  | 					  Qt.ImhNoAutoUppercase | 
					
						
							| 
									
										
										
										
											2017-07-22 13:15:28 -07:00
										 |  |  | 			onEditingFinished: { | 
					
						
							|  |  |  | 				saveCredentials() | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2015-12-03 14:06:52 -08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 		Kirigami.Label { | 
					
						
							| 
									
										
										
										
											2016-05-03 21:24:00 +02:00
										 |  |  | 			text: qsTr("Password") | 
					
						
							| 
									
										
										
										
											2017-08-03 15:31:23 -07:00
										 |  |  | 			font.pointSize: subsurfaceTheme.smallPointSize | 
					
						
							|  |  |  | 			color: subsurfaceTheme.secondaryTextColor | 
					
						
							| 
									
										
										
										
											2015-12-03 14:06:52 -08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-31 16:15:14 +02:00
										 |  |  | 		TextField { | 
					
						
							| 
									
										
										
										
											2015-12-03 14:06:52 -08:00
										 |  |  | 			id: password | 
					
						
							|  |  |  | 			text: manager.cloudPassword | 
					
						
							| 
									
										
										
										
											2017-07-26 15:19:42 +02:00
										 |  |  | 			echoMode: TextInput.PasswordEchoOnEdit | 
					
						
							| 
									
										
										
										
											2015-12-30 21:46:28 +11:00
										 |  |  | 			inputMethodHints: Qt.ImhSensitiveData | | 
					
						
							| 
									
										
										
										
											2015-12-27 12:19:51 -08:00
										 |  |  | 					  Qt.ImhHiddenText | | 
					
						
							|  |  |  | 					  Qt.ImhNoAutoUppercase | 
					
						
							| 
									
										
										
										
											2015-12-03 14:06:52 -08:00
										 |  |  | 			Layout.fillWidth: true | 
					
						
							| 
									
										
										
										
											2017-07-22 13:15:28 -07:00
										 |  |  | 			onEditingFinished: { | 
					
						
							|  |  |  | 				saveCredentials() | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2015-12-03 14:06:52 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2016-06-13 16:42:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		Kirigami.Label { | 
					
						
							|  |  |  | 			text: qsTr("PIN") | 
					
						
							|  |  |  | 			visible: rootItem.showPin | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-03-31 16:15:14 +02:00
										 |  |  | 		TextField { | 
					
						
							| 
									
										
										
										
											2016-06-13 16:42:36 -07:00
										 |  |  | 			id: pin | 
					
						
							|  |  |  | 			text: "" | 
					
						
							|  |  |  | 			Layout.fillWidth: true | 
					
						
							|  |  |  | 			visible: rootItem.showPin | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-12-03 14:06:52 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | } |