diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 000000000..e96534fb2 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/org/cryptomator/ui/forgetPassword/ForgetPasswordController.java b/src/main/java/org/cryptomator/ui/forgetPassword/ForgetPasswordController.java index 81d28f682..8cd43ae22 100644 --- a/src/main/java/org/cryptomator/ui/forgetPassword/ForgetPasswordController.java +++ b/src/main/java/org/cryptomator/ui/forgetPassword/ForgetPasswordController.java @@ -43,9 +43,11 @@ public class ForgetPasswordController implements FxController { LOG.debug("Forgot password for vault {}.", vault.getDisplayName()); confirmedResult.setValue(true); } catch (KeychainAccessException e) { - LOG.error("Failed to remove entry from system keychain.", e); + LOG.error("Failed to delete passphrase from system keychain.", e); confirmedResult.setValue(false); } + } else { + LOG.warn("Keychain not supported. Doing nothing."); } window.close(); } diff --git a/src/main/java/org/cryptomator/ui/keyloading/masterkeyfile/ChooseMasterkeyFileController.java b/src/main/java/org/cryptomator/ui/keyloading/masterkeyfile/ChooseMasterkeyFileController.java index d47f4e5b3..9b2231921 100644 --- a/src/main/java/org/cryptomator/ui/keyloading/masterkeyfile/ChooseMasterkeyFileController.java +++ b/src/main/java/org/cryptomator/ui/keyloading/masterkeyfile/ChooseMasterkeyFileController.java @@ -1,11 +1,13 @@ package org.cryptomator.ui.keyloading.masterkeyfile; +import org.cryptomator.common.vaults.Vault; import org.cryptomator.ui.common.FxController; import org.cryptomator.ui.keyloading.KeyLoading; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.inject.Inject; +import javafx.beans.binding.StringBinding; import javafx.fxml.FXML; import javafx.stage.FileChooser; import javafx.stage.Stage; @@ -23,12 +25,14 @@ public class ChooseMasterkeyFileController implements FxController { private static final Logger LOG = LoggerFactory.getLogger(ChooseMasterkeyFileController.class); private final Stage window; + private final Vault vault; private final CompletableFuture result; private final ResourceBundle resourceBundle; @Inject - public ChooseMasterkeyFileController(@KeyLoading Stage window, CompletableFuture result, ResourceBundle resourceBundle) { + public ChooseMasterkeyFileController(@KeyLoading Stage window, @KeyLoading Vault vault, CompletableFuture result, ResourceBundle resourceBundle) { this.window = window; + this.vault = vault; this.result = result; this.resourceBundle = resourceBundle; this.window.setOnHiding(this::windowClosed); @@ -56,4 +60,10 @@ public class ChooseMasterkeyFileController implements FxController { } } + //--- Setter & Getter --- + + public String getDisplayName(){ + return vault.getDisplayName(); + } + } diff --git a/src/main/java/org/cryptomator/ui/keyloading/masterkeyfile/MasterkeyFileLoadingStrategy.java b/src/main/java/org/cryptomator/ui/keyloading/masterkeyfile/MasterkeyFileLoadingStrategy.java index b4964f9a0..68877430a 100644 --- a/src/main/java/org/cryptomator/ui/keyloading/masterkeyfile/MasterkeyFileLoadingStrategy.java +++ b/src/main/java/org/cryptomator/ui/keyloading/masterkeyfile/MasterkeyFileLoadingStrategy.java @@ -61,6 +61,7 @@ public class MasterkeyFileLoadingStrategy implements KeyLoadingStrategy { @Override public Masterkey loadKey(URI keyId) throws MasterkeyLoadingFailedException { + window.setTitle(resourceBundle.getString("unlock.title").formatted(vault.getDisplayName())); Preconditions.checkArgument(SCHEME.equalsIgnoreCase(keyId.getScheme()), "Only supports keys with scheme " + SCHEME); try { Path filePath = vault.getPath().resolve(keyId.getSchemeSpecificPart()); @@ -124,7 +125,6 @@ public class MasterkeyFileLoadingStrategy implements KeyLoadingStrategy { var comp = masterkeyFileChoice.build(); Platform.runLater(() -> { window.setScene(comp.chooseMasterkeyScene()); - window.setTitle(resourceBundle.getString("unlock.chooseMasterkey.title").formatted(vault.getDisplayName())); window.show(); Window owner = window.getOwner(); if (owner != null) { @@ -147,7 +147,6 @@ public class MasterkeyFileLoadingStrategy implements KeyLoadingStrategy { var comp = passphraseEntry.savedPassword(passphrase).build(); Platform.runLater(() -> { window.setScene(comp.passphraseEntryScene()); - window.setTitle(resourceBundle.getString("unlock.title").formatted(vault.getDisplayName())); window.show(); Window owner = window.getOwner(); if (owner != null) { diff --git a/src/main/java/org/cryptomator/ui/quit/QuitModule.java b/src/main/java/org/cryptomator/ui/quit/QuitModule.java index ee90d747b..a1dc581ed 100644 --- a/src/main/java/org/cryptomator/ui/quit/QuitModule.java +++ b/src/main/java/org/cryptomator/ui/quit/QuitModule.java @@ -5,10 +5,10 @@ import dagger.Module; import dagger.Provides; import dagger.multibindings.IntoMap; import org.cryptomator.ui.common.DefaultSceneFactory; -import org.cryptomator.ui.common.FxmlLoaderFactory; import org.cryptomator.ui.common.FxController; import org.cryptomator.ui.common.FxControllerKey; import org.cryptomator.ui.common.FxmlFile; +import org.cryptomator.ui.common.FxmlLoaderFactory; import org.cryptomator.ui.common.FxmlScene; import org.cryptomator.ui.common.StageFactory; @@ -32,8 +32,9 @@ abstract class QuitModule { @Provides @QuitWindow @QuitScoped - static Stage provideStage(StageFactory factory) { + static Stage provideStage(StageFactory factory, ResourceBundle resourceBundle) { Stage stage = factory.create(); + stage.setTitle(resourceBundle.getString("quit.title")); stage.setMinWidth(300); stage.setMinHeight(100); stage.initModality(Modality.APPLICATION_MODAL); diff --git a/src/main/java/org/cryptomator/ui/quitforced/QuitForcedModule.java b/src/main/java/org/cryptomator/ui/quitforced/QuitForcedModule.java index b46de2cc5..dbc311339 100644 --- a/src/main/java/org/cryptomator/ui/quitforced/QuitForcedModule.java +++ b/src/main/java/org/cryptomator/ui/quitforced/QuitForcedModule.java @@ -37,7 +37,7 @@ abstract class QuitForcedModule { stage.setMinWidth(300); stage.setMinHeight(100); stage.initModality(Modality.APPLICATION_MODAL); - stage.setTitle(resourceBundle.getString("forcedQuit.title")); + stage.setTitle(resourceBundle.getString("quit.title")); return stage; } diff --git a/src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyCreationController.java b/src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyCreationController.java index 87dcbd0e8..77f191015 100644 --- a/src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyCreationController.java +++ b/src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyCreationController.java @@ -20,6 +20,7 @@ import javafx.fxml.FXML; import javafx.scene.Scene; import javafx.stage.Stage; import java.io.IOException; +import java.util.ResourceBundle; import java.util.concurrent.ExecutorService; @RecoveryKeyScoped @@ -37,8 +38,9 @@ public class RecoveryKeyCreationController implements FxController { public NiceSecurePasswordField passwordField; @Inject - public RecoveryKeyCreationController(@RecoveryKeyWindow Stage window, @FxmlScene(FxmlFile.RECOVERYKEY_SUCCESS) Lazy successScene, @RecoveryKeyWindow Vault vault, RecoveryKeyFactory recoveryKeyFactory, ExecutorService executor, @RecoveryKeyWindow StringProperty recoveryKey, FxApplicationWindows appWindows) { + public RecoveryKeyCreationController(@RecoveryKeyWindow Stage window, @FxmlScene(FxmlFile.RECOVERYKEY_SUCCESS) Lazy successScene, @RecoveryKeyWindow Vault vault, RecoveryKeyFactory recoveryKeyFactory, ExecutorService executor, @RecoveryKeyWindow StringProperty recoveryKey, FxApplicationWindows appWindows, ResourceBundle resourceBundle) { this.window = window; + window.setTitle(resourceBundle.getString("recoveryKey.display.title")); this.successScene = successScene; this.vault = vault; this.executor = executor; diff --git a/src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyModule.java b/src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyModule.java index 0522e3a8d..7e730a245 100644 --- a/src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyModule.java +++ b/src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyModule.java @@ -53,9 +53,8 @@ abstract class RecoveryKeyModule { @Provides @RecoveryKeyWindow @RecoveryKeyScoped - static Stage provideStage(StageFactory factory, ResourceBundle resourceBundle, @Named("keyRecoveryOwner") Stage owner) { + static Stage provideStage(StageFactory factory, @Named("keyRecoveryOwner") Stage owner) { Stage stage = factory.create(); - stage.setTitle(resourceBundle.getString("recoveryKey.title")); stage.setResizable(false); stage.initModality(Modality.WINDOW_MODAL); stage.initOwner(owner); diff --git a/src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyRecoverController.java b/src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyRecoverController.java index e05a73169..61cdebcd9 100644 --- a/src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyRecoverController.java +++ b/src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyRecoverController.java @@ -26,6 +26,7 @@ import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; import javafx.stage.Stage; import java.util.Optional; +import java.util.ResourceBundle; @RecoveryKeyScoped public class RecoveryKeyRecoverController implements FxController { @@ -45,8 +46,9 @@ public class RecoveryKeyRecoverController implements FxController { public TextArea textarea; @Inject - public RecoveryKeyRecoverController(@RecoveryKeyWindow Stage window, @RecoveryKeyWindow Vault vault, @RecoveryKeyWindow @Nullable VaultConfig.UnverifiedVaultConfig unverifiedVaultConfig, @RecoveryKeyWindow StringProperty recoveryKey, RecoveryKeyFactory recoveryKeyFactory, @FxmlScene(FxmlFile.RECOVERYKEY_RESET_PASSWORD) Lazy resetPasswordScene) { + public RecoveryKeyRecoverController(@RecoveryKeyWindow Stage window, @RecoveryKeyWindow Vault vault, @RecoveryKeyWindow @Nullable VaultConfig.UnverifiedVaultConfig unverifiedVaultConfig, @RecoveryKeyWindow StringProperty recoveryKey, RecoveryKeyFactory recoveryKeyFactory, @FxmlScene(FxmlFile.RECOVERYKEY_RESET_PASSWORD) Lazy resetPasswordScene, ResourceBundle resourceBundle) { this.window = window; + window.setTitle(resourceBundle.getString("recoveryKey.recover.title")); this.vault = vault; this.unverifiedVaultConfig = unverifiedVaultConfig; this.recoveryKey = recoveryKey; diff --git a/src/main/java/org/cryptomator/ui/removevault/RemoveVaultModule.java b/src/main/java/org/cryptomator/ui/removevault/RemoveVaultModule.java index 4288e9c7c..2fcac4add 100644 --- a/src/main/java/org/cryptomator/ui/removevault/RemoveVaultModule.java +++ b/src/main/java/org/cryptomator/ui/removevault/RemoveVaultModule.java @@ -4,6 +4,7 @@ import dagger.Binds; import dagger.Module; import dagger.Provides; import dagger.multibindings.IntoMap; +import org.cryptomator.common.vaults.Vault; import org.cryptomator.ui.common.DefaultSceneFactory; import org.cryptomator.ui.common.FxController; import org.cryptomator.ui.common.FxControllerKey; @@ -33,9 +34,9 @@ abstract class RemoveVaultModule { @Provides @RemoveVaultWindow @RemoveVaultScoped - static Stage provideStage(StageFactory factory, @PrimaryStage Stage primaryStage, ResourceBundle resourceBundle) { + static Stage provideStage(StageFactory factory, @PrimaryStage Stage primaryStage, @RemoveVaultWindow Vault vault, ResourceBundle resourceBundle) { Stage stage = factory.create(); - stage.setTitle(resourceBundle.getString("removeVault.title")); + stage.setTitle(String.format(resourceBundle.getString("removeVault.title"), vault.getDisplayName())); stage.setResizable(false); stage.initModality(Modality.WINDOW_MODAL); stage.initOwner(primaryStage); diff --git a/src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java b/src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java index fb9d6b711..a9bc88cf7 100644 --- a/src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java +++ b/src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java @@ -5,6 +5,7 @@ import org.cryptomator.common.vaults.Vault; import org.cryptomator.integrations.keychain.KeychainAccessException; import org.cryptomator.ui.changepassword.ChangePasswordComponent; import org.cryptomator.ui.common.FxController; +import org.cryptomator.ui.forgetPassword.ForgetPasswordComponent; import org.cryptomator.ui.recoverykey.RecoveryKeyComponent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -25,16 +26,18 @@ public class MasterkeyOptionsController implements FxController { private final Stage window; private final ChangePasswordComponent.Builder changePasswordWindow; private final RecoveryKeyComponent.Builder recoveryKeyWindow; + private final ForgetPasswordComponent.Builder forgetPasswordWindow; private final KeychainManager keychain; private final BooleanExpression passwordSaved; @Inject - MasterkeyOptionsController(@VaultOptionsWindow Vault vault, @VaultOptionsWindow Stage window, ChangePasswordComponent.Builder changePasswordWindow, RecoveryKeyComponent.Builder recoveryKeyWindow, KeychainManager keychain) { + MasterkeyOptionsController(@VaultOptionsWindow Vault vault, @VaultOptionsWindow Stage window, ChangePasswordComponent.Builder changePasswordWindow, RecoveryKeyComponent.Builder recoveryKeyWindow, ForgetPasswordComponent.Builder forgetPasswordWindow, KeychainManager keychain) { this.vault = vault; this.window = window; this.changePasswordWindow = changePasswordWindow; this.recoveryKeyWindow = recoveryKeyWindow; + this.forgetPasswordWindow = forgetPasswordWindow; this.keychain = keychain; if (keychain.isSupported() && !keychain.isLocked()) { this.passwordSaved = Bindings.createBooleanBinding(this::isPasswordSaved, keychain.getPassphraseStoredProperty(vault.getId())); @@ -54,19 +57,14 @@ public class MasterkeyOptionsController implements FxController { } @FXML - public void showRecoverVaultDialogue() { + public void showRecoverVaultDialog() { recoveryKeyWindow.vault(vault).owner(window).build().showRecoveryKeyRecoverWindow(); } @FXML - public void removePasswordFromKeychain() { + public void showForgetPasswordDialog() { assert keychain.isSupported(); - try { - keychain.deletePassphrase(vault.getId()); - } catch (KeychainAccessException e) { - LOG.error("Failed to delete passphrase from system keychain.", e); - } - window.close(); + forgetPasswordWindow.vault(vault).owner(window).build().showForgetPassword(); } public BooleanExpression passwordSavedProperty() { diff --git a/src/main/java/org/cryptomator/ui/vaultoptions/VaultOptionsModule.java b/src/main/java/org/cryptomator/ui/vaultoptions/VaultOptionsModule.java index e6966da64..a9014cc54 100644 --- a/src/main/java/org/cryptomator/ui/vaultoptions/VaultOptionsModule.java +++ b/src/main/java/org/cryptomator/ui/vaultoptions/VaultOptionsModule.java @@ -13,6 +13,7 @@ import org.cryptomator.ui.common.FxmlFile; import org.cryptomator.ui.common.FxmlLoaderFactory; import org.cryptomator.ui.common.FxmlScene; import org.cryptomator.ui.common.StageFactory; +import org.cryptomator.ui.forgetPassword.ForgetPasswordComponent; import org.cryptomator.ui.fxapp.PrimaryStage; import org.cryptomator.ui.recoverykey.RecoveryKeyComponent; @@ -25,7 +26,7 @@ import javafx.stage.Stage; import java.util.Map; import java.util.ResourceBundle; -@Module(subcomponents = {ChangePasswordComponent.class, RecoveryKeyComponent.class}) +@Module(subcomponents = {ChangePasswordComponent.class, RecoveryKeyComponent.class, ForgetPasswordComponent.class}) abstract class VaultOptionsModule { @Provides diff --git a/src/main/java/org/cryptomator/ui/wrongfilealert/WrongFileAlertController.java b/src/main/java/org/cryptomator/ui/wrongfilealert/WrongFileAlertController.java index 7f05e5287..e772a0113 100644 --- a/src/main/java/org/cryptomator/ui/wrongfilealert/WrongFileAlertController.java +++ b/src/main/java/org/cryptomator/ui/wrongfilealert/WrongFileAlertController.java @@ -30,6 +30,7 @@ public class WrongFileAlertController implements FxController { @FXML public void initialize() { + //TODO: add dark-mode screens final String resource = SystemUtils.IS_OS_MAC ? "/img/vault-volume-mac.png" : "/img/vault-volume-win.png"; try (InputStream in = getClass().getResourceAsStream(resource)) { this.screenshot = new Image(in); diff --git a/src/main/resources/css/dark_theme.css b/src/main/resources/css/dark_theme.css index f55509cd8..32bddbbf1 100644 --- a/src/main/resources/css/dark_theme.css +++ b/src/main/resources/css/dark_theme.css @@ -98,11 +98,16 @@ -fx-text-fill: TEXT_FILL_MUTED; } -.label-large { +.label-extra-large { -fx-font-family: 'Open Sans SemiBold'; -fx-font-size: 1.5em; } +.label-large { + -fx-font-family: 'Open Sans SemiBold'; + -fx-font-size: 1.2em; +} + .label-small { -fx-font-size: 0.8em; } diff --git a/src/main/resources/css/light_theme.css b/src/main/resources/css/light_theme.css index 06899c907..a6cd67af9 100644 --- a/src/main/resources/css/light_theme.css +++ b/src/main/resources/css/light_theme.css @@ -98,11 +98,16 @@ -fx-text-fill: TEXT_FILL_MUTED; } -.label-large { +.label-extra-large { -fx-font-family: 'Open Sans SemiBold'; -fx-font-size: 1.5em; } +.label-large { + -fx-font-family: 'Open Sans SemiBold'; + -fx-font-size: 1.2em; +} + .label-small { -fx-font-size: 0.8em; } diff --git a/src/main/resources/fxml/error.fxml b/src/main/resources/fxml/error.fxml index 4dbddc4c3..1bb8a5ae2 100644 --- a/src/main/resources/fxml/error.fxml +++ b/src/main/resources/fxml/error.fxml @@ -30,14 +30,14 @@ - -