Index: ui/file_manager/file_manager/foreground/js/main_window_component.js |
diff --git a/ui/file_manager/file_manager/foreground/js/main_window_component.js b/ui/file_manager/file_manager/foreground/js/main_window_component.js |
index c96af6af926afbd063a796e5712e80812243618b..c861a10e3ea8811fc418aaf21fc11b2280e77536 100644 |
--- a/ui/file_manager/file_manager/foreground/js/main_window_component.js |
+++ b/ui/file_manager/file_manager/foreground/js/main_window_component.js |
@@ -188,11 +188,35 @@ MainWindowComponent.prototype.onDetailClick_ = function(event) { |
this.directoryModel_.changeDirectoryEntry( |
/** @type {!DirectoryEntry} */ (entry)); |
} else { |
- this.taskController_.executeSelectionTask(); |
+ this.acceptSelection_(); |
} |
}; |
/** |
+ * Accepts the current selection depending on the mode. |
+ * @private |
+ */ |
+MainWindowComponent.prototype.acceptSelection_ = function() { |
+ var selection = this.selectionHandler_.selection; |
+ if (this.dialogType_ == DialogType.FULL_PAGE) { |
+ this.taskController_.getFileTasks() |
+ .then(function(tasks) { |
+ tasks.executeDefault(); |
+ }) |
+ .catch(function(error) { |
+ if (error) |
+ console.error(error.stack || error); |
+ }); |
+ return true; |
+ } |
+ if (!this.ui_.dialogFooter.okButton.disabled) { |
+ this.ui_.dialogFooter.okButton.click(); |
+ return true; |
+ } |
+ return false; |
+} |
+ |
+/** |
* Handles click event on the toggle-view button. |
* @param {Event} event Click event. |
* @private |
@@ -282,7 +306,7 @@ MainWindowComponent.prototype.onListKeyDown_ = function(event) { |
this.directoryModel_.changeDirectoryEntry( |
/** @type {!DirectoryEntry} */ (selection.entries[0])); |
} |
- } else if (this.taskController_.executeSelectionTask()) { |
+ } else if (this.acceptSelection_()) { |
event.preventDefault(); |
} |
break; |