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
|
2017-08-03 22:47:37 +00:00
|
|
|
width: loginWindow.width - Kirigami.Units.gridUnit // to ensure the full input fields are visible
|
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:27:48 +00:00
|
|
|
Qt.inputMethod.show()
|
|
|
|
login.forceActiveFocus()
|
|
|
|
} else {
|
|
|
|
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")
|
2017-08-03 22:31:23 +00:00
|
|
|
font.pointSize: subsurfaceTheme.smallPointSize
|
|
|
|
color: subsurfaceTheme.secondaryTextColor
|
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
|
2017-07-22 20:15:28 +00:00
|
|
|
onEditingFinished: {
|
|
|
|
saveCredentials()
|
|
|
|
}
|
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")
|
2017-08-03 22:31:23 +00:00
|
|
|
font.pointSize: subsurfaceTheme.smallPointSize
|
|
|
|
color: subsurfaceTheme.secondaryTextColor
|
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
|
2017-07-26 13:19:42 +00:00
|
|
|
echoMode: TextInput.PasswordEchoOnEdit
|
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
|
2017-07-22 20:15:28 +00:00
|
|
|
onEditingFinished: {
|
|
|
|
saveCredentials()
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
}
|