Bug 1473470 - Part 1 - Add new "Delete all" option to about:logins; r=JanH
authorPetru Lingurar <petru.lingurar@softvision.ro>
Mon, 14 Jan 2019 13:42:42 +0000
changeset 510853 a7034ada9fb35dffe4e0729987cb00b2e37d46ac
parent 510852 ff87d87996fda94c59817084578291d2e3ce16c9
child 510854 5306b81a94f76fc9d867435ff304dbdec9bab203
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersJanH
bugs1473470
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1473470 - Part 1 - Add new "Delete all" option to about:logins; r=JanH This new option allows removing all logins from our login manager. Differential Revision: https://phabricator.services.mozilla.com/D16026
mobile/android/chrome/content/aboutLogins.js
mobile/android/locales/en-US/chrome/aboutLogins.properties
--- a/mobile/android/chrome/content/aboutLogins.js
+++ b/mobile/android/chrome/content/aboutLogins.js
@@ -362,16 +362,17 @@ var Logins = {
       window: window,
     });
     let menuItems = [
       { label: gStringBundle.GetStringFromName("loginsMenu.showPassword") },
       { label: gStringBundle.GetStringFromName("loginsMenu.copyPassword") },
       { label: gStringBundle.GetStringFromName("loginsMenu.copyUsername") },
       { label: gStringBundle.GetStringFromName("loginsMenu.editLogin") },
       { label: gStringBundle.GetStringFromName("loginsMenu.delete") },
+      { label: gStringBundle.GetStringFromName("loginsMenu.deleteAll") },
     ];
 
     prompt.setSingleChoiceItems(menuItems);
     prompt.show((data) => {
       // Switch on indices of buttons, as they were added when creating login item.
       switch (data.button) {
         case 0:
           this._showPassword(login.password);
@@ -383,33 +384,52 @@ var Logins = {
           copyStringShowSnackbar(login.username, gStringBundle.GetStringFromName("loginsDetails.usernameCopied"));
           break;
         case 3:
           this._selectedLogin = login;
           this._showEditLoginDialog(login);
           history.pushState({ id: login.guid }, document.title);
           break;
         case 4:
-          let confirmPrompt = new Prompt({
+          let deleteLoginConfirmPrompt = new Prompt({
             window: window,
             message: gStringBundle.GetStringFromName("loginsDialog.confirmDelete"),
             buttons: [
               gStringBundle.GetStringFromName("loginsDialog.confirm"),
               gStringBundle.GetStringFromName("loginsDialog.cancel") ],
           });
-          confirmPrompt.show((data) => {
+          deleteLoginConfirmPrompt.show((data) => {
             switch (data.button) {
               case 0:
                 // Corresponds to "confirm" button.
                 Services.logins.removeLogin(login);
 
                 // Show a snackbar to notify the login record has been deleted.
                 Snackbars.show(gStringBundle.GetStringFromName("loginsDetails.deleted"), Snackbars.LENGTH_LONG);
             }
           });
+          break;
+        case 5:
+          let deleteAllLoginsConfirmPrompt = new Prompt({
+            window: window,
+            message: gStringBundle.GetStringFromName("loginsDialog.confirmDeleteAll"),
+            buttons: [
+              gStringBundle.GetStringFromName("loginsDialog.confirm"),
+              gStringBundle.GetStringFromName("loginsDialog.cancel") ],
+          });
+          deleteAllLoginsConfirmPrompt.show((data) => {
+            switch (data.button) {
+              case 0:
+                // Corresponds to "confirm" button.
+                Services.logins.removeAllLogins();
+
+                // Show a snackbar to notify that all logins records have been deleted.
+                Snackbars.show(gStringBundle.GetStringFromName("loginsDetails.deletedAll"), Snackbars.LENGTH_LONG);
+            }
+          });
       }
     });
   },
 
   _loadFavicon: function(aImg, aHostname) {
     // Load favicon from cache.
     EventDispatcher.instance.sendRequestForResult({
       type: "Favicon:Request",
--- a/mobile/android/locales/en-US/chrome/aboutLogins.properties
+++ b/mobile/android/locales/en-US/chrome/aboutLogins.properties
@@ -2,27 +2,30 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 loginsMenu.showPassword=Show password
 loginsMenu.copyPassword=Copy password
 loginsMenu.copyUsername=Copy username
 loginsMenu.editLogin=Edit login
 loginsMenu.delete=Delete
+loginsMenu.deleteAll=Delete All
 
 loginsDialog.confirmDelete=Delete this login?
+loginsDialog.confirmDeleteAll=Delete all logins?
 loginsDialog.copy=Copy
 loginsDialog.confirm=OK
 loginsDialog.cancel=Cancel
 
 editLogin.fallbackTitle=Edit Login
 editLogin.saved1=Saved login
 editLogin.couldNotSave=Changes could not be saved
 
 loginsDetails.age=Age: %S days
 
 loginsDetails.copyFailed=Copy failed
 loginsDetails.passwordCopied=Password copied
 loginsDetails.usernameCopied=Username copied
 loginsDetails.deleted=Login deleted
+loginsDetails.deletedAll=All logins deleted
 
 password-btn.show=Show
 password-btn.hide=Hide