enabled "lock all" from tray menu (#297, #863)

This commit is contained in:
Sebastian Stenzel
2019-12-16 14:44:14 +01:00
parent a1034f5663
commit c97f146964
2 changed files with 10 additions and 0 deletions

View File

@@ -116,6 +116,11 @@ class TrayMenuController {
}
menu.addSeparator();
MenuItem lockAllItem = new MenuItem(resourceBundle.getString("traymenu.lockAllVaults"));
lockAllItem.addActionListener(this::lockAllVaults);
lockAllItem.setEnabled(!vaults.filtered(Vault::isUnlocked).isEmpty());
menu.add(lockAllItem);
MenuItem quitApplicationItem = new MenuItem(resourceBundle.getString("traymenu.quitApplication"));
quitApplicationItem.addActionListener(this::quitApplication);
menu.add(quitApplicationItem);
@@ -153,6 +158,10 @@ class TrayMenuController {
fxApplicationStarter.get(true).thenAccept(app -> app.getVaultService().lock(vault, false));
}
private void lockAllVaults(ActionEvent actionEvent) {
fxApplicationStarter.get(true).thenAccept(app -> app.getVaultService().lockAll(vaults.filtered(Vault::isUnlocked), false));
}
private void revealVault(Vault vault) {
fxApplicationStarter.get(true).thenAccept(app -> app.getVaultService().reveal(vault));
}

View File

@@ -18,6 +18,7 @@ generic.error.instruction=This should not have happened. Please report the error
# Tray Menu
traymenu.showMainWindow=Show
traymenu.showPreferencesWindow=Preferences
traymenu.lockAllVaults=Lock All
traymenu.quitApplication=Quit
traymenu.vault.unlock=Unlock
traymenu.vault.lock=Lock