From 5ff6a8c25845505ce8aa0d8bffa5544810ef0a8a Mon Sep 17 00:00:00 2001 From: Jan-Peter Klein Date: Wed, 23 Oct 2024 19:48:55 +0200 Subject: [PATCH] used dialogBuilder for dokankySupportEndDialog --- .../ui/fxapp/FxApplicationWindows.java | 26 ++++++++++++++++--- .../SupporterCertificateController.java | 2 +- src/main/resources/fxml/custom_dialog.fxml | 5 +--- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/fxapp/FxApplicationWindows.java b/src/main/java/org/cryptomator/ui/fxapp/FxApplicationWindows.java index 33d8491a7..394474f80 100644 --- a/src/main/java/org/cryptomator/ui/fxapp/FxApplicationWindows.java +++ b/src/main/java/org/cryptomator/ui/fxapp/FxApplicationWindows.java @@ -5,6 +5,8 @@ import dagger.Lazy; import org.cryptomator.common.vaults.Vault; import org.cryptomator.common.vaults.VaultState; import org.cryptomator.integrations.tray.TrayIntegrationProvider; +import org.cryptomator.ui.controls.CustomDialogBuilder; +import org.cryptomator.ui.controls.FontAwesome5Icon; import org.cryptomator.ui.dokanysupportend.DokanySupportEndComponent; import org.cryptomator.ui.error.ErrorComponent; import org.cryptomator.ui.lock.LockComponent; @@ -33,6 +35,7 @@ import java.awt.Desktop; import java.awt.desktop.AppReopenedListener; import java.awt.desktop.QuitResponse; import java.util.Optional; +import java.util.ResourceBundle; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; import java.util.concurrent.ExecutorService; @@ -56,6 +59,7 @@ public class FxApplicationWindows { private final VaultOptionsComponent.Factory vaultOptionsWindow; private final ShareVaultComponent.Factory shareVaultWindow; private final FilteredList visibleWindows; + private final ResourceBundle resourceBundle; @Inject public FxApplicationWindows(@PrimaryStage Stage primaryStage, // @@ -70,7 +74,8 @@ public class FxApplicationWindows { ErrorComponent.Factory errorWindowFactory, // VaultOptionsComponent.Factory vaultOptionsWindow, // ShareVaultComponent.Factory shareVaultWindow, // - ExecutorService executor) { + ExecutorService executor, // + ResourceBundle resourceBundle) { this.primaryStage = primaryStage; this.trayIntegration = trayIntegration; this.mainWindow = mainWindow; @@ -85,6 +90,8 @@ public class FxApplicationWindows { this.vaultOptionsWindow = vaultOptionsWindow; this.shareVaultWindow = shareVaultWindow; this.visibleWindows = Window.getWindows().filtered(Window::isShowing); + this.resourceBundle = resourceBundle; + } public void initialize() { @@ -147,10 +154,23 @@ public class FxApplicationWindows { } public void showDokanySupportEndWindow() { - CompletableFuture.runAsync(() -> dokanySupportEndWindowBuilder.create().showDokanySupportEndWindow(), Platform::runLater); + CompletableFuture.runAsync(() -> { + new CustomDialogBuilder() // + .setTitle(resourceBundle.getString("dokanySupportEnd.title")) // + .setMessage(resourceBundle.getString("dokanySupportEnd.message")) // + .setDescription(resourceBundle.getString("dokanySupportEnd.description")) // + .setIcon(FontAwesome5Icon.EXCLAMATION) // + .setOkButtonText(resourceBundle.getString("generic.button.close")) // + .setCancelButtonText(resourceBundle.getString("dokanySupportEnd.preferencesBtn")) // + .setOkAction(Stage::close) // + .setCancelAction(v -> { + showPreferencesWindow(SelectedPreferencesTab.VOLUME); + v.close(); + }) // + .buildAndShow(mainWindow.get().window()); + }, Platform::runLater); } - public CompletionStage startUnlockWorkflow(Vault vault, @Nullable Stage owner) { return CompletableFuture.supplyAsync(() -> { Preconditions.checkState(vault.stateProperty().transition(VaultState.Value.LOCKED, VaultState.Value.PROCESSING), "Vault not locked."); diff --git a/src/main/java/org/cryptomator/ui/preferences/SupporterCertificateController.java b/src/main/java/org/cryptomator/ui/preferences/SupporterCertificateController.java index b7e5872ea..a145bdc8a 100644 --- a/src/main/java/org/cryptomator/ui/preferences/SupporterCertificateController.java +++ b/src/main/java/org/cryptomator/ui/preferences/SupporterCertificateController.java @@ -90,7 +90,7 @@ public class SupporterCertificateController implements FxController { .setTitle(resourceBundle.getString("removeCert.title")) .setMessage(resourceBundle.getString("removeCert.message")) .setDescription(resourceBundle.getString("removeCert.description")) - .setIcon(FontAwesome5Icon.BUG) + .setIcon(FontAwesome5Icon.QUESTION) .setOkButtonText(resourceBundle.getString("removeCert.confirmBtn")) .setCancelButtonText(resourceBundle.getString("generic.button.cancel")) .setOkAction(v -> { diff --git a/src/main/resources/fxml/custom_dialog.fxml b/src/main/resources/fxml/custom_dialog.fxml index 3c4521c00..887a35799 100644 --- a/src/main/resources/fxml/custom_dialog.fxml +++ b/src/main/resources/fxml/custom_dialog.fxml @@ -11,7 +11,6 @@ - - - +