1
0

qml: start new wallet wizard if no wallets exist, create/open button opens wizard if no wallets exist

This commit is contained in:
Sander van Grieken
2022-10-04 15:09:37 +02:00
parent 8184093a34
commit 6dab3de1f2
2 changed files with 23 additions and 3 deletions

View File

@@ -89,7 +89,17 @@ Item {
text: qsTr('Open/Create Wallet')
Layout.alignment: Qt.AlignHCenter
onClicked: {
stack.push(Qt.resolvedUrl('Wallets.qml'))
if (Daemon.availableWallets.rowCount() > 0) {
stack.push(Qt.resolvedUrl('Wallets.qml'))
} else {
var newww = app.newWalletWizard.createObject(app)
newww.walletCreated.connect(function() {
Daemon.availableWallets.reload()
// and load the new wallet
Daemon.load_wallet(newww.path, newww.wizard_data['password'])
})
newww.open()
}
}
}
}

View File

@@ -223,16 +223,26 @@ ApplicationWindow
})
dialog.accepted.connect(function() {
var newww = app.newWalletWizard.createObject(app)
newww.open()
newww.walletCreated.connect(function() {
Daemon.availableWallets.reload()
// and load the new wallet
Daemon.load_wallet(newww.path, newww.wizard_data['password'])
})
newww.open()
})
dialog.open()
} else {
Daemon.load_wallet()
if (Daemon.availableWallets.rowCount() > 0) {
Daemon.load_wallet()
} else {
var newww = app.newWalletWizard.createObject(app)
newww.walletCreated.connect(function() {
Daemon.availableWallets.reload()
// and load the new wallet
Daemon.load_wallet(newww.path, newww.wizard_data['password'])
})
newww.open()
}
}
}