mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-17 10:11:27 +00:00
@@ -74,6 +74,8 @@ import javafx.scene.control.MenuItem;
|
||||
import javafx.scene.control.ToggleButton;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyCodeCombination;
|
||||
import javafx.scene.input.KeyCombination;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.HBox;
|
||||
@@ -107,6 +109,9 @@ public class MainController implements ViewController {
|
||||
private final BooleanBinding isShowingSettings;
|
||||
private final Map<Vault, UnlockedController> unlockedVaults = new HashMap<>();
|
||||
|
||||
private final KeyCombination keyCodeCombinationCtrlUp = new KeyCodeCombination(KeyCode.UP, KeyCombination.CONTROL_DOWN);
|
||||
private final KeyCombination keyCodeCombinationCtrlDown = new KeyCodeCombination(KeyCode.DOWN, KeyCombination.CONTROL_DOWN);
|
||||
|
||||
private Subscription subs = Subscription.EMPTY;
|
||||
|
||||
@Inject
|
||||
@@ -171,6 +176,7 @@ public class MainController implements ViewController {
|
||||
vaultList.setItems(vaults);
|
||||
vaultList.setOnKeyReleased(this::didPressKeyOnList);
|
||||
vaultList.setCellFactory(this::createDirecoryListCell);
|
||||
root.setOnKeyReleased(this::didPressKeyOnRoot);
|
||||
activeController.set(viewControllerLoader.load("/fxml/welcome.fxml"));
|
||||
selectedVault.bind(vaultList.getSelectionModel().selectedItemProperty());
|
||||
removeVaultButton.disableProperty().bind(canEditSelectedVault.not());
|
||||
@@ -408,6 +414,19 @@ public class MainController implements ViewController {
|
||||
}
|
||||
}
|
||||
|
||||
private void didPressKeyOnRoot(KeyEvent event) {
|
||||
if (keyCodeCombinationCtrlUp.match(event)) {
|
||||
vaultList.getSelectionModel().select(
|
||||
vaultList.getSelectionModel().getSelectedIndex() == 0 ? 0
|
||||
: vaultList.getSelectionModel().getSelectedIndex() - 1);
|
||||
} else if (keyCodeCombinationCtrlDown.match(event)) {
|
||||
vaultList.getSelectionModel().select(
|
||||
vaultList.getSelectionModel().getSelectedIndex() == vaultList.getItems().size()
|
||||
? vaultList.getItems().size()
|
||||
: vaultList.getSelectionModel().getSelectedIndex() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void didClickOnListCell(MouseEvent e) {
|
||||
if (MouseEvent.MOUSE_CLICKED.equals(e.getEventType()) && e.getSource() instanceof Cell && ((Cell<?>) e.getSource()).isSelected()) {
|
||||
activeController.get().focus();
|
||||
|
||||
Reference in New Issue
Block a user