mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 927605 - UX-only: use the ShortcutUtils module in CustomizableUI, r=mikedeboer
This commit is contained in:
parent
4fd7b7c65f
commit
a30c6a27e8
@ -22,10 +22,8 @@ XPCOMUtils.defineLazyGetter(this, "gWidgetsBundle", function() {
|
||||
const kUrl = "chrome://browser/locale/customizableui/customizableWidgets.properties";
|
||||
return Services.strings.createBundle(kUrl);
|
||||
});
|
||||
XPCOMUtils.defineLazyGetter(this, "gPlatformKeys", function() {
|
||||
const kUrl = "chrome://global-platform/locale/platformKeys.properties";
|
||||
return Services.strings.createBundle(kUrl);
|
||||
});
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ShortcutUtils",
|
||||
"resource://gre/modules/ShortcutUtils.jsm");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "gELS",
|
||||
"@mozilla.org/eventlistenerservice;1", "nsIEventListenerService");
|
||||
|
||||
@ -931,7 +929,7 @@ let CustomizableUIInternal = {
|
||||
if (aWidget.shortcutId) {
|
||||
let keyEl = aDocument.getElementById(aWidget.shortcutId);
|
||||
if (keyEl) {
|
||||
additionalTooltipArguments.push(this.createShortcutString(keyEl));
|
||||
additionalTooltipArguments.push(ShortcutUtils.prettifyShortcut(keyEl));
|
||||
} else {
|
||||
ERROR("Key element with id '" + aWidget.shortcutId + "' for widget '" + aWidget.id +
|
||||
"' not found!");
|
||||
@ -1016,51 +1014,6 @@ let CustomizableUIInternal = {
|
||||
return def;
|
||||
},
|
||||
|
||||
// From devtools/shared/helpers.js:
|
||||
createShortcutString: function(aElemKey) {
|
||||
let elemString = "";
|
||||
let elemMod = aElemKey.getAttribute("modifiers");
|
||||
|
||||
if (elemMod.match("accel")) {
|
||||
if (Services.appinfo.OS == "Darwin") {
|
||||
elemString += gPlatformKeys.GetStringFromName("VK_META") +
|
||||
gPlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
} else {
|
||||
elemString += gPlatformKeys.GetStringFromName("VK_CONTROL") +
|
||||
gPlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
}
|
||||
}
|
||||
if (elemMod.match("access")) {
|
||||
if (Services.appinfo.OS == "Darwin") {
|
||||
elemString += gPlatformKeys.GetStringFromName("VK_CONTROL") +
|
||||
gPlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
} else {
|
||||
elemString += gPlatformKeys.GetStringFromName("VK_ALT") +
|
||||
gPlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
}
|
||||
}
|
||||
if (elemMod.match("shift")) {
|
||||
elemString += gPlatformKeys.GetStringFromName("VK_SHIFT") +
|
||||
gPlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
}
|
||||
if (elemMod.match("alt")) {
|
||||
elemString += gPlatformKeys.GetStringFromName("VK_ALT") +
|
||||
gPlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
}
|
||||
if (elemMod.match("ctrl") || elemMod.match("control")) {
|
||||
elemString += gPlatformKeys.GetStringFromName("VK_CONTROL") +
|
||||
gPlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
}
|
||||
if (elemMod.match("meta")) {
|
||||
elemString += gPlatformKeys.GetStringFromName("VK_META") +
|
||||
gPlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
|
||||
}
|
||||
|
||||
return elemString +
|
||||
(aElemKey.getAttribute("keycode").replace(/^.*VK_/, "") ||
|
||||
aElemKey.getAttribute("key")).toUpperCase();
|
||||
},
|
||||
|
||||
handleWidgetCommand: function(aWidget, aNode, aEvent) {
|
||||
LOG("handleWidgetCommand");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user