Browse Source

add menu item to lock all open wallets in a window

terminal
Craig Raw 3 years ago
parent
commit
06c0fb8594
  1. 11
      src/main/java/com/sparrowwallet/sparrow/AppController.java
  2. 4
      src/main/java/com/sparrowwallet/sparrow/wallet/WalletForm.java
  3. 2
      src/main/resources/com/sparrowwallet/sparrow/app.fxml

11
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) {

4
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;
}

2
src/main/resources/com/sparrowwallet/sparrow/app.fxml

@ -102,6 +102,8 @@
<SeparatorMenuItem />
<MenuItem fx:id="minimizeToTray" mnemonicParsing="false" text="Minimize to System Tray" accelerator="Shortcut+Y" onAction="#minimizeToTray"/>
<MenuItem fx:id="lockWallet" mnemonicParsing="false" text="Lock Wallet" accelerator="Shortcut+L" onAction="#lockWallet"/>
<MenuItem mnemonicParsing="false" text="Lock All Wallets" accelerator="Shortcut+Shift+L" onAction="#lockWallets"/>
<SeparatorMenuItem />
<MenuItem fx:id="refreshWallet" mnemonicParsing="false" text="Refresh Wallet" accelerator="Shortcut+R" onAction="#refreshWallet"/>
</items>
</Menu>

Loading…
Cancel
Save