Bug 1338757 - "Remove All Shown" and button in about:preferences should use its own accesskey, r=jaws draft
authorFischer.json <fischer.json@gmail.com>
Mon, 13 Feb 2017 11:43:37 +0800
changeset 483302 2412af6673be8b885b1a68e6add857c68beecb7c
parent 482503 00d16f03506b7f9f754b01a0a458c05445ac6dba
child 545609 001822d243441e32b383f30af1e42d3c050cec3a
push id45278
push userbmo:fliu@mozilla.com
push dateTue, 14 Feb 2017 03:12:23 +0000
reviewersjaws
bugs1338757
milestone54.0a1
Bug 1338757 - "Remove All Shown" and button in about:preferences should use its own accesskey, r=jaws MozReview-Commit-ID: 2ucF0GqOCJV
browser/components/preferences/cookies.js
browser/components/preferences/siteDataSettings.js
browser/locales/en-US/chrome/browser/preferences/preferences.properties
toolkit/components/passwordmgr/content/passwordManager.js
toolkit/locales/en-US/chrome/passwordmgr/passwordmgr.properties
--- a/browser/components/preferences/cookies.js
+++ b/browser/components/preferences/cookies.js
@@ -872,19 +872,25 @@ var gCookiesWindow = {
       if (item && item.container && item.open)
         this._openIndices.push(i);
     }
   },
 
   _updateRemoveAllButton: function gCookiesWindow__updateRemoveAllButton() {
     let removeAllCookies = document.getElementById("removeAllCookies");
     removeAllCookies.disabled = this._view._rowCount == 0;
-    let label = this._view._filtered ?
-      this._bundle.getString("removeAllShownCookies.label") : this._bundle.getString("removeAllCookies.label");
-    removeAllCookies.setAttribute("label", label);
+
+    let labelStringID = "removeAllCookies.label";
+    let accessKeyStringID = "removeAllCookies.accesskey";
+    if (this._view._filtered) {
+      labelStringID = "removeAllShownCookies.label";
+      accessKeyStringID = "removeAllShownCookies.accesskey";
+    }
+    removeAllCookies.setAttribute("label", this._bundle.getString(labelStringID));
+    removeAllCookies.setAttribute("accesskey", this._bundle.getString(accessKeyStringID));
   },
 
   filter() {
     var filter = document.getElementById("filter").value;
     if (filter == "") {
       gCookiesWindow.clearFilter();
       return;
     }
--- a/browser/components/preferences/siteDataSettings.js
+++ b/browser/components/preferences/siteDataSettings.js
@@ -40,38 +40,41 @@ let gSiteDataSettings = {
     SiteDataManager.getSites().then(sites => {
       this._sites = sites;
       let sortCol = document.getElementById("hostCol");
       this._sortSites(this._sites, sortCol);
       this._buildSitesList(this._sites);
       Services.obs.notifyObservers(null, "sitedata-settings-init", null);
     });
 
-    let removeAllBtn = document.getElementById("removeAll");
-    removeAllBtn.setAttribute("accesskey", this._prefStrBundle.getString("removeAll.accesskey"));
-
     setEventListener("hostCol", "click", this.onClickTreeCol);
     setEventListener("usageCol", "click", this.onClickTreeCol);
     setEventListener("statusCol", "click", this.onClickTreeCol);
     setEventListener("cancel", "command", this.close);
     setEventListener("save", "command", this.saveChanges);
     setEventListener("searchBox", "command", this.onCommandSearch);
     setEventListener("removeAll", "command", this.onClickRemoveAll);
     setEventListener("removeSelected", "command", this.onClickRemoveSelected);
   },
 
   _updateButtonsState() {
     let items = this._list.getElementsByTagName("richlistitem");
     let removeSelectedBtn = document.getElementById("removeSelected");
     let removeAllBtn = document.getElementById("removeAll");
     removeSelectedBtn.disabled = items.length == 0;
     removeAllBtn.disabled = removeSelectedBtn.disabled;
-    let removeAllBtnLabel = this._searchBox.value ?
-      this._prefStrBundle.getString("removeAllShown.label") : this._prefStrBundle.getString("removeAll.label");
-    removeAllBtn.setAttribute("label", removeAllBtnLabel);
+
+    let removeAllBtnLabelStringID = "removeAllSiteData.label";
+    let removeAllBtnAccesskeyStringID = "removeAllSiteData.accesskey";
+    if (this._searchBox.value) {
+      removeAllBtnLabelStringID = "removeAllSiteDataShown.label";
+      removeAllBtnAccesskeyStringID = "removeAllSiteDataShown.accesskey";
+    }
+    removeAllBtn.setAttribute("label", this._prefStrBundle.getString(removeAllBtnLabelStringID));
+    removeAllBtn.setAttribute("accesskey", this._prefStrBundle.getString(removeAllBtnAccesskeyStringID));
   },
 
   /**
    * @param sites {Array}
    * @param col {XULElement} the <treecol> being sorted on
    */
   _sortSites(sites, col) {
     let isCurrentSortCol = col.getAttribute("data-isCurrentSortCol")
--- a/browser/locales/en-US/chrome/browser/preferences/preferences.properties
+++ b/browser/locales/en-US/chrome/browser/preferences/preferences.properties
@@ -120,22 +120,25 @@ can=Allow
 canAccessFirstParty=Allow first party only
 canSession=Allow for Session
 cannot=Block
 noCookieSelected=<no cookie selected>
 cookiesAll=The following cookies are stored on your computer:
 cookiesFiltered=The following cookies match your search:
 
 # LOCALIZATION NOTE (removeAllCookies, removeAllShownCookies):
+# removeAllCookies and removeAllShownCookies are both used on the same one button,
+# never displayed together and can share the same accesskey.
 # When only partial cookies are shown as a result of keyword search,
 # removeAllShownCookies is displayed as button label.
 # removeAllCookies is displayed when no keyword search and all cookies are shown.
 removeAllCookies.label=Remove All
+removeAllCookies.accesskey=A
 removeAllShownCookies.label=Remove All Shown
-removeAllCookies.accesskey=A
+removeAllShownCookies.accesskey=A
 
 # LOCALIZATION NOTE (removeSelectedCookies):
 # Semicolon-separated list of plural forms. See:
 # http://developer.mozilla.org/en/docs/Localization_and_Plurals
 # If you need to display the number of selected elements in your language,
 # you can use #1 in your localization as a placeholder for the number.
 # For example this is the English string with numbers:
 # removeSelectedCookied=Remove #1 Selected;Remove #1 Selected
@@ -182,23 +185,26 @@ actualAppCacheSize=Your application cach
 #   %2$S = unit (MB, KB, etc.)
 totalSiteDataSize=Your stored site data is currently using %1$S %2$S of disk space
 clearSiteDataPromptTitle=Clear all cookies and site data
 clearSiteDataPromptText=Selecting ‘Clear Now’ will clear all cookies and site data stored by Firefox. This may sign you out of websites and remove offline web content.
 clearSiteDataNow=Clear Now
 important=Important
 default=Default
 siteUsage=%1$S %2$S
-# LOCALIZATION NOTE (removeAll, removeAllShown):
+# LOCALIZATION NOTE (removeAllSiteData, removeAllSiteDataShown):
+# removeAllSiteData and removeAllSiteDataShown are both used on the same one button,
+# never displayed together and can share the same accesskey.
 # When only partial sites are shown as a result of keyword search,
 # removeAllShown is displayed as button label.
 # removeAll is displayed when no keyword search and all sites are shown.
-removeAll.label=Remove All
-removeAllShown.label=Remove All Shown
-removeAll.accesskey=e
+removeAllSiteData.label=Remove All
+removeAllSiteData.accesskey=e
+removeAllSiteDataShown.label=Remove All Shown
+removeAllSiteDataShown.accesskey=e
 
 # LOCALIZATION NOTE (featureEnableRequiresRestart, featureDisableRequiresRestart, restartTitle): %S = brandShortName
 featureEnableRequiresRestart=%S must restart to enable this feature.
 featureDisableRequiresRestart=%S must restart to disable this feature.
 shouldRestartTitle=Restart %S
 okToRestartButton=Restart %S now
 revertNoRestartButton=Revert
 
--- a/toolkit/components/passwordmgr/content/passwordManager.js
+++ b/toolkit/components/passwordmgr/content/passwordManager.js
@@ -554,16 +554,17 @@ function SignonClearFilter() {
     }
   } else {
     signonsTreeView.selection.select(0);
   }
   signonsTreeView._lastSelectedRanges = [];
 
   signonsIntro.textContent = kSignonBundle.getString("loginsDescriptionAll");
   removeAllButton.setAttribute("label", kSignonBundle.getString("removeAll.label"));
+  removeAllButton.setAttribute("accesskey", kSignonBundle.getString("removeAll.accesskey"));
 }
 
 function FocusFilterBox() {
   if (filterField.getAttribute("focused") != "true") {
     filterField.focus();
   }
 }
 
