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

Side by Side Diff: ui/file_manager/file_manager/foreground/js/file_manager_commands.js

Issue 1725563004: Files: Add a shortcut Alt-E to open gear menu. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/file_manager/file_manager/main.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * Sets 'hidden' property of a cr.ui.Command instance and dispatches 6 * Sets 'hidden' property of a cr.ui.Command instance and dispatches
7 * 'hiddenChange' event manually so that associated cr.ui.MenuItem can handle 7 * 'hiddenChange' event manually so that associated cr.ui.MenuItem can handle
8 * the event. 8 * the event.
9 * TODO(fukino): Remove this workaround when crbug.com/481941 is fixed. 9 * TODO(fukino): Remove this workaround when crbug.com/481941 is fixed.
10 * 10 *
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 fileManager.providersModel.requestMount(assert(itemId)); 1456 fileManager.providersModel.requestMount(assert(itemId));
1457 }); 1457 });
1458 }, 1458 },
1459 canExecute: function(event, fileManager) { 1459 canExecute: function(event, fileManager) {
1460 event.canExecute = fileManager.dialogType === DialogType.FULL_PAGE; 1460 event.canExecute = fileManager.dialogType === DialogType.FULL_PAGE;
1461 event.command.setHidden(!event.canExecute); 1461 event.command.setHidden(!event.canExecute);
1462 } 1462 }
1463 }); 1463 });
1464 1464
1465 /** 1465 /**
1466 * Opens the gear menu on Alt-E.
1467 * @type {Command}
1468 */
1469 CommandHandler.COMMANDS_['open-gear-menu'] = /** @type {Command} */ ({
1470 /**
1471 * @param {!Event} event Command event.
1472 * @param {!FileManager} fileManager FileManager to use.
1473 */
1474 execute: function(event, fileManager) {
1475 fileManager.ui.gearButton.showMenu(true);
1476 },
1477 /**
1478 * @param {!Event} event Command event.
1479 * @param {!FileManager} fileManager FileManager to use.
1480 */
1481 canExecute: function(event, fileManager) {
hirono 2016/02/23 08:41:11 nit: Maybe CommandUtil.canExecuteAlways is enough?
fukino 2016/02/23 08:50:33 Yes, canExecuteAlways works here. Thank you for po
1482 event.canExecute = !fileManager.ui.gearButton.isMenuShown();
1483 }
1484 });
1485
1486 /**
1466 * Configures the currently selected volume. 1487 * Configures the currently selected volume.
1467 */ 1488 */
1468 CommandHandler.COMMANDS_['configure'] = /** @type {Command} */ ({ 1489 CommandHandler.COMMANDS_['configure'] = /** @type {Command} */ ({
1469 /** 1490 /**
1470 * @param {!Event} event Command event. 1491 * @param {!Event} event Command event.
1471 * @param {!FileManager} fileManager FileManager to use. 1492 * @param {!FileManager} fileManager FileManager to use.
1472 */ 1493 */
1473 execute: function(event, fileManager) { 1494 execute: function(event, fileManager) {
1474 var volumeInfo = 1495 var volumeInfo =
1475 CommandUtil.getElementVolumeInfo(event.target, fileManager) || 1496 CommandUtil.getElementVolumeInfo(event.target, fileManager) ||
(...skipping 24 matching lines...) Expand all
1500 }, 1521 },
1501 canExecute: function(event, fileManager) { 1522 canExecute: function(event, fileManager) {
1502 var currentDirEntry = fileManager.directoryModel.getCurrentDirEntry(); 1523 var currentDirEntry = fileManager.directoryModel.getCurrentDirEntry();
1503 var volumeInfo = currentDirEntry && 1524 var volumeInfo = currentDirEntry &&
1504 fileManager.volumeManager.getVolumeInfo(currentDirEntry); 1525 fileManager.volumeManager.getVolumeInfo(currentDirEntry);
1505 event.canExecute = volumeInfo && !volumeInfo.watchable; 1526 event.canExecute = volumeInfo && !volumeInfo.watchable;
1506 event.command.setHidden(!event.canExecute || 1527 event.command.setHidden(!event.canExecute ||
1507 fileManager.directoryModel.getFileListSelection().getCheckSelectMode()); 1528 fileManager.directoryModel.getFileListSelection().getCheckSelectMode());
1508 } 1529 }
1509 }); 1530 });
OLDNEW
« no previous file with comments | « no previous file | ui/file_manager/file_manager/main.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698