From 06c0fb859437bd5ea629748e444f77c85c89e4e6 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Fri, 10 Dec 2021 07:59:44 +0200 Subject: [PATCH] add menu item to lock all open wallets in a window --- .../java/com/sparrowwallet/sparrow/AppController.java | 11 +++++++++++ .../com/sparrowwallet/sparrow/wallet/WalletForm.java | 4 ++++ src/main/resources/com/sparrowwallet/sparrow/app.fxml | 2 ++ 3 files changed, 17 insertions(+) diff --git a/src/main/java/com/sparrowwallet/sparrow/AppController.java b/src/main/java/com/sparrowwallet/sparrow/AppController.java index d8eb6e5a..76c334d4 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppController.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppController.java @@ -1300,6 +1300,17 @@ public class AppController implements Initializable { } } + public void lockWallets(ActionEvent event) { + for(Tab tab : tabs.getTabs()) { + TabData tabData = (TabData)tab.getUserData(); + if(tabData instanceof WalletTabData walletTabData) { + if(!walletTabData.getWalletForm().isLocked()) { + EventManager.get().post(new WalletLockEvent(walletTabData.getWalletForm().getMasterWallet())); + } + } + } + } + public void refreshWallet(ActionEvent event) { WalletForm selectedWalletForm = getSelectedWalletForm(); if(selectedWalletForm != null) { diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/WalletForm.java b/src/main/java/com/sparrowwallet/sparrow/wallet/WalletForm.java index 5fb6140c..72ecab76 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/WalletForm.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/WalletForm.java @@ -332,6 +332,10 @@ public class WalletForm { return walletUtxosEntry; } + public boolean isLocked() { + return lockedProperty.get(); + } + public BooleanProperty lockedProperty() { return lockedProperty; } diff --git a/src/main/resources/com/sparrowwallet/sparrow/app.fxml b/src/main/resources/com/sparrowwallet/sparrow/app.fxml index cdd3df63..8e162881 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/app.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/app.fxml @@ -102,6 +102,8 @@ + +