From bbcb780cfa821b2176c86e3ffd5118778b5588da Mon Sep 17 00:00:00 2001 From: Jaquee Date: Sun, 6 Aug 2017 17:11:12 +0200 Subject: [PATCH] wizard: use m_wallet instead of storing in settingsObj --- main.qml | 6 +++--- wizard/WizardCreateWallet.qml | 6 +++--- wizard/WizardFinish.qml | 2 +- wizard/WizardMain.qml | 14 +++++++------- wizard/WizardManageWalletUI.qml | 4 ++-- wizard/WizardPassword.qml | 5 ++--- wizard/WizardRecoveryWallet.qml | 2 +- 7 files changed, 19 insertions(+), 20 deletions(-) diff --git a/main.qml b/main.qml index 285423f3..bb7f9a5c 100644 --- a/main.qml +++ b/main.qml @@ -196,7 +196,7 @@ ApplicationWindow { walletManager.setDaemonAddress(persistentSettings.daemon_address) // wallet already opened with wizard, we just need to initialize it - if (typeof wizard.settings['wallet'] !== 'undefined') { + if (typeof wizard.m_wallet !== 'undefined') { console.log("using wizard wallet") //Set restoreHeight if(persistentSettings.restore_height > 0){ @@ -204,11 +204,11 @@ ApplicationWindow { restoreHeight = persistentSettings.restore_height } - connectWallet(wizard.settings['wallet']) + connectWallet(wizard.m_wallet) isNewWallet = true // We don't need the wizard wallet any more - delete to avoid conflict with daemon adress change - delete wizard.settings['wallet'] + delete wizard.m_wallet } else { var wallet_path = walletPath(); if(isIOS) diff --git a/wizard/WizardCreateWallet.qml b/wizard/WizardCreateWallet.qml index 99ee2478..14142212 100644 --- a/wizard/WizardCreateWallet.qml +++ b/wizard/WizardCreateWallet.qml @@ -78,7 +78,7 @@ ColumnLayout { // page submitted or b) delete it when program closed before reaching final page // Always delete the wallet object before creating new - we could be stepping back from recovering wallet - if (typeof settingsObject.wallet !== 'undefined') { + if (typeof m_wallet !== 'undefined') { walletManager.closeWallet() console.log("deleting wallet") } @@ -91,8 +91,8 @@ ColumnLayout { uiItem.wordsTextItem.memoText = wallet.seed // saving wallet in "global" settings object // TODO: wallet should have a property pointing to the file where it stored or loaded from - settingsObject.wallet = wallet - settingsObject.tmp_wallet_filename = tmp_wallet_filename + m_wallet = wallet; + settingsObject['tmp_wallet_filename'] = tmp_wallet_filename } WizardManageWalletUI { diff --git a/wizard/WizardFinish.qml b/wizard/WizardFinish.qml index 30292f08..794a5cf9 100644 --- a/wizard/WizardFinish.qml +++ b/wizard/WizardFinish.qml @@ -100,7 +100,7 @@ ColumnLayout { ListElement { dotColor: "#36B05B" } ListElement { dotColor: "#36B05B" } ListElement { dotColor: "#36B05B" } - //ListElement { dotColor: "#36B05B" } + ListElement { dotColor: "#FFE00A" } } Repeater { diff --git a/wizard/WizardMain.qml b/wizard/WizardMain.qml index 0eeb4384..ade1de60 100644 --- a/wizard/WizardMain.qml +++ b/wizard/WizardMain.qml @@ -44,6 +44,8 @@ ColumnLayout { property int wizardRightMargin: (!isMobile) ? 150 : 25 * scaleRatio property int wizardBottomMargin: (isMobile) ? 150 : 25 * scaleRatio property int wizardTopMargin: (isMobile) ? 15 * scaleRatio : 50 + // Storing wallet in Settings object doesn't work in qt 5.8 on android + property var m_wallet; property var paths: { // "create_wallet" : [welcomePage, optionsPage, createWalletPage, passwordPage, donationPage, finishPage ], @@ -137,9 +139,8 @@ ColumnLayout { function openOpenWalletPage() { console.log("open wallet from file page"); - if (typeof wizard.settings['wallet'] !== 'undefined') { - settings.wallet.destroy(); - delete wizard.settings['wallet']; + if (typeof m_wallet !== 'undefined' && m_wallet != null) { + walletManager.closeWallet() } optionsPage.onPageClosed(settings) wizard.openWalletFromFileClicked(); @@ -203,11 +204,10 @@ ColumnLayout { var new_wallet_filename = createWalletPath(settings.wallet_path,settings.account_name) if(isIOS) { console.log("saving in ios: "+ moneroAccountsDir + new_wallet_filename) - settings.wallet.store(moneroAccountsDir + new_wallet_filename); + m_wallet.store(moneroAccountsDir + new_wallet_filename); } else { console.log("saving in wizard: "+ new_wallet_filename) - settings.wallet.store(new_wallet_filename); - + m_wallet.store(new_wallet_filename); } @@ -217,7 +217,7 @@ ColumnLayout { oshelper.removeTemporaryWallet(settings.tmp_wallet_filename) // protecting wallet with password - settings.wallet.setPassword(settings.wallet_password); + m_wallet.setPassword(settings.wallet_password); // Store password in session to be able to use password protected functions (e.g show seed) appWindow.password = settings.wallet_password diff --git a/wizard/WizardManageWalletUI.qml b/wizard/WizardManageWalletUI.qml index c9470a1d..9c79672d 100644 --- a/wizard/WizardManageWalletUI.qml +++ b/wizard/WizardManageWalletUI.qml @@ -93,8 +93,8 @@ ColumnLayout { ListModel { id: dotsModel - ListElement { dotColor: "#36B05B" } - //ListElement { dotColor: "#DBDBDB" } + ListElement { dotColor: "#FFE00A" } + ListElement { dotColor: "#DBDBDB" } ListElement { dotColor: "#DBDBDB" } ListElement { dotColor: "#DBDBDB" } } diff --git a/wizard/WizardPassword.qml b/wizard/WizardPassword.qml index 0b5b4282..3ce6584d 100644 --- a/wizard/WizardPassword.qml +++ b/wizard/WizardPassword.qml @@ -64,7 +64,6 @@ ColumnLayout { function onPageClosed(settingsObject) { // TODO: set password on the final page - // settingsObject.wallet.setPassword(passwordItem.password) settingsObject['wallet_password'] = passwordUI.password return true } @@ -82,8 +81,8 @@ ColumnLayout { ListModel { id: dotsModel ListElement { dotColor: "#36B05B" } - ListElement { dotColor: "#36B05B" } - //ListElement { dotColor: "#FFE00A" } + ListElement { dotColor: "#FFE00A" } + ListElement { dotColor: "#DBDBDB" } ListElement { dotColor: "#DBDBDB" } } diff --git a/wizard/WizardRecoveryWallet.qml b/wizard/WizardRecoveryWallet.qml index 240641e0..ed92ce1c 100644 --- a/wizard/WizardRecoveryWallet.qml +++ b/wizard/WizardRecoveryWallet.qml @@ -92,7 +92,7 @@ ColumnLayout { var success = wallet.status === Wallet.Status_Ok; if (success) { - settingsObject['wallet'] = wallet; + m_wallet = wallet; settingsObject['is_recovering'] = true; settingsObject['tmp_wallet_filename'] = tmp_wallet_filename } else {