terminal: add lock menu item to all wallets with a password

This commit is contained in:
Craig Raw 2023-02-17 08:37:10 +02:00
parent 88fc8f5017
commit e0ff42b6a4

View file

@ -4,6 +4,7 @@ import com.googlecode.lanterna.TerminalSize;
import com.googlecode.lanterna.gui2.*; import com.googlecode.lanterna.gui2.*;
import com.googlecode.lanterna.gui2.dialogs.DialogWindow; import com.googlecode.lanterna.gui2.dialogs.DialogWindow;
import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.drongo.wallet.Wallet;
import com.sparrowwallet.sparrow.io.Storage;
import com.sparrowwallet.sparrow.terminal.SparrowTerminal; import com.sparrowwallet.sparrow.terminal.SparrowTerminal;
import com.sparrowwallet.sparrow.wallet.Function; import com.sparrowwallet.sparrow.wallet.Function;
@ -48,7 +49,7 @@ public class WalletActionsDialog extends DialogWindow {
SettingsDialog settingsDialog = getWalletData().getSettingsDialog(); SettingsDialog settingsDialog = getWalletData().getSettingsDialog();
settingsDialog.showDialog(SparrowTerminal.get().getGui()); settingsDialog.showDialog(SparrowTerminal.get().getGui());
}); });
if(getWalletData().getWalletForm().getWallet().isEncrypted()) { if(!Storage.NO_PASSWORD_KEY.equals(getWalletData().getWalletForm().getStorage().getEncryptionPubKey())) {
actions.addItem("Lock", () -> { actions.addItem("Lock", () -> {
close(); close();
SparrowTerminal.get().lockWallet(getWalletData().getWalletForm().getStorage()); SparrowTerminal.get().lockWallet(getWalletData().getWalletForm().getStorage());