Browse Source

restore checkbox and other small ui rearrangements

Jan-Peter Klein 2 months ago
parent
commit
6231c5b8b3

+ 20 - 11
src/main/java/org/cryptomator/ui/addvaultwizard/ChooseExistingVaultController.java

@@ -19,10 +19,13 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.inject.Inject;
+import javafx.beans.property.BooleanProperty;
 import javafx.beans.property.ObjectProperty;
+import javafx.beans.property.SimpleBooleanProperty;
 import javafx.beans.value.ObservableValue;
 import javafx.fxml.FXML;
 import javafx.scene.Scene;
+import javafx.scene.control.CheckBox;
 import javafx.scene.image.Image;
 import javafx.stage.DirectoryChooser;
 import javafx.stage.FileChooser;
@@ -55,6 +58,11 @@ public class ChooseExistingVaultController implements FxController {
 	private final RecoveryKeyComponent.Factory recoveryKeyWindow;
 	private final List<MountService> mountServices;
 
+	@FXML
+	private CheckBox restoreCheckBox;
+
+	private final BooleanProperty restoreButtonVisible = new SimpleBooleanProperty(false);
+
 
 	@Inject
 	ChooseExistingVaultController(@AddVaultWizardWindow Stage window, //
@@ -83,6 +91,9 @@ public class ChooseExistingVaultController implements FxController {
 		this.dialogs = dialogs;
 	}
 
+	public void initialize(){
+		restoreButtonVisible.bind(restoreCheckBox.selectedProperty());
+	}
 	private Image selectScreenshot(Theme theme) {
 		String imageResourcePath;
 		if (SystemUtils.IS_OS_MAC) {
@@ -122,18 +133,9 @@ public class ChooseExistingVaultController implements FxController {
 
 		Optional<Vault> optionalVault = RecoverUtil.prepareVaultFromDirectory(directoryChooser, window, dialogs, vaultComponentFactory, mountServices);
 
+
 		optionalVault.ifPresent(vault -> {
-			dialogs.prepareContactHubAdmin(window) //
-					.setTitleKey("a.title", vault.getVaultSettings().displayName.get() + " " + vault.getState()) //
-					.setDescriptionKey("a.description") //
-					.setMessageKey("a.message") //
-					.setCancelButtonKey("generic.button.cancel") //
-					.setOkButtonKey("generic.button.next") //
-					.setOkAction(stage -> {
-						recoveryKeyWindow.create(vault, window,RecoverUtil.Type.RESTORE_VAULT_CONFIG).showIsHubVaultDialogWindow();
-						stage.close();
-					}) //
-					.build().showAndWait();
+			recoveryKeyWindow.create(vault, window,RecoverUtil.Type.RESTORE_VAULT_CONFIG).showIsHubVaultDialogWindow();
 		});
 	}
 
@@ -147,4 +149,11 @@ public class ChooseExistingVaultController implements FxController {
 		return screenshot.getValue();
 	}
 
+	public boolean isRestoreButtonVisible() {
+		return restoreButtonVisible.get();
+	}
+
+	public BooleanProperty restoreButtonVisibleProperty() {
+		return restoreButtonVisible;
+	}
 }

+ 9 - 6
src/main/resources/fxml/addvault_existing.fxml

@@ -7,26 +7,29 @@
 <?import javafx.scene.image.ImageView?>
 <?import javafx.scene.layout.Region?>
 <?import javafx.scene.layout.VBox?>
+<?import javafx.scene.control.CheckBox?>
 <VBox xmlns:fx="http://javafx.com/fxml"
 	  xmlns="http://javafx.com/javafx"
 	  fx:controller="org.cryptomator.ui.addvaultwizard.ChooseExistingVaultController"
 	  prefWidth="450"
-	  prefHeight="480"
-	  spacing="24"
-	  alignment="CENTER">
+	  prefHeight="480">
 	<padding>
 		<Insets topRightBottomLeft="24"/>
 	</padding>
 	<children>
 		<ImageView VBox.vgrow="ALWAYS" fitWidth="400" preserveRatio="true" smooth="true" image="${controller.screenshot}"/>
 
-		<Label text="%addvaultwizard.existing.instruction" wrapText="true"/>
+		<Label text="%addvaultwizard.existing.instruction" wrapText="true">
+			<padding>
+				<Insets bottom="6" top="6"/>
+			</padding>
+		</Label>
 
+		<CheckBox fx:id="restoreCheckBox" text="%addvaultwizard.existing.instruction.restore" wrapText="true"/>
 		<Region VBox.vgrow="ALWAYS"/>
-
 		<ButtonBar buttonMinWidth="120" buttonOrder="+CX">
 			<buttons>
-				<Button text="%addvaultwizard.existing.restore" ButtonBar.buttonData="NEXT_FORWARD" onAction="#restoreVaultConfigWithRecoveryKey" />
+				<Button text="%addvaultwizard.existing.restore" ButtonBar.buttonData="NEXT_FORWARD" onAction="#restoreVaultConfigWithRecoveryKey" visible="${controller.restoreButtonVisible}" />
 				<Button text="%addvaultwizard.existing.chooseBtn" ButtonBar.buttonData="NEXT_FORWARD" onAction="#chooseFileAndNext" defaultButton="true"/>
 			</buttons>
 		</ButtonBar>

+ 9 - 6
src/main/resources/fxml/recoverykey_is_hub_vault.fxml

@@ -16,7 +16,7 @@
 	  fx:controller="org.cryptomator.ui.recoverykey.RecoveryKeyIsHubVaultController"
 	  minWidth="400"
 	  maxWidth="400"
-	  minHeight="145"
+	  minHeight="204"
 	  spacing="12"
 	  alignment="TOP_CENTER">
 	<padding>
@@ -34,19 +34,22 @@
 		</Group>
 
 		<VBox HBox.hgrow="ALWAYS">
-			<Label styleClass="label-large" text="Hub Vault or not?" wrapText="true">
+			<Label styleClass="label-large" text="%recoveryKey.recover.onBoarding.title" wrapText="true">
+				<padding>
+					<Insets bottom="6" top="6"/>
+				</padding>
+			</Label>
+			<Label text="%recoveryKey.recover.onBoarding.message" wrapText="true"/>
+			<Label text="%recoveryKey.recover.onBoarding.description" wrapText="true">
 				<padding>
 					<Insets bottom="6" top="6"/>
 				</padding>
 			</Label>
-
-			<Label text="If your Vault is an Hub Vault you can restore the vault config .... Otherwise you need the recovery key of the vault to restore the config files." wrapText="true"/>
-
 			<Region VBox.vgrow="ALWAYS" minHeight="18"/>
 			<ButtonBar buttonMinWidth="120" buttonOrder="+C">
 				<buttons>
 					<Button text="%generic.button.close" ButtonBar.buttonData="CANCEL_CLOSE" cancelButton="true" onAction="#close"/>
-					<Button text="Use RecoveryKey" ButtonBar.buttonData="CANCEL_CLOSE" defaultButton="true" onAction="#recover"/>
+					<Button text="%recoveryKey.recover.onBoarding.confirm" ButtonBar.buttonData="CANCEL_CLOSE" defaultButton="true" onAction="#recover"/>
 				</buttons>
 			</ButtonBar>
 		</VBox>

+ 6 - 4
src/main/resources/i18n/strings.properties

@@ -96,6 +96,7 @@ addvault.new.readme.accessLocation.4=Feel free to remove this file.
 ## Existing
 addvaultwizard.existing.title=Add Existing Vault
 addvaultwizard.existing.instruction=Choose the "vault.cryptomator" file of your existing vault. If only a file named "masterkey.cryptomator" exists, select that instead. If your vault.cryptomator lost you can recover it with your RecoveryKey.
+addvaultwizard.existing.instruction.restore=If your vault.cryptomator file went missing you can enable restore mode here.
 addvaultwizard.existing.restore=Restore…
 addvaultwizard.existing.chooseBtn=Choose…
 addvaultwizard.existing.filePickerTitle=Select Vault File
@@ -531,13 +532,14 @@ recoveryKey.noDDirDetected.title=Invalid Selection
 recoveryKey.noDDirDetected.description=The selected folder must contain a subfolder named "d".
 recoveryKey.noDDirDetected.message=Please choose a different folder that includes a subfolder named "d".
 
-a.title=Title %s
-a.description=Description
-a.message=Message
-
 recoveryKey.recoverVaultConfig.title=Recover Vault Config
 recoveryKey.recoverMasterkey.title=Recover Masterkey
 
+recoveryKey.recover.onBoarding.title=Restore your vault.cryptomator file
+recoveryKey.recover.onBoarding.message=If your vault is a hub managed vault, the Hub Admin can restore the file for you.
+recoveryKey.recover.onBoarding.description=Otherwise you will need the Recovery Key of the vault, possible some expert settings, and a new vault password.
+recoveryKey.recover.onBoarding.confirm=Use RecoveryKey
+
 # Convert Vault
 convertVault.title=Convert Vault
 convertVault.convert.convertBtn.before=Convert