Bug 768005 Add a "confirm on delete" option for address book entries r=IanN.
authorLiu Weiran <liuweiran.nus@gmail.com>
Thu, 15 Nov 2012 22:46:28 +0800
changeset 11582 73ac92981a1be2ea5c6f4a0d77f70b956d4e9b55
parent 11581 216a373b1d1eb1c067e11f3b97311c0fa9ec1c98
child 11583 931f0547903cb8955d1f5e1c1b676f6deed455d1
push id8631
push userphilip.chee@gmail.com
push dateMon, 19 Nov 2012 17:49:19 +0000
treeherdercomm-central@73ac92981a1b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN
bugs768005
Bug 768005 Add a "confirm on delete" option for address book entries r=IanN.
suite/locales/en-US/chrome/mailnews/addressbook/addressBook.properties
suite/mailnews/addrbook/abCommon.js
--- a/suite/locales/en-US/chrome/mailnews/addressbook/addressBook.properties
+++ b/suite/locales/en-US/chrome/mailnews/addressbook/addressBook.properties
@@ -30,16 +30,18 @@ viewListTitle=Mailing List: %S
 mailListNameExistsTitle=Mailing List Already Exists
 mailListNameExistsMessage=A Mailing List with that name already exists. Please choose a different name.
 
 # used in the addressbook
 confirmDeleteMailingListTitle=Delete Mailing List
 confirmDeleteAddressbookTitle=Delete Address Book
 confirmDeleteAddressbook=Are you sure you want to delete the selected address book?
 confirmDeleteCollectionAddressbook=If this address book is deleted, %S will no longer collect addresses. Are you sure you want to delete the selected address book?
+confirmDeleteContact=Are you sure you want to delete the selected contact?
+confirmDeleteContacts=Are you sure you want to delete the selected contacts?
 confirmDeleteMailingList=Are you sure you want to delete the selected mailing list?
 confirmDeleteListsAndContacts=Are you sure you want to delete the selected contacts and mailing lists?
 confirmDeleteMailingLists=Are you sure you want to delete the selected mailing lists?
 
 propertyPrimaryEmail=Email
 propertyListName=List Name
 propertySecondaryEmail=Additional Email
 propertyScreenName=Screen Name
--- a/suite/mailnews/addrbook/abCommon.js
+++ b/suite/mailnews/addrbook/abCommon.js
@@ -240,31 +240,39 @@ function UpgradeAddressBookResultsPaneUI
 
 function AbDelete()
 {
   var types = GetSelectedCardTypes();
 
   if (types == kNothingSelected)
     return;
 
+  var confirmDeleteMessage;
+
+  if (types == kCardsOnly)
+  {
+    if (gAbView && gAbView.selection.count < 2)
+      confirmDeleteMessage = gAddressBookBundle.getString("confirmDeleteContact");
+    else 
+      confirmDeleteMessage = gAddressBookBundle.getString("confirmDeleteContacts");
+  }
   // If at least one mailing list is selected then prompt users for deletion.
-  if (types != kCardsOnly)
-  {
-    var confirmDeleteMessage;
+  else
+  {   
     if (types == kListsAndCards)
       confirmDeleteMessage = gAddressBookBundle.getString("confirmDeleteListsAndContacts");
     else if (types == kMultipleListsOnly)
       confirmDeleteMessage = gAddressBookBundle.getString("confirmDeleteMailingLists");
-    else
+    else if (types == kSingleListOnly)
       confirmDeleteMessage = gAddressBookBundle.getString("confirmDeleteMailingList");
-    if (!Services.prompt.confirm(window, null, confirmDeleteMessage))
-      return;
   }
 
-  gAbView.deleteSelectedCards();
+  if (confirmDeleteMessage &&
+      Services.prompt.confirm(window, null, confirmDeleteMessage))
+    gAbView.deleteSelectedCards();
 }
 
 function AbNewCard()
 {
   goNewCardDialog(GetSelectedDirectory());
 }
 
 function AbEditCard(card)