2022-08-31 17:09:07 +00:00
|
|
|
|
import QtQuick 2.14
|
|
|
|
|
|
|
|
|
|
import utils 1.0
|
2023-03-22 15:48:44 +00:00
|
|
|
|
import shared.panels 1.0 as SharedPanels
|
2022-08-31 17:09:07 +00:00
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
|
|
property var sharedKeycardModule
|
|
|
|
|
|
|
|
|
|
signal validation(bool result)
|
|
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
|
id: d
|
|
|
|
|
|
|
|
|
|
property bool wrongSeedPhrase: root.sharedKeycardModule.keycardData & Constants.predefinedKeycardData.wrongSeedPhrase
|
|
|
|
|
onWrongSeedPhraseChanged: {
|
2023-03-22 15:48:44 +00:00
|
|
|
|
seedPhrase.setWrongSeedPhraseMessage(wrongSeedPhrase? qsTr("The phrase you’ve entered does not match this Keycard’s seed phrase") : "")
|
2022-08-31 17:09:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-22 15:48:44 +00:00
|
|
|
|
SharedPanels.EnterSeedPhrase {
|
|
|
|
|
id: seedPhrase
|
2022-08-31 17:09:07 +00:00
|
|
|
|
anchors.fill: parent
|
|
|
|
|
anchors.topMargin: Style.current.xlPadding
|
|
|
|
|
anchors.bottomMargin: Style.current.halfPadding
|
|
|
|
|
anchors.leftMargin: Style.current.xlPadding
|
|
|
|
|
anchors.rightMargin: Style.current.xlPadding
|
|
|
|
|
|
2023-03-22 15:48:44 +00:00
|
|
|
|
isSeedPhraseValid: function(mnemonic) {
|
|
|
|
|
return root.sharedKeycardModule.validSeedPhrase(mnemonic)
|
2022-08-31 17:09:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-22 15:48:44 +00:00
|
|
|
|
onSeedPhraseUpdated: {
|
|
|
|
|
if (valid) {
|
|
|
|
|
root.sharedKeycardModule.setSeedPhrase(seedPhrase)
|
2022-08-31 17:09:07 +00:00
|
|
|
|
}
|
2023-03-22 15:48:44 +00:00
|
|
|
|
root.validation(valid)
|
2022-08-31 17:09:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-22 15:48:44 +00:00
|
|
|
|
onSubmitSeedPhrase: {
|
|
|
|
|
root.sharedKeycardModule.currentState.doPrimaryAction()
|
2022-08-31 17:09:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
states: [
|
|
|
|
|
State {
|
|
|
|
|
name: Constants.keycardSharedState.enterSeedPhrase
|
|
|
|
|
when: root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.enterSeedPhrase
|
|
|
|
|
},
|
|
|
|
|
State {
|
|
|
|
|
name: Constants.keycardSharedState.wrongSeedPhrase
|
|
|
|
|
when: root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.wrongSeedPhrase
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|