mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-16 15:58:11 +00:00
new wallet default path + open wallet from file
This commit is contained in:
parent
097449079d
commit
6818ecd163
1 changed files with 62 additions and 8 deletions
70
main.qml
70
main.qml
|
@ -130,6 +130,12 @@ ApplicationWindow {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openWalletFromFile(){
|
||||||
|
persistentSettings.restore_height = 0
|
||||||
|
persistentSettings.is_recovering = false
|
||||||
|
appWindow.password = ""
|
||||||
|
fileDialog.open();
|
||||||
|
}
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
console.log("initializing..")
|
console.log("initializing..")
|
||||||
|
@ -148,6 +154,12 @@ ApplicationWindow {
|
||||||
if (currentWallet != undefined) {
|
if (currentWallet != undefined) {
|
||||||
console.log("closing currentWallet")
|
console.log("closing currentWallet")
|
||||||
walletManager.closeWallet(currentWallet);
|
walletManager.closeWallet(currentWallet);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// set page to transfer if not changing daemon
|
||||||
|
middlePanel.state = "Transfer";
|
||||||
|
leftPanel.selectItem(middlePanel.state)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// wallet already opened with wizard, we just need to initialize it
|
// wallet already opened with wizard, we just need to initialize it
|
||||||
|
@ -158,7 +170,6 @@ ApplicationWindow {
|
||||||
restoreHeight = persistentSettings.restore_height
|
restoreHeight = persistentSettings.restore_height
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("using wizard wallet")
|
|
||||||
connectWallet(wizard.settings['wallet'])
|
connectWallet(wizard.settings['wallet'])
|
||||||
|
|
||||||
isNewWallet = true
|
isNewWallet = true
|
||||||
|
@ -171,6 +182,7 @@ ApplicationWindow {
|
||||||
walletManager.openWalletAsync(wallet_path, appWindow.password,
|
walletManager.openWalletAsync(wallet_path, appWindow.password,
|
||||||
persistentSettings.testnet);
|
persistentSettings.testnet);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -189,8 +201,7 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
function walletPath() {
|
function walletPath() {
|
||||||
var wallet_path = persistentSettings.wallet_path + "/" + persistentSettings.account_name + "/"
|
var wallet_path = persistentSettings.wallet_path
|
||||||
+ persistentSettings.account_name;
|
|
||||||
return wallet_path;
|
return wallet_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,8 +320,8 @@ ApplicationWindow {
|
||||||
if (wallets.length === 0) {
|
if (wallets.length === 0) {
|
||||||
wallets = walletManager.findWallets(applicationDirectory);
|
wallets = walletManager.findWallets(applicationDirectory);
|
||||||
}
|
}
|
||||||
print(wallets);
|
console.log("wallets found: ",wallets);
|
||||||
return wallets.length > 0;
|
return wallets.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -423,6 +434,16 @@ ApplicationWindow {
|
||||||
splash.close()
|
splash.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// close wallet and show wizard
|
||||||
|
function showWizard(){
|
||||||
|
|
||||||
|
splashCounter = 0;
|
||||||
|
walletManager.closeWallet(currentWallet);
|
||||||
|
wizard.restart();
|
||||||
|
rootItem.state = "wizard"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
objectName: "appWindow"
|
objectName: "appWindow"
|
||||||
visible: true
|
visible: true
|
||||||
|
@ -439,11 +460,22 @@ ApplicationWindow {
|
||||||
//
|
//
|
||||||
walletManager.walletOpened.connect(onWalletOpened);
|
walletManager.walletOpened.connect(onWalletOpened);
|
||||||
walletManager.walletClosed.connect(onWalletClosed);
|
walletManager.walletClosed.connect(onWalletClosed);
|
||||||
|
var numWalletsFound = walletsFound();
|
||||||
|
|
||||||
rootItem.state = walletsFound() ? "normal" : "wizard";
|
if(!numWalletsFound) {
|
||||||
if (rootItem.state === "normal") {
|
rootItem.state = "wizard"
|
||||||
initialize(persistentSettings)
|
} else {
|
||||||
|
rootItem.state = "normal"
|
||||||
|
|
||||||
|
// If more than 1 wallet found, open file dialog.
|
||||||
|
// TODO: implement prettier wallet picker
|
||||||
|
if(numWalletsFound > 1) {
|
||||||
|
openWalletFromFile();
|
||||||
|
} else {
|
||||||
|
initialize(persistentSettings);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onRightPanelExpandedChanged: {
|
onRightPanelExpandedChanged: {
|
||||||
|
@ -493,6 +525,24 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Open Wallet from file
|
||||||
|
FileDialog {
|
||||||
|
id: fileDialog
|
||||||
|
title: "Please choose a file"
|
||||||
|
folder: "file://" +moneroAccountsDir
|
||||||
|
|
||||||
|
onAccepted: {
|
||||||
|
console.log("You chose: " + walletManager.urlToLocalPath(fileDialog.fileUrl))
|
||||||
|
persistentSettings.wallet_path = walletManager.urlToLocalPath(fileDialog.fileUrl)
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
onRejected: {
|
||||||
|
console.log("Canceled")
|
||||||
|
rootItem.state = "wizard";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
PasswordDialog {
|
PasswordDialog {
|
||||||
id: passwordDialog
|
id: passwordDialog
|
||||||
standardButtons: StandardButton.Ok + StandardButton.Cancel
|
standardButtons: StandardButton.Ok + StandardButton.Cancel
|
||||||
|
@ -729,6 +779,10 @@ ApplicationWindow {
|
||||||
rootItem.state = "normal" // TODO: listen for this state change in appWindow;
|
rootItem.state = "normal" // TODO: listen for this state change in appWindow;
|
||||||
appWindow.initialize();
|
appWindow.initialize();
|
||||||
}
|
}
|
||||||
|
onOpenWalletFromFileClicked: {
|
||||||
|
rootItem.state = "normal" // TODO: listen for this state change in appWindow;
|
||||||
|
appWindow.openWalletFromFile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property int maxWidth: leftPanel.width + 655 + rightPanel.width
|
property int maxWidth: leftPanel.width + 655 + rightPanel.width
|
||||||
|
|
Loading…
Reference in a new issue