Bug 940116 - part 2, include more shortcuts inside Australis widgets, r=jaws

This commit is contained in:
Gijs Kruitbosch 2014-01-29 20:48:28 +00:00
parent 41163b8c89
commit 6e04d1bdec
2 changed files with 76 additions and 32 deletions

View File

@ -16,6 +16,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "PlacesUIUtils",
"resource:///modules/PlacesUIUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "RecentlyClosedTabsAndWindowsMenuUtils",
"resource:///modules/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ShortcutUtils",
"resource://gre/modules/ShortcutUtils.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "CharsetManager",
"@mozilla.org/charset-converter-manager;1",
"nsICharsetConverterManager");
@ -32,13 +34,26 @@ let gModuleName = "[CustomizableWidgets]";
#include logging.js
function setAttributes(aNode, aAttrs) {
let doc = aNode.ownerDocument;
for (let [name, value] of Iterator(aAttrs)) {
if (!value) {
if (aNode.hasAttribute(name))
aNode.removeAttribute(name);
} else {
if (name == "label" || name == "tooltiptext")
value = CustomizableUI.getLocalizedProperty({id: aAttrs.id}, name);
if (name == "shortcutId") {
continue;
}
if (name == "label" || name == "tooltiptext") {
let stringId = (typeof value == "string") ? value : name;
let additionalArgs = [];
if (aAttrs.shortcutId) {
let shortcut = doc.getElementById(aAttrs.shortcutId);
if (doc) {
additionalArgs.push(ShortcutUtils.prettifyShortcut(shortcut));
}
}
value = CustomizableUI.getLocalizedProperty({id: aAttrs.id}, stringId, additionalArgs);
}
aNode.setAttribute(name, value);
}
}
@ -63,6 +78,7 @@ const CustomizableWidgets = [{
type: "view",
viewId: "PanelUI-history",
shortcutId: "key_gotoHistory",
tooltiptext: "history-panelmenu.tooltiptext2",
defaultArea: CustomizableUI.AREA_PANEL,
onViewShowing: function(aEvent) {
// Populate our list of history
@ -190,6 +206,7 @@ const CustomizableWidgets = [{
}, {
id: "save-page-button",
shortcutId: "key_savePage",
tooltiptext: "save-page-button.tooltiptext2",
defaultArea: CustomizableUI.AREA_PANEL,
onCommand: function(aEvent) {
let win = aEvent.target &&
@ -202,6 +219,7 @@ const CustomizableWidgets = [{
}, {
id: "find-button",
shortcutId: "key_find",
tooltiptext: "find-button.tooltiptext2",
defaultArea: CustomizableUI.AREA_PANEL,
onCommand: function(aEvent) {
let win = aEvent.target &&
@ -214,6 +232,7 @@ const CustomizableWidgets = [{
}, {
id: "open-file-button",
shortcutId: "openFileKb",
tooltiptext: "open-file-button.tooltiptext2",
defaultArea: CustomizableUI.AREA_PANEL,
onCommand: function(aEvent) {
let win = aEvent.target
@ -289,6 +308,7 @@ const CustomizableWidgets = [{
}, {
id: "add-ons-button",
shortcutId: "key_openAddons",
tooltiptext: "add-ons-button.tooltiptext2",
defaultArea: CustomizableUI.AREA_PANEL,
onCommand: function(aEvent) {
let win = aEvent.target &&
@ -303,7 +323,14 @@ const CustomizableWidgets = [{
defaultArea: CustomizableUI.AREA_PANEL,
#ifdef XP_WIN
label: "preferences-button.labelWin",
tooltiptext: "preferences-button.tooltipWin",
tooltiptext: "preferences-button.tooltipWin2",
#else
#ifdef XP_MACOSX
tooltiptext: "preferences-button.tooltiptext.withshortcut",
shortcutId: "key_preferencesCmdMac",
#else
tooltiptext: "preferences-button.tooltiptext",
#endif
#endif
onCommand: function(aEvent) {
let win = aEvent.target &&
@ -334,20 +361,23 @@ const CustomizableWidgets = [{
command: "cmd_fullZoomReduce",
class: cls,
label: true,
tooltiptext: true
tooltiptext: "tooltiptext2",
shortcutId: "key_fullZoomReduce",
}, {
id: "zoom-reset-button",
closemenu: closeMenu,
command: "cmd_fullZoomReset",
class: cls,
tooltiptext: true
tooltiptext: "tooltiptext2",
shortcutId: "key_fullZoomReset",
}, {
id: "zoom-in-button",
closemenu: closeMenu,
command: "cmd_fullZoomEnlarge",
class: cls,
label: true,
tooltiptext: true
tooltiptext: "tooltiptext2",
shortcutId: "key_fullZoomEnlarge",
}];
let node = aDocument.createElementNS(kNSXUL, "toolbaritem");
@ -490,19 +520,22 @@ const CustomizableWidgets = [{
command: "cmd_cut",
class: cls,
label: true,
tooltiptext: true
tooltiptext: "tooltiptext2",
shortcutId: "key_cut",
}, {
id: "copy-button",
command: "cmd_copy",
class: cls,
label: true,
tooltiptext: true
tooltiptext: "tooltiptext2",
shortcutId: "key_copy",
}, {
id: "paste-button",
command: "cmd_paste",
class: cls,
label: true,
tooltiptext: true
tooltiptext: "tooltiptext2",
shortcutId: "key_paste",
}];
let node = aDocument.createElementNS(kNSXUL, "toolbaritem");
@ -610,6 +643,7 @@ const CustomizableWidgets = [{
id: "characterencoding-button",
type: "view",
viewId: "PanelUI-characterEncodingView",
tooltiptext: "characterencoding-button.tooltiptext2",
defaultArea: CustomizableUI.AREA_PANEL,
maybeDisableMenu: function(aDocument) {
let window = aDocument.defaultView;
@ -817,6 +851,7 @@ const CustomizableWidgets = [{
}
}, {
id: "email-link-button",
tooltiptext: "email-link-button.tooltiptext2",
onCommand: function(aEvent) {
let win = aEvent.view;
win.MailIntegration.sendLinkForWindow(win.content);

View File

@ -3,73 +3,80 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
history-panelmenu.label = History
# LOCALIZATION NOTE (history-panelmenu.tooltiptext): Use the unicode ellipsis char,
# \u2026, or use "..." if \u2026 doesn't suit traditions in your locale.
history-panelmenu.tooltiptext = History… (%S)
# LOCALIZATION NOTE(history-panelmenu.tooltiptext2): %S is the keyboard shortcut
history-panelmenu.tooltiptext2 = Show your history (%S)
privatebrowsing-button.label = New Private Window
# LOCALIZATION NOTE(privatebrowsing-button.tooltiptext): %S is the keyboard shortcut
privatebrowsing-button.tooltiptext = Open a new Private Browsing window (%S)
save-page-button.label = Save Page
# LOCALIZATION NOTE(save-page-button.tooltiptext): %S is the keyboard shortcut
save-page-button.tooltiptext = Save this page (%S)
# LOCALIZATION NOTE(save-page-button.tooltiptext2): %S is the keyboard shortcut
# Use the unicode ellipsis char, \u2026, or use "..." if \u2026 doesn't suit traditions in your locale.
save-page-button.tooltiptext2 = Save this page… (%S)
find-button.label = Find
# LOCALIZATION NOTE(find-button.tooltiptext): %S is the keyboard shortcut
find-button.tooltiptext = Find in this page (%S)
# LOCALIZATION NOTE(find-button.tooltiptext2): %S is the keyboard shortcut.
# Use the unicode ellipsis char, \u2026, or use "..." if \u2026 doesn't suit traditions in your locale.
find-button.tooltiptext2 = Find in this page… (%S)
open-file-button.label = Open File
# LOCALIZATION NOTE(open-file-button.tooltiptext): %S is the keyboard shortcut
open-file-button.tooltiptext = Open file (%S)
# LOCALIZATION NOTE (open-file-button.tooltiptext2): %S is the keyboard shortcut.
# Use the unicode ellipsis char, \u2026, or use "..." if \u2026 doesn't suit traditions in your locale.
open-file-button.tooltiptext2 = Open file… (%S)
developer-button.label = Developer
# LOCALIZATION NOTE(developer-button.tooltiptext): %S is the keyboard shortcut
developer-button.tooltiptext = Web Developer Tools (%S)
add-ons-button.label = Add-ons
# LOCALIZATION NOTE(add-ons-button.tooltiptext): %S is the keyboard shortcut
add-ons-button.tooltiptext = Add-ons Manager (%S)
# LOCALIZATION NOTE(add-ons-button.tooltiptext2): %S is the keyboard shortcut
add-ons-button.tooltiptext2 = Open Add-ons Manager (%S)
switch-to-metro-button2.label = Windows 8 Touch
# LOCALIZATION NOTE(switch-to-metro-button2.tooltiptext): %S is the brand short name
switch-to-metro-button2.tooltiptext = Relaunch in %S for Windows 8 Touch
preferences-button.label = Preferences
# LOCALIZATION NOTE (preferences-button.tooltiptext): Use the unicode ellipsis char,
# \u2026, or use "..." if \u2026 doesn't suit traditions in your locale.
preferences-button.tooltiptext = Preferences…
preferences-button.tooltiptext2 = Open Preferences
preferences-button.tooltiptext.withshortcut = Open Preferences (%S)
# LOCALIZATION NOTE (preferences-button.labelWin): Windows-only label for Options
preferences-button.labelWin = Options
# LOCALIZATION NOTE (preferences-button.tooltipWin): Windows-only tooltip for Options
preferences-button.tooltipWin = Options
preferences-button.tooltipWin2 = Open Options
zoom-controls.label = Zoom Controls
zoom-controls.tooltiptext = Zoom Controls
zoom-out-button.label = Zoom out
zoom-out-button.tooltiptext = Zoom out
# LOCALIZATION NOTE(zoom-out-button.tooltiptext2): %S is the keyboard shortcut.
zoom-out-button.tooltiptext2 = Zoom out (%S)
# LOCALIZATION NOTE(zoom-reset-button.label): %S is the current zoom level,
# %% will be displayed as a single % character (% is commonly used to define
# format specifiers, so it needs to be escaped).
zoom-reset-button.label = %S%%
zoom-reset-button.tooltiptext = Reset zoom level
# LOCALIZATION NOTE(zoom-reset-button.tooltiptext2): %S is the keyboard shortcut.
zoom-reset-button.tooltiptext2 = Reset zoom level (%S)
zoom-in-button.label = Zoom in
zoom-in-button.tooltiptext = Zoom in
# LOCALIZATION NOTE(zoom-in-button.tooltiptext2): %S is the keyboard shortcut.
zoom-in-button.tooltiptext2 = Zoom in (%S)
edit-controls.label = Edit Controls
edit-controls.tooltiptext = Edit Controls
cut-button.label = Cut
cut-button.tooltiptext = Cut
# LOCALIZATION NOTE(cut-button.tooltiptext2): %S is the keyboard shortcut.
cut-button.tooltiptext2 = Cut (%S)
copy-button.label = Copy
copy-button.tooltiptext = Copy
# LOCALIZATION NOTE(copy-button.tooltiptext2): %S is the keyboard shortcut.
copy-button.tooltiptext2 = Copy (%S)
paste-button.label = Paste
paste-button.tooltiptext = Paste
# LOCALIZATION NOTE(paste-button.tooltiptext2): %S is the keyboard shortcut.
paste-button.tooltiptext2 = Paste (%S)
# LOCALIZATION NOTE (feed-button.tooltiptext): Use the unicode ellipsis char,
# \u2026, or use "..." if \u2026 doesn't suit traditions in your locale.
@ -77,10 +84,12 @@ feed-button.label = Subscribe
feed-button.tooltiptext = Subscribe to this page…
characterencoding-button.label = Character Encoding
characterencoding-button.tooltiptext = Character encoding
characterencoding-button.tooltiptext2 = Show Character Encoding options
email-link-button.label = Email Link
email-link-button.tooltiptext = Email Link
# LOCALIZATION NOTE (email-link-button.tooltiptext2): Use the unicode ellipsis char,
# \u2026, or use "..." if \u2026 doesn't suit traditions in your locale.
email-link-button.tooltiptext2 = Email Link…
# LOCALIZATION NOTE(quit-button.tooltiptext.linux): %S is the keyboard shortcut
quit-button.tooltiptext.linux = Quit (%S)