Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(825)

Unified Diff: ui/file_manager/file_manager/foreground/js/dialog_action_controller.js

Issue 831833003: Open folder as OK action when a folder is selected in save-as dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/file_manager/file_manager/foreground/js/ui/dialog_footer.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/dialog_action_controller.js
diff --git a/ui/file_manager/file_manager/foreground/js/dialog_action_controller.js b/ui/file_manager/file_manager/foreground/js/dialog_action_controller.js
index 300a19387abb9a5aaaad39abeb2897874d9bbce3..8f4e136ef3ea687ec758246daad399488dc00575 100644
--- a/ui/file_manager/file_manager/foreground/js/dialog_action_controller.js
+++ b/ui/file_manager/file_manager/foreground/js/dialog_action_controller.js
@@ -128,6 +128,14 @@ function DialogActionController(
* @private
*/
DialogActionController.prototype.processOKActionForSaveDialog_ = function() {
+ var selection = this.fileSelectionHandler_.selection;
+
+ // If OK action is clicked when a directory is selected, open the directory.
+ if (selection.directoryCount === 1 && selection.fileCount === 0) {
+ this.directoryModel_.changeDirectoryEntry(selection.entries[0]);
+ return;
+ }
+
// Save-as doesn't require a valid selection from the list, since
// we're going to take the filename from the text input.
var filename = this.dialogFooter_.filenameInput.value;
@@ -443,9 +451,15 @@ DialogActionController.prototype.updateOkButton_ = function() {
}
if (this.dialogType_ === DialogType.SELECT_SAVEAS_FILE) {
- this.dialogFooter_.okButton.disabled =
- this.directoryModel_.isReadOnly() ||
- !this.dialogFooter_.filenameInput.value;
+ if (selection.directoryCount === 1 && selection.fileCount === 0) {
+ this.dialogFooter_.okButton.textContent = str('OPEN_LABEL');
+ this.dialogFooter_.okButton.disabled = false;
+ } else {
+ this.dialogFooter_.okButton.textContent = str('SAVE_LABEL');
+ this.dialogFooter_.okButton.disabled =
+ this.directoryModel_.isReadOnly() ||
+ !this.dialogFooter_.filenameInput.value;
+ }
return;
}
« no previous file with comments | « no previous file | ui/file_manager/file_manager/foreground/js/ui/dialog_footer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698