2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
2022-03-07 22:59:38 +00:00
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2020-05-19 13:22:38 +00:00
|
|
|
|
2022-03-07 22:59:38 +00:00
|
|
|
import shared.panels 1.0
|
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-14 08:04:15 +00:00
|
|
|
|
2022-03-07 22:59:38 +00:00
|
|
|
import "../controls"
|
|
|
|
import "../panels"
|
|
|
|
import "../stores"
|
2022-03-01 15:59:38 +00:00
|
|
|
|
|
|
|
|
2022-03-07 22:59:38 +00:00
|
|
|
OnboardingBasePage {
|
|
|
|
id: root
|
2020-05-21 15:25:33 +00:00
|
|
|
anchors.fill: parent
|
2022-03-07 22:59:38 +00:00
|
|
|
Behavior on opacity { NumberAnimation { duration: 200 }}
|
|
|
|
state: "username"
|
|
|
|
|
|
|
|
signal keysGenerated()
|
|
|
|
|
|
|
|
function gotoKeysStack(stackIndex) { createKeysStack.currentIndex = stackIndex }
|
2020-05-21 15:25:33 +00:00
|
|
|
|
2022-03-07 22:59:38 +00:00
|
|
|
enum KeysStack {
|
|
|
|
DETAILS,
|
|
|
|
CREATE_PWD,
|
|
|
|
CONFRIM_PWD,
|
|
|
|
TOUCH_ID
|
2020-05-21 15:25:33 +00:00
|
|
|
}
|
|
|
|
|
2022-03-07 22:59:38 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
property string newPassword
|
|
|
|
property string confirmationPassword
|
|
|
|
}
|
|
|
|
|
|
|
|
StackLayout {
|
|
|
|
id: createKeysStack
|
|
|
|
anchors.fill: parent
|
|
|
|
currentIndex: GenKeyView.KeysStack.DETAILS
|
|
|
|
|
|
|
|
onCurrentIndexChanged: {
|
|
|
|
// Set focus:
|
|
|
|
if(currentIndex === GenKeyView.KeysStack.CREATE_PWD)
|
|
|
|
createPswView.forceNewPswInputFocus()
|
|
|
|
else if(currentIndex === GenKeyView.KeysStack.CONFRIM_PWD)
|
|
|
|
confirmPswView.forcePswInputFocus()
|
|
|
|
}
|
|
|
|
|
|
|
|
InsertDetailsView {
|
|
|
|
id: userDetailsPanel
|
|
|
|
onCreatePassword: { gotoKeysStack(GenKeyView.KeysStack.CREATE_PWD) }
|
|
|
|
}
|
|
|
|
CreatePasswordView {
|
|
|
|
id: createPswView
|
|
|
|
newPassword: d.newPassword
|
|
|
|
confirmationPassword: d.confirmationPassword
|
|
|
|
|
2022-03-15 22:27:36 +00:00
|
|
|
onExit: {
|
2022-03-07 22:59:38 +00:00
|
|
|
d.newPassword = newPassword
|
|
|
|
d.confirmationPassword = confirmationPassword
|
|
|
|
gotoKeysStack(GenKeyView.KeysStack.CONFRIM_PWD)
|
|
|
|
}
|
|
|
|
onBackClicked: {
|
|
|
|
d.newPassword = ""
|
|
|
|
d.confirmationPassword = ""
|
|
|
|
gotoKeysStack(GenKeyView.KeysStack.DETAILS)
|
|
|
|
}
|
2020-05-19 13:22:38 +00:00
|
|
|
}
|
2022-03-07 22:59:38 +00:00
|
|
|
ConfirmPasswordView {
|
|
|
|
id: confirmPswView
|
|
|
|
password: d.newPassword
|
|
|
|
displayName: userDetailsPanel.displayName
|
2022-03-15 22:27:36 +00:00
|
|
|
onExit: {
|
2022-03-07 22:59:38 +00:00
|
|
|
if (Qt.platform.os == "osx") {
|
|
|
|
gotoKeysStack(GenKeyView.KeysStack.TOUCH_ID);
|
|
|
|
} else {
|
|
|
|
root.keysGenerated();
|
|
|
|
}
|
2020-05-21 15:25:33 +00:00
|
|
|
}
|
2022-03-07 22:59:38 +00:00
|
|
|
onBackClicked: { gotoKeysStack(GenKeyView.KeysStack.CREATE_PWD) }
|
|
|
|
}
|
|
|
|
TouchIDAuthView {
|
|
|
|
userPass: d.newPassword
|
|
|
|
onBackClicked: { gotoKeysStack(GenKeyView.KeysStack.CONFRIM_PWD) }
|
|
|
|
onGenKeysDone: { root.keysGenerated() }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onBackClicked: {
|
|
|
|
if (userDetailsPanel.state === "chatkey") {
|
|
|
|
userDetailsPanel.state = "username";
|
|
|
|
} else {
|
2022-03-15 22:27:36 +00:00
|
|
|
root.exit();
|
2020-05-21 15:25:33 +00:00
|
|
|
}
|
2020-05-19 13:22:38 +00:00
|
|
|
}
|
|
|
|
}
|