@@ -623,16 +624,17 @@ function FilterPasswords() {
   signonsTree.treeBoxObject.rowCountChanged(0, signonsTreeView.rowCount);
 
   // if the view is not empty then select the first item
   if (signonsTreeView.rowCount > 0)
     signonsTreeView.selection.select(0);
 
   signonsIntro.textContent = kSignonBundle.getString("loginsDescriptionFiltered");
   removeAllButton.setAttribute("label", kSignonBundle.getString("removeAllShown.label"));
+  removeAllButton.setAttribute("accesskey", kSignonBundle.getString("removeAllShown.accesskey"));
 }
 
 function CopyPassword() {
   // Don't copy passwords if we aren't already showing the passwords & a master
   // password hasn't been entered.
   if (!showingPasswords && !masterPasswordLogin())
     return;
   // Copy selected signon's password to clipboard
--- a/toolkit/locales/en-US/chrome/passwordmgr/passwordmgr.properties
+++ b/toolkit/locales/en-US/chrome/passwordmgr/passwordmgr.properties
@@ -74,14 +74,17 @@ duplicateLogin=A duplicate login already
 insecureFieldWarningDescription = This connection is not secure. Logins entered here could be compromised.
 # LOCALIZATION NOTE (insecureFieldWarningDescription2, insecureFieldWarningDescription3):
 # %1$S will contain insecureFieldWarningLearnMore and look like a link to indicate that clicking will open a tab with support information.
 insecureFieldWarningDescription2 = This connection is not secure. Logins entered here could be compromised. %1$S
 insecureFieldWarningDescription3 = Logins entered here could be compromised. %1$S
 insecureFieldWarningLearnMore = Learn More
 
 # LOCALIZATION NOTE (removeAll, removeAllShown):
+# removeAll and removeAllShown are both used on the same one button,
+# never displayed together and can share the same accesskey.
 # When only partial sites are shown as a result of keyword search,
 # removeAllShown is displayed as button label.
 # removeAll is displayed when no keyword search and all sites are shown.
 removeAll.label=Remove All
+removeAll.accesskey=A
 removeAllShown.label=Remove All Shown
-removeAll.accesskey=A
+removeAllShown.accesskey=A