Bug 243767 - Multiple Identities dialogue should have a Close instead of an OK button. r=IanN,r=Standard8,ui-review=bwinton
authoraceman <acelists@atlas.sk>
Tue, 21 Feb 2012 14:44:28 +0000
changeset 10889 d7c6f47e41e1cf714de9161355ff48e90d1799db
parent 10888 59710ebe215a546ee3372172b920c534afa3f7f9
child 10890 0f7e5afbe6508e39d2feb0004daae37a24c31215
push id463
push userbugzilla@standard8.plus.com
push dateTue, 24 Apr 2012 17:34:51 +0000
treeherdercomm-beta@e53588e8f7b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN, Standard8
bugs243767
Bug 243767 - Multiple Identities dialogue should have a Close instead of an OK button. r=IanN,r=Standard8,ui-review=bwinton
mail/locales/en-US/chrome/messenger/am-identities-list.dtd
mailnews/base/prefs/content/am-identities-list.js
mailnews/base/prefs/content/am-identities-list.xul
suite/locales/en-US/chrome/mailnews/pref/am-identities-list.dtd
--- a/mail/locales/en-US/chrome/messenger/am-identities-list.dtd
+++ b/mail/locales/en-US/chrome/messenger/am-identities-list.dtd
@@ -1,7 +1,9 @@
 <!ENTITY identitiesListDesc.label "Multiple Identities Support">
 <!ENTITY identitiesListAdd.label  "Add…">
 <!ENTITY identitiesListAdd.accesskey  "A">
 <!ENTITY identitiesListEdit.label "Edit…">
 <!ENTITY identitiesListEdit.accesskey "E">
 <!ENTITY identitiesListDelete.label "Delete">
 <!ENTITY identitiesListDelete.accesskey "D">
+<!ENTITY identitiesListClose.label "Close">
+<!ENTITY identitiesListClose.accesskey "C">
--- a/mailnews/base/prefs/content/am-identities-list.js
+++ b/mailnews/base/prefs/content/am-identities-list.js
@@ -35,37 +35,34 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 var gIdentityListBox;                 // the root <listbox> node
 var gAddButton;
 var gEditButton;
 var gDeleteButton;
