73 lines
1.9 KiB
QML
73 lines
1.9 KiB
QML
import QtQuick 2.13
|
|
import QtQuick.Controls 2.13
|
|
import "../imports"
|
|
|
|
Item {
|
|
property var onClosed: function () {}
|
|
id: existingKeyView
|
|
anchors.fill: parent
|
|
|
|
Component.onCompleted: {
|
|
enterSeedPhraseModal.open()
|
|
}
|
|
|
|
EnterSeedPhraseModal {
|
|
property bool wentNext: false
|
|
id: enterSeedPhraseModal
|
|
onConfirmSeedClick: function (mnemonic) {
|
|
error = "";
|
|
|
|
if (!Utils.isMnemonic(mnemonic)) {
|
|
//% "Invalid seed phrase"
|
|
error = qsTrId("custom-seed-phrase")
|
|
} else {
|
|
error = onboardingModel.validateMnemonic(mnemonic)
|
|
const regex = new RegExp('word [a-z]+ not found in the dictionary', 'i');
|
|
if (regex.test(error)) {
|
|
error = qsTr('Invalid seed phrase') + '. ' +
|
|
qsTr("This seed phrase doesn't match our supported dictionary. Check for misspelled words.")
|
|
}
|
|
}
|
|
|
|
if (error === "") {
|
|
wentNext = true
|
|
enterSeedPhraseModal.close()
|
|
onboardingModel.importMnemonic(mnemonic)
|
|
removeMnemonicAfterLogin = true
|
|
recoverySuccessModal.open()
|
|
}
|
|
}
|
|
onClosed: function () {
|
|
if (!wentNext) {
|
|
existingKeyView.onClosed()
|
|
}
|
|
}
|
|
}
|
|
|
|
MnemonicRecoverySuccessModal {
|
|
id: recoverySuccessModal
|
|
onButtonClicked: {
|
|
recoverySuccessModal.close()
|
|
createPasswordModal.open()
|
|
}
|
|
onClosed: function () {
|
|
if (!enterSeedPhraseModal.wentNext) {
|
|
existingKeyView.onClosed()
|
|
}
|
|
}
|
|
}
|
|
|
|
CreatePasswordModal {
|
|
id: createPasswordModal
|
|
onClosed: function () {
|
|
existingKeyView.onClosed()
|
|
}
|
|
}
|
|
}
|
|
|
|
/*##^##
|
|
Designer {
|
|
D{i:0;autoSize:true;height:480;width:640}
|
|
}
|
|
##^##*/
|