diff --git a/src/main/java/org/cryptomator/ui/fxapp/FxApplicationWindows.java b/src/main/java/org/cryptomator/ui/fxapp/FxApplicationWindows.java index 000954bd5..55dabdef1 100644 --- a/src/main/java/org/cryptomator/ui/fxapp/FxApplicationWindows.java +++ b/src/main/java/org/cryptomator/ui/fxapp/FxApplicationWindows.java @@ -13,6 +13,8 @@ import org.cryptomator.ui.preferences.SelectedPreferencesTab; import org.cryptomator.ui.quit.QuitComponent; import org.cryptomator.ui.unlock.UnlockComponent; import org.cryptomator.ui.unlock.UnlockWorkflow; +import org.cryptomator.ui.vaultoptions.SelectedVaultOptionsTab; +import org.cryptomator.ui.vaultoptions.VaultOptionsComponent; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,10 +48,11 @@ public class FxApplicationWindows { private final LockComponent.Factory lockWorkflowFactory; private final ErrorComponent.Factory errorWindowFactory; private final ExecutorService executor; + private final VaultOptionsComponent.Factory vaultOptionsWindow; private final FilteredList visibleWindows; @Inject - public FxApplicationWindows(@PrimaryStage Stage primaryStage, Optional trayIntegration, Lazy mainWindow, Lazy preferencesWindow, QuitComponent.Builder quitWindowBuilder, UnlockComponent.Factory unlockWorkflowFactory, LockComponent.Factory lockWorkflowFactory, ErrorComponent.Factory errorWindowFactory, ExecutorService executor) { + public FxApplicationWindows(@PrimaryStage Stage primaryStage, Optional trayIntegration, Lazy mainWindow, Lazy preferencesWindow, QuitComponent.Builder quitWindowBuilder, UnlockComponent.Factory unlockWorkflowFactory, LockComponent.Factory lockWorkflowFactory, ErrorComponent.Factory errorWindowFactory, ExecutorService executor, VaultOptionsComponent.Factory vaultOptionsWindow) { this.primaryStage = primaryStage; this.trayIntegration = trayIntegration; this.mainWindow = mainWindow; @@ -59,6 +62,7 @@ public class FxApplicationWindows { this.lockWorkflowFactory = lockWorkflowFactory; this.errorWindowFactory = errorWindowFactory; this.executor = executor; + this.vaultOptionsWindow = vaultOptionsWindow; this.visibleWindows = Window.getWindows().filtered(Window::isShowing); } @@ -105,6 +109,10 @@ public class FxApplicationWindows { return CompletableFuture.supplyAsync(() -> preferencesWindow.get().showPreferencesWindow(selectedTab), Platform::runLater).whenComplete(this::reportErrors); } + public CompletionStage showVaultOptionsWindow(Vault vault, SelectedVaultOptionsTab tab) { + return CompletableFuture.supplyAsync(() -> vaultOptionsWindow.create(vault).showVaultOptionsWindow(tab), Platform::runLater).whenComplete(this::reportErrors); + } + public void showQuitWindow(QuitResponse response, boolean forced) { CompletableFuture.runAsync(() -> quitWindowBuilder.build().showQuitWindow(response,forced), Platform::runLater); } diff --git a/src/main/java/org/cryptomator/ui/unlock/UnlockInvalidMountPointController.java b/src/main/java/org/cryptomator/ui/unlock/UnlockInvalidMountPointController.java index 2665f5f0e..667cb552b 100644 --- a/src/main/java/org/cryptomator/ui/unlock/UnlockInvalidMountPointController.java +++ b/src/main/java/org/cryptomator/ui/unlock/UnlockInvalidMountPointController.java @@ -8,6 +8,7 @@ import org.cryptomator.ui.common.FxController; import org.cryptomator.ui.controls.FormattedLabel; import org.cryptomator.ui.fxapp.FxApplicationWindows; import org.cryptomator.ui.preferences.SelectedPreferencesTab; +import org.cryptomator.ui.vaultoptions.SelectedVaultOptionsTab; import javax.inject.Inject; import javafx.fxml.FXML; @@ -64,7 +65,7 @@ public class UnlockInvalidMountPointController implements FxController { @FXML public void closeAndOpenVaultOptions() { - //TODO + appWindows.showVaultOptionsWindow(vault, SelectedVaultOptionsTab.MOUNT); window.close(); } diff --git a/src/main/java/org/cryptomator/ui/vaultoptions/VaultOptionsComponent.java b/src/main/java/org/cryptomator/ui/vaultoptions/VaultOptionsComponent.java index ac749132a..4f4de613b 100644 --- a/src/main/java/org/cryptomator/ui/vaultoptions/VaultOptionsComponent.java +++ b/src/main/java/org/cryptomator/ui/vaultoptions/VaultOptionsComponent.java @@ -28,12 +28,13 @@ public interface VaultOptionsComponent { ObjectProperty selectedTabProperty(); - default void showVaultOptionsWindow(SelectedVaultOptionsTab selectedTab) { + default Stage showVaultOptionsWindow(SelectedVaultOptionsTab selectedTab) { selectedTabProperty().set(selectedTab); Stage stage = window(); stage.setScene(scene().get()); stage.show(); stage.requestFocus(); + return stage; } @Subcomponent.Factory