2017-04-27 18:30:36 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2015-12-03 22:06:52 +00:00
|
|
|
import QtQuick 2.3
|
2017-03-31 14:15:14 +00:00
|
|
|
import QtQuick.Controls 2.0
|
2015-12-03 22:06:52 +00:00
|
|
|
import QtQuick.Window 2.2
|
|
|
|
import QtQuick.Dialogs 1.2
|
|
|
|
import QtQuick.Layouts 1.1
|
2017-03-31 14:15:14 +00:00
|
|
|
import org.kde.kirigami 2.0 as Kirigami
|
2015-12-03 22:06:52 +00:00
|
|
|
import org.subsurfacedivelog.mobile 1.0
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: loginWindow
|
2017-07-20 17:39:55 +00:00
|
|
|
height: outerLayout.height
|
2015-12-03 22:06:52 +00:00
|
|
|
|
|
|
|
property string username: login.text;
|
|
|
|
property string password: password.text;
|
|
|
|
|
2016-02-14 05:09:33 +00:00
|
|
|
function saveCredentials() {
|
|
|
|
manager.cloudUserName = login.text
|
|
|
|
manager.cloudPassword = password.text
|
2016-06-13 23:42:36 +00:00
|
|
|
manager.cloudPin = pin.text
|
2016-02-14 05:09:33 +00:00
|
|
|
manager.saveCloudCredentials()
|
|
|
|
}
|
|
|
|
|
2015-12-03 22:06:52 +00:00
|
|
|
ColumnLayout {
|
2016-02-11 15:01:24 +00:00
|
|
|
id: outerLayout
|
2016-04-07 19:12:01 +00:00
|
|
|
width: loginWindow.width - loginWindow.leftPadding - loginWindow.rightPadding - 2 * Kirigami.Units.gridUnit
|
2016-03-27 04:27:48 +00:00
|
|
|
|
2016-04-21 21:00:37 +00: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-27 04:27:48 +00:00
|
|
|
onVisibleChanged: {
|
2016-04-04 00:00:49 +00:00
|
|
|
if (visible && manager.accessingCloud < 0) {
|
2016-03-27 04:35:35 +00:00
|
|
|
manager.appendTextToLog("Credential scrn: show kbd was: " + (Qt.inputMethod.isVisible ? "visible" : "invisible"))
|
2016-03-27 04:27:48 +00:00
|
|
|
Qt.inputMethod.show()
|
|
|
|
login.forceActiveFocus()
|
|
|
|
} else {
|
2016-03-27 04:35:35 +00:00
|
|
|
manager.appendTextToLog("Credential scrn: hide kbd was: " + (Qt.inputMethod.isVisible ? "visible" : "invisible"))
|
2016-03-27 04:27:48 +00:00
|
|
|
Qt.inputMethod.hide()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.Heading {
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("Cloud credentials")
|
2016-02-10 12:53:55 +00:00
|
|
|
level: headingLevel
|
2016-03-08 20:26:54 +00:00
|
|
|
Layout.bottomMargin: Kirigami.Units.largeSpacing / 2
|
2015-12-03 22:06:52 +00:00
|
|
|
}
|
|
|
|
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.Label {
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("Email")
|
2015-12-03 22:06:52 +00:00
|
|
|
}
|
|
|
|
|
2017-03-31 14:15:14 +00:00
|
|
|
TextField {
|
2015-12-03 22:06:52 +00:00
|
|
|
id: login
|
|
|
|
text: manager.cloudUserName
|
|
|
|
Layout.fillWidth: true
|
2015-12-27 20:19:51 +00:00
|
|
|
inputMethodHints: Qt.ImhEmailCharactersOnly |
|
|
|
|
Qt.ImhNoAutoUppercase
|
2015-12-03 22:06:52 +00:00
|
|
|
}
|
|
|
|
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.Label {
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("Password")
|
2015-12-03 22:06:52 +00:00
|
|
|
}
|
|
|
|
|
2017-03-31 14:15:14 +00:00
|
|
|
TextField {
|
2015-12-03 22:06:52 +00:00
|
|
|
id: password
|
|
|
|
text: manager.cloudPassword
|
|
|
|
echoMode: TextInput.Password
|
2015-12-30 10:46:28 +00:00
|
|
|
inputMethodHints: Qt.ImhSensitiveData |
|
2015-12-27 20:19:51 +00:00
|
|
|
Qt.ImhHiddenText |
|
|
|
|
Qt.ImhNoAutoUppercase
|
2015-12-03 22:06:52 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
2016-06-13 23:42:36 +00:00
|
|
|
|
2015-12-04 01:57:25 +00:00
|
|
|
GridLayout {
|
|
|
|
columns: 2
|
2015-12-03 22:06:52 +00:00
|
|
|
|
2017-07-20 17:39:55 +00:00
|
|
|
Switch {
|
2015-12-04 01:57:25 +00:00
|
|
|
checked: false
|
|
|
|
id: showPassword
|
|
|
|
onCheckedChanged: {
|
|
|
|
password.echoMode = checked ? TextInput.Normal : TextInput.Password
|
|
|
|
}
|
|
|
|
}
|
2016-03-08 20:26:54 +00:00
|
|
|
Kirigami.Label {
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("Show password")
|
2015-12-03 22:06:52 +00:00
|
|
|
}
|
|
|
|
}
|
2016-06-13 23:42:36 +00:00
|
|
|
|
|
|
|
Kirigami.Label {
|
|
|
|
text: qsTr("PIN")
|
|
|
|
visible: rootItem.showPin
|
|
|
|
}
|
2017-03-31 14:15:14 +00:00
|
|
|
TextField {
|
2016-06-13 23:42:36 +00:00
|
|
|
id: pin
|
|
|
|
text: ""
|
|
|
|
Layout.fillWidth: true
|
|
|
|
visible: rootItem.showPin
|
|
|
|
}
|
2015-12-03 22:06:52 +00:00
|
|
|
}
|
|
|
|
}
|