rem: var addressbook = Components.classes["@mozilla.org/addressbook;1"].createInstance(Components.interfaces.nsIAddressBook); 
context: function OnLoadNewCard(){  InitEditCard();  gEditCard.card =    (("arguments" in window) && (window.arguments.length > 0) &&     (window.arguments[0] instanceof Components.interfaces.nsIAbCard))    ? window.arguments[0]    : Components.classes["@mozilla.org/addressbook/cardproperty;1"]                .createInstance(Components.interfaces.nsIAbCard);  gEditCard.titleProperty = "newCardTitle";  gEditCard.selectedAB = "";  if ("arguments" in window && window.arguments[0])  {    gEditCard.selectedAB = kPersonalAddressbookURI;    if ("selectedAB" in window.arguments[0]) {      // check if selected ab is a mailing list      var abURI = window.arguments[0].selectedAB;            var directory = GetDirectoryFromURI(abURI);      if (directory.isMailList) {        var parentURI = GetParentDirectoryFromMailingListURI(abURI);        if (parentURI)          gEditCard.selectedAB = parentURI;      }      else if (directory.operations & directory.opWrite)        gEditCard.selectedAB = window.arguments[0].selectedAB;    }    // we may have been given properties to pre-initialize the window with....    // we'll fill these in here...    if ("primaryEmail" in window.arguments[0])      gEditCard.card.primaryEmail = window.arguments[0].primaryEmail;    if ("displayName" in window.arguments[0]) {      gEditCard.card.displayName = window.arguments[0].displayName;      // if we've got a display name, don't generate      // a display name (and stomp on the existing display name)      // when the user types a first or last name      if (gEditCard.card.displayName.length)        gEditCard.generateDisplayName = false;    }    if ("aimScreenName" in window.arguments[0])      gEditCard.card.aimScreenName = window.arguments[0].aimScreenName;        if ("okCallback" in window.arguments[0])      gOkCallback = window.arguments[0].okCallback;    if ("escapedVCardStr" in window.arguments[0]) {      // hide non vcard values      HideNonVcardFields();      var addressbook = Components.classes["@mozilla.org/addressbook;1"].createInstance(Components.interfaces.nsIAddressBook);      gEditCard.card =        addressbook.escapedVCardToAbCard(window.arguments[0].escapedVCardStr);    }    if ("titleProperty" in window.arguments[0])      gEditCard.titleProperty = window.arguments[0].titleProperty;        if ("hideABPicker" in window.arguments[0])      gHideABPicker = window.arguments[0].hideABPicker;  }  // set popup with address book names  var abPopup = document.getElementById('abPopup');  abPopup.value = gEditCard.selectedAB || kPersonalAddressbookURI;  if (gHideABPicker && abPopup) {    abPopup.hidden = true;    var abPopupLabel = document.getElementById("abPopupLabel");    abPopupLabel.hidden = true;  }  SetCardDialogTitle(gEditCard.card.displayName);      GetCardValues(gEditCard.card, document);  // FIX ME - looks like we need to focus on both the text field and the tab widget  // probably need to do the same in the addressing widget  // focus on first or last name based on the pref  var focus = document.getElementById(gEditCard.displayLastNameFirst                                      ? "LastName" : "FirstName");  if ( focus ) {    // XXX Using the setTimeout hack until bug 103197 is fixed    setTimeout( function(firstTextBox) { firstTextBox.focus(); }, 0, focus );  }  moveToAlertPosition();}
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8395/6cd2fb3ca117d85362b1d0d66c086baec5694338/abCardOverlay.js/clean/mail/components/addrbook/content/abCardOverlay.js