This commit is contained in:
Sebastian Stenzel
2016-03-02 22:41:05 +01:00
parent 890a0c4408
commit 807fdae3b9
5 changed files with 22 additions and 1 deletions

View File

@@ -23,4 +23,7 @@ public interface Frontend extends AutoCloseable {
void reveal() throws CommandFailedException;
// For now let's assume every single frontend knows what a WebDAV url is ;-)
String getWebDavUrl();
}

View File

@@ -62,4 +62,9 @@ class WebDavFrontend implements Frontend {
}
}
@Override
public String getWebDavUrl() {
return uri.toString();
}
}

View File

@@ -39,6 +39,8 @@ import javafx.scene.chart.XYChart.Series;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.Label;
import javafx.scene.control.ToggleButton;
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import javafx.stage.PopupWindow.AnchorLocation;
import javafx.stage.Stage;
import javafx.util.Duration;
@@ -155,6 +157,13 @@ public class UnlockedController extends AbstractFXMLViewController {
});
}
@FXML
private void didClickCopyUrl(ActionEvent event) {
ClipboardContent clipboardContent = new ClipboardContent();
clipboardContent.putUrl(vault.get().getWebDavUrl());
Clipboard.getSystemClipboard().setContent(clipboardContent);
}
// ****************************************
// MAC Auth Warnings
// ****************************************

View File

@@ -176,6 +176,10 @@ public class Vault implements Serializable, CryptoFileSystemDelegate {
// Getter/Setter
// *******************************************************************************/
public String getWebDavUrl() {
return filesystemFrontend.get().map(Frontend::getWebDavUrl).orElseThrow(IllegalStateException::new);
}
public Path getPath() {
return path;
}

View File

@@ -30,7 +30,7 @@
<items>
<MenuItem text="%unlocked.moreOptions.reveal" onAction="#didClickRevealVault"/>
<!-- Future use: -->
<MenuItem text="%unlocked.moreOptions.copyUrl" disable="true"/>
<MenuItem text="%unlocked.moreOptions.copyUrl" onAction="#didClickCopyUrl"/>
</items>
</ContextMenu>
</fx:define>