mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-22 04:31:27 +00:00
clean up
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user