qml: disable 'Create Wallet' before first unlock

If the user has not unlocked any wallet yet and tries to create a new
wallet in the overview a dialog will prompt them to first unlock an
existing wallet in order to be able to create a new wallet.

This ensures they remember at least one password so they can complete
the wizard. The wizard will ask them for an existing password later and
it would be annoying for the user to go through all steps (writing down
the seed etc.) only to find out they need a password they don't
remember. This way they can reinstall the app right before going through
the wizard.
This commit is contained in:
f321x
2025-12-04 15:37:09 +01:00
parent 3b028b06a0
commit 378a9e6112
3 changed files with 31 additions and 1 deletions
@@ -528,6 +528,9 @@ Pane {
})
dialog.accepted.connect(function() {
var success = Daemon.currentWallet.setPassword(dialog.password)
if (success && Config.walletShouldUseSinglePassword) {
Daemon.singlePassword = dialog.password
}
var done_dialog = app.messageDialog.createObject(app, {
title: success ? qsTr('Success') : qsTr('Error'),
iconSource: success
+15 -1
View File
@@ -121,7 +121,21 @@ Pane {
Layout.fillWidth: true
text: qsTr('Create Wallet')
icon.source: '../../icons/add.png'
onClicked: rootItem.createWallet()
onClicked: {
if (Daemon.availableWallets.rowCount() > 0 && Config.walletShouldUseSinglePassword
&& (!Daemon.singlePassword || Daemon.numWalletsWithPassword(Daemon.singlePassword) < 1)) {
// if the user has wallets but hasn't unlocked any wallet yet force them to do so.
// this ensures they know at least one wallets password and can complete the wizard
// where they will need to enter the password of an existing wallet.
var dialog = app.messageDialog.createObject(app, {
title: qsTr('Wallet unlock required'),
text: qsTr("You have to unlock any existing wallet first before creating a new wallet."),
})
dialog.open()
} else {
rootItem.createWallet()
}
}
}
}