Skip to content

Commit

Permalink
Use default download folder as default location for open panel.
Browse files Browse the repository at this point in the history
Former-commit-id: 504b467791c70220892e783fa56ca755370896a5
  • Loading branch information
dkocher committed Nov 18, 2013
1 parent cc2a25a commit 6dac4b3
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions source/ch/cyberduck/ui/cocoa/BrowserController.java
Expand Up @@ -35,7 +35,6 @@
import ch.cyberduck.core.local.ApplicationFinder;
import ch.cyberduck.core.local.ApplicationFinderFactory;
import ch.cyberduck.core.local.BrowserLauncherFactory;
import ch.cyberduck.core.local.FinderLocal;
import ch.cyberduck.core.local.TemporaryFileServiceFactory;
import ch.cyberduck.core.sftp.SFTPSession;
import ch.cyberduck.core.ssl.SSLSession;
Expand Down Expand Up @@ -2626,9 +2625,6 @@ public void deleteFileButtonClicked(final ID sender) {
this.deletePaths(this.getSelectedPaths());
}

private static String lastSelectedDownloadDirectory =
Preferences.instance().getProperty("queue.download.folder");

private NSOpenPanel downloadToPanel;

@Action
Expand All @@ -2640,7 +2636,7 @@ public void downloadToButtonClicked(final ID sender) {
downloadToPanel.setAllowsMultipleSelection(false);
downloadToPanel.setPrompt(LocaleFactory.localizedString("Choose"));
downloadToPanel.beginSheetForDirectory(
lastSelectedDownloadDirectory, //trying to be smart
session.getHost().getDownloadFolder().getAbsolute(),
null, this.window, this.id(),
Foundation.selector("downloadToPanelDidEnd:returnCode:contextInfo:"),
null);
Expand All @@ -2658,7 +2654,6 @@ public void downloadToPanelDidEnd_returnCode_contextInfo(final NSOpenPanel sheet
this.transfer(new DownloadTransfer(session.getHost(), selected), Collections.<Path>emptyList());
}
}
lastSelectedDownloadDirectory = sheet.filename();
downloadToPanel = null;
}

Expand All @@ -2671,7 +2666,8 @@ public void downloadAsButtonClicked(final ID sender) {
downloadAsPanel.setNameFieldLabel(LocaleFactory.localizedString("Download As:"));
downloadAsPanel.setPrompt(LocaleFactory.localizedString("Download"));
downloadAsPanel.setCanCreateDirectories(true);
downloadAsPanel.beginSheetForDirectory(null, this.getSelectedPath().getName(), this.window, this.id(),
downloadAsPanel.beginSheetForDirectory(session.getHost().getDownloadFolder().getAbsolute(),
this.getSelectedPath().getName(), this.window, this.id(),
Foundation.selector("downloadAsPanelDidEnd:returnCode:contextInfo:"),
null);
}
Expand Down Expand Up @@ -2709,7 +2705,8 @@ public void syncButtonClicked(final ID sender) {
syncPanel.setMessage(MessageFormat.format(LocaleFactory.localizedString("Synchronize {0} with"),
selection.getName()));
syncPanel.setPrompt(LocaleFactory.localizedString("Choose"));
syncPanel.beginSheetForDirectory(session.getHost().getDownloadFolder().getAbsolute(), null, this.window, this.id(),
syncPanel.beginSheetForDirectory(session.getHost().getDownloadFolder().getAbsolute(),
null, this.window, this.id(),
Foundation.selector("syncPanelDidEnd:returnCode:contextInfo:"), null //context info
);
}
Expand Down Expand Up @@ -2740,8 +2737,6 @@ public void downloadButtonClicked(final ID sender) {
this.transfer(new DownloadTransfer(session.getHost(), selected), Collections.<Path>emptyList());
}

private static Local lastSelectedUploadDirectory = null;

private NSOpenPanel uploadPanel;

private NSButton uploadPanelHiddenFilesCheckbox;
Expand All @@ -2765,7 +2760,7 @@ public void uploadButtonClicked(final ID sender) {
uploadPanelHiddenFilesCheckbox.sizeToFit();
uploadPanel.setAccessoryView(uploadPanelHiddenFilesCheckbox);
}
uploadPanel.beginSheetForDirectory(lastSelectedUploadDirectory.getAbsolute(), //trying to be smart
uploadPanel.beginSheetForDirectory(session.getHost().getDownloadFolder().getAbsolute(),
null, this.window,
this.id(),
Foundation.selector("uploadPanelDidEnd:returnCode:contextInfo:"),
Expand Down Expand Up @@ -2796,7 +2791,6 @@ else if(!destination.attributes().isDirectory()) {
}
transfer(new UploadTransfer(session.getHost(), roots));
}
lastSelectedUploadDirectory = new FinderLocal(sheet.filename()).getParent();
uploadPanel = null;
uploadPanelHiddenFilesCheckbox = null;
}
Expand Down

0 comments on commit 6dac4b3

Please sign in to comment.