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")
|
QML UI: rework single credential page to two pages
This commit tries to implement most of issue #515. It reworks the
one credential page, which its dynamic PIN part, into two pages.
Main driver of selecting one of the two pages is the showPin
boolean. Page 1 contains the email/passwd field (and the
option to use a no cloud setup). Page 2 only contains the PIN
part (and the option to cancel the process).
The Kirigami central button does not seem very handy here. We
need, for example, a cancel, sign-in and register, only register,
etc. buttons, which are not easy to handle in specific icons.
Therefore, normal pushbuttons are chosen to deal with user
interaction, and the Kirigami button is removed from these
pages.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-27 17:11:23 +00:00
|
|
|
visible: !rootItem.showPin
|
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
|
QML UI: rework single credential page to two pages
This commit tries to implement most of issue #515. It reworks the
one credential page, which its dynamic PIN part, into two pages.
Main driver of selecting one of the two pages is the showPin
boolean. Page 1 contains the email/passwd field (and the
option to use a no cloud setup). Page 2 only contains the PIN
part (and the option to cancel the process).
The Kirigami central button does not seem very handy here. We
need, for example, a cancel, sign-in and register, only register,
etc. buttons, which are not easy to handle in specific icons.
Therefore, normal pushbuttons are chosen to deal with user
interaction, and the Kirigami button is removed from these
pages.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-27 17:11:23 +00:00
|
|
|
visible: !rootItem.showPin
|
2015-12-03 22:06:52 +00:00
|
|
|
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")
|
QML UI: rework single credential page to two pages
This commit tries to implement most of issue #515. It reworks the
one credential page, which its dynamic PIN part, into two pages.
Main driver of selecting one of the two pages is the showPin
boolean. Page 1 contains the email/passwd field (and the
option to use a no cloud setup). Page 2 only contains the PIN
part (and the option to cancel the process).
The Kirigami central button does not seem very handy here. We
need, for example, a cancel, sign-in and register, only register,
etc. buttons, which are not easy to handle in specific icons.
Therefore, normal pushbuttons are chosen to deal with user
interaction, and the Kirigami button is removed from these
pages.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-27 17:11:23 +00:00
|
|
|
visible: !rootItem.showPin
|
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
|
QML UI: rework single credential page to two pages
This commit tries to implement most of issue #515. It reworks the
one credential page, which its dynamic PIN part, into two pages.
Main driver of selecting one of the two pages is the showPin
boolean. Page 1 contains the email/passwd field (and the
option to use a no cloud setup). Page 2 only contains the PIN
part (and the option to cancel the process).
The Kirigami central button does not seem very handy here. We
need, for example, a cancel, sign-in and register, only register,
etc. buttons, which are not easy to handle in specific icons.
Therefore, normal pushbuttons are chosen to deal with user
interaction, and the Kirigami button is removed from these
pages.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-27 17:11:23 +00:00
|
|
|
visible: !rootItem.showPin
|
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
|
|
|
|
}
|
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
|
|
|
|
}
|
QML UI: rework single credential page to two pages
This commit tries to implement most of issue #515. It reworks the
one credential page, which its dynamic PIN part, into two pages.
Main driver of selecting one of the two pages is the showPin
boolean. Page 1 contains the email/passwd field (and the
option to use a no cloud setup). Page 2 only contains the PIN
part (and the option to cancel the process).
The Kirigami central button does not seem very handy here. We
need, for example, a cancel, sign-in and register, only register,
etc. buttons, which are not easy to handle in specific icons.
Therefore, normal pushbuttons are chosen to deal with user
interaction, and the Kirigami button is removed from these
pages.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-27 17:11:23 +00:00
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.margins: Kirigami.Units.smallSpacing
|
|
|
|
spacing: Kirigami.Units.smallSpacing
|
|
|
|
visible: rootItem.showPin
|
|
|
|
SsrfButton {
|
2017-09-29 07:15:43 +00:00
|
|
|
id: registerpin
|
QML UI: rework single credential page to two pages
This commit tries to implement most of issue #515. It reworks the
one credential page, which its dynamic PIN part, into two pages.
Main driver of selecting one of the two pages is the showPin
boolean. Page 1 contains the email/passwd field (and the
option to use a no cloud setup). Page 2 only contains the PIN
part (and the option to cancel the process).
The Kirigami central button does not seem very handy here. We
need, for example, a cancel, sign-in and register, only register,
etc. buttons, which are not easy to handle in specific icons.
Therefore, normal pushbuttons are chosen to deal with user
interaction, and the Kirigami button is removed from these
pages.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-27 17:11:23 +00:00
|
|
|
text: qsTr("Register")
|
|
|
|
onClicked: {
|
|
|
|
saveCredentials()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Kirigami.Label {
|
|
|
|
text: "" // Spacer between 2 button groups
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
SsrfButton {
|
|
|
|
id: cancelpin
|
|
|
|
text: qsTr("Cancel")
|
|
|
|
onClicked: {
|
|
|
|
manager.cancelCredentialsPinSetup()
|
|
|
|
rootItem.returnTopPage()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.margins: Kirigami.Units.smallSpacing
|
|
|
|
spacing: Kirigami.Units.smallSpacing
|
|
|
|
visible: !rootItem.showPin
|
|
|
|
|
|
|
|
SsrfButton {
|
2017-09-29 07:15:43 +00:00
|
|
|
id: signin_register_normal
|
QML UI: rework single credential page to two pages
This commit tries to implement most of issue #515. It reworks the
one credential page, which its dynamic PIN part, into two pages.
Main driver of selecting one of the two pages is the showPin
boolean. Page 1 contains the email/passwd field (and the
option to use a no cloud setup). Page 2 only contains the PIN
part (and the option to cancel the process).
The Kirigami central button does not seem very handy here. We
need, for example, a cancel, sign-in and register, only register,
etc. buttons, which are not easy to handle in specific icons.
Therefore, normal pushbuttons are chosen to deal with user
interaction, and the Kirigami button is removed from these
pages.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-27 17:11:23 +00:00
|
|
|
text: qsTr("Sign-in or Register")
|
|
|
|
onClicked: {
|
|
|
|
saveCredentials()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Kirigami.Label {
|
|
|
|
text: "" // Spacer between 2 button groups
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
SsrfButton {
|
|
|
|
id: toNoCloudMode
|
|
|
|
text: qsTr("No cloud mode")
|
|
|
|
onClicked: {
|
|
|
|
manager.syncToCloud = false
|
|
|
|
manager.credentialStatus = QMLManager.CS_NOCLOUD
|
|
|
|
manager.saveCloudCredentials()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-12-03 22:06:52 +00:00
|
|
|
}
|
|
|
|
}
|