| 
									
										
										
										
											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 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 	height: outerLayout.height + 2 * Kirigami.Units.gridUnit | 
					
						
							| 
									
										
										
										
											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 | 
					
						
							| 
									
										
										
										
											2016-04-07 12:12:01 -07:00
										 |  |  | 		width: loginWindow.width - loginWindow.leftPadding - loginWindow.rightPadding - 2 * Kirigami.Units.gridUnit | 
					
						
							| 
									
										
										
										
											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:35:35 -07:00
										 |  |  | 				manager.appendTextToLog("Credential scrn: show kbd was: " + (Qt.inputMethod.isVisible ? "visible" : "invisible")) | 
					
						
							| 
									
										
										
										
											2016-03-26 21:27:48 -07:00
										 |  |  | 				Qt.inputMethod.show() | 
					
						
							|  |  |  | 				login.forceActiveFocus() | 
					
						
							|  |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2016-03-26 21:35:35 -07:00
										 |  |  | 				manager.appendTextToLog("Credential scrn: hide kbd was: " + (Qt.inputMethod.isVisible ? "visible" : "invisible")) | 
					
						
							| 
									
										
										
										
											2016-03-26 21:27:48 -07:00
										 |  |  | 				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") | 
					
						
							| 
									
										
										
										
											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 | 
					
						
							| 
									
										
										
										
											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") | 
					
						
							| 
									
										
										
										
											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 | 
					
						
							|  |  |  | 			echoMode: TextInput.Password | 
					
						
							| 
									
										
										
										
											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 | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2016-06-13 16:42:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 17:57:25 -08:00
										 |  |  | 		GridLayout { | 
					
						
							|  |  |  | 			columns: 2 | 
					
						
							| 
									
										
										
										
											2015-12-03 14:06:52 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-03 17:57:25 -08:00
										 |  |  | 			CheckBox { | 
					
						
							|  |  |  | 				checked: false | 
					
						
							|  |  |  | 				id: showPassword | 
					
						
							|  |  |  | 				onCheckedChanged: { | 
					
						
							|  |  |  | 					password.echoMode = checked ? TextInput.Normal : TextInput.Password | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 			Kirigami.Label { | 
					
						
							| 
									
										
										
										
											2016-05-03 21:24:00 +02:00
										 |  |  | 				text: qsTr("Show password") | 
					
						
							| 
									
										
										
										
											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 | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 		Item { width: Kirigami.Units.gridUnit; height: width } | 
					
						
							| 
									
										
										
										
											2015-12-03 14:06:52 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | } |