mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 03:59:38 +00:00
wizard: use m_wallet instead of storing in settingsObj
This commit is contained in:
parent
91953f1a3a
commit
bbcb780cfa
7 changed files with 19 additions and 20 deletions
6
main.qml
6
main.qml
|
@ -196,7 +196,7 @@ ApplicationWindow {
|
||||||
|
|
||||||
walletManager.setDaemonAddress(persistentSettings.daemon_address)
|
walletManager.setDaemonAddress(persistentSettings.daemon_address)
|
||||||
// wallet already opened with wizard, we just need to initialize it
|
// 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")
|
console.log("using wizard wallet")
|
||||||
//Set restoreHeight
|
//Set restoreHeight
|
||||||
if(persistentSettings.restore_height > 0){
|
if(persistentSettings.restore_height > 0){
|
||||||
|
@ -204,11 +204,11 @@ ApplicationWindow {
|
||||||
restoreHeight = persistentSettings.restore_height
|
restoreHeight = persistentSettings.restore_height
|
||||||
}
|
}
|
||||||
|
|
||||||
connectWallet(wizard.settings['wallet'])
|
connectWallet(wizard.m_wallet)
|
||||||
|
|
||||||
isNewWallet = true
|
isNewWallet = true
|
||||||
// We don't need the wizard wallet any more - delete to avoid conflict with daemon adress change
|
// 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 {
|
} else {
|
||||||
var wallet_path = walletPath();
|
var wallet_path = walletPath();
|
||||||
if(isIOS)
|
if(isIOS)
|
||||||
|
|
|
@ -78,7 +78,7 @@ ColumnLayout {
|
||||||
// page submitted or b) delete it when program closed before reaching final page
|
// 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
|
// 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()
|
walletManager.closeWallet()
|
||||||
console.log("deleting wallet")
|
console.log("deleting wallet")
|
||||||
}
|
}
|
||||||
|
@ -91,8 +91,8 @@ ColumnLayout {
|
||||||
uiItem.wordsTextItem.memoText = wallet.seed
|
uiItem.wordsTextItem.memoText = wallet.seed
|
||||||
// saving wallet in "global" settings object
|
// saving wallet in "global" settings object
|
||||||
// TODO: wallet should have a property pointing to the file where it stored or loaded from
|
// TODO: wallet should have a property pointing to the file where it stored or loaded from
|
||||||
settingsObject.wallet = wallet
|
m_wallet = wallet;
|
||||||
settingsObject.tmp_wallet_filename = tmp_wallet_filename
|
settingsObject['tmp_wallet_filename'] = tmp_wallet_filename
|
||||||
}
|
}
|
||||||
|
|
||||||
WizardManageWalletUI {
|
WizardManageWalletUI {
|
||||||
|
|
|
@ -100,7 +100,7 @@ ColumnLayout {
|
||||||
ListElement { dotColor: "#36B05B" }
|
ListElement { dotColor: "#36B05B" }
|
||||||
ListElement { dotColor: "#36B05B" }
|
ListElement { dotColor: "#36B05B" }
|
||||||
ListElement { dotColor: "#36B05B" }
|
ListElement { dotColor: "#36B05B" }
|
||||||
//ListElement { dotColor: "#36B05B" }
|
ListElement { dotColor: "#FFE00A" }
|
||||||
}
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
|
|
|
@ -44,6 +44,8 @@ ColumnLayout {
|
||||||
property int wizardRightMargin: (!isMobile) ? 150 : 25 * scaleRatio
|
property int wizardRightMargin: (!isMobile) ? 150 : 25 * scaleRatio
|
||||||
property int wizardBottomMargin: (isMobile) ? 150 : 25 * scaleRatio
|
property int wizardBottomMargin: (isMobile) ? 150 : 25 * scaleRatio
|
||||||
property int wizardTopMargin: (isMobile) ? 15 * scaleRatio : 50
|
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: {
|
property var paths: {
|
||||||
// "create_wallet" : [welcomePage, optionsPage, createWalletPage, passwordPage, donationPage, finishPage ],
|
// "create_wallet" : [welcomePage, optionsPage, createWalletPage, passwordPage, donationPage, finishPage ],
|
||||||
|
@ -137,9 +139,8 @@ ColumnLayout {
|
||||||
|
|
||||||
function openOpenWalletPage() {
|
function openOpenWalletPage() {
|
||||||
console.log("open wallet from file page");
|
console.log("open wallet from file page");
|
||||||
if (typeof wizard.settings['wallet'] !== 'undefined') {
|
if (typeof m_wallet !== 'undefined' && m_wallet != null) {
|
||||||
settings.wallet.destroy();
|
walletManager.closeWallet()
|
||||||
delete wizard.settings['wallet'];
|
|
||||||
}
|
}
|
||||||
optionsPage.onPageClosed(settings)
|
optionsPage.onPageClosed(settings)
|
||||||
wizard.openWalletFromFileClicked();
|
wizard.openWalletFromFileClicked();
|
||||||
|
@ -203,11 +204,10 @@ ColumnLayout {
|
||||||
var new_wallet_filename = createWalletPath(settings.wallet_path,settings.account_name)
|
var new_wallet_filename = createWalletPath(settings.wallet_path,settings.account_name)
|
||||||
if(isIOS) {
|
if(isIOS) {
|
||||||
console.log("saving in ios: "+ moneroAccountsDir + new_wallet_filename)
|
console.log("saving in ios: "+ moneroAccountsDir + new_wallet_filename)
|
||||||
settings.wallet.store(moneroAccountsDir + new_wallet_filename);
|
m_wallet.store(moneroAccountsDir + new_wallet_filename);
|
||||||
} else {
|
} else {
|
||||||
console.log("saving in wizard: "+ new_wallet_filename)
|
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)
|
oshelper.removeTemporaryWallet(settings.tmp_wallet_filename)
|
||||||
|
|
||||||
// protecting wallet with password
|
// 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)
|
// Store password in session to be able to use password protected functions (e.g show seed)
|
||||||
appWindow.password = settings.wallet_password
|
appWindow.password = settings.wallet_password
|
||||||
|
|
|
@ -93,8 +93,8 @@ ColumnLayout {
|
||||||
|
|
||||||
ListModel {
|
ListModel {
|
||||||
id: dotsModel
|
id: dotsModel
|
||||||
ListElement { dotColor: "#36B05B" }
|
ListElement { dotColor: "#FFE00A" }
|
||||||
//ListElement { dotColor: "#DBDBDB" }
|
ListElement { dotColor: "#DBDBDB" }
|
||||||
ListElement { dotColor: "#DBDBDB" }
|
ListElement { dotColor: "#DBDBDB" }
|
||||||
ListElement { dotColor: "#DBDBDB" }
|
ListElement { dotColor: "#DBDBDB" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,6 @@ ColumnLayout {
|
||||||
|
|
||||||
function onPageClosed(settingsObject) {
|
function onPageClosed(settingsObject) {
|
||||||
// TODO: set password on the final page
|
// TODO: set password on the final page
|
||||||
// settingsObject.wallet.setPassword(passwordItem.password)
|
|
||||||
settingsObject['wallet_password'] = passwordUI.password
|
settingsObject['wallet_password'] = passwordUI.password
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -82,8 +81,8 @@ ColumnLayout {
|
||||||
ListModel {
|
ListModel {
|
||||||
id: dotsModel
|
id: dotsModel
|
||||||
ListElement { dotColor: "#36B05B" }
|
ListElement { dotColor: "#36B05B" }
|
||||||
ListElement { dotColor: "#36B05B" }
|
ListElement { dotColor: "#FFE00A" }
|
||||||
//ListElement { dotColor: "#FFE00A" }
|
ListElement { dotColor: "#DBDBDB" }
|
||||||
ListElement { dotColor: "#DBDBDB" }
|
ListElement { dotColor: "#DBDBDB" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ ColumnLayout {
|
||||||
|
|
||||||
var success = wallet.status === Wallet.Status_Ok;
|
var success = wallet.status === Wallet.Status_Ok;
|
||||||
if (success) {
|
if (success) {
|
||||||
settingsObject['wallet'] = wallet;
|
m_wallet = wallet;
|
||||||
settingsObject['is_recovering'] = true;
|
settingsObject['is_recovering'] = true;
|
||||||
settingsObject['tmp_wallet_filename'] = tmp_wallet_filename
|
settingsObject['tmp_wallet_filename'] = tmp_wallet_filename
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue