Bug 1168530 - Add context menu option for "Show password". r=ally
authorChenxia Liu <liuche@mozilla.com>
Tue, 02 Jun 2015 17:43:20 -0700
changeset 248035 01a6f68c4e53ed187a4bb059a48b324d2260ee50
parent 248034 5080433ff6105dcd9b2280319a99406c349af245
child 248036 6034dc30409f9da00973f116b9c0f6ae14fa14b8
push id60888
push userkwierso@gmail.com
push dateThu, 11 Jun 2015 01:38:38 +0000
treeherdermozilla-inbound@39e638ed06bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersally
bugs1168530
milestone41.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 1168530 - Add context menu option for "Show password". r=ally
mobile/android/chrome/content/aboutPasswords.js
mobile/android/locales/en-US/chrome/aboutPasswords.properties
--- a/mobile/android/chrome/content/aboutPasswords.js
+++ b/mobile/android/chrome/content/aboutPasswords.js
@@ -152,37 +152,53 @@ let Passwords = {
       debug("No login!");
       return;
     }
 
     let prompt = new Prompt({
       window: window,
     });
     let menuItems = [
+      { label: gStringBundle.GetStringFromName("passwordsMenu.showPassword") },
       { label: gStringBundle.GetStringFromName("passwordsMenu.copyPassword") },
       { label: gStringBundle.GetStringFromName("passwordsMenu.copyUsername") },
       { label: gStringBundle.GetStringFromName("passwordsMenu.details") },
       { label: gStringBundle.GetStringFromName("passwordsMenu.delete") }
     ];
 
     prompt.setSingleChoiceItems(menuItems);
     prompt.show((data) => {
       // Switch on indices of buttons, as they were added when creating login item.
       switch (data.button) {
         case 0:
-          copyStringAndToast(login.password, gStringBundle.GetStringFromName("passwordsDetails.passwordCopied"));
+          let passwordPrompt = new Prompt({
+            window: window,
+            message: login.password,
+            buttons: [
+              gStringBundle.GetStringFromName("passwordsDialog.copy"),
+              gStringBundle.GetStringFromName("passwordsDialog.cancel") ]
+          }).show((data) => {
+            switch (data.button) {
+              case 0:
+                // Corresponds to "Copy password" button.
+                copyStringAndToast(login.password, gStringBundle.GetStringFromName("passwordsDetails.passwordCopied"));
+            }
+          });
           break;
         case 1:
+          copyStringAndToast(login.password, gStringBundle.GetStringFromName("passwordsDetails.passwordCopied"));
+          break;
+        case 2:
           copyStringAndToast(login.username, gStringBundle.GetStringFromName("passwordsDetails.usernameCopied"));
           break;
-        case 2:
+        case 3:
           this._showDetails(loginItem);
           history.pushState({ id: login.guid }, document.title);
           break;
-        case 3:
+        case 4:
           let confirmPrompt = new Prompt({
             window: window,
             message: gStringBundle.GetStringFromName("passwordsDialog.confirmDelete"),
             buttons: [
               gStringBundle.GetStringFromName("passwordsDialog.confirm"),
               gStringBundle.GetStringFromName("passwordsDialog.cancel") ]
           });
           confirmPrompt.show((data) => {
--- a/mobile/android/locales/en-US/chrome/aboutPasswords.properties
+++ b/mobile/android/locales/en-US/chrome/aboutPasswords.properties
@@ -1,18 +1,20 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # 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/.
 
+passwordsMenu.showPassword=Show password
 passwordsMenu.copyPassword=Copy password
 passwordsMenu.copyUsername=Copy username
 passwordsMenu.details=Details
 passwordsMenu.delete=Delete
 
 passwordsDialog.confirmDelete=Delete this login?
+passwordsDialog.copy=Copy
 passwordsDialog.confirm=OK
 passwordsDialog.cancel=Cancel
 
 passwordsDetails.age=Age: %S days
 
 passwordsDetails.copyFailed=Copy failed
 passwordsDetails.passwordCopied=Password copied
 passwordsDetails.usernameCopied=Username copied