used dialogBuilder for dokankySupportEndDialog

This commit is contained in:
Jan-Peter Klein 2024-10-23 19:48:55 +02:00
parent 62d7b7a0c0
commit 5ff6a8c258
No known key found for this signature in database
GPG Key ID: 90EDA3A7C822FD0E
3 changed files with 25 additions and 8 deletions

View File

@ -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<Window> 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<Void> startUnlockWorkflow(Vault vault, @Nullable Stage owner) {
return CompletableFuture.supplyAsync(() -> {
Preconditions.checkState(vault.stateProperty().transition(VaultState.Value.LOCKED, VaultState.Value.PROCESSING), "Vault not locked.");

View File

@ -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 -> {

View File

@ -11,7 +11,6 @@
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.layout.Region?>
<?import javafx.scene.control.ButtonBar?>
<?import javafx.scene.layout.AnchorPane?>
<HBox xmlns:fx="http://javafx.com/fxml"
xmlns="http://javafx.com/javafx"
fx:controller="org.cryptomator.ui.controls.CustomDialogController"
@ -38,9 +37,7 @@
<Insets bottom="6" top="6"/>
</padding>
</Label>
<AnchorPane>
<Label fx:id="descriptionLabel" wrapText="true" maxWidth="300"/>
</AnchorPane>
<Label fx:id="descriptionLabel" wrapText="true"/>
<Region VBox.vgrow="ALWAYS" minHeight="18"/>
<ButtonBar buttonMinWidth="120" buttonOrder="+CI">
<buttons>