This commit is contained in:
Jan-Peter Klein
2025-07-04 22:17:27 +02:00
parent 191d9473c0
commit a9444182bb
10 changed files with 30 additions and 75 deletions

View File

@@ -158,13 +158,9 @@ public class VaultListManager {
}
private void initializeLastKnownKeyLoaderIfPossible(VaultSettings vaultSettings, VaultConfigCache wrapper) throws IOException {
try {
if (vaultSettings.lastKnownKeyLoader.get() == null) {
var keyIdScheme = wrapper.get().getKeyId().getScheme();
vaultSettings.lastKnownKeyLoader.set(keyIdScheme);
}
} catch (NoSuchFileException e) {
LOG.warn("Vault config file not found.");
if (vaultSettings.lastKnownKeyLoader.get() == null) {
var keyIdScheme = wrapper.get().getKeyId().getScheme();
vaultSettings.lastKnownKeyLoader.set(keyIdScheme);
}
}

View File

@@ -28,7 +28,7 @@ import static org.cryptomator.common.vaults.VaultState.Value.*;
@FxApplicationScoped
public class FxApplicationTerminator {
private static final Set<VaultState.Value> STATES_ALLOWING_TERMINATION = EnumSet.of(LOCKED, NEEDS_MIGRATION, MISSING, ERROR);
private static final Set<VaultState.Value> STATES_ALLOWING_TERMINATION = EnumSet.of(LOCKED, NEEDS_MIGRATION, MISSING, ERROR, VAULT_CONFIG_MISSING, ALL_MISSING);
private static final Set<VaultState.Value> STATES_PREVENT_TERMINATION = EnumSet.of(PROCESSING);
private static final Logger LOG = LoggerFactory.getLogger(FxApplicationTerminator.class);

View File

@@ -34,8 +34,10 @@ public class ChooseMasterkeyFileController implements FxController {
private final RecoveryKeyComponent.Factory recoveryKeyWindow;
private final ResourceBundle resourceBundle;
@FXML private CheckBox restoreInsteadCheckBox;
@FXML private Button chooseButton;
@FXML
private CheckBox restoreInsteadCheckBox;
@FXML
private Button forwardButton;
@Inject
public ChooseMasterkeyFileController(@KeyLoading Stage window, //
@@ -55,11 +57,11 @@ public class ChooseMasterkeyFileController implements FxController {
private void initialize() {
restoreInsteadCheckBox.selectedProperty().addListener((_, _, newVal) -> {
if (newVal) {
chooseButton.setText(resourceBundle.getString("addvaultwizard.existing.restore"));
chooseButton.setOnAction(_ -> restoreMasterkey());
forwardButton.setText(resourceBundle.getString("addvaultwizard.existing.restore"));
forwardButton.setOnAction(_ -> restoreMasterkey());
} else {
chooseButton.setText(resourceBundle.getString("generic.button.choose"));
chooseButton.setOnAction(_ -> proceed());
forwardButton.setText(resourceBundle.getString("generic.button.choose"));
forwardButton.setOnAction(_ -> proceed());
}
});
}
@@ -94,7 +96,7 @@ public class ChooseMasterkeyFileController implements FxController {
//--- Setter & Getter ---
public String getDisplayName(){
public String getDisplayName() {
return vault.getDisplayName();
}

View File

@@ -60,10 +60,12 @@ import java.util.stream.Collectors;
import static org.cryptomator.common.Constants.CRYPTOMATOR_FILENAME_EXT;
import static org.cryptomator.common.Constants.MASTERKEY_FILENAME;
import static org.cryptomator.common.Constants.VAULTCONFIG_FILENAME;
import static org.cryptomator.common.vaults.VaultState.Value.ALL_MISSING;
import static org.cryptomator.common.vaults.VaultState.Value.ERROR;
import static org.cryptomator.common.vaults.VaultState.Value.LOCKED;
import static org.cryptomator.common.vaults.VaultState.Value.MISSING;
import static org.cryptomator.common.vaults.VaultState.Value.NEEDS_MIGRATION;
import static org.cryptomator.common.vaults.VaultState.Value.VAULT_CONFIG_MISSING;
@MainWindowScoped
public class VaultListController implements FxController {
@@ -305,7 +307,7 @@ public class VaultListController implements FxController {
private void pressedShortcutToRemoveVault() {
final var vault = selectedVault.get();
if (vault != null && EnumSet.of(LOCKED, MISSING, ERROR, NEEDS_MIGRATION).contains(vault.getState())) {
if (vault != null && EnumSet.of(LOCKED, MISSING, ERROR, NEEDS_MIGRATION, ALL_MISSING, VAULT_CONFIG_MISSING).contains(vault.getState())) {
dialogs.prepareRemoveVaultDialog(mainWindow, vault, vaults).build().showAndWait();
}
}

View File

@@ -132,10 +132,11 @@ public class RecoveryKeyOnboardingController implements FxController {
window.setScene(recoverykeyExpertSettingsScene.get());
} else {
window.setScene(recoverykeyRecoverScene.get());
window.centerOnScreen();
}
}
case RESTORE_MASTERKEY -> window.setScene(recoverykeyRecoverScene.get());
}
window.centerOnScreen();
}
}

View File

@@ -13,6 +13,7 @@ import javafx.fxml.FXML;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
import java.util.Objects;
import java.util.ResourceBundle;
@RecoveryKeyScoped
@@ -67,17 +68,20 @@ public class RecoveryKeyRecoverController implements FxController {
@FXML
public void initialize() {
switch (recoverType.get()) {
case RESTORE_ALL, RESTORE_VAULT_CONFIG -> cancelButton.setText(resourceBundle.getString("generic.button.back"));
case RESET_PASSWORD -> cancelButton.setText(resourceBundle.getString("generic.button.cancel"));
if (Objects.requireNonNull(recoverType.get()) == RecoveryActionType.RESET_PASSWORD) {
cancelButton.setText(resourceBundle.getString("generic.button.cancel"));
} else {
cancelButton.setText(resourceBundle.getString("generic.button.back"));
}
}
@FXML
public void close() {
switch (recoverType.get()) {
case RESTORE_ALL, RESTORE_VAULT_CONFIG -> window.setScene(onBoardingScene.get());
case RESET_PASSWORD -> window.close();
if (Objects.requireNonNull(recoverType.get()) == RecoveryActionType.RESET_PASSWORD) {
window.close();
} else {
window.setScene(onBoardingScene.get());
window.centerOnScreen();
}
}

View File

@@ -25,7 +25,7 @@
<VBox alignment="BOTTOM_CENTER" VBox.vgrow="ALWAYS">
<ButtonBar buttonMinWidth="120" buttonOrder="+BX">
<buttons>
<Button fx:id="cancelButton" text="%generic.button.back" ButtonBar.buttonData="BACK_PREVIOUS" cancelButton="true" onAction="#close"/>
<Button fx:id="cancelButton" ButtonBar.buttonData="BACK_PREVIOUS" cancelButton="true" onAction="#close"/>
<Button text="%generic.button.next" ButtonBar.buttonData="NEXT_FORWARD" defaultButton="true" onAction="#recover" disable="${!controller.validateController.recoveryKeyCorrect}"/>
</buttons>
</ButtonBar>

View File

@@ -47,7 +47,7 @@
<ButtonBar buttonMinWidth="120" buttonOrder="+CX">
<buttons>
<Button text="%generic.button.cancel" ButtonBar.buttonData="CANCEL_CLOSE" cancelButton="true" onAction="#cancel"/>
<Button fx:id="chooseButton" text="%generic.button.choose" ButtonBar.buttonData="NEXT_FORWARD" defaultButton="true" onAction="#proceed"/>
<Button fx:id="forwardButton" text="%generic.button.choose" ButtonBar.buttonData="NEXT_FORWARD" defaultButton="true" onAction="#proceed"/>
</buttons>
</ButtonBar>
</VBox>

View File

@@ -1,49 +0,0 @@
<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Circle?>
<VBox xmlns:fx="http://javafx.com/fxml"
xmlns="http://javafx.com/javafx"
fx:controller="org.cryptomator.ui.mainwindow.VaultDetailMissingVaultController"
alignment="TOP_CENTER"
spacing="9">
<children>
<VBox spacing="9" alignment="CENTER">
<StackPane alignment="CENTER">
<Circle styleClass="glyph-icon-primary" radius="48"/>
<FontAwesome5IconView styleClass="glyph-icon-white" glyph="FILE" glyphSize="48"/>
<FontAwesome5IconView styleClass="glyph-icon-primary" glyph="SEARCH" glyphSize="24">
<StackPane.margin>
<Insets top="12"/>
</StackPane.margin>
</FontAwesome5IconView>
</StackPane>
<Label text="%main.vaultDetail.missingMasterkey.info" wrapText="true"/>
</VBox>
<VBox spacing="6" alignment="CENTER">
<Button text="%main.vaultDetail.missing.recheck" minWidth="120" onAction="#recheck">
<graphic>
<FontAwesome5IconView glyph="REDO"/>
</graphic>
</Button>
<Button text="Select Masterkey" minWidth="120" onAction="#unlock">
<graphic>
<FontAwesome5IconView glyph="MAGIC"/>
</graphic>
</Button>
<Button text="%main.vaultDetail.missingMasterkey.restore" minWidth="120" onAction="#restoreMasterkey">
<graphic>
<FontAwesome5IconView glyph="MAGIC"/>
</graphic>
</Button>
<Button text="%main.vaultDetail.missing.remove" minWidth="120" onAction="#didClickRemoveVault">
<graphic>
<FontAwesome5IconView glyph="TRASH"/>
</graphic>
</Button>
</VBox>
</children>
</VBox>

View File

@@ -581,7 +581,6 @@ passwordStrength.messageLabel.1=Weak
passwordStrength.messageLabel.2=Fair
passwordStrength.messageLabel.3=Strong
passwordStrength.messageLabel.4=Very strong
password.promptText=Enter password
# Quit
quit.title=Quit Application