From eb12d9f7cd5c98bbbf518ca50657f238fbf6e046 Mon Sep 17 00:00:00 2001 From: Michal Iskierko Date: Wed, 25 May 2022 15:36:42 +0200 Subject: [PATCH] fix(@desktop/wallet): not remove seed phrases when changing number of words in wallet section Fix #5613 --- .../Wallet/panels/ImportSeedPhrasePanel.qml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ui/app/AppLayouts/Wallet/panels/ImportSeedPhrasePanel.qml b/ui/app/AppLayouts/Wallet/panels/ImportSeedPhrasePanel.qml index 82315180c2..618c4c36f9 100644 --- a/ui/app/AppLayouts/Wallet/panels/ImportSeedPhrasePanel.qml +++ b/ui/app/AppLayouts/Wallet/panels/ImportSeedPhrasePanel.qml @@ -79,7 +79,17 @@ GridView { onModelChanged: { mnemonicString = ""; - _internal.mnemonicInput = []; + let menmonicInputTemp = _internal.mnemonicInput.filter(function(value) { + return value.pos <= grid.count + }) + _internal.mnemonicInput = [] + for (let i = 0; i < menmonicInputTemp.length; i++) { + // .pos starts with 1 + grid.itemAtIndex(menmonicInputTemp[i].pos - 1).setWord(menmonicInputTemp[i].seed) + grid.addWord(menmonicInputTemp[i].pos, + menmonicInputTemp[i].seed, + true) + } } @@ -162,7 +172,6 @@ GridView { width: _internal.seedPhraseInputWidth height: _internal.seedPhraseInputHeight textEdit.errorMessageCmp.visible: false - textEdit.input.anchors.topMargin: 11 leftComponentText: index + 1 inputList: BIP39_en { } property int itemIndex: index