Explorar el Código

Add migration impossible dialogue

Armin Schrenk hace 5 años
padre
commit
fcdbc7a6cc

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

@@ -13,6 +13,7 @@ public enum FxmlFile {
 	FORGET_PASSWORD("/fxml/forget_password.fxml"), //
 	MAIN_WINDOW("/fxml/main_window.fxml"), //
 	MIGRATION_CAPABILITY_ERROR("/fxml/migration_capability_error.fxml"), //
+	MIGRATION_IMPOSSIBLE("/fxml/migration_impossible.fxml"),
 	MIGRATION_RUN("/fxml/migration_run.fxml"), //
 	MIGRATION_START("/fxml/migration_start.fxml"), //
 	MIGRATION_SUCCESS("/fxml/migration_success.fxml"), //

+ 35 - 0
main/ui/src/main/java/org/cryptomator/ui/migration/MigrationImpossibleController.java

@@ -0,0 +1,35 @@
+package org.cryptomator.ui.migration;
+
+import javafx.fxml.FXML;
+import javafx.stage.Stage;
+import org.cryptomator.common.vaults.Vault;
+import org.cryptomator.ui.common.FxController;
+import org.cryptomator.ui.fxapp.FxApplication;
+
+import javax.inject.Inject;
+
+public class MigrationImpossibleController implements FxController {
+
+	private final FxApplication fxApplication;
+	private final Stage window;
+	private final Vault vault;
+
+	@Inject
+	MigrationImpossibleController(FxApplication fxApplication, @MigrationWindow Stage window, @MigrationWindow Vault vault) {
+		this.fxApplication = fxApplication;
+		this.window = window;
+		this.vault = vault;
+	}
+
+	@FXML
+	public void close() {
+		window.close();
+	}
+
+	/* Getter/Setters */
+
+	public Vault getVault() {
+		return vault;
+	}
+
+}

+ 12 - 1
main/ui/src/main/java/org/cryptomator/ui/migration/MigrationModule.java

@@ -83,6 +83,13 @@ abstract class MigrationModule {
 		return fxmlLoaders.createScene("/fxml/migration_capability_error.fxml");
 	}
 
+	@Provides
+	@FxmlScene(FxmlFile.MIGRATION_IMPOSSIBLE)
+	@MigrationScoped
+	static Scene provideMigrationImpossibleScene(@MigrationWindow FXMLLoaderFactory fxmlLoaders) {
+		return fxmlLoaders.createScene("/fxml/migration_impossible.fxml");
+	}
+
 	// ------------------
 
 	@Binds
@@ -104,5 +111,9 @@ abstract class MigrationModule {
 	@IntoMap
 	@FxControllerKey(MigrationCapabilityErrorController.class)
 	abstract FxController bindMigrationCapabilityErrorController(MigrationCapabilityErrorController controller);
-	
+
+	@Binds
+	@IntoMap
+	@FxControllerKey(MigrationImpossibleController.class)
+	abstract FxController bindMigrationImpossibleController(MigrationImpossibleController controller);
 }

+ 37 - 0
main/ui/src/main/resources/fxml/migration_impossible.fxml

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+
+<?import javafx.scene.control.Button?>
+<?import javafx.scene.control.ButtonBar?>
+<?import javafx.scene.control.Label?>
+<?import javafx.scene.layout.AnchorPane?>
+<?import javafx.scene.layout.HBox?>
+<?import javafx.scene.layout.StackPane?>
+<?import javafx.scene.layout.VBox?>
+<?import javafx.scene.shape.Circle?>
+<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
+
+<AnchorPane xmlns="http://javafx.com/javafx"
+			xmlns:fx="http://javafx.com/fxml"
+			fx:controller="org.cryptomator.ui.migration.MigrationImpossibleController"
+			prefHeight="400.0" prefWidth="600.0">
+
+	<HBox spacing="12" alignment="CENTER_LEFT" VBox.vgrow="ALWAYS">
+		<StackPane alignment="CENTER" HBox.hgrow="NEVER">
+			<Circle styleClass="glyph-icon-primary" radius="24"/>
+			<FontAwesome5IconView styleClass="glyph-icon-white" glyph="TIMES" glyphSize="24"/>
+		</StackPane>
+		<Label text="%migration.impossible.nextStepsInstructions" wrapText="true" HBox.hgrow="ALWAYS"/>
+
+		<!-- TODO: maybe add error why it is not possible -->
+	</HBox>
+
+	<VBox alignment="BOTTOM_CENTER" VBox.vgrow="ALWAYS">
+		<ButtonBar buttonMinWidth="120" buttonOrder="+C">
+			<buttons>
+				<!-- Button text="Try again" ButtonBar.buttonData="to do" onAction="#retry" / also add button to button bar order-->
+				<Button text="%generic.button.close" ButtonBar.buttonData="CANCEL_CLOSE" cancelButton="true" onAction="#close"/>
+			</buttons>
+		</ButtonBar>
+	</VBox>
+</AnchorPane>

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

@@ -118,6 +118,8 @@ migration.error.missingFileSystemCapabilities.reason.LONG_FILENAMES=The file sys
 migration.error.missingFileSystemCapabilities.reason.LONG_PATHS=The file system does not support long paths.
 migration.error.missingFileSystemCapabilities.reason.READ_ACCESS=The file system does not allow to be read.
 migration.error.missingFileSystemCapabilities.reason.WRITE_ACCESS=The file system does not allow to be written to.
+## Impossible
+migration.impossible.nextStepsInstructions=Cryptomator cannot migrate the vault automatically due to TODO. You need to migrate manually. FOr more information, please read TODO.
 
 # Preferences
 preferences.title=Preferences