mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 12:09:57 +00:00
Merge pull request #2590
cc86795
WizardController: always close and re-open newly created wallet (xiphon)
This commit is contained in:
commit
05a0d21f4c
2 changed files with 29 additions and 72 deletions
71
main.qml
71
main.qml
|
@ -57,7 +57,6 @@ ApplicationWindow {
|
||||||
property var transaction;
|
property var transaction;
|
||||||
property var transactionDescription;
|
property var transactionDescription;
|
||||||
property var walletPassword
|
property var walletPassword
|
||||||
property bool isNewWallet: false
|
|
||||||
property int restoreHeight:0
|
property int restoreHeight:0
|
||||||
property bool daemonSynced: false
|
property bool daemonSynced: false
|
||||||
property bool walletSynced: false
|
property bool walletSynced: false
|
||||||
|
@ -201,8 +200,20 @@ ApplicationWindow {
|
||||||
leftPanel.selectItem(page);
|
leftPanel.selectItem(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openWallet(prevState) {
|
||||||
|
passwordDialog.onAcceptedCallback = function() {
|
||||||
|
walletPassword = passwordDialog.password;
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
passwordDialog.onRejectedCallback = function() {
|
||||||
|
if (prevState) {
|
||||||
|
appWindow.viewState = prevState;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
passwordDialog.open(usefulName(walletPath()));
|
||||||
|
}
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
appWindow.viewState = "normal";
|
|
||||||
console.log("initializing..")
|
console.log("initializing..")
|
||||||
|
|
||||||
// Use stored log level
|
// Use stored log level
|
||||||
|
@ -238,20 +249,6 @@ ApplicationWindow {
|
||||||
simpleModeConnectionTimer.running = true;
|
simpleModeConnectionTimer.running = true;
|
||||||
|
|
||||||
// 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.m_wallet !== 'undefined') {
|
|
||||||
console.log("using wizard wallet")
|
|
||||||
//Set restoreHeight
|
|
||||||
if(persistentSettings.restore_height > 0){
|
|
||||||
// We store restore height in own variable for performance reasons.
|
|
||||||
restoreHeight = persistentSettings.restore_height
|
|
||||||
}
|
|
||||||
|
|
||||||
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.m_wallet
|
|
||||||
} else {
|
|
||||||
var wallet_path = walletPath();
|
var wallet_path = walletPath();
|
||||||
if(isIOS)
|
if(isIOS)
|
||||||
wallet_path = moneroAccountsDir + wallet_path;
|
wallet_path = moneroAccountsDir + wallet_path;
|
||||||
|
@ -259,9 +256,11 @@ ApplicationWindow {
|
||||||
console.log("opening wallet at: ", wallet_path, ", network type: ", persistentSettings.nettype == NetworkType.MAINNET ? "mainnet" : persistentSettings.nettype == NetworkType.TESTNET ? "testnet" : "stagenet");
|
console.log("opening wallet at: ", wallet_path, ", network type: ", persistentSettings.nettype == NetworkType.MAINNET ? "mainnet" : persistentSettings.nettype == NetworkType.TESTNET ? "testnet" : "stagenet");
|
||||||
|
|
||||||
this.onWalletOpening();
|
this.onWalletOpening();
|
||||||
walletManager.openWalletAsync(wallet_path, walletPassword,
|
walletManager.openWalletAsync(
|
||||||
persistentSettings.nettype, persistentSettings.kdfRounds);
|
wallet_path,
|
||||||
}
|
walletPassword,
|
||||||
|
persistentSettings.nettype,
|
||||||
|
persistentSettings.kdfRounds);
|
||||||
|
|
||||||
// Hide titlebar based on persistentSettings.customDecorations
|
// Hide titlebar based on persistentSettings.customDecorations
|
||||||
titleBar.visible = persistentSettings.customDecorations;
|
titleBar.visible = persistentSettings.customDecorations;
|
||||||
|
@ -517,16 +516,6 @@ ApplicationWindow {
|
||||||
walletName = usefulName(wallet.path)
|
walletName = usefulName(wallet.path)
|
||||||
console.log(">>> wallet opened: " + wallet)
|
console.log(">>> wallet opened: " + wallet)
|
||||||
if (wallet.status !== Wallet.Status_Ok) {
|
if (wallet.status !== Wallet.Status_Ok) {
|
||||||
passwordDialog.onAcceptedCallback = function() {
|
|
||||||
walletPassword = passwordDialog.password;
|
|
||||||
appWindow.initialize();
|
|
||||||
}
|
|
||||||
passwordDialog.onRejectedCallback = function() {
|
|
||||||
walletPassword = "";
|
|
||||||
//appWindow.enableUI(false)
|
|
||||||
wizard.wizardState = "wizardHome";
|
|
||||||
rootItem.state = "wizard";
|
|
||||||
}
|
|
||||||
// try to resolve common wallet cache errors automatically
|
// try to resolve common wallet cache errors automatically
|
||||||
switch (wallet.errorString) {
|
switch (wallet.errorString) {
|
||||||
case "basic_string::_M_replace_aux":
|
case "basic_string::_M_replace_aux":
|
||||||
|
@ -649,17 +638,6 @@ ApplicationWindow {
|
||||||
|
|
||||||
// Refresh is succesfull if blockchain height > 1
|
// Refresh is succesfull if blockchain height > 1
|
||||||
if (bcHeight > 1){
|
if (bcHeight > 1){
|
||||||
// Save new wallet after first refresh
|
|
||||||
// Wallet is nomrmally saved to disk on app exit. This prevents rescan from block 0 after app crash
|
|
||||||
if(isNewWallet){
|
|
||||||
console.log("Saving wallet after first refresh");
|
|
||||||
currentWallet.store()
|
|
||||||
isNewWallet = false
|
|
||||||
|
|
||||||
// Update History
|
|
||||||
currentWallet.history.refresh(currentWallet.currentSubaddressAccount);
|
|
||||||
}
|
|
||||||
|
|
||||||
// recovering from seed is finished after first refresh
|
// recovering from seed is finished after first refresh
|
||||||
if(persistentSettings.is_recovering) {
|
if(persistentSettings.is_recovering) {
|
||||||
persistentSettings.is_recovering = false
|
persistentSettings.is_recovering = false
|
||||||
|
@ -1329,19 +1307,12 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
} else console.log("qrScannerEnabled disabled");
|
} else console.log("qrScannerEnabled disabled");
|
||||||
|
|
||||||
|
wizard.wizardState = "wizardHome";
|
||||||
if(!walletsFound()) {
|
if(!walletsFound()) {
|
||||||
rootItem.state = "wizard"
|
rootItem.state = "wizard"
|
||||||
} else {
|
} else {
|
||||||
rootItem.state = "normal"
|
rootItem.state = "normal"
|
||||||
passwordDialog.onAcceptedCallback = function() {
|
openWallet("wizard");
|
||||||
walletPassword = passwordDialog.password;
|
|
||||||
initialize(persistentSettings);
|
|
||||||
}
|
|
||||||
passwordDialog.onRejectedCallback = function() {
|
|
||||||
wizard.wizardState = "wizardHome";
|
|
||||||
rootItem.state = "wizard"
|
|
||||||
}
|
|
||||||
passwordDialog.open(usefulName(walletPath()))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
checkUpdates();
|
checkUpdates();
|
||||||
|
@ -1704,7 +1675,7 @@ ApplicationWindow {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onUseMoneroClicked: {
|
onUseMoneroClicked: {
|
||||||
rootItem.state = "normal";
|
rootItem.state = "normal";
|
||||||
appWindow.initialize();
|
appWindow.openWallet("wizard");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -375,8 +375,7 @@ Rectangle {
|
||||||
// protecting wallet with password
|
// protecting wallet with password
|
||||||
wizardController.m_wallet.setPassword(wizardController.walletOptionsPassword);
|
wizardController.m_wallet.setPassword(wizardController.walletOptionsPassword);
|
||||||
|
|
||||||
// Store password in session to be able to use password protected functions (e.g show seed)
|
restart();
|
||||||
appWindow.walletPassword = walletOptionsPassword
|
|
||||||
|
|
||||||
// save to persistent settings
|
// save to persistent settings
|
||||||
persistentSettings.language = wizardController.language_language
|
persistentSettings.language = wizardController.language_language
|
||||||
|
@ -540,20 +539,7 @@ Rectangle {
|
||||||
if(isIOS)
|
if(isIOS)
|
||||||
persistentSettings.wallet_path = persistentSettings.wallet_path.replace(moneroAccountsDir, "");
|
persistentSettings.wallet_path = persistentSettings.wallet_path.replace(moneroAccountsDir, "");
|
||||||
|
|
||||||
console.log(moneroAccountsDir);
|
appWindow.openWallet();
|
||||||
console.log(fn);
|
|
||||||
console.log(persistentSettings.wallet_path);
|
|
||||||
|
|
||||||
passwordDialog.onAcceptedCallback = function() {
|
|
||||||
walletPassword = passwordDialog.password;
|
|
||||||
appWindow.initialize();
|
|
||||||
}
|
|
||||||
passwordDialog.onRejectedCallback = function() {
|
|
||||||
console.log("Canceled");
|
|
||||||
appWindow.viewState = "wizard";
|
|
||||||
}
|
|
||||||
|
|
||||||
passwordDialog.open(appWindow.usefulName(appWindow.walletPath()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
|
Loading…
Reference in a new issue