Sebastian Stenzel il y a 5 ans
Parent
commit
35207de7cc

+ 1 - 0
main/ui/src/main/java/org/cryptomator/ui/common/FxmlFile.java

@@ -12,6 +12,7 @@ public enum FxmlFile {
 	CHANGEPASSWORD("/fxml/changepassword.fxml"), //
 	FORGET_PASSWORD("/fxml/forget_password.fxml"), //
 	MAIN_WINDOW("/fxml/main_window.fxml"), //
+	MIGRATION_CAPABILITY_ERROR("/fxml/migration_capability_error.fxml"), //
 	MIGRATION_GENERIC_ERROR("/fxml/migration_generic_error.fxml"), //
 	MIGRATION_RUN("/fxml/migration_run.fxml"), //
 	MIGRATION_START("/fxml/migration_start.fxml"), //

+ 57 - 0
main/ui/src/main/java/org/cryptomator/ui/migration/MigrationCapabilityErrorController.java

@@ -0,0 +1,57 @@
+package org.cryptomator.ui.migration;
+
+import dagger.Lazy;
+import javafx.beans.binding.Bindings;
+import javafx.beans.binding.StringBinding;
+import javafx.beans.property.ObjectProperty;
+import javafx.beans.property.ReadOnlyObjectProperty;
+import javafx.fxml.FXML;
+import javafx.scene.Scene;
+import javafx.stage.Stage;
+import org.cryptomator.cryptofs.common.FileSystemCapabilityChecker;
+import org.cryptomator.ui.common.FxController;
+import org.cryptomator.ui.common.FxmlFile;
+import org.cryptomator.ui.common.FxmlScene;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.util.ResourceBundle;
+
+@MigrationScoped
+public class MigrationCapabilityErrorController implements FxController {
+
+	private final Stage window;
+	private final ResourceBundle localization;
+	private final Lazy<Scene> startScene;
+	private final StringBinding missingCapabilityDescription;
+	private final ReadOnlyObjectProperty<FileSystemCapabilityChecker.Capability> missingCapability;
+
+	@Inject
+	MigrationCapabilityErrorController(@MigrationWindow Stage window, @Named("capabilityErrorCause") ObjectProperty<FileSystemCapabilityChecker.Capability> missingCapability, ResourceBundle localization, @FxmlScene(FxmlFile.MIGRATION_START) Lazy<Scene> startScene) {
+		this.window = window;
+		this.missingCapability = missingCapability;
+		this.localization = localization;
+		this.startScene = startScene;
+		this.missingCapabilityDescription = Bindings.createStringBinding(this::getMissingCapabilityDescription, missingCapability);
+	}
+
+	@FXML
+	public void back() {
+		window.setScene(startScene.get());
+	}
+
+	/* Getters */
+
+	public StringBinding missingCapabilityDescriptionProperty() {
+		return missingCapabilityDescription;
+	}
+
+	public String getMissingCapabilityDescription() {
+		FileSystemCapabilityChecker.Capability c = missingCapability.get();
+		if (c != null) {
+			return localization.getString("migration.error.missingFileSystemCapabilities.reason." + c.name());
+		} else {
+			return null;
+		}
+	}
+}

+ 21 - 0
main/ui/src/main/java/org/cryptomator/ui/migration/MigrationModule.java

@@ -10,6 +10,7 @@ import javafx.scene.Scene;
 import javafx.scene.image.Image;
 import javafx.stage.Modality;
 import javafx.stage.Stage;
+import org.cryptomator.cryptofs.common.FileSystemCapabilityChecker;
 import org.cryptomator.ui.common.DefaultSceneFactory;
 import org.cryptomator.ui.common.FXMLLoaderFactory;
 import org.cryptomator.ui.common.FxController;
@@ -55,6 +56,13 @@ abstract class MigrationModule {
 		return new SimpleObjectProperty<>();
 	}
 
+	@Provides
+	@Named("capabilityErrorCause")
+	@MigrationScoped
+	static ObjectProperty<FileSystemCapabilityChecker.Capability> provideCapabilityErrorCause() {
+		return new SimpleObjectProperty<>();
+	}
+
 	@Provides
 	@FxmlScene(FxmlFile.MIGRATION_START)
 	@MigrationScoped
@@ -76,6 +84,13 @@ abstract class MigrationModule {
 		return fxmlLoaders.createScene("/fxml/migration_success.fxml");
 	}
 
+	@Provides
+	@FxmlScene(FxmlFile.MIGRATION_CAPABILITY_ERROR)
+	@MigrationScoped
+	static Scene provideMigrationCapabilityErrorScene(@MigrationWindow FXMLLoaderFactory fxmlLoaders) {
+		return fxmlLoaders.createScene("/fxml/migration_capability_error.fxml");
+	}
+
 	@Provides
 	@FxmlScene(FxmlFile.MIGRATION_GENERIC_ERROR)
 	@MigrationScoped
@@ -83,6 +98,7 @@ abstract class MigrationModule {
 		return fxmlLoaders.createScene("/fxml/migration_generic_error.fxml");
 	}
 
+
 	// ------------------
 
 	@Binds
@@ -100,6 +116,11 @@ abstract class MigrationModule {
 	@FxControllerKey(MigrationSuccessController.class)
 	abstract FxController bindMigrationSuccessController(MigrationSuccessController controller);
 
+	@Binds
+	@IntoMap
+	@FxControllerKey(MigrationCapabilityErrorController.class)
+	abstract FxController bindMigrationCapabilityErrorController(MigrationCapabilityErrorController controller);
+
 	@Binds
 	@IntoMap
 	@FxControllerKey(MigrationGenericErrorController.class)

Fichier diff supprimé car celui-ci est trop grand
+ 11 - 15
main/ui/src/main/java/org/cryptomator/ui/migration/MigrationRunController.java


+ 0 - 7
main/ui/src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyCreationController.java

@@ -1,16 +1,10 @@
 package org.cryptomator.ui.recoverykey;
 
 import dagger.Lazy;
-import javafx.animation.KeyFrame;
-import javafx.animation.KeyValue;
-import javafx.animation.Timeline;
-import javafx.beans.property.ReadOnlyStringProperty;
 import javafx.beans.property.StringProperty;
-import javafx.beans.value.WritableValue;
 import javafx.fxml.FXML;
 import javafx.scene.Scene;
 import javafx.stage.Stage;
-import javafx.util.Duration;
 import org.cryptomator.common.vaults.Vault;
 import org.cryptomator.cryptolib.api.InvalidPassphraseException;
 import org.cryptomator.ui.common.Animations;
@@ -22,7 +16,6 @@ import org.cryptomator.ui.controls.NiceSecurePasswordField;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.annotation.Nullable;
 import javax.inject.Inject;
 import java.io.IOException;
 import java.util.concurrent.ExecutorService;

+ 0 - 7
main/ui/src/main/java/org/cryptomator/ui/unlock/UnlockController.java

@@ -1,34 +1,27 @@
 package org.cryptomator.ui.unlock;
 
 import dagger.Lazy;
-import javafx.animation.KeyFrame;
-import javafx.animation.KeyValue;
-import javafx.animation.Timeline;
 import javafx.beans.binding.Bindings;
 import javafx.beans.binding.ObjectBinding;
 import javafx.beans.property.BooleanProperty;
 import javafx.beans.property.ObjectProperty;
 import javafx.beans.property.ReadOnlyBooleanProperty;
 import javafx.beans.property.SimpleBooleanProperty;
-import javafx.beans.value.WritableValue;
 import javafx.concurrent.Task;
 import javafx.fxml.FXML;
 import javafx.scene.Scene;
 import javafx.scene.control.CheckBox;
 import javafx.scene.control.ContentDisplay;
 import javafx.stage.Stage;
-import javafx.util.Duration;
 import org.cryptomator.common.vaults.Vault;
 import org.cryptomator.common.vaults.VaultState;
 import org.cryptomator.cryptolib.api.InvalidPassphraseException;
-import org.cryptomator.cryptolib.api.UnsupportedVaultFormatException;
 import org.cryptomator.keychain.KeychainAccess;
 import org.cryptomator.keychain.KeychainAccessException;
 import org.cryptomator.ui.common.Animations;
 import org.cryptomator.ui.common.FxController;
 import org.cryptomator.ui.common.FxmlFile;
 import org.cryptomator.ui.common.FxmlScene;
-import org.cryptomator.ui.common.Tasks;
 import org.cryptomator.ui.common.VaultService;
 import org.cryptomator.ui.controls.NiceSecurePasswordField;
 import org.cryptomator.ui.forgetPassword.ForgetPasswordComponent;

+ 47 - 0
main/ui/src/main/resources/fxml/migration_capability_error.fxml

@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<?import javafx.geometry.Insets?>
+<?import javafx.scene.control.Button?>
+<?import javafx.scene.control.ButtonBar?>
+<?import javafx.scene.control.Label?>
+<?import javafx.scene.layout.HBox?>
+<?import javafx.scene.layout.Region?>
+<?import javafx.scene.layout.StackPane?>
+<?import javafx.scene.layout.VBox?>
+<?import javafx.scene.shape.Circle?>
+<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
+<VBox xmlns="http://javafx.com/javafx"
+	  xmlns:fx="http://javafx.com/fxml"
+	  fx:controller="org.cryptomator.ui.migration.MigrationCapabilityErrorController"
+	  minWidth="400"
+	  maxWidth="400"
+	  minHeight="145"
+	  spacing="12">
+	<padding>
+		<Insets topRightBottomLeft="12"/>
+	</padding>
+	<children>
+		<HBox spacing="12" VBox.vgrow="ALWAYS">
+			<StackPane alignment="CENTER" HBox.hgrow="NEVER">
+				<Circle styleClass="glyph-icon-primary" radius="24"/>
+				<FontAwesome5IconView styleClass="glyph-icon-white" glyph="EXCLAMATION" glyphSize="24"/>
+			</StackPane>
+			<VBox spacing="6" HBox.hgrow="ALWAYS">
+				<Label text="%migration.error.missingFileSystemCapabilities.title" wrapText="true"/>
+				<Label text="%migration.error.missingFileSystemCapabilities.description" wrapText="true"/>
+				<Label text="${controller.missingCapabilityDescription}" wrapText="true"/>
+			</VBox>
+		</HBox>
+
+		<Region VBox.vgrow="ALWAYS"/>
+
+		<VBox alignment="BOTTOM_CENTER" VBox.vgrow="ALWAYS">
+			<ButtonBar buttonMinWidth="120" buttonOrder="B+U">
+				<buttons>
+					<Button text="%generic.button.back" ButtonBar.buttonData="BACK_PREVIOUS" cancelButton="true" onAction="#back"/>
+					<Region ButtonBar.buttonData="OTHER"/>
+				</buttons>
+			</ButtonBar>
+		</VBox>
+	</children>
+</VBox>

+ 5 - 0
main/ui/src/main/resources/i18n/strings.properties

@@ -104,6 +104,11 @@ migration.run.startMigrationBtn=Migrate Vault
 ## Sucess
 migration.success.nextStepsInstructions=Migrated "%s" successfully.\nYou can now unlock your vault.
 migration.success.unlockNow=Unlock Now
+## Missing file system capabilities
+migration.error.missingFileSystemCapabilities.title=Unsupported File System
+migration.error.missingFileSystemCapabilities.description=Migration was not started, because your vault is located on an inadequate file system.
+migration.error.missingFileSystemCapabilities.reason.LONG_FILENAMES=The file system does not support long file names.
+migration.error.missingFileSystemCapabilities.reason.LONG_PATHS=The file system does not support long paths.
 
 # Preferences
 preferences.title=Preferences