From 0c2554da72666c33dc19ee39a1604a42022d72e2 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Fri, 19 Mar 2021 14:34:29 +0200 Subject: [PATCH] add export button to wallet settings --- .../sparrow/wallet/SettingsController.java | 16 ++++++++++++++++ .../sparrowwallet/sparrow/wallet/settings.fxml | 3 +++ 2 files changed, 19 insertions(+) diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java index d4c1e494..604e7faa 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java @@ -65,6 +65,8 @@ public class SettingsController extends WalletFormController implements Initiali private TabPane keystoreTabs; + @FXML Button export; + @FXML private Button apply; @@ -221,6 +223,7 @@ public class SettingsController extends WalletFormController implements Initiali scriptType.getSelectionModel().select(walletForm.getWallet().getScriptType()); } + export.setDisable(!walletForm.getWallet().isValid()); revert.setDisable(true); apply.setDisable(true); } @@ -312,6 +315,11 @@ public class SettingsController extends WalletFormController implements Initiali } } + public void exportWallet(ActionEvent event) { + WalletExportDialog dlg = new WalletExportDialog(walletForm.getWallet()); + dlg.showAndWait(); + } + @Override protected String describeKeystore(Keystore keystore) { if(!keystore.isValid()) { @@ -341,6 +349,14 @@ public class SettingsController extends WalletFormController implements Initiali revert.setDisable(false); apply.setDisable(!wallet.isValid()); + export.setDisable(true); + } + } + + @Subscribe + public void walletSettingsChanged(WalletSettingsChangedEvent event) { + if(event.getWalletFile().equals(walletForm.getWalletFile())) { + export.setDisable(!event.getWallet().isValid()); } } diff --git a/src/main/resources/com/sparrowwallet/sparrow/wallet/settings.fxml b/src/main/resources/com/sparrowwallet/sparrow/wallet/settings.fxml index bcf7b8e8..603b48a3 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/wallet/settings.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/wallet/settings.fxml @@ -112,6 +112,9 @@ + +