Bug 996363 - order OS X cloverleaf symbol correctly in ShortcutUtils.jsm, r=Unfocused
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 16 Apr 2014 13:23:19 +0100
changeset 179322 14b25d18dbada515097030d6813540de6298157f
parent 179321 0ee15acfea79fa8d0dd1c5ddb9e6d04e56c99ac2
child 179323 854848b9722d69c8a7afea209e38ffbc339f73c2
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersUnfocused
bugs996363
milestone31.0a1
Bug 996363 - order OS X cloverleaf symbol correctly in ShortcutUtils.jsm, r=Unfocused
toolkit/modules/ShortcutUtils.jsm
--- a/toolkit/modules/ShortcutUtils.jsm
+++ b/toolkit/modules/ShortcutUtils.jsm
@@ -29,26 +29,26 @@ let ShortcutUtils = {
     * @param boolean aNoCloverLeaf
     *        Pass true to use a descriptive string instead of the cloverleaf symbol. (OS X only)
     * @return string
     *         A prettified and properly separated modifier keys string.
     */
   prettifyShortcut: function(aElemKey, aNoCloverLeaf) {
     let elemString = "";
     let elemMod = aElemKey.getAttribute("modifiers");
+    let haveCloverLeaf = false;
 
     if (elemMod.match("accel")) {
       if (Services.appinfo.OS == "Darwin") {
         // XXX bug 779642 Use "Cmd-" literal vs. cloverleaf meta-key until
         // Orion adds variable height lines.
         if (aNoCloverLeaf) {
           elemString += "Cmd-";
         } else {
-          elemString += PlatformKeys.GetStringFromName("VK_META") +
-            PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
+          haveCloverLeaf = true;
         }
       } else {
         elemString += PlatformKeys.GetStringFromName("VK_CONTROL") +
           PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
       }
     }
     if (elemMod.match("access")) {
       if (Services.appinfo.OS == "Darwin") {
@@ -75,16 +75,21 @@ let ShortcutUtils = {
       elemString += PlatformKeys.GetStringFromName("VK_CONTROL") +
         PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
     }
     if (elemMod.match("meta")) {
       elemString += PlatformKeys.GetStringFromName("VK_META") +
         PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
     }
 
+    if (haveCloverLeaf) {
+      elemString += PlatformKeys.GetStringFromName("VK_META") +
+        PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR");
+    }
+
     let key;
     let keyCode = aElemKey.getAttribute("keycode");
     if (keyCode) {
       try {
         // Some keys might not exist in the locale file, which will throw:
         key = Keys.GetStringFromName(keyCode.toUpperCase());
       } catch (ex) {
         Cu.reportError("Error finding " + keyCode + ": " + ex);