From 8d93f01db434ffd873e095d55abeeae7d8021f6f Mon Sep 17 00:00:00 2001 From: Ilya Kitaev Date: Fri, 19 Aug 2016 14:44:44 +0300 Subject: WalletManager::openWalletAsync integrating with UI --- wizard/WizardCreateWallet.qml | 3 ++- wizard/WizardRecoveryWallet.qml | 9 ++++----- wizard/utils.js | 5 +++++ 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'wizard') diff --git a/wizard/WizardCreateWallet.qml b/wizard/WizardCreateWallet.qml index 771a13ec..43b8158f 100644 --- a/wizard/WizardCreateWallet.qml +++ b/wizard/WizardCreateWallet.qml @@ -29,6 +29,7 @@ import QtQuick 2.2 import moneroComponents 1.0 import QtQuick.Dialogs 1.2 +import 'utils.js' as Utils Item { opacity: 0 @@ -54,7 +55,7 @@ Item { } function checkNextButton() { - var wordsArray = cleanWordsInput(uiItem.wordsTextItem.memoText).split(" "); + var wordsArray = Utils.lineBreaksToSpaces(uiItem.wordsTextItem.memoText).split(" "); wizard.nextButton.enabled = wordsArray.length === 25; } diff --git a/wizard/WizardRecoveryWallet.qml b/wizard/WizardRecoveryWallet.qml index 2e6fe5f6..505bc239 100644 --- a/wizard/WizardRecoveryWallet.qml +++ b/wizard/WizardRecoveryWallet.qml @@ -30,6 +30,7 @@ import QtQuick 2.2 import moneroComponents 1.0 import QtQuick.Dialogs 1.2 import Bitmonero.Wallet 1.0 +import 'utils.js' as Utils Item { opacity: 0 @@ -46,13 +47,13 @@ Item { } function checkNextButton() { - var wordsArray = cleanWordsInput(uiItem.wordsTextItem.memoText).split(" "); + var wordsArray = Utils.lineBreaksToSpaces(uiItem.wordsTextItem.memoText).split(" "); wizard.nextButton.enabled = wordsArray.length === 25; } function onPageClosed(settingsObject) { settingsObject['account_name'] = uiItem.accountNameText - settingsObject['words'] = cleanWordsInput(uiItem.wordsTextItem.memoText) + settingsObject['words'] = Utils.lineBreaksToSpaces(uiItem.wordsTextItem.memoText) settingsObject['wallet_path'] = uiItem.walletPath return recoveryWallet(settingsObject) } @@ -69,9 +70,7 @@ Item { return success; } - function cleanWordsInput(text) { - return text.trim().replace(/(\r\n|\n|\r)/gm, " "); - } + WizardManageWalletUI { id: uiItem diff --git a/wizard/utils.js b/wizard/utils.js index 0cc910c6..be066598 100644 --- a/wizard/utils.js +++ b/wizard/utils.js @@ -42,3 +42,8 @@ function mapScope (inputScopeFrom, inputScopeTo, outputScopeFrom, outputScopeTo, function tr(text) { return qsTr(text) + translationManager.emptyString } + + +function lineBreaksToSpaces(text) { + return text.trim().replace(/(\r\n|\n|\r)/gm, " "); +} -- cgit v1.2.3