2017-04-27 18:30:36 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2017-10-29 07:44:06 +00:00
|
|
|
import QtQuick 2.6
|
2017-10-29 12:44:22 +00:00
|
|
|
import QtQuick.Controls 2.2 as Controls
|
2015-12-03 22:06:52 +00:00
|
|
|
import QtQuick.Window 2.2
|
|
|
|
import QtQuick.Dialogs 1.2
|
2017-10-30 10:26:47 +00:00
|
|
|
import QtQuick.Layouts 1.2
|
2018-09-27 20:09:26 +00:00
|
|
|
import org.kde.kirigami 2.4 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() {
|
2018-06-13 16:06:11 +00:00
|
|
|
prefs.cloudPin = pin.text
|
2019-12-21 16:33:51 +00:00
|
|
|
manager.saveCloudCredentials(login.text, password.text)
|
2016-02-14 05:09:33 +00:00
|
|
|
}
|
|
|
|
|
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: {
|
2019-12-18 13:35:04 +00:00
|
|
|
if (visible) {
|
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
|
|
|
}
|
|
|
|
|
2017-10-12 12:25:22 +00:00
|
|
|
Controls.Label {
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("Email")
|
2019-12-18 10:29:37 +00:00
|
|
|
visible: !prefs.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-10-12 12:25:22 +00:00
|
|
|
Controls.TextField {
|
2015-12-03 22:06:52 +00:00
|
|
|
id: login
|
2019-12-20 15:35:12 +00:00
|
|
|
text: PrefCloudStorage.cloud_storage_email
|
2019-12-18 10:29:37 +00:00
|
|
|
visible: !prefs.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
|
|
|
}
|
|
|
|
|
2017-10-12 12:25:22 +00:00
|
|
|
Controls.Label {
|
2016-05-03 19:24:00 +00:00
|
|
|
text: qsTr("Password")
|
2019-12-18 10:29:37 +00:00
|
|
|
visible: !prefs.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-10-12 12:25:22 +00:00
|
|
|
Controls.TextField {
|
2015-12-03 22:06:52 +00:00
|
|
|
id: password
|
2019-12-20 16:04:28 +00:00
|
|
|
text: PrefCloudStorage.cloud_storage_password
|
2019-12-24 23:21:18 +00:00
|
|
|
visible: !prefs.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
|
|
|
|
2017-10-12 12:25:22 +00:00
|
|
|
Controls.Label {
|
2016-06-13 23:42:36 +00:00
|
|
|
text: qsTr("PIN")
|
2019-12-18 10:29:37 +00:00
|
|
|
visible: prefs.showPin
|
2016-06-13 23:42:36 +00:00
|
|
|
}
|
2017-10-12 12:25:22 +00:00
|
|
|
Controls.TextField {
|
2016-06-13 23:42:36 +00:00
|
|
|
id: pin
|
|
|
|
text: ""
|
|
|
|
Layout.fillWidth: true
|
2019-12-18 10:29:37 +00:00
|
|
|
visible: prefs.showPin
|
2016-06-13 23:42:36 +00:00
|
|
|
}
|
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 {
|
2018-06-25 08:41:29 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.margins: Kirigami.Units.smallSpacing
|
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
|
|
|
spacing: Kirigami.Units.smallSpacing
|
2019-12-18 10:29:37 +00:00
|
|
|
visible: prefs.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
|
|
|
SsrfButton {
|
2017-09-29 07:15:43 +00:00
|
|
|
id: registerpin
|
2019-12-20 15:35:12 +00:00
|
|
|
text: qsTr("Register")
|
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
|
|
|
onClicked: {
|
|
|
|
saveCredentials()
|
|
|
|
}
|
|
|
|
}
|
2017-10-12 12:25:22 +00:00
|
|
|
Controls.Label {
|
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: "" // Spacer between 2 button groups
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
SsrfButton {
|
|
|
|
id: cancelpin
|
|
|
|
text: qsTr("Cancel")
|
|
|
|
onClicked: {
|
2018-06-18 08:53:08 +00:00
|
|
|
prefs.cancelCredentialsPinSetup()
|
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
|
|
|
rootItem.returnTopPage()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
2018-06-25 08:41:29 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.margins: Kirigami.Units.smallSpacing
|
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
|
|
|
spacing: Kirigami.Units.smallSpacing
|
2019-12-18 10:29:37 +00:00
|
|
|
visible: !prefs.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
|
|
|
|
|
|
|
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()
|
|
|
|
}
|
|
|
|
}
|
2017-10-12 12:25:22 +00:00
|
|
|
Controls.Label {
|
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: "" // Spacer between 2 button groups
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
SsrfButton {
|
|
|
|
id: toNoCloudMode
|
|
|
|
text: qsTr("No cloud mode")
|
|
|
|
onClicked: {
|
2018-10-09 08:23:24 +00:00
|
|
|
manager.setGitLocalOnly(true)
|
2018-10-08 16:47:01 +00:00
|
|
|
PrefCloudStorage.cloud_auto_sync = false
|
2018-09-04 09:18:43 +00:00
|
|
|
prefs.credentialStatus = CloudStatus.CS_NOCLOUD
|
2019-12-26 08:19:10 +00:00
|
|
|
manager.saveCloudCredentials("", "")
|
mobile: No cloud repo creation more explicit
Before this change, there was only one way to create the local
no cloud repo on the device. The user needed to add at least
one dive to the no cloud account (so that there is something
to save). While this worked in some scenarios, it could also
get things in an inconsistent state: credential status = CS_NOCLOUD
but no local repo. This was a dead end.
In this commit, the creation of the no cloud repo is made more
explicit. When asking for no cloud mode, just create an (empty)
repo for it when it does not yet exist, and otherwise, just
open the existing (possibly empty) repo.
Now, a user can have no cloud repo, next to (any number of)
cloud accounts.
This leaves one functional aspect left: how does a user abandon
the no cloud repo, by merging his data into a true cloud
account. This is code for this, that tries to do this merge in
a smart way. This seems to be broken (too). To be clear: this
is no part of this commit.
Fixes: #667
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-17 07:51:00 +00:00
|
|
|
manager.openNoCloudRepo()
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-12-03 22:06:52 +00:00
|
|
|
}
|
|
|
|
}
|