reveal vault access and storage location from vault detail view

This commit is contained in:
Sebastian Stenzel
2019-08-26 15:22:54 +02:00
parent 7eaf598089
commit b22ddaf13e
2 changed files with 21 additions and 4 deletions

View File

@@ -4,8 +4,11 @@ import javafx.beans.binding.Binding;
import javafx.beans.binding.BooleanBinding;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.ReadOnlyObjectProperty;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.input.MouseEvent;
import org.cryptomator.common.vaults.Vault;
import org.cryptomator.common.vaults.Volume;
import org.cryptomator.ui.changepassword.ChangePasswordComponent;
import org.cryptomator.ui.common.FxController;
import org.cryptomator.ui.common.Tasks;
@@ -85,6 +88,20 @@ public class VaultDetailController implements FxController {
changePasswordWindow.vault(vault.get()).build().showChangePasswordWindow();
}
@FXML
public void revealStorageLocation(ActionEvent actionEvent) {
application.getHostServices().showDocument(vault.get().getPath().toUri().toString());
}
@FXML
public void revealAccessLocation(MouseEvent mouseEvent) {
try {
vault.get().reveal();
} catch (Volume.VolumeException e) {
LOG.error("Failed to reveal vault.", e);
}
}
/* Observable Properties */
public ReadOnlyObjectProperty<Vault> vaultProperty() {
@@ -110,5 +127,4 @@ public class VaultDetailController implements FxController {
public boolean isAnyVaultSelected() {
return anyVaultSelected.get();
}
}

View File

@@ -2,6 +2,7 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Hyperlink?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Tooltip?>
<?import javafx.scene.layout.HBox?>
@@ -44,16 +45,16 @@
<Tooltip text="${controller.vault.displayableName}"/>
</tooltip>
</Label>
<Label styleClass="vault-path" text="${controller.vault.displayablePath}" textOverrun="CENTER_ELLIPSIS">
<Hyperlink styleClass="vault-path" text="${controller.vault.displayablePath}" textOverrun="CENTER_ELLIPSIS" onAction="#revealStorageLocation">
<tooltip>
<Tooltip text="${controller.vault.displayablePath}"/>
</tooltip>
</Label>
</Hyperlink>
</VBox>
</children>
</HBox>
<VBox visible="${controller.vault.unlocked}" managed="${controller.vault.unlocked}">
<HBox styleClass="button-group,first" alignment="CENTER">
<HBox styleClass="button-group,first" alignment="CENTER" onMouseClicked="#revealAccessLocation">
<VBox styleClass="button-group-labels">
<Label styleClass="button-group-heading" text="%vaultDetail.accessLocation"/>
<Label text="${controller.vault.customMountPath}"/>