Procházet zdrojové kódy

Merge commit 'cc40d05e44780cd52757e8afa0a917dce4f5a377' into develop

fixes #79
Sebastian Stenzel před 7 roky
rodič
revize
5b9efcc16f

+ 15 - 0
main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java

@@ -172,6 +172,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());
@@ -409,6 +410,20 @@ public class MainController implements ViewController {
 		}
 	}
 
+	private void didPressKeyOnRoot(KeyEvent event) {
+		if ((event.isMetaDown() || event.isControlDown()) && event.getCode().isDigitKey()) {
+			int digit = Integer.valueOf(event.getText());
+			switch (digit) {
+				case 0:
+					showWelcomeView();
+					return;
+				default:
+					vaultList.getSelectionModel().select(digit - 1);
+					return;
+			}
+		}
+	}
+
 	private void didClickOnListCell(MouseEvent e) {
 		if (MouseEvent.MOUSE_CLICKED.equals(e.getEventType()) && e.getSource() instanceof Cell && ((Cell<?>) e.getSource()).isSelected()) {
 			activeController.get().focus();