mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-04-19 00:56:52 -04:00
allow adding *.cryptomator files to vault list
This commit is contained in:
@@ -134,16 +134,27 @@ public class MainController implements Initializable, InitializationListener, Un
|
||||
/**
|
||||
* adds the given directory or selects it if it is already in the list of directories.
|
||||
*
|
||||
* @param dir non-null, writable, existing directory
|
||||
* @param path non-null, writable, existing directory
|
||||
*/
|
||||
void addVault(final Path dir, boolean select) {
|
||||
if (dir != null && Files.isWritable(dir)) {
|
||||
final Vault vault = new Vault(dir);
|
||||
if (!directoryList.getItems().contains(vault)) {
|
||||
directoryList.getItems().add(vault);
|
||||
}
|
||||
directoryList.getSelectionModel().select(vault);
|
||||
void addVault(final Path path, boolean select) {
|
||||
if (path == null || !Files.isWritable(path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Path vaultPath;
|
||||
if (path != null && Files.isDirectory(path)) {
|
||||
vaultPath = path;
|
||||
} else if (Files.isRegularFile(path) && path.getParent().getFileName().toString().endsWith(Vault.VAULT_FILE_EXTENSION)) {
|
||||
vaultPath = path.getParent();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
final Vault vault = new Vault(vaultPath);
|
||||
if (!directoryList.getItems().contains(vault)) {
|
||||
directoryList.getItems().add(vault);
|
||||
}
|
||||
directoryList.getSelectionModel().select(vault);
|
||||
}
|
||||
|
||||
private ListCell<Vault> createDirecoryListCell(ListView<Vault> param) {
|
||||
|
||||
@@ -43,10 +43,7 @@
|
||||
|
||||
<!-- Row 3 -->
|
||||
<Button fx:id="okButton" defaultButton="true" GridPane.rowIndex="3" GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.halignment="RIGHT" text="%initialize.button.ok" prefWidth="150.0" onAction="#initializeVault" focusTraversable="false" disable="true" />
|
||||
|
||||
<!-- Row 4 -->
|
||||
<ProgressIndicator progress="-1" fx:id="progressIndicator" GridPane.rowIndex="4" GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.halignment="CENTER" visible="false"/>
|
||||
|
||||
|
||||
<!-- Row 5 -->
|
||||
<Label fx:id="messageLabel" GridPane.rowIndex="5" GridPane.columnIndex="0" GridPane.columnSpan="2" />
|
||||
</children>
|
||||
|
||||
Reference in New Issue
Block a user