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
|
QML UI: Kirigami to 2.2
When first tested this commit, especially the dive list was looking
terrible. However, after including newer SHA's from libkirigami, and
correcting lots of spacing/margin issue, a retest of this commit shows
no strange artifact any more, and the amount of warnings in the log
output is reduced significantly. So now, it appears save to
upgrade.
Notice that main.qml still uses Kirigami 2.0. and is not updated in
this commit. With version 2.2, there is a new way of theming, that
is not (yet) compatible with our current code. Blindly upgrading to
2.2 leads to a almost black dive list, wrong button colors, and
runtime errors in the log, due to the fact the direct setting from
QML Kirigami's Theme colors is not allowed any more.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-14 19:13:01 +00:00
|
|
|
import org.kde.kirigami 2.2 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.cloudUserName = login.text
|
|
|
|
prefs.cloudPassword = password.text
|
|
|
|
prefs.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
|
|
|
}
|
|
|
|
|
2017-10-12 12:25:22 +00:00
|
|
|
Controls.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-10-12 12:25:22 +00:00
|
|
|
Controls.TextField {
|
2015-12-03 22:06:52 +00:00
|
|
|
id: login
|
2018-06-13 16:06:11 +00:00
|
|
|
text: prefs.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
|
|
|
}
|
|
|
|
|
2017-10-12 12:25:22 +00:00
|
|
|
Controls.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-10-12 12:25:22 +00:00
|
|
|
Controls.TextField {
|
2015-12-03 22:06:52 +00:00
|
|
|
id: password
|
2018-06-13 16:06:11 +00:00
|
|
|
text: prefs.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
|
|
|
|
2017-10-12 12:25:22 +00:00
|
|
|
Controls.Label {
|
2016-06-13 23:42:36 +00:00
|
|
|
text: qsTr("PIN")
|
|
|
|
visible: rootItem.showPin
|
|
|
|
}
|
2017-10-12 12:25:22 +00:00
|
|
|
Controls.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 {
|
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
|
|
|
|
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()
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
|
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()
|
|
|
|
}
|
|
|
|
}
|
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: {
|
|
|
|
manager.syncToCloud = false
|
2018-07-05 18:37:53 +00:00
|
|
|
prefs.credentialStatus = SsrfPrefs.CS_NOCLOUD
|
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
|
|
|
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
|
|
|
}
|
|
|
|
}
|