Commit 3e538da7 authored by harukam's avatar harukam Committed by Commit bot

Add 'Get Info' to contextual menu to display QuickView.

BUG=474318
TEST=manuallry tested

Review-Url: https://codereview.chromium.org/2347063003
Cr-Commit-Position: refs/heads/master@{#419157}
parent fef37c43
......@@ -451,6 +451,9 @@ Press any key to continue exploring.
<message name="IDS_FILE_BROWSER_ERROR_RENAMING" desc="Error message.">
Unable to rename "<ph name="FILE_NAME">$1<ex>document.pdf</ex></ph>". <ph name="ERROR_MESSAGE">$2<ex>An error occurred (code: ABORT)</ex></ph>
</message>
<message name="IDS_FILE_BROWSER_GET_INFO_BUTTON_LABEL" desc="Label for a context menu item which shows file's metadata.">
Get Info
</message>
<message name="IDS_FILE_BROWSER_RENAME_BUTTON_LABEL" desc="Button Label.">
Rename
</message>
......
......@@ -473,6 +473,7 @@ ExtensionFunction::ResponseAction FileManagerPrivateGetStringsFunction::Run() {
SET_STRING("SORT_BUTTON_TOOLTIP", IDS_FILE_BROWSER_SORT_BUTTON_TOOLTIP);
SET_STRING("DETAIL_BUTTON_TOOLTIP", IDS_FILE_BROWSER_DETAIL_BUTTON_TOOLTIP);
SET_STRING("GEAR_BUTTON_TOOLTIP", IDS_FILE_BROWSER_GEAR_BUTTON_TOOLTIP);
SET_STRING("GET_INFO_BUTTON_LABEL", IDS_FILE_BROWSER_GET_INFO_BUTTON_LABEL);
SET_STRING("HOSTED_OFFLINE_MESSAGE", IDS_FILE_BROWSER_HOSTED_OFFLINE_MESSAGE);
SET_STRING("HOSTED_OFFLINE_MESSAGE_PLURAL",
IDS_FILE_BROWSER_HOSTED_OFFLINE_MESSAGE_PLURAL);
......
......@@ -1057,6 +1057,36 @@ CommandHandler.COMMANDS_['open-with'] = /** @type {Command} */ ({
}
});
/**
* Displays QuickView for current selection.
* @type {Command}
*/
CommandHandler.COMMANDS_['get-info'] = /** @type {Command} */ ({
/**
* @param {!Event} event Command event.
* @param {!FileManager} fileManager fileManager to use.
*/
execute: function(event, fileManager) {
// 'get-info' command is executed by 'command' event handler in
// QuickViewController.
},
/**
* @param {!Event} event Command event.
* @param {!FileManager} fileManager FileManager to use.
*/
canExecute: function(event, fileManager) {
var entries = CommandUtil.getCommandEntries(event.target);
if (entries.length === 0) {
event.canExecute = false;
event.command.setHidden(true);
return;
}
event.canExecute = entries.length === 1;
event.command.setHidden(false);
}
});
/**
* Focuses search input box.
* @type {Command}
......
......@@ -74,6 +74,10 @@ function QuickViewController(
this.onFileSelectionChanged_.bind(this));
listContainer.element.addEventListener(
'keydown', this.onKeyDownToOpen_.bind(this));
listContainer.element.addEventListener('command', function(event) {
if(event.command.id === 'get-info')
this.display_();
}.bind(this));
quickView.addEventListener('keydown', this.onQuickViewKeyDown_.bind(this));
quickView.addEventListener('iron-overlay-closed', function() {
this.listContainer_.focus();
......
......@@ -75,6 +75,8 @@
shortcut="v|Ctrl">
<command id="paste-into-folder"
i18n-values="label:PASTE_INTO_FOLDER_BUTTON_LABEL">
<command id="get-info" i18n-values="label:GET_INFO_BUTTON_LABEL"
shortcut="Space">
<command id="rename" i18n-values="label:RENAME_BUTTON_LABEL"
shortcut="Enter|Ctrl">
<command id="delete" shortcut="Backspace|Alt Delete">
......@@ -165,6 +167,7 @@
<cr-menu-item command="#paste" visibleif="full-page"></cr-menu-item>
<cr-menu-item command="#paste-into-folder" visibleif="full-page"></cr-menu-item>
<hr visibleif="full-page">
<cr-menu-item command="#get-info"></cr-menu-item>
<cr-menu-item command="#rename"></cr-menu-item>
<cr-menu-item command="#delete" i18n-content="DELETE_BUTTON_LABEL"></cr-menu-item>
<cr-menu-item command="#zip-selection"></cr-menu-item>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment