Fixes #1262 by adding new buttons, if a vault cannot be found

This commit is contained in:
Martin Beyer
2020-07-29 10:21:16 +02:00
parent 0091c401df
commit 3bd2a2f911
4 changed files with 47 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ public enum FontAwesome5Icon {
COGS("\uF085"), //
COPY("\uF0C5"), //
CROWN("\uF521"), //
EDIT("\uF044"), //
EXCLAMATION("\uF12A"), //
EXCLAMATION_CIRCLE("\uF06A"), //
EXCLAMATION_TRIANGLE("\uF071"), //
@@ -37,6 +38,7 @@ public enum FontAwesome5Icon {
SPINNER("\uF110"), //
SYNC("\uF021"), //
TIMES("\uF00D"), //
TRASH("\uF1F8"), //
UNLINK("\uf127"), //
WRENCH("\uF0AD"), //
WINDOW_MINIMIZE("\uF2D1"), //

View File

@@ -1,26 +1,55 @@
package org.cryptomator.ui.mainwindow;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.ReadOnlyObjectProperty;
import javafx.fxml.FXML;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import org.cryptomator.common.vaults.Vault;
import org.cryptomator.common.vaults.VaultListManager;
import org.cryptomator.ui.common.FxController;
import org.cryptomator.ui.removevault.RemoveVaultComponent;
import javax.inject.Inject;
import java.io.File;
import java.util.ResourceBundle;
@MainWindowScoped
public class VaultDetailMissingVaultController implements FxController {
private final ReadOnlyObjectProperty<Vault> vault;
private final ObjectProperty<Vault> vault;
private final RemoveVaultComponent.Builder removeVault;
private final ResourceBundle resourceBundle;
private final Stage window;
@Inject
public VaultDetailMissingVaultController(ObjectProperty<Vault> vault) {
public VaultDetailMissingVaultController(ObjectProperty<Vault> vault, RemoveVaultComponent.Builder removeVault, ResourceBundle resourceBundle, @MainWindow Stage window) {
this.vault = vault;
this.removeVault = removeVault;
this.resourceBundle = resourceBundle;
this.window = window;
}
@FXML
public void recheck() {
VaultListManager.redetermineVaultState(vault.get());
}
@FXML
void didClickRemoveVault() {
removeVault.vault(vault.get()).build().showRemoveVault();
}
@FXML
void changeLocation() {
// copied from ChooseExistingVaultController class
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(resourceBundle.getString("addvaultwizard.existing.filePickerTitle"));
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Cryptomator Masterkey", "*.cryptomator"));
File masterkeyFile = fileChooser.showOpenDialog(window);
if (masterkeyFile != null) {
vault.get().getVaultSettings().path().setValue(masterkeyFile.toPath().toAbsolutePath().getParent());
recheck();
}
}
}

View File

@@ -26,5 +26,16 @@
<FontAwesome5IconView glyph="REDO"/>
</graphic>
</Button>
<Button text="%main.vaultDetail.missing.changeLocation" minWidth="120" onAction="#changeLocation">
<graphic>
<FontAwesome5IconView glyph="EDIT"/>
</graphic>
</Button>
<Button text="%main.vaultDetail.missing.remove" minWidth="120" onAction="#didClickRemoveVault">
<graphic>
<FontAwesome5IconView glyph="TRASH"/>
</graphic>
</Button>
</children>
</VBox>

View File

@@ -194,6 +194,8 @@ main.vaultDetail.throughput.mbps=%.1f MiB/s
### Missing
main.vaultDetail.missing.info=Cryptomator could not find a vault at this path.
main.vaultDetail.missing.recheck=Recheck
main.vaultDetail.missing.remove=Remove from Vault List
main.vaultDetail.missing.changeLocation=Change Vault Location…
### Needs Migration
main.vaultDetail.migrateButton=Upgrade Vault
main.vaultDetail.migratePrompt=Your vault needs to be upgraded to a new format, before you can access it