浏览代码

Specified the messages of failed UnlockWorkflows

Specified the messages of failed UnlockWorkflows by adding the ability to distinguish between the different MountPointRequirements

Translation for all languages but German and Englisch required
JaniruTEC 4 年之前
父节点
当前提交
a1b375316c

+ 4 - 0
main/commons/src/main/java/org/cryptomator/common/vaults/Vault.java

@@ -319,6 +319,10 @@ public class Vault {
 		return vaultSettings.getId();
 		return vaultSettings.getId();
 	}
 	}
 
 
+	public MountPointRequirement getMountPointRequirement() {
+		return volume.getMountPointRequirement();
+	}
+
 	// ******************************************************************************
 	// ******************************************************************************
 	// Hashcode / Equals
 	// Hashcode / Equals
 	// *******************************************************************************/
 	// *******************************************************************************/

+ 8 - 0
main/ui/src/main/java/org/cryptomator/ui/unlock/UnlockInvalidMountPointController.java

@@ -4,6 +4,7 @@ import dagger.Lazy;
 import javafx.fxml.FXML;
 import javafx.fxml.FXML;
 import javafx.scene.Scene;
 import javafx.scene.Scene;
 import javafx.stage.Stage;
 import javafx.stage.Stage;
+import org.cryptomator.common.vaults.MountPointRequirement;
 import org.cryptomator.common.vaults.Vault;
 import org.cryptomator.common.vaults.Vault;
 import org.cryptomator.ui.common.FxController;
 import org.cryptomator.ui.common.FxController;
 import org.cryptomator.ui.common.FxmlFile;
 import org.cryptomator.ui.common.FxmlFile;
@@ -36,4 +37,11 @@ public class UnlockInvalidMountPointController implements FxController {
 		return vault.getVaultSettings().getCustomMountPath().orElse("AUTO");
 		return vault.getVaultSettings().getCustomMountPath().orElse("AUTO");
 	}
 	}
 
 
+	public boolean getMustExist() {
+		MountPointRequirement requirement = vault.getMountPointRequirement();
+		assert requirement != MountPointRequirement.NONE; //An invalid MountPoint with no required MountPoint doesn't seem sensible
+
+		return requirement == MountPointRequirement.EMPTY_MOUNT_POINT;
+	}
+
 }
 }

+ 10 - 1
main/ui/src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java

@@ -6,6 +6,7 @@ import javafx.concurrent.Task;
 import javafx.scene.Scene;
 import javafx.scene.Scene;
 import javafx.stage.Stage;
 import javafx.stage.Stage;
 import javafx.stage.Window;
 import javafx.stage.Window;
+import org.cryptomator.common.vaults.MountPointRequirement;
 import org.cryptomator.common.vaults.Vault;
 import org.cryptomator.common.vaults.Vault;
 import org.cryptomator.common.vaults.VaultState;
 import org.cryptomator.common.vaults.VaultState;
 import org.cryptomator.common.vaults.Volume;
 import org.cryptomator.common.vaults.Volume;
@@ -156,7 +157,15 @@ public class UnlockWorkflow extends Task<Boolean> {
 	}
 	}
 
 
 	private void handleInvalidMountPoint(FileSystemException e) {
 	private void handleInvalidMountPoint(FileSystemException e) {
-		LOG.error("Unlock failed. Mount point not an empty directory: {}", e.getMessage());
+		MountPointRequirement requirement = vault.getMountPointRequirement();
+		assert requirement != MountPointRequirement.NONE; //An invalid MountPoint with no required MountPoint doesn't seem sensible
+
+		if (requirement == MountPointRequirement.EMPTY_MOUNT_POINT) {
+			LOG.error("Unlock failed. Mount point not an empty directory or doesn't exist: {}", e.getMessage());
+		} else {
+			LOG.error("Unlock failed. Mount point/folder already exists or parent folder doesn't exist: {}", e.getMessage());
+		}
+
 		Platform.runLater(() -> {
 		Platform.runLater(() -> {
 			window.setScene(invalidMountPointScene.get());
 			window.setScene(invalidMountPointScene.get());
 		});
 		});

+ 2 - 1
main/ui/src/main/resources/fxml/unlock_invalid_mount_point.fxml

@@ -27,7 +27,8 @@
 				<FontAwesome5IconView styleClass="glyph-icon-white" glyph="EXCLAMATION" glyphSize="24"/>
 				<FontAwesome5IconView styleClass="glyph-icon-white" glyph="EXCLAMATION" glyphSize="24"/>
 			</StackPane>
 			</StackPane>
 			<VBox spacing="6" HBox.hgrow="ALWAYS">
 			<VBox spacing="6" HBox.hgrow="ALWAYS">
-				<FormattedLabel format="%unlock.error.invalidMountPoint" arg1="${controller.mountPoint}" wrapText="true"/>
+				<FormattedLabel visible="${controller.mustExist}" managed="${controller.mustExist}" format="%unlock.error.invalidMountPoint.notExisting" arg1="${controller.mountPoint}" wrapText="true"/>
+				<FormattedLabel visible="${!controller.mustExist}" managed="${!controller.mustExist}" format="%unlock.error.invalidMountPoint.existing" arg1="${controller.mountPoint}" wrapText="true"/>
 			</VBox>
 			</VBox>
 		</HBox>
 		</HBox>
 
 

+ 2 - 1
main/ui/src/main/resources/i18n/strings.properties

@@ -100,7 +100,8 @@ unlock.success.message=Unlocked "%s" successfully! Your vault is now accessible.
 unlock.success.rememberChoice=Remember choice, don't show this again
 unlock.success.rememberChoice=Remember choice, don't show this again
 unlock.success.revealBtn=Reveal Vault
 unlock.success.revealBtn=Reveal Vault
 ## Invalid Mount Point
 ## Invalid Mount Point
-unlock.error.invalidMountPoint=Mount point is not an empty directory: %s
+unlock.error.invalidMountPoint.notExisting=Mount point is not an empty directory or doesn't exist: %s
+unlock.error.invalidMountPoint.existing=Mount point/folder already exists or parent folder doesn't exist: %s
 
 
 # Migration
 # Migration
 migration.title=Upgrade Vault
 migration.title=Upgrade Vault

+ 2 - 1
main/ui/src/main/resources/i18n/strings_de.properties

@@ -99,7 +99,8 @@ unlock.success.message=„%s“ erfolgreich entsperrt! Nun kannst du auf deinen
 unlock.success.rememberChoice=Auswahl speichern und nicht mehr anzeigen
 unlock.success.rememberChoice=Auswahl speichern und nicht mehr anzeigen
 unlock.success.revealBtn=Tresor anzeigen
 unlock.success.revealBtn=Tresor anzeigen
 ## Invalid Mount Point
 ## Invalid Mount Point
-unlock.error.invalidMountPoint=Einhängepunkt ist kein leeres Verzeichnis: %s
+unlock.error.invalidMountPoint.notExisting=Einhängepunkt ist kein leeres Verzeichnis oder existiert nicht: %s
+unlock.error.invalidMountPoint.existing=Einhängepunkt/-ordner existiert bereits oder das darüber liegende Verzeichnis existiert nicht: %s
 
 
 # Migration
 # Migration
 migration.title=Tresor aktualisieren
 migration.title=Tresor aktualisieren