-var gMessengerBundle;
 
 var gAccount = null;  // the account we are showing the identities for
 
 function onLoad()
 {
-  gMessengerBundle = document.getElementById("bundle_messenger");
-
   gIdentityListBox = document.getElementById("identitiesList");
-  gAddButton        = document.getElementById("addButton");
-  gEditButton       = document.getElementById("editButton");
-  gDeleteButton     = document.getElementById("deleteButton");
+  gAddButton       = document.getElementById("addButton");
+  gEditButton      = document.getElementById("editButton");
+  gDeleteButton    = document.getElementById("deleteButton");
 
   // extract the account
   gAccount = window.arguments[0].account;
 
   var accountName = window.arguments[0].accountName;
   document.title = document.getElementById("bundle_prefs")
                            .getFormattedString("identity-list-title", [accountName]);
 
-  // extract the account from 
+  // extract the account from
   refreshIdentityList();
 
   // try selecting the first identity
   gIdentityListBox.selectedIndex = 0;
 }
 
 function refreshIdentityList()
 {
@@ -73,97 +70,92 @@ function refreshIdentityList()
   while (gIdentityListBox.hasChildNodes())
     gIdentityListBox.removeChild(gIdentityListBox.lastChild);
 
   var identities = gAccount.identities;
   var identitiesCount = identities.Count();
   for (var j = 0; j < identitiesCount; j++) 
   {
     var identity = identities.QueryElementAt(j, Components.interfaces.nsIMsgIdentity);
-    if (identity.valid) 
+    if (identity.valid)
     {
       var listitem = document.createElement("listitem");
       listitem.setAttribute("label", identity.identityName);
       listitem.setAttribute("key", identity.key);
       gIdentityListBox.appendChild(listitem);
     }
   }
 }
 
 // opens the identity editor dialog
 // identity: pass in the identity (if any) to load in the dialog
 function openIdentityEditor(identity)
 {
-  var result = false; 
+  var result = false;
   var args = { identity: identity, account: gAccount, result: result };
 
   window.openDialog("am-identity-edit.xul", "", "chrome,modal,resizable=no,centerscreen", args);
 
   var selectedItemIndex = gIdentityListBox.selectedIndex;
 
   if (args.result)
   {
-    refreshIdentityList();   
+    refreshIdentityList();
     gIdentityListBox.selectedIndex = selectedItemIndex;
   }
 }
 
 function getSelectedIdentity()
 {
   var identityKey = gIdentityListBox.selectedItems[0].getAttribute("key");
   var identities = gAccount.identities;
   var identitiesCount = identities.Count();
-	for (var j = 0; j < identitiesCount; j++) 
+  for (var j = 0; j < identitiesCount; j++)
   {
     var identity = identities.QueryElementAt(j, Components.interfaces.nsIMsgIdentity);
-    if (identity.valid && identity.key == identityKey) 
+    if (identity.valid && identity.key == identityKey)
       return identity;
   }
 
   return null; // no identity found
 }
 
 function onEdit(event)
 {
   var id = (event.target.localName == 'listbox') ? null : getSelectedIdentity();
   openIdentityEditor(id);
 }
 
 function updateButtons()
 {
-  if (gIdentityListBox.selectedItems.length <= 0) 
+  if (gIdentityListBox.selectedItems.length <= 0)
   {
     gEditButton.setAttribute("disabled", "true");
     gDeleteButton.setAttribute("disabled", "true");
-  } 
-  else 
+  }
+  else
   {
     gEditButton.removeAttribute("disabled");
     if (gIdentityListBox.getRowCount() > 1)
       gDeleteButton.removeAttribute("disabled");
   }
 }
 
 function onDelete(event)
 {
   if (gIdentityListBox.getRowCount() <= 1)  // don't support deleting the last identity
     return;
 
   gAccount.removeIdentity(getSelectedIdentity());
   // rebuild the list
-  refreshIdentityList(); 
+  refreshIdentityList();
 }
 
 function onOk()
 {
   window.arguments[0].result = true;
   return true;
 }
 
-function onCancel()
-{
-  return true;
-}
-
 function onSetDefault(event)
 {
   // not implemented yet
 }
--- a/mailnews/base/prefs/content/am-identities-list.xul
+++ b/mailnews/base/prefs/content/am-identities-list.xul
@@ -36,22 +36,25 @@
  and other provisions required by the GPL or the LGPL. If you do not delete
  the provisions above, a recipient may use your version of this file under
  the terms of any one of the MPL, the GPL or the LGPL.
 
  ***** END LICENSE BLOCK ***** -->
 
 <!DOCTYPE dialog SYSTEM "chrome://messenger/locale/am-identities-list.dtd">
 
-<dialog 
+<dialog
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
   onload="onLoad();"
   buttons="accept"
+  buttonlabelaccept="&identitiesListClose.label;"
+  buttonaccesskeyaccept="&identitiesListClose.accesskey;"
   ondialogaccept="return onOk();"
+  ondialogcancel="return onOk();"
   style="width: 40em;">
 
 <stringbundle id="bundle_prefs" src="chrome://messenger/locale/prefs.properties"/>
 <script type="application/javascript" src="am-identities-list.js"/>
 
 <label control="identitiesList">&identitiesListDesc.label;</label>
 
 <separator class="thin"/>
--- a/suite/locales/en-US/chrome/mailnews/pref/am-identities-list.dtd
+++ b/suite/locales/en-US/chrome/mailnews/pref/am-identities-list.dtd
@@ -1,7 +1,9 @@
 <!ENTITY identitiesListDesc.label "Multiple Identities Support">
 <!ENTITY identitiesListAdd.label  "Add…">
 <!ENTITY identitiesListAdd.accesskey  "A">
 <!ENTITY identitiesListEdit.label "Edit…">
 <!ENTITY identitiesListEdit.accesskey "E">
 <!ENTITY identitiesListDelete.label "Delete">
 <!ENTITY identitiesListDelete.accesskey "D">
+<!ENTITY identitiesListClose.label "Close">
+<!ENTITY identitiesListClose.accesskey "C">