X-Git-Url: https://code.grnet.gr/git/pithos/blobdiff_plain/ea517aad393680528aa0a3ebe0eaacf9989caffc..adf2d3e124d1078e53d6e35f32f6023692a2ea68:/src/gr/ebs/gss/client/FileMenu.java diff --git a/src/gr/ebs/gss/client/FileMenu.java b/src/gr/ebs/gss/client/FileMenu.java index 3eb72e9..5a0a467 100644 --- a/src/gr/ebs/gss/client/FileMenu.java +++ b/src/gr/ebs/gss/client/FileMenu.java @@ -118,8 +118,10 @@ public class FileMenu extends PopupPanel implements ClickListener { * @param link a String array with two elements that is modified so that the * first position contains the opening tag and the second one the * closing tag + * @param forceDownload If true, link will be such that browser should ask for filename + * and save location */ - void createDownloadLink(String[] link) { + void createDownloadLink(String[] link, boolean forceDownload) { GSS app = GSS.get(); Object selection = app.getCurrentSelection(); if (selection != null && selection instanceof FileResource) { @@ -127,7 +129,8 @@ public class FileMenu extends PopupPanel implements ClickListener { String dateString = RestCommand.getDate(); String resource = file.getUri().substring(app.getApiPath().length()-1,file.getUri().length()); String sig = app.getCurrentUserResource().getUsername()+" "+RestCommand.calculateSig("GET", dateString, resource, RestCommand.base64decode(app.getToken())); - link[0] = ""; + link[0] = ""; link[1] = ""; } } @@ -148,11 +151,13 @@ public class FileMenu extends PopupPanel implements ClickListener { boolean uploadVisible = GSS.get().getFolders().getCurrent().getUserObject() instanceof FolderResource; boolean propertiesNotVisible = selectedItem != null && (folders.isTrash(selectedItem) || folders.isMyShares(selectedItem) || folders.isOthersShared(selectedItem) || selectedItem.getUserObject() instanceof GroupUserResource); contextMenu.addItem("" + images.folderNew().getHTML() + " New Folder", true, new NewFolderCommand(this, images)); - if (uploadVisible) contextMenu.addItem("" + images.fileUpdate().getHTML() + " Upload", true, new UploadFileCommand(this, images)); + contextMenu.addItem("" + images.fileUpdate().getHTML() + " Upload", true, new UploadFileCommand(this)); if (downloadVisible) { String[] link = {"", ""}; - createDownloadLink(link); + createDownloadLink(link, false); contextMenu.addItem("" + link[0] + images.download().getHTML() + " Download" + link[1] + "", true, downloadCmd); + createDownloadLink(link, true); + contextMenu.addItem("" + link[0] + images.download().getHTML() + " Save As" + link[1] + "", true, downloadCmd); } contextMenu.addItem("" + images.emptyTrash().getHTML() + " Empty Trash", true, new EmptyTrashCommand(this)); contextMenu.addItem("" + images.refresh().getHTML() + " Refresh", true, new RefreshCommand(this, images));