fix(@desktop/keycard): create card with new seed phrase always fails

Fixes: #11311
This commit is contained in:
Sale Djenic 2023-06-30 09:03:09 +02:00 committed by saledjenic
parent 48c7d875de
commit db16c61cbe
2 changed files with 18 additions and 8 deletions

View File

@ -124,6 +124,7 @@ Item {
id: accountDetails id: accountDetails
Layout.preferredWidth: Constants.keycard.general.keycardNameInputWidth Layout.preferredWidth: Constants.keycard.general.keycardNameInputWidth
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
visible: root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.importFromKeycard
height: Style.current.xlPadding * 2 height: Style.current.xlPadding * 2
color: "transparent" color: "transparent"
border.color: Theme.palette.baseColor2 border.color: Theme.palette.baseColor2
@ -146,7 +147,8 @@ Item {
} }
StatusBaseText { StatusBaseText {
text: root.sharedKeycardModule.keyPairHelper.observedAccount.path text: root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.importFromKeycard?
root.sharedKeycardModule.keyPairHelper.observedAccount.path : ""
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
font.pixelSize: Constants.keycard.general.fontSize2 font.pixelSize: Constants.keycard.general.fontSize2
color: Theme.palette.baseColor1 color: Theme.palette.baseColor1
@ -161,10 +163,14 @@ Item {
ColumnLayout { ColumnLayout {
StatusBaseText { StatusBaseText {
text: { text: {
return qsTr("Balance: %1").arg(LocaleUtils.currencyAmountToLocaleString({ return qsTr("Balance: %1").arg(LocaleUtils.currencyAmountToLocaleString(
amount: parseFloat(root.sharedKeycardModule.keyPairHelper.observedAccount.balance), {
symbol: SharedStore.RootStore.currencyStore.currentCurrencySymbol, amount: root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.importFromKeycard?
displayDecimals: 2})) parseFloat(root.sharedKeycardModule.keyPairHelper.observedAccount.balance) :
0,
symbol: SharedStore.RootStore.currencyStore.currentCurrencySymbol,
displayDecimals: 2
}))
} }
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
font.pixelSize: Constants.keycard.general.fontSize2 font.pixelSize: Constants.keycard.general.fontSize2
@ -274,6 +280,10 @@ Item {
onRemoveAccount: { onRemoveAccount: {
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.importFromKeycard) if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.importFromKeycard)
return return
if (name.trim().length == 0) {
root.sharedKeycardModule.keyPairForProcessing.removeAccountAtIndex(index)
return
}
d.accountIndexToBeRemoved = index d.accountIndexToBeRemoved = index
d.accountNameToBeRemoved = name d.accountNameToBeRemoved = name
confirmationPopup.open() confirmationPopup.open()
@ -296,7 +306,8 @@ Item {
target: stepper target: stepper
visible: root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.importFromKeycard && visible: root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.importFromKeycard &&
root.sharedKeycardModule.keyPairHelper.accounts.count > 1 root.sharedKeycardModule.keyPairHelper.accounts.count > 1
totalSteps: root.sharedKeycardModule.keyPairHelper.accounts.count totalSteps: root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.importFromKeycard?
root.sharedKeycardModule.keyPairHelper.accounts.count : 0
completedSteps: root.sharedKeycardModule.keyPairForProcessing.accounts.count completedSteps: root.sharedKeycardModule.keyPairForProcessing.accounts.count
title: qsTr("Account %1 of %2").arg(completedSteps).arg(totalSteps) title: qsTr("Account %1 of %2").arg(completedSteps).arg(totalSteps)
} }

View File

@ -785,10 +785,9 @@ QtObject {
return Theme.palette.customisationColors.yinYang return Theme.palette.customisationColors.yinYang
case Constants.walletAccountColors.undefinedAccount.toUpperCase(): case Constants.walletAccountColors.undefinedAccount.toUpperCase():
return Theme.palette.baseColor1 return Theme.palette.baseColor1
default:
return Theme.palette.customisationColors.blue
} }
} }
return Theme.palette.customisationColors.blue
} }
// Leave this function at the bottom of the file as QT Creator messes up the code color after this // Leave this function at the bottom of the file as QT Creator messes up the code color after this