From 76c84b34e9fb59eb768bc6c16095d1b9a9857ee4 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Mon, 5 Nov 2018 10:46:39 +0100 Subject: [PATCH 01/17] bumped version --- main/ant-kit/pom.xml | 2 +- main/commons/pom.xml | 2 +- main/keychain/pom.xml | 2 +- main/launcher/pom.xml | 2 +- main/pom.xml | 2 +- main/uber-jar/pom.xml | 2 +- main/ui/pom.xml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/main/ant-kit/pom.xml b/main/ant-kit/pom.xml index acd09e3f5..090e5142c 100644 --- a/main/ant-kit/pom.xml +++ b/main/ant-kit/pom.xml @@ -4,7 +4,7 @@ org.cryptomator main - 1.4.0-SNAPSHOT + 1.5.0-SNAPSHOT ant-kit pom diff --git a/main/commons/pom.xml b/main/commons/pom.xml index 80d96e00c..723568fa6 100644 --- a/main/commons/pom.xml +++ b/main/commons/pom.xml @@ -4,7 +4,7 @@ org.cryptomator main - 1.4.0-SNAPSHOT + 1.5.0-SNAPSHOT commons Cryptomator Commons diff --git a/main/keychain/pom.xml b/main/keychain/pom.xml index 1d2ae0e0a..8ae41d506 100644 --- a/main/keychain/pom.xml +++ b/main/keychain/pom.xml @@ -4,7 +4,7 @@ org.cryptomator main - 1.4.0-SNAPSHOT + 1.5.0-SNAPSHOT keychain System Keychain Access diff --git a/main/launcher/pom.xml b/main/launcher/pom.xml index bb55d145b..aef980622 100644 --- a/main/launcher/pom.xml +++ b/main/launcher/pom.xml @@ -4,7 +4,7 @@ org.cryptomator main - 1.4.0-SNAPSHOT + 1.5.0-SNAPSHOT launcher Cryptomator Launcher diff --git a/main/pom.xml b/main/pom.xml index 67b24ceab..024cd68ad 100644 --- a/main/pom.xml +++ b/main/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.cryptomator main - 1.4.0-SNAPSHOT + 1.5.0-SNAPSHOT pom Cryptomator diff --git a/main/uber-jar/pom.xml b/main/uber-jar/pom.xml index e0fb9e634..fa28bfada 100644 --- a/main/uber-jar/pom.xml +++ b/main/uber-jar/pom.xml @@ -4,7 +4,7 @@ org.cryptomator main - 1.4.0-SNAPSHOT + 1.5.0-SNAPSHOT uber-jar Single über jar with all dependencies diff --git a/main/ui/pom.xml b/main/ui/pom.xml index 2421329e6..a613c2b01 100644 --- a/main/ui/pom.xml +++ b/main/ui/pom.xml @@ -4,7 +4,7 @@ org.cryptomator main - 1.4.0-SNAPSHOT + 1.5.0-SNAPSHOT ui Cryptomator GUI From 6951edac96321a5495e06ab2aa774da1a40e0b7d Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Wed, 5 Dec 2018 18:22:48 +0100 Subject: [PATCH 02/17] fixes #770 --- main/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/pom.xml b/main/pom.xml index 024cd68ad..d7a950918 100644 --- a/main/pom.xml +++ b/main/pom.xml @@ -27,7 +27,7 @@ 1.2.1 1.6.1 2.0.0 - 1.0.1 + 1.0.2 1.0.0 1.0.5 From 69b1bf5a268d1409098ca2082e98e571e5372ddb Mon Sep 17 00:00:00 2001 From: jellemdekker Date: Sat, 22 Dec 2018 12:53:42 +0100 Subject: [PATCH 03/17] Added a Cancel button to the graceful shutdown-dialog. Fixes issue #771. --- .../java/org/cryptomator/ui/controllers/MainController.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java b/main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java index 8a3153503..6814414f0 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java @@ -222,7 +222,7 @@ public class MainController implements ViewController { ButtonType forceShutdownButtonType = new ButtonType(localization.getString("main.gracefulShutdown.button.forceShutdown")); Alert gracefulShutdownDialog = DialogBuilderUtil.buildGracefulShutdownDialog( localization.getString("main.gracefulShutdown.dialog.title"), localization.getString("main.gracefulShutdown.dialog.header"), localization.getString("main.gracefulShutdown.dialog.content"), - forceShutdownButtonType, forceShutdownButtonType, tryAgainButtonType); + forceShutdownButtonType, ButtonType.CANCEL, forceShutdownButtonType, tryAgainButtonType); Optional choice = gracefulShutdownDialog.showAndWait(); choice.ifPresent(btnType -> { @@ -230,6 +230,8 @@ public class MainController implements ViewController { gracefulShutdown(); } else if (forceShutdownButtonType.equals(btnType)) { Platform.runLater(Platform::exit); + } else { + return; } }); } else { From 8fc647eb2b4fba345bbd419143d26ace282c9ceb Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 9 Jan 2019 15:26:02 +0100 Subject: [PATCH 04/17] Updating Apache Commons libraries --- main/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/pom.xml b/main/pom.xml index d7a950918..052251658 100644 --- a/main/pom.xml +++ b/main/pom.xml @@ -31,8 +31,8 @@ 1.0.0 1.0.5 - 2.5 - 3.6 + 2.6 + 3.8.1 1.0.3 From f760347d9db41e3f88ba8a239f69e141878822ad Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 9 Jan 2019 15:28:05 +0100 Subject: [PATCH 05/17] fixes #787 --- .../cryptomator/ui/controllers/MainController.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java b/main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java index 8a3153503..c401da43a 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java @@ -2,7 +2,7 @@ * Copyright (c) 2014, 2017 Sebastian Stenzel * All rights reserved. * This program and the accompanying materials are made available under the terms of the accompanying LICENSE file. - * + * * Contributors: * Sebastian Stenzel - initial API and implementation * Jean-Noël Charon - confirmation dialog on vault removal @@ -110,7 +110,7 @@ public class MainController implements ViewController { @Inject public MainController(@Named("mainWindow") Stage mainWindow, ExecutorService executorService, @Named("fileOpenRequests") BlockingQueue fileOpenRequests, ExitUtil exitUtil, Localization localization, - VaultFactory vaultFactoy, ViewControllerLoader viewControllerLoader, UpgradeStrategies upgradeStrategies, VaultList vaults, AutoUnlocker autoUnlocker) { + VaultFactory vaultFactoy, ViewControllerLoader viewControllerLoader, UpgradeStrategies upgradeStrategies, VaultList vaults, AutoUnlocker autoUnlocker) { this.mainWindow = mainWindow; this.executorService = executorService; this.fileOpenRequests = fileOpenRequests; @@ -331,7 +331,7 @@ public class MainController implements ViewController { /** * adds the given directory or selects it if it is already in the list of directories. - * + * * @param path to a vault directory or masterkey file */ public void addVault(final Path path, boolean select) { @@ -432,7 +432,13 @@ public class MainController implements ViewController { } private void didPressKeyOnRoot(KeyEvent event) { - if ((event.isMetaDown() || event.isControlDown()) && event.getCode().isDigitKey()) { + boolean triggered; + if (SystemUtils.IS_OS_MAC) { + triggered = event.isMetaDown(); + } else { + triggered = event.isControlDown() && !event.isAltDown(); + } + if (triggered && event.getCode().isDigitKey()) { int digit = Integer.valueOf(event.getText()); switch (digit) { case 0: { From c36a1a4aefa2476f32fbb29317409e9d5bb8a15e Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 9 Jan 2019 17:58:23 +0100 Subject: [PATCH 06/17] closes #711 --- main/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/pom.xml b/main/pom.xml index 052251658..79f01ed6e 100644 --- a/main/pom.xml +++ b/main/pom.xml @@ -28,7 +28,7 @@ 1.6.1 2.0.0 1.0.2 - 1.0.0 + 1.1.1 1.0.5 2.6 From da62a22faf144addc21abfecbb51029ca1c29da5 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 9 Jan 2019 17:59:41 +0100 Subject: [PATCH 07/17] fixes #750 --- main/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/pom.xml b/main/pom.xml index 79f01ed6e..faee74d2e 100644 --- a/main/pom.xml +++ b/main/pom.xml @@ -25,7 +25,7 @@ 1.2.1 - 1.6.1 + 1.6.2 2.0.0 1.0.2 1.1.1 From af03e0d73d1c1ae20a3bed4684a06881ae8aaa33 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Tue, 15 Jan 2019 13:07:39 +0100 Subject: [PATCH 08/17] updated dagger [ci skip] --- main/pom.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main/pom.xml b/main/pom.xml index faee74d2e..9ba79345a 100644 --- a/main/pom.xml +++ b/main/pom.xml @@ -37,7 +37,7 @@ 1.0.3 27.0-jre - 2.19 + 2.20 2.8.5 1.7.25 @@ -317,8 +317,6 @@ maven-compiler-plugin 3.8.0 - 9 - 9 9 From f2f8f9b28c7a31f0b46bac1e4750a3788e4b1a68 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Tue, 15 Jan 2019 13:15:38 +0100 Subject: [PATCH 09/17] added intellij project configuration --- .gitignore | 18 +++++----- .idea/.name | 1 + .idea/codeStyles/Project.xml | 51 ++++++++++++++++++++++++++++ .idea/codeStyles/codeStyleConfig.xml | 5 +++ .idea/compiler.xml | 16 +++++++++ .idea/encodings.xml | 10 ++++++ .idea/misc.xml | 14 ++++++++ .idea/vcs.xml | 6 ++++ 8 files changed, 111 insertions(+), 10 deletions(-) create mode 100644 .idea/.name create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .idea/compiler.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/vcs.xml diff --git a/.gitignore b/.gitignore index 7051b0cd0..52f9a6ccd 100644 --- a/.gitignore +++ b/.gitignore @@ -9,15 +9,13 @@ .settings .project .classpath + +# Maven # target/ -test-output/ -# IntelliJ Settings Files # -.idea/ -out/ -.idea_modules/ -*.iws -*.iml - -# Temporary file created by test launcher -main/launcher/.ipcPort.tmp +# IntelliJ Settings Files (https://intellij-support.jetbrains.com/hc/en-us/articles/206544839-How-to-manage-projects-under-Version-Control-Systems) # +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries +.idea/**/libraries/ +*.iml \ No newline at end of file diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 000000000..f9944b4aa --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Cryptomator \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 000000000..d6cb2c866 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,51 @@ + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 000000000..79ee123c2 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 000000000..69fb739cd --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 000000000..74a53dde5 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 000000000..fd8e48573 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..94a25f7f4 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From 240bf122ddcdd9ecd11320bafc72645ef5826c0b Mon Sep 17 00:00:00 2001 From: Tobias Hagemann Date: Wed, 16 Jan 2019 14:00:32 +0100 Subject: [PATCH 10/17] Hide "check for updates" indicator by default --- main/ui/src/main/resources/fxml/welcome.fxml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/main/ui/src/main/resources/fxml/welcome.fxml b/main/ui/src/main/resources/fxml/welcome.fxml index e455e28e6..4cdfe8430 100644 --- a/main/ui/src/main/resources/fxml/welcome.fxml +++ b/main/ui/src/main/resources/fxml/welcome.fxml @@ -7,31 +7,28 @@ Contributors: Sebastian Stenzel - initial API and implementation --> - - - - + - + - + \ No newline at end of file From 078a1271826dea17289a5b151539a3360a2be1c8 Mon Sep 17 00:00:00 2001 From: Tobias Hagemann Date: Wed, 16 Jan 2019 14:15:26 +0100 Subject: [PATCH 11/17] Shortened "welcome.askForUpdateCheck.dialog.content" copy --- main/ui/src/main/resources/localization/en.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/ui/src/main/resources/localization/en.txt b/main/ui/src/main/resources/localization/en.txt index bf787682d..04dc90158 100644 --- a/main/ui/src/main/resources/localization/en.txt +++ b/main/ui/src/main/resources/localization/en.txt @@ -30,7 +30,7 @@ welcome.checkForUpdates.label.currentlyChecking=Checking for Updates... welcome.newVersionMessage=Version %1$s can be downloaded.\nThis is %2$s. welcome.askForUpdateCheck.dialog.title=Update check welcome.askForUpdateCheck.dialog.header=Enable the integrated update check? -welcome.askForUpdateCheck.dialog.content=To check for updates, Cryptomator will fetch the current version from the Cryptomator servers and display a hint to you if a newer version is available.\n\nWe recommend to enable the update check to always be sure you have the newest version of Cryptomator, with all security patches, installed. If you do not enable the update check you may check and download the current version from https://cryptomator.org/downloads/.\n\nYou can change this at any time from within the settings. +welcome.askForUpdateCheck.dialog.content=Recommended: Enable the update check to always be sure you have the newest version of Cryptomator, with all security patches, installed.\n\nYou can change this from within the settings at any time. # initialize.fxml initialize.label.password=Password From bbe1ef3dbc479e9699559c027b7030af2248638b Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 16 Jan 2019 15:08:00 +0100 Subject: [PATCH 12/17] Feature/custom mount point generalizing (#797) * changing naming of individual mout path property * adding input/output for the new custom mount points * ui integration of custom mount point * removing unused variable * Improving UX * Simplify mountPathProperty and implement its usage * reverting renaming of Properties concerning the usage of own mount point (rescheduled for 1.5.0) * changing displayed message when no mount path given * fixing ui error * applying suggestion of comment https://github.com/cryptomator/cryptomator/pull/797/files/7338fda41858942ee17daf436979e2a69114a108#r248254180 --- .../common/settings/VaultSettings.java | 23 +++--- .../settings/VaultSettingsJsonAdapter.java | 12 ++- .../ui/controllers/UnlockController.java | 80 ++++++++++--------- .../cryptomator/ui/model/DokanyVolume.java | 42 +++++----- .../java/org/cryptomator/ui/model/Vault.java | 29 ++++--- main/ui/src/main/resources/fxml/unlock.fxml | 17 ++-- .../ui/src/main/resources/localization/en.txt | 3 +- 7 files changed, 107 insertions(+), 99 deletions(-) diff --git a/main/commons/src/main/java/org/cryptomator/common/settings/VaultSettings.java b/main/commons/src/main/java/org/cryptomator/common/settings/VaultSettings.java index 1f8510d99..5b33a9765 100644 --- a/main/commons/src/main/java/org/cryptomator/common/settings/VaultSettings.java +++ b/main/commons/src/main/java/org/cryptomator/common/settings/VaultSettings.java @@ -5,16 +5,6 @@ *******************************************************************************/ package org.cryptomator.common.settings; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.nio.file.Path; -import java.util.Base64; -import java.util.Objects; -import java.util.UUID; - -import org.apache.commons.lang3.StringUtils; -import org.fxmisc.easybind.EasyBind; - import javafx.beans.Observable; import javafx.beans.property.BooleanProperty; import javafx.beans.property.ObjectProperty; @@ -22,7 +12,20 @@ import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; +import org.apache.commons.lang3.StringUtils; +import org.fxmisc.easybind.EasyBind; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.nio.file.Path; +import java.util.Base64; +import java.util.Objects; +import java.util.UUID; + +/** + * The settings specific to a single vault. + * TODO: Change the name of individualMountPath and its derivatives to customMountPath + */ public class VaultSettings { public static final boolean DEFAULT_UNLOCK_AFTER_STARTUP = false; diff --git a/main/commons/src/main/java/org/cryptomator/common/settings/VaultSettingsJsonAdapter.java b/main/commons/src/main/java/org/cryptomator/common/settings/VaultSettingsJsonAdapter.java index 5fb30ef88..866b78bc9 100644 --- a/main/commons/src/main/java/org/cryptomator/common/settings/VaultSettingsJsonAdapter.java +++ b/main/commons/src/main/java/org/cryptomator/common/settings/VaultSettingsJsonAdapter.java @@ -5,14 +5,13 @@ *******************************************************************************/ package org.cryptomator.common.settings; -import java.io.IOException; -import java.nio.file.Paths; - +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.nio.file.Paths; class VaultSettingsJsonAdapter { @@ -27,8 +26,7 @@ class VaultSettingsJsonAdapter { out.name("unlockAfterStartup").value(value.unlockAfterStartup().get()); out.name("revealAfterMount").value(value.revealAfterMount().get()); out.name("usesIndividualMountPath").value(value.usesIndividualMountPath().get()); - //TODO: should this always be written? ( because it could contain metadata, which the user does not want to save!) - out.name("individualMountPath").value(value.individualMountPath().get()); + out.name("individualMountPath").value(value.individualMountPath().get()); //TODO: should this always be written? ( because it could contain metadata, which the user may not want to save!) out.endObject(); } diff --git a/main/ui/src/main/java/org/cryptomator/ui/controllers/UnlockController.java b/main/ui/src/main/java/org/cryptomator/ui/controllers/UnlockController.java index 9584bfc81..6c102d6cc 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/controllers/UnlockController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/controllers/UnlockController.java @@ -8,13 +8,6 @@ ******************************************************************************/ package org.cryptomator.ui.controllers; -import javax.inject.Inject; -import java.util.Arrays; -import java.util.Comparator; -import java.util.Objects; -import java.util.Optional; -import java.util.concurrent.ExecutorService; - import com.google.common.base.CharMatcher; import com.google.common.base.Strings; import javafx.application.Application; @@ -45,9 +38,9 @@ import org.cryptomator.cryptolib.api.InvalidPassphraseException; import org.cryptomator.cryptolib.api.UnsupportedVaultFormatException; import org.cryptomator.frontend.webdav.ServerLifecycleException; import org.cryptomator.keychain.KeychainAccess; -import org.cryptomator.ui.model.InvalidSettingsException; import org.cryptomator.ui.controls.SecPasswordField; import org.cryptomator.ui.l10n.Localization; +import org.cryptomator.ui.model.InvalidSettingsException; import org.cryptomator.ui.model.Vault; import org.cryptomator.ui.model.WindowsDriveLetters; import org.cryptomator.ui.util.DialogBuilderUtil; @@ -57,6 +50,13 @@ import org.fxmisc.easybind.Subscription; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.inject.Inject; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Objects; +import java.util.Optional; +import java.util.concurrent.ExecutorService; + public class UnlockController implements ViewController { private static final Logger LOG = LoggerFactory.getLogger(UnlockController.class); @@ -115,13 +115,13 @@ public class UnlockController implements ViewController { private ChoiceBox winDriveLetter; @FXML - private CheckBox useOwnMountPath; + private CheckBox useCustomMountPath; @FXML - private Label mountPathLabel; + private Label customMountPathLabel; @FXML - private TextField mountPath; + private TextField customMountPathField; @FXML private ProgressIndicator progressIndicator; @@ -150,27 +150,31 @@ public class UnlockController implements ViewController { savePassword.setDisable(!keychainAccess.isPresent()); unlockAfterStartup.disableProperty().bind(savePassword.disabledProperty().or(savePassword.selectedProperty().not())); - mountPathLabel.visibleProperty().bind(useOwnMountPath.selectedProperty()); - mountPath.visibleProperty().bind(useOwnMountPath.selectedProperty()); - mountPath.managedProperty().bind(useOwnMountPath.selectedProperty()); - mountPath.textProperty().addListener(this::mountPathDidChange); + customMountPathLabel.visibleProperty().bind(useCustomMountPath.selectedProperty()); + customMountPathLabel.managedProperty().bind(useCustomMountPath.selectedProperty()); + customMountPathField.visibleProperty().bind(useCustomMountPath.selectedProperty()); + customMountPathField.managedProperty().bind(useCustomMountPath.selectedProperty()); + customMountPathField.textProperty().addListener(this::mountPathDidChange); + winDriveLetter.setConverter(new WinDriveLetterLabelConverter()); - if (SystemUtils.IS_OS_WINDOWS) { - winDriveLetter.setConverter(new WinDriveLetterLabelConverter()); - useOwnMountPath.setVisible(false); - useOwnMountPath.setManaged(false); - mountPathLabel.setManaged(false); - //dirty cheat - mountPath.setMouseTransparent(true); - } else { + if (!SystemUtils.IS_OS_WINDOWS) { winDriveLetterLabel.setVisible(false); winDriveLetterLabel.setManaged(false); winDriveLetter.setVisible(false); winDriveLetter.setManaged(false); - if (VolumeImpl.WEBDAV.equals(settings.preferredVolumeImpl().get())) { - useOwnMountPath.setVisible(false); - useOwnMountPath.setManaged(false); - mountPathLabel.setManaged(false); + } + + if (VolumeImpl.WEBDAV.equals(settings.preferredVolumeImpl().get())) { + useCustomMountPath.setVisible(false); + useCustomMountPath.setManaged(false); + customMountPathField.setMouseTransparent(true); + } else { + useCustomMountPath.setVisible(true); + if (SystemUtils.IS_OS_WINDOWS) { + winDriveLetter.visibleProperty().bind(useCustomMountPath.selectedProperty().not()); + winDriveLetter.managedProperty().bind(useCustomMountPath.selectedProperty().not()); + winDriveLetterLabel.visibleProperty().bind(useCustomMountPath.selectedProperty().not()); + winDriveLetterLabel.managedProperty().bind(useCustomMountPath.selectedProperty().not()); } } } @@ -210,13 +214,11 @@ public class UnlockController implements ViewController { winDriveLetter.getItems().addAll(driveLetters.getAvailableDriveLetters()); winDriveLetter.getItems().sort(new WinDriveLetterComparator()); winDriveLetter.valueProperty().addListener(driveLetterChangeListener); + chooseSelectedDriveLetter(); } downloadsPageLink.setVisible(false); messageText.setText(null); mountName.setText(vault.getMountName()); - if (SystemUtils.IS_OS_WINDOWS) { - chooseSelectedDriveLetter(); - } savePassword.setSelected(false); // auto-fill pw from keychain: if (keychainAccess.isPresent()) { @@ -231,14 +233,15 @@ public class UnlockController implements ViewController { VaultSettings vaultSettings = vault.getVaultSettings(); unlockAfterStartup.setSelected(savePassword.isSelected() && vaultSettings.unlockAfterStartup().get()); revealAfterMount.setSelected(vaultSettings.revealAfterMount().get()); - useOwnMountPath.setSelected(vaultSettings.usesIndividualMountPath().get()); + + if (!settings.preferredVolumeImpl().get().equals(VolumeImpl.WEBDAV)) { + useCustomMountPath.setSelected(vaultSettings.usesIndividualMountPath().get()); + customMountPathField.textProperty().setValue(vaultSettings.individualMountPath().getValueSafe()); + } vaultSubs = vaultSubs.and(EasyBind.subscribe(unlockAfterStartup.selectedProperty(), vaultSettings.unlockAfterStartup()::set)); vaultSubs = vaultSubs.and(EasyBind.subscribe(revealAfterMount.selectedProperty(), vaultSettings.revealAfterMount()::set)); - vaultSubs = vaultSubs.and(EasyBind.subscribe(useOwnMountPath.selectedProperty(), vaultSettings.usesIndividualMountPath()::set)); - - - mountPath.textProperty().setValue(vaultSettings.individualMountPath().getValueSafe()); + vaultSubs = vaultSubs.and(EasyBind.subscribe(useCustomMountPath.selectedProperty(), vaultSettings.usesIndividualMountPath()::set)); } @@ -282,7 +285,7 @@ public class UnlockController implements ViewController { } private void mountPathDidChange(ObservableValue property, String oldValue, String newValue) { - vault.setIndividualMountPath(newValue); + vault.setCustomMountPath(newValue); } /** @@ -389,6 +392,7 @@ public class UnlockController implements ViewController { CharSequence password = passwordField.getCharacters(); Tasks.create(() -> { + messageText.setText(localization.getString("unlock.pendingMessage.unlocking")); vault.unlock(password); if (keychainAccess.isPresent() && savePassword.isSelected()) { keychainAccess.get().storePassphrase(vault.getId(), password); @@ -400,7 +404,7 @@ public class UnlockController implements ViewController { }).onError(InvalidSettingsException.class, e -> { messageText.setText(localization.getString("unlock.errorMessage.invalidMountPath")); advancedOptions.setVisible(true); - mountPath.setStyle("-fx-border-color: red;"); + customMountPathField.setStyle("-fx-border-color: red;"); }).onError(InvalidPassphraseException.class, e -> { messageText.setText(localization.getString("unlock.errorMessage.wrongPassword")); passwordField.selectAll(); @@ -429,7 +433,7 @@ public class UnlockController implements ViewController { advancedOptions.setDisable(false); progressIndicator.setVisible(false); if (advancedOptions.isVisible()) { //dirty programming, but otherwise the focus is wrong - mountPath.requestFocus(); + customMountPathField.requestFocus(); } }).runOnce(executor); } diff --git a/main/ui/src/main/java/org/cryptomator/ui/model/DokanyVolume.java b/main/ui/src/main/java/org/cryptomator/ui/model/DokanyVolume.java index f986b6e3f..26a4b7993 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/model/DokanyVolume.java +++ b/main/ui/src/main/java/org/cryptomator/ui/model/DokanyVolume.java @@ -1,17 +1,17 @@ package org.cryptomator.ui.model; -import javax.inject.Inject; -import java.nio.file.Paths; -import java.util.Set; -import java.util.concurrent.ExecutorService; - -import com.google.common.collect.Sets; +import com.google.common.base.Strings; import org.cryptomator.common.settings.VaultSettings; import org.cryptomator.cryptofs.CryptoFileSystem; import org.cryptomator.frontend.dokany.Mount; import org.cryptomator.frontend.dokany.MountFactory; import org.cryptomator.frontend.dokany.MountFailedException; +import javax.inject.Inject; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.concurrent.ExecutorService; + public class DokanyVolume implements Volume { private static final String FS_TYPE_NAME = "Cryptomator File System"; @@ -34,29 +34,31 @@ public class DokanyVolume implements Volume { return DokanyVolume.isSupportedStatic(); } - //TODO: Drive letter 'A' as mount point is invalid in dokany. maybe we should do already here something against it @Override public void mount(CryptoFileSystem fs) throws VolumeException { - char driveLetter; - if (!vaultSettings.winDriveLetter().getValueSafe().equals("")) { - driveLetter = vaultSettings.winDriveLetter().get().charAt(0); + Path mountPath = Paths.get(getMountPathString()); + String mountName = vaultSettings.mountName().get(); + try { + this.mount = mountFactory.mount(fs.getPath("/"), mountPath, mountName, FS_TYPE_NAME); + } catch (MountFailedException e) { + throw new VolumeException("Unable to mount Filesystem", e); + } + } + + private String getMountPathString() throws VolumeException { + if (vaultSettings.usesIndividualMountPath().get()) { + return vaultSettings.individualMountPath().get(); + } else if (!Strings.isNullOrEmpty(vaultSettings.winDriveLetter().get())) { + return vaultSettings.winDriveLetter().get().charAt(0) + ":\\"; } else { //auto assign drive letter if (!windowsDriveLetters.getAvailableDriveLetters().isEmpty()) { - //this is a temporary fix for 'A' being an invalid drive letter - Set availableLettersWithoutA = Sets.difference(windowsDriveLetters.getAvailableDriveLetters(), Set.of('A')); - driveLetter = availableLettersWithoutA.iterator().next(); -// driveLetter = windowsDriveLetters.getAvailableDriveLetters().iterator().next(); + return windowsDriveLetters.getAvailableDriveLetters().iterator().next() + ":\\"; } else { throw new VolumeException("No free drive letter available."); } } - String mountName = vaultSettings.mountName().get(); - try { - this.mount = mountFactory.mount(fs.getPath("/"), Paths.get(driveLetter + ":\\") , mountName, FS_TYPE_NAME); - } catch (MountFailedException e) { - throw new VolumeException("Unable to mount Filesystem", e); - } + } @Override diff --git a/main/ui/src/main/java/org/cryptomator/ui/model/Vault.java b/main/ui/src/main/java/org/cryptomator/ui/model/Vault.java index cf0e6d7cc..ec1b889b3 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/model/Vault.java +++ b/main/ui/src/main/java/org/cryptomator/ui/model/Vault.java @@ -8,19 +8,6 @@ *******************************************************************************/ package org.cryptomator.ui.model; -import java.io.IOException; -import java.nio.file.FileAlreadyExistsException; -import java.nio.file.Files; -import java.nio.file.NoSuchFileException; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Objects; -import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Predicate; - -import javax.inject.Inject; -import javax.inject.Provider; - import javafx.application.Platform; import javafx.beans.Observable; import javafx.beans.binding.Binding; @@ -42,6 +29,18 @@ import org.fxmisc.easybind.EasyBind; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.inject.Inject; +import javax.inject.Provider; +import java.io.IOException; +import java.nio.file.FileAlreadyExistsException; +import java.nio.file.Files; +import java.nio.file.NoSuchFileException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Predicate; + @PerVault public class Vault { @@ -241,11 +240,11 @@ public class Vault { return vaultSettings.mountName().get(); } - public String getIndividualMountPath() { + public String getCustomMountPath() { return vaultSettings.individualMountPath().getValueSafe(); } - public void setIndividualMountPath(String mountPath) { + public void setCustomMountPath(String mountPath) { vaultSettings.individualMountPath().set(mountPath); } diff --git a/main/ui/src/main/resources/fxml/unlock.fxml b/main/ui/src/main/resources/fxml/unlock.fxml index 5675556a1..0add97f49 100644 --- a/main/ui/src/main/resources/fxml/unlock.fxml +++ b/main/ui/src/main/resources/fxml/unlock.fxml @@ -82,16 +82,17 @@ - - -