From 91661600086a8b2b214053ff34ed4485e201fe5f Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Thu, 18 Mar 2021 11:59:59 +0200 Subject: [PATCH] always show wallet name on password dialog --- .../com/sparrowwallet/sparrow/AppController.java | 2 +- .../sparrow/control/FileWalletExportPane.java | 2 +- .../sparrow/control/MessageSignDialog.java | 2 +- .../sparrow/control/WalletPasswordDialog.java | 12 ++++-------- .../sparrow/transaction/HeadersController.java | 2 +- .../sparrow/wallet/KeystoreController.java | 2 +- 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/AppController.java b/src/main/java/com/sparrowwallet/sparrow/AppController.java index 211ef493..b9723df0 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppController.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppController.java @@ -837,7 +837,7 @@ public class AppController implements Initializable { } Storage storage = new Storage(Storage.getWalletFile(wallet.getName())); - WalletPasswordDialog dlg = new WalletPasswordDialog(WalletPasswordDialog.PasswordRequirement.UPDATE_NEW); + WalletPasswordDialog dlg = new WalletPasswordDialog(wallet.getName(), WalletPasswordDialog.PasswordRequirement.UPDATE_NEW); Optional password = dlg.showAndWait(); if(password.isPresent()) { if(password.get().length() == 0) { diff --git a/src/main/java/com/sparrowwallet/sparrow/control/FileWalletExportPane.java b/src/main/java/com/sparrowwallet/sparrow/control/FileWalletExportPane.java index be014589..d510d9e8 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/FileWalletExportPane.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/FileWalletExportPane.java @@ -93,7 +93,7 @@ public class FileWalletExportPane extends TitledDescriptionPane { Wallet copy = wallet.copy(); if(copy.isEncrypted()) { - WalletPasswordDialog dlg = new WalletPasswordDialog(WalletPasswordDialog.PasswordRequirement.LOAD); + WalletPasswordDialog dlg = new WalletPasswordDialog(wallet.getName(), WalletPasswordDialog.PasswordRequirement.LOAD); Optional password = dlg.showAndWait(); if(password.isPresent()) { final File walletFile = AppServices.get().getOpenWallets().get(wallet).getWalletFile(); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/MessageSignDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/MessageSignDialog.java index a1631242..3cba445e 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/MessageSignDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/MessageSignDialog.java @@ -308,7 +308,7 @@ public class MessageSignDialog extends Dialog { return; } - WalletPasswordDialog dlg = new WalletPasswordDialog(WalletPasswordDialog.PasswordRequirement.LOAD); + WalletPasswordDialog dlg = new WalletPasswordDialog(wallet.getName(), WalletPasswordDialog.PasswordRequirement.LOAD); Optional password = dlg.showAndWait(); if(password.isPresent()) { Storage.DecryptWalletService decryptWalletService = new Storage.DecryptWalletService(wallet.copy(), password.get()); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/WalletPasswordDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/WalletPasswordDialog.java index d0bdbd7c..92bebf81 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/WalletPasswordDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/WalletPasswordDialog.java @@ -25,12 +25,8 @@ public class WalletPasswordDialog extends Dialog { private final CheckBox deleteBackups; private boolean addingPassword; - public WalletPasswordDialog(PasswordRequirement requirement) { - this(null, requirement); - } - public WalletPasswordDialog(String walletName, PasswordRequirement requirement) { - this(null, requirement, false); + this(walletName, requirement, false); } public WalletPasswordDialog(String walletName, PasswordRequirement requirement, boolean suggestChangePassword) { @@ -135,10 +131,10 @@ public class WalletPasswordDialog extends Dialog { public enum PasswordRequirement { LOAD("Please enter the wallet password:", "Unlock"), - UPDATE_NEW("Add a password to the wallet?\nLeave empty for none:", "No Password"), - UPDATE_EMPTY("This wallet has no password.\nAdd a password to the wallet?\nLeave empty for none:", "No Password"), + UPDATE_NEW("Add a password to the wallet?\nLeave empty for no password:", "No Password"), + UPDATE_EMPTY("This wallet has no password.\nAdd a password to the wallet?\nLeave empty for no password:", "No Password"), UPDATE_SET("Please re-enter the wallet password:", "Verify Password"), - UPDATE_CHANGE("Enter the new wallet password.\nLeave empty for none:", "No Password"); + UPDATE_CHANGE("Enter the new wallet password.\nLeave empty for no password:", "No Password"); private final String description; private final String okButtonText; diff --git a/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java b/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java index 9d338545..ea8e3259 100644 --- a/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java +++ b/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java @@ -716,7 +716,7 @@ public class HeadersController extends TransactionFormController implements Init File file = headersForm.getAvailableWallets().get(headersForm.getSigningWallet()).getWalletFile(); if(copy.isEncrypted()) { - WalletPasswordDialog dlg = new WalletPasswordDialog(WalletPasswordDialog.PasswordRequirement.LOAD); + WalletPasswordDialog dlg = new WalletPasswordDialog(copy.getName(), WalletPasswordDialog.PasswordRequirement.LOAD); Optional password = dlg.showAndWait(); if(password.isPresent()) { Storage.DecryptWalletService decryptWalletService = new Storage.DecryptWalletService(copy, password.get()); diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java index 0befd815..1b0ab3c6 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java @@ -338,7 +338,7 @@ public class KeystoreController extends WalletFormController implements Initiali Wallet copy = getWalletForm().getWallet().copy(); if(copy.isEncrypted()) { - WalletPasswordDialog dlg = new WalletPasswordDialog(WalletPasswordDialog.PasswordRequirement.LOAD); + WalletPasswordDialog dlg = new WalletPasswordDialog(copy.getName(), WalletPasswordDialog.PasswordRequirement.LOAD); Optional password = dlg.showAndWait(); if(password.isPresent()) { Storage.DecryptWalletService decryptWalletService = new Storage.DecryptWalletService(copy, password.get());