adjust choose masterkeyfile dialog

This commit is contained in:
Armin Schrenk 2022-06-27 19:04:14 +02:00
parent bf3a62a6b4
commit ab2d740722
No known key found for this signature in database
GPG Key ID: 8F2992163CBBA7FC
3 changed files with 36 additions and 14 deletions

View File

@ -1,11 +1,13 @@
package org.cryptomator.ui.keyloading.masterkeyfile;
import org.cryptomator.common.vaults.Vault;
import org.cryptomator.ui.common.FxController;
import org.cryptomator.ui.keyloading.KeyLoading;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.inject.Inject;
import javafx.beans.binding.StringBinding;
import javafx.fxml.FXML;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
@ -23,12 +25,14 @@ public class ChooseMasterkeyFileController implements FxController {
private static final Logger LOG = LoggerFactory.getLogger(ChooseMasterkeyFileController.class);
private final Stage window;
private final Vault vault;
private final CompletableFuture<Path> result;
private final ResourceBundle resourceBundle;
@Inject
public ChooseMasterkeyFileController(@KeyLoading Stage window, CompletableFuture<Path> result, ResourceBundle resourceBundle) {
public ChooseMasterkeyFileController(@KeyLoading Stage window, @KeyLoading Vault vault, CompletableFuture<Path> result, ResourceBundle resourceBundle) {
this.window = window;
this.vault = vault;
this.result = result;
this.resourceBundle = resourceBundle;
this.window.setOnHiding(this::windowClosed);
@ -56,4 +60,10 @@ public class ChooseMasterkeyFileController implements FxController {
}
}
//--- Setter & Getter ---
public String getDisplayName(){
return vault.getDisplayName();
}
}

View File

@ -9,28 +9,40 @@
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Circle?>
<VBox xmlns:fx="http://javafx.com/fxml"
<?import javafx.scene.Group?>
<?import javafx.scene.layout.Region?>
<?import org.cryptomator.ui.controls.FormattedLabel?>
<HBox xmlns:fx="http://javafx.com/fxml"
xmlns="http://javafx.com/javafx"
fx:controller="org.cryptomator.ui.keyloading.masterkeyfile.ChooseMasterkeyFileController"
minWidth="400"
maxWidth="400"
minHeight="145"
spacing="12">
spacing="12"
alignment="TOP_LEFT">
<padding>
<Insets topRightBottomLeft="12"/>
</padding>
<children>
<HBox spacing="12" alignment="CENTER_LEFT" VBox.vgrow="ALWAYS">
<StackPane alignment="CENTER" HBox.hgrow="NEVER">
<Group>
<StackPane>
<padding>
<Insets topRightBottomLeft="6"/>
</padding>
<Circle styleClass="glyph-icon-primary" radius="24"/>
<FontAwesome5IconView styleClass="glyph-icon-white" glyph="FILE" glyphSize="24"/>
<FontAwesome5IconView styleClass="glyph-icon-white" glyph="SEARCH" glyphSize="24"/>
</StackPane>
<VBox spacing="6">
<Label text="%unlock.chooseMasterkey.prompt" wrapText="true" HBox.hgrow="ALWAYS"/>
</VBox>
</HBox>
</Group>
<VBox HBox.hgrow="ALWAYS">
<!-- TODO: migrate translations -->
<Label styleClass="label-large" text="%unlock.chooseMasterkey.title" wrapText="true" textAlignment="LEFT">
<padding>
<Insets bottom="6" top="6"/>
</padding>
</Label>
<FormattedLabel format="%unlock.chooseMasterkey.description" arg1="${controller.displayName}" wrapText="true"/>
<VBox alignment="BOTTOM_CENTER" VBox.vgrow="ALWAYS">
<Region VBox.vgrow="ALWAYS" minHeight="18"/>
<ButtonBar buttonMinWidth="120" buttonOrder="+CX">
<buttons>
<Button text="%generic.button.cancel" ButtonBar.buttonData="CANCEL_CLOSE" cancelButton="true" onAction="#cancel"/>
@ -39,4 +51,4 @@
</ButtonBar>
</VBox>
</children>
</VBox>
</HBox>

View File

@ -106,8 +106,8 @@ unlock.passwordPrompt=Enter password for "%s":
unlock.savePassword=Remember Password
unlock.unlockBtn=Unlock
## Select
unlock.chooseMasterkey.title=Select Masterkey of "%s"
unlock.chooseMasterkey.prompt=Could not find the masterkey file for this vault at its expected location. Please choose the key file manually.
unlock.chooseMasterkey.title=Masterkey file not found
unlock.chooseMasterkey.description=Cryptomator could not find the masterkey file for vault "%s". Please choose the key file manually.
unlock.chooseMasterkey.chooseBtn=Choose…
unlock.chooseMasterkey.filePickerTitle=Select Masterkey File
unlock.chooseMasterkey.filePickerMimeDesc=Cryptomator Masterkey