mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-23 21:21:31 +00:00
adding back, open and file chooser button.
This commit is contained in:
@@ -1,13 +1,43 @@
|
||||
package org.cryptomator.ui.addvaultwizard;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.stage.FileChooser;
|
||||
import javafx.stage.Stage;
|
||||
import org.cryptomator.ui.common.FXMLLoaderFactory;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@AddVaultWizardScoped
|
||||
public class ChooseExistingVaultController implements FxController {
|
||||
|
||||
@Inject
|
||||
ChooseExistingVaultController() {}
|
||||
private final FXMLLoaderFactory fxmlLoaders;
|
||||
private final Stage window;
|
||||
|
||||
@Inject
|
||||
ChooseExistingVaultController(@AddVaultWizard Stage window, @AddVaultWizard FXMLLoaderFactory fxmlLoaders) {
|
||||
this.window = window;
|
||||
this.fxmlLoaders = fxmlLoaders;
|
||||
}
|
||||
|
||||
public void chooseFile(ActionEvent actionEvent) {
|
||||
FileChooser fileChooser = new FileChooser();
|
||||
fileChooser.setTitle("Open Masterkey File");
|
||||
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Cryptomator Masterkey", "*.cryptomator"));
|
||||
final File file = fileChooser.showOpenDialog(window);
|
||||
if (file != null) {
|
||||
window.setWidth(100);
|
||||
}
|
||||
}
|
||||
|
||||
public void goBack(ActionEvent actionEvent) throws IOException {
|
||||
fxmlLoaders.setScene("/fxml/addvault_welcome.fxml", window);
|
||||
|
||||
}
|
||||
|
||||
public void confirm(ActionEvent actionEvent) {
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<VBox xmlns="http://javafx.com/javafx"
|
||||
@@ -13,6 +14,9 @@
|
||||
<Insets top="12" right="12" bottom="12" left="12"/>
|
||||
</padding>
|
||||
<children>
|
||||
<Label text="TODO existing!"/>
|
||||
<Label text="Open your existing vault by choosing its masterkey file:"/>
|
||||
<Button text="file picker" onAction="#chooseFile"/>
|
||||
<Button text="Back" onAction="#goBack"/>
|
||||
<Button text="Open" onAction="#confirm"/>
|
||||
</children>
|
||||
</VBox>
|
||||
|
||||
Reference in New Issue
Block a user