Bug 1143939 - Add single-item delete to about:passwords context menu. r=ally

This commit is contained in:
Chenxia Liu 2015-03-26 10:42:34 -07:00
parent 73d995b610
commit f1b3db2a8a
2 changed files with 22 additions and 1 deletions

View File

@ -136,7 +136,8 @@ let Passwords = {
let menuItems = [
{ label: gStringBundle.GetStringFromName("passwordsMenu.copyPassword") },
{ label: gStringBundle.GetStringFromName("passwordsMenu.copyUsername") },
{ label: gStringBundle.GetStringFromName("passwordsMenu.details") } ];
{ label: gStringBundle.GetStringFromName("passwordsMenu.details") },
{ label: gStringBundle.GetStringFromName("passwordsMenu.delete") } ];
prompt.setSingleChoiceItems(menuItems);
prompt.show((data) => {
@ -152,6 +153,21 @@ let Passwords = {
this._showDetails(loginItem);
history.pushState({ id: login.guid }, document.title);
break;
case 3:
let confirmPrompt = new Prompt({
window: window,
message: gStringBundle.GetStringFromName("passwordsDialog.confirmDelete"),
buttons: [
gStringBundle.GetStringFromName("passwordsDialog.confirm"),
gStringBundle.GetStringFromName("passwordsDialog.cancel") ]
});
confirmPrompt.show((data) => {
switch (data.button) {
case 0:
// Corresponds to "confirm" button.
Services.logins.removeLogin(login);
}
});
}
});

View File

@ -5,6 +5,11 @@
passwordsMenu.copyPassword=Copy password
passwordsMenu.copyUsername=Copy username
passwordsMenu.details=Details
passwordsMenu.delete=Delete
passwordsDialog.confirmDelete=Delete this login?
passwordsDialog.confirm=OK
passwordsDialog.cancel=Cancel
passwordsDetails.age=Age: %S days