~exprez135/cryptomator-libre

ce11017609c7c7c9f06da51dabf49e92b4af2dbe — Sebastian Stenzel 1 year, 9 months ago caa8c84
Moved masterkey-related vault options to its own tab
Also made remaining vault recovery labels localizable
M main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/AddVaultModule.java => main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/AddVaultModule.java +2 -2
@@ 193,8 193,8 @@ public abstract class AddVaultModule {
	@Provides
	@IntoMap
	@FxControllerKey(RecoveryKeyDisplayController.class)
	static FxController provideRecoveryKeyDisplayController(@AddVaultWizardWindow Stage window, @Named("vaultName") StringProperty vaultName, @Named("recoveryKey") StringProperty recoveryKey) {
		return new RecoveryKeyDisplayController(window, vaultName.get(), recoveryKey.get());
	static FxController provideRecoveryKeyDisplayController(@AddVaultWizardWindow Stage window, @Named("vaultName") StringProperty vaultName, @Named("recoveryKey") StringProperty recoveryKey, ResourceBundle localization) {
		return new RecoveryKeyDisplayController(window, vaultName.get(), recoveryKey.get(), localization);
	}

	@Binds

M main/ui/src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyDisplayController.java => main/ui/src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyDisplayController.java +10 -2
@@ 4,6 4,7 @@ import javafx.fxml.FXML;
import javafx.print.PageLayout;
import javafx.print.Printer;
import javafx.print.PrinterJob;
import javafx.scene.control.Button;
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import javafx.scene.text.Font;


@@ 16,6 17,8 @@ import org.cryptomator.ui.common.FxController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ResourceBundle;

public class RecoveryKeyDisplayController implements FxController {
	
	private static final Logger LOG = LoggerFactory.getLogger(RecoveryKeyDisplayController.class);


@@ 23,11 26,14 @@ public class RecoveryKeyDisplayController implements FxController {
	private final Stage window;
	private final String vaultName;
	private final String recoveryKey;
	
	public RecoveryKeyDisplayController(Stage window, String vaultName, String recoveryKey) {
	private final ResourceBundle localization;
	public Button copyButton;

	public RecoveryKeyDisplayController(Stage window, String vaultName, String recoveryKey, ResourceBundle localization) {
		this.window = window;
		this.vaultName = vaultName;
		this.recoveryKey = recoveryKey;
		this.localization = localization;
	}

	@FXML


@@ 68,6 74,8 @@ public class RecoveryKeyDisplayController implements FxController {
		clipboardContent.putString(recoveryKey);
		Clipboard.getSystemClipboard().setContent(clipboardContent);
		LOG.info("Recovery key copied to clipboard.");

		copyButton.setText(localization.getString("generic.button.copied"));
	}

	@FXML

M main/ui/src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyModule.java => main/ui/src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyModule.java +2 -2
@@ 106,8 106,8 @@ abstract class RecoveryKeyModule {
	@Provides
	@IntoMap
	@FxControllerKey(RecoveryKeyDisplayController.class)
	static FxController provideRecoveryKeyDisplayController(@RecoveryKeyWindow Stage window, @RecoveryKeyWindow Vault vault, @RecoveryKeyWindow StringProperty recoveryKey) {
		return new RecoveryKeyDisplayController(window, vault.getDisplayableName(), recoveryKey.get());
	static FxController provideRecoveryKeyDisplayController(@RecoveryKeyWindow Stage window, @RecoveryKeyWindow Vault vault, @RecoveryKeyWindow StringProperty recoveryKey, ResourceBundle localization) {
		return new RecoveryKeyDisplayController(window, vault.getDisplayableName(), recoveryKey.get(), localization);
	}

	@Binds

M main/ui/src/main/java/org/cryptomator/ui/vaultoptions/GeneralVaultOptionsController.java => main/ui/src/main/java/org/cryptomator/ui/vaultoptions/GeneralVaultOptionsController.java +2 -26
@@ 2,11 2,8 @@ package org.cryptomator.ui.vaultoptions;

import javafx.fxml.FXML;
import javafx.scene.control.CheckBox;
import javafx.stage.Stage;
import org.cryptomator.common.vaults.Vault;
import org.cryptomator.ui.changepassword.ChangePasswordComponent;
import org.cryptomator.ui.common.FxController;
import org.cryptomator.ui.recoverykey.RecoveryKeyComponent;

import javax.inject.Inject;



@@ 14,36 11,15 @@ import javax.inject.Inject;
public class GeneralVaultOptionsController implements FxController {

	private final Vault vault;
	private final Stage window;
	private final ChangePasswordComponent.Builder changePasswordWindow;
	private final RecoveryKeyComponent.Builder recoveryKeyWindow;
	public CheckBox unlockOnStartupCheckbox;

	@Inject
	GeneralVaultOptionsController(@VaultOptionsWindow Vault vault, @VaultOptionsWindow Stage window, ChangePasswordComponent.Builder changePasswordWindow, RecoveryKeyComponent.Builder recoveryKeyWindow) {
	GeneralVaultOptionsController(@VaultOptionsWindow Vault vault) {
		this.vault = vault;
		this.window = window;
		this.changePasswordWindow = changePasswordWindow;
		this.recoveryKeyWindow = recoveryKeyWindow;
	}
	

	@FXML
	public void initialize() {
		unlockOnStartupCheckbox.selectedProperty().bindBidirectional(vault.getVaultSettings().unlockAfterStartup());
	}

	@FXML
	public void changePassword() {
		changePasswordWindow.vault(vault).owner(window).build().showChangePasswordWindow();
	}

	@FXML
	public void showRecoveryKey() {
		recoveryKeyWindow.vault(vault).owner(window).build().showRecoveryKeyCreationWindow();
	}

	@FXML
	public void showRecoverVaultDialogue(){
		recoveryKeyWindow.vault(vault).owner(window).build().showRecoveryKeyRecoverWindow();
	}
}

A main/ui/src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java => main/ui/src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java +42 -0
@@ 0,0 1,42 @@
package org.cryptomator.ui.vaultoptions;

import javafx.fxml.FXML;
import javafx.stage.Stage;
import org.cryptomator.common.vaults.Vault;
import org.cryptomator.ui.changepassword.ChangePasswordComponent;
import org.cryptomator.ui.common.FxController;
import org.cryptomator.ui.recoverykey.RecoveryKeyComponent;

import javax.inject.Inject;

@VaultOptionsScoped
public class MasterkeyOptionsController implements FxController {

	private final Vault vault;
	private final Stage window;
	private final ChangePasswordComponent.Builder changePasswordWindow;
	private final RecoveryKeyComponent.Builder recoveryKeyWindow;

	@Inject
	MasterkeyOptionsController(@VaultOptionsWindow Vault vault, @VaultOptionsWindow Stage window, ChangePasswordComponent.Builder changePasswordWindow, RecoveryKeyComponent.Builder recoveryKeyWindow) {
		this.vault = vault;
		this.window = window;
		this.changePasswordWindow = changePasswordWindow;
		this.recoveryKeyWindow = recoveryKeyWindow;
	}

	@FXML
	public void changePassword() {
		changePasswordWindow.vault(vault).owner(window).build().showChangePasswordWindow();
	}

	@FXML
	public void showRecoveryKey() {
		recoveryKeyWindow.vault(vault).owner(window).build().showRecoveryKeyCreationWindow();
	}

	@FXML
	public void showRecoverVaultDialogue() {
		recoveryKeyWindow.vault(vault).owner(window).build().showRecoveryKeyRecoverWindow();
	}
}

M main/ui/src/main/java/org/cryptomator/ui/vaultoptions/VaultOptionsModule.java => main/ui/src/main/java/org/cryptomator/ui/vaultoptions/VaultOptionsModule.java +8 -1
@@ 41,7 41,9 @@ abstract class VaultOptionsModule {
	static Stage provideStage(@MainWindow Stage owner, @VaultOptionsWindow Vault vault, ResourceBundle resourceBundle, @Named("windowIcons") List<Image> windowIcons) {
		Stage stage = new Stage();
		stage.setTitle(vault.getDisplayableName());
		stage.setResizable(false);
		stage.setResizable(true);
		stage.setMinWidth(400);
		stage.setMinHeight(300);
		stage.initModality(Modality.WINDOW_MODAL);
		stage.initOwner(owner);
		stage.getIcons().addAll(windowIcons);


@@ 72,4 74,9 @@ abstract class VaultOptionsModule {
	@FxControllerKey(MountOptionsController.class)
	abstract FxController bindMountOptionsController(MountOptionsController controller);

	@Binds
	@IntoMap
	@FxControllerKey(MasterkeyOptionsController.class)
	abstract FxController bindMasterkeyOptionsController(MasterkeyOptionsController controller);

}

M main/ui/src/main/resources/fxml/changepassword.fxml => main/ui/src/main/resources/fxml/changepassword.fxml +0 -4
@@ 4,14 4,10 @@
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ButtonBar?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Region?>
<?import javafx.scene.layout.VBox?>
<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
<?import org.cryptomator.ui.controls.FormattedLabel?>
<?import org.cryptomator.ui.controls.NiceSecurePasswordField?>
<?import org.cryptomator.ui.controls.PasswordStrengthIndicator?>
<VBox xmlns="http://javafx.com/javafx"
	  xmlns:fx="http://javafx.com/fxml"
	  fx:controller="org.cryptomator.ui.changepassword.ChangePasswordController"

M main/ui/src/main/resources/fxml/recoverykey_display.fxml => main/ui/src/main/resources/fxml/recoverykey_display.fxml +1 -1
@@ 26,7 26,7 @@
						<FontAwesome5IconView glyph="PRINT"/>
					</graphic>
				</Button>
				<Button text="%generic.button.copy" ButtonBar.buttonData="RIGHT" onAction="#copyRecoveryKey">
				<Button fx:id="copyButton" text="%generic.button.copy" ButtonBar.buttonData="RIGHT" onAction="#copyRecoveryKey">
					<graphic>
						<FontAwesome5IconView glyph="COPY"/>
					</graphic>

M main/ui/src/main/resources/fxml/recoverykey_recover.fxml => main/ui/src/main/resources/fxml/recoverykey_recover.fxml +2 -2
@@ 21,11 21,11 @@
		<Insets topRightBottomLeft="12"/>
	</padding>
	<children>
		<FormattedLabel format="TODO Enter your recovery key for &quot;%s&quot;:" arg1="${controller.vault.displayableName}" wrapText="true"/>
		<FormattedLabel format="%recoveryKey.recover.prompt" arg1="${controller.vault.displayableName}" wrapText="true"/>

		<TextArea wrapText="true" prefRowCount="4" fx:id="textarea" textFormatter="${controller.recoveryKeyTextFormatter}" onKeyPressed="#onKeyPressed"/>
		
		<Label text="TODO This is a valid recovery key" graphicTextGap="6" contentDisplay="LEFT" visible="${controller.validRecoveryKey}">
		<Label text="%recoveryKey.recover.validKey" graphicTextGap="6" contentDisplay="LEFT" visible="${controller.validRecoveryKey}">
			<graphic>
				<FontAwesome5IconView glyph="CHECK"/>
			</graphic>

M main/ui/src/main/resources/fxml/recoverykey_reset_password.fxml => main/ui/src/main/resources/fxml/recoverykey_reset_password.fxml +1 -1
@@ 25,7 25,7 @@
			<ButtonBar buttonMinWidth="120" buttonOrder="B+I">
				<buttons>
					<Button text="%generic.button.back" ButtonBar.buttonData="BACK_PREVIOUS" cancelButton="true" onAction="#back" />
					<Button text="%generic.button.next" ButtonBar.buttonData="FINISH" defaultButton="true" onAction="#done" disable="${controller.invalidNewPassword}"/>
					<Button text="%generic.button.done" ButtonBar.buttonData="FINISH" defaultButton="true" onAction="#done" disable="${controller.invalidNewPassword}"/>
				</buttons>
			</ButtonBar>
		</VBox>

M main/ui/src/main/resources/fxml/vault_options.fxml => main/ui/src/main/resources/fxml/vault_options.fxml +9 -1
@@ 7,7 7,7 @@
		 xmlns:fx="http://javafx.com/fxml"
		 fx:id="tabPane"
		 fx:controller="org.cryptomator.ui.vaultoptions.VaultOptionsController"
		 minWidth="400"
		 prefWidth="400"
		 tabMinWidth="60"
		 tabClosingPolicy="UNAVAILABLE"
		 tabDragPolicy="FIXED">


@@ 28,5 28,13 @@
				<fx:include source="/fxml/vault_options_mount.fxml"/>
			</content>
		</Tab>
		<Tab fx:id="keyTab" text="%vaultOptions.masterkey">
			<graphic>
				<FontAwesome5IconView glyph="KEY"/>
			</graphic>
			<content>
				<fx:include source="/fxml/vault_options_masterkey.fxml"/>
			</content>
		</Tab>
	</tabs>
</TabPane>

M main/ui/src/main/resources/fxml/vault_options_general.fxml => main/ui/src/main/resources/fxml/vault_options_general.fxml +1 -5
@@ 1,9 1,8 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.layout.VBox?>
<VBox xmlns="http://javafx.com/javafx"
	  xmlns:fx="http://javafx.com/fxml"
	  fx:controller="org.cryptomator.ui.vaultoptions.GeneralVaultOptionsController"


@@ 12,9 11,6 @@
		<Insets topRightBottomLeft="12"/>
	</padding>
	<children>
		<Button text="%vaultOptions.general.changePasswordBtn" onAction="#changePassword"/>
		<Button text="%vaultOptions.general.showRecoveryKeyBtn" onAction="#showRecoveryKey"/>
		<Button text="TODO recoverVault" onAction="#showRecoverVaultDialogue"/>
		<CheckBox text="%vaultOptions.general.unlockAfterStartup" fx:id="unlockOnStartupCheckbox"/>
	</children>
</VBox>

A main/ui/src/main/resources/fxml/vault_options_masterkey.fxml => main/ui/src/main/resources/fxml/vault_options_masterkey.fxml +43 -0
@@ 0,0 1,43 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.layout.VBox?>
<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.Region?>
<VBox xmlns="http://javafx.com/javafx"
	  xmlns:fx="http://javafx.com/fxml"
	  fx:controller="org.cryptomator.ui.vaultoptions.MasterkeyOptionsController"
	  spacing="6"
	  alignment="TOP_CENTER">
	<padding>
		<Insets topRightBottomLeft="12"/>
	</padding>
	<children>
		<Button text="%vaultOptions.general.changePasswordBtn" onAction="#changePassword" contentDisplay="LEFT">
			<graphic>
				<FontAwesome5IconView glyph="KEY"/>
			</graphic>
		</Button>
		
		<Region VBox.vgrow="ALWAYS"/>
		
		<Label maxWidth="-Infinity" text="%vaultOptions.masterkey.recoveryKeyExpanation" wrapText="true"/>
		<HBox spacing="6" alignment="CENTER">
			<Button text="%vaultOptions.general.showRecoveryKeyBtn" onAction="#showRecoveryKey" contentDisplay="LEFT">
				<graphic>
					<FontAwesome5IconView glyph="EYE"/>
				</graphic>
			</Button>
			<Button text="%vaultOptions.masterkey.recoverPasswordBtn" onAction="#showRecoverVaultDialogue" contentDisplay="LEFT">
				<graphic>
					<FontAwesome5IconView glyph="SYNC"/>
				</graphic>
			</Button>
		</HBox>

		<Region VBox.vgrow="ALWAYS"/>
	</children>
</VBox>

M main/ui/src/main/resources/i18n/strings.properties => main/ui/src/main/resources/i18n/strings.properties +10 -3
@@ 8,6 8,7 @@ generic.button.back=Back
generic.button.cancel=Cancel
generic.button.change=Change
generic.button.copy=Copy
generic.button.copied=Copied!
generic.button.done=Done
generic.button.next=Next
generic.button.print=Print


@@ 177,8 178,7 @@ wrongFileAlert.information=You have tried to add a file or folder that does not 
# Vault Options
## General
vaultOptions.general=General
vaultOptions.general.changePasswordBtn=Change Password
vaultOptions.general.showRecoveryKeyBtn=Display Recovery Key
vaultOptions.general.unlockAfterStartup=Unlock vault when starting Cryptomator
## Mount
vaultOptions.mount=Mounting
vaultOptions.mount.readonly=Read-Only


@@ 191,12 191,20 @@ vaultOptions.mount.mountPoint.driveLetter=Use assigned drive letter
vaultOptions.mount.mountPoint.custom=Custom path
vaultOptions.mount.mountPoint.directoryPickerButton=Choose…
vaultOptions.mount.mountPoint.directoryPickerTitle=Pick an empty directory
## Master Key
vaultOptions.masterkey=Password
vaultOptions.general.changePasswordBtn=Change Password
vaultOptions.masterkey.recoveryKeyExpanation=A recovery key is your only means to restore access to a vault, if you loose your password.
vaultOptions.general.showRecoveryKeyBtn=Display Recovery Key
vaultOptions.masterkey.recoverPasswordBtn=Recover Password

# Recovery Key
recoveryKey.title=Recovery Key
recoveryKey.enterPassword.prompt=Enter your password to show the recovery key for "%s":
recoveryKey.display.message=The following recovery key can be used to restore access to "%s":
recoveryKey.display.StorageHints=Keep it somewhere very secure, e.g.:\n • Store it using a password manager\n • Save it on a USB flash drive\n • Print it on paper
recoveryKey.recover.prompt=Enter your recovery key for "%s":
recoveryKey.recover.validKey=This is a valid recovery key

# New Password
newPassword.promptText=Enter a new password


@@ 213,4 221,3 @@ passwordStrength.messageLabel.4=Very strong
# Quit
quit.prompt=Quit application? There are unlocked vaults.
quit.lockAndQuit=Lock and Quit
vaultOptions.general.unlockAfterStartup=Unlock vault when starting Cryptomator