зеркало из https://github.com/mozilla/gecko-dev.git
Bug 237210 In <abCommon.js>, "Warning: function GetSelectedCardTypes does not always return a value"; plus various cleanups including a few additionnal fixes. (Cv1-TB) <abCommon.js> additional cleanup. patch by Serge GAUTHERIE <gautheri@noos.fr> r/sr=bryner
This commit is contained in:
Родитель
9356969f0d
Коммит
87237d4cb5
|
@ -193,9 +193,9 @@ var DirPaneController =
|
|||
var ldapUrlPrefix = "moz-abldapdirectory://";
|
||||
if ((selectedDir.indexOf(ldapUrlPrefix, 0)) == 0)
|
||||
{
|
||||
var prefName = selectedDir.substr(ldapUrlPrefix.length, selectedDir.length);
|
||||
var disable = false;
|
||||
try {
|
||||
var prefName = selectedDir.substr(ldapUrlPrefix.length);
|
||||
disable = gPrefs.getBoolPref(prefName + ".disable_delete");
|
||||
}
|
||||
catch(ex) {
|
||||
|
@ -269,7 +269,7 @@ function AbEditSelectedDirectory()
|
|||
var ldapUrlPrefix = "moz-abldapdirectory://";
|
||||
var args = { selectedDirectory: directory.dirName,
|
||||
selectedDirectoryString: null};
|
||||
args.selectedDirectoryString = selecteduri.substr(ldapUrlPrefix.length, selecteduri.length);
|
||||
args.selectedDirectoryString = selecteduri.substr(ldapUrlPrefix.length);
|
||||
window.openDialog("chrome://messenger/content/addressbook/pref-directory-add.xul",
|
||||
"editDirectory", "chrome,modal=yes,resizable=no,centerscreen", args);
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ function GetSelectedCardTypes()
|
|||
return kNothingSelected; // no view
|
||||
|
||||
var count = cards.length;
|
||||
if (!count)
|
||||
if (count == 0)
|
||||
return kNothingSelected; // nothing selected
|
||||
|
||||
var mailingListCnt = 0;
|
||||
|
@ -393,10 +393,7 @@ function GetSelectedCardIndex()
|
|||
function GetSelectedCard()
|
||||
{
|
||||
var index = GetSelectedCardIndex();
|
||||
if (index == -1)
|
||||
return null;
|
||||
else
|
||||
return gAbView.getCardFromRow(index);
|
||||
return (index == -1) ? null : gAbView.getCardFromRow(index);
|
||||
}
|
||||
|
||||
function AbEditSelectedCard()
|
||||
|
@ -406,11 +403,9 @@ function AbEditSelectedCard()
|
|||
|
||||
function AbEditCard(card)
|
||||
{
|
||||
if (!card)
|
||||
return;
|
||||
|
||||
// Not allowing AOL special groups to be edited.
|
||||
if (card.isASpecialGroup)
|
||||
// Need a card,
|
||||
// but not allowing AOL special groups to be edited.
|
||||
if (!card || card.isASpecialGroup)
|
||||
return;
|
||||
|
||||
if (card.isMailList) {
|
||||
|
@ -463,7 +458,6 @@ function goToggleSplitter( id, elementID )
|
|||
if ( splitter )
|
||||
{
|
||||
var attribValue = splitter.getAttribute("state") ;
|
||||
|
||||
if ( attribValue == "collapsed" )
|
||||
{
|
||||
splitter.setAttribute("state", "open" );
|
||||
|
@ -496,11 +490,9 @@ function GetSelectedAddressesFromDirTree()
|
|||
if (directory.isMailList) {
|
||||
var listCardsCount = directory.addressLists.Count();
|
||||
var cards = new Array(listCardsCount);
|
||||
for ( var i = 0; i < listCardsCount; i++ ) {
|
||||
var card = directory.addressLists.GetElementAt(i);
|
||||
card = card.QueryInterface(Components.interfaces.nsIAbCard);
|
||||
cards[i] = card;
|
||||
}
|
||||
for (var i = 0; i < listCardsCount; ++i)
|
||||
cards[i] = directory.addressLists.QueryElementAt(
|
||||
i, Components.interfaces.nsIAbCard);
|
||||
addresses = GetAddressesForCards(cards);
|
||||
}
|
||||
}
|
||||
|
@ -605,10 +597,8 @@ function GetSelectedAbCards()
|
|||
var start = new Object;
|
||||
var end = new Object;
|
||||
abView.selection.getRangeAt(i,start,end);
|
||||
for (j=start.value;j<=end.value;j++) {
|
||||
cards[current] = abView.getCardFromRow(j);
|
||||
current++;
|
||||
}
|
||||
for (j = start.value; j <= end.value; ++j)
|
||||
cards[current++] = abView.getCardFromRow(j);
|
||||
}
|
||||
return cards;
|
||||
}
|
||||
|
@ -729,10 +719,7 @@ function GetAbView()
|
|||
// done. to get the uri of the directory only, use GetSelectedDirectory().
|
||||
function GetAbViewURI()
|
||||
{
|
||||
if (gAbView)
|
||||
return gAbView.URI;
|
||||
else
|
||||
return null;
|
||||
return gAbView && gAbView.URI;
|
||||
}
|
||||
|
||||
function ChangeDirectoryByURI(uri)
|
||||
|
@ -902,10 +889,7 @@ function GenerateAddressFromCard(card)
|
|||
if (card.isMailList)
|
||||
{
|
||||
var directory = GetDirectoryFromURI(card.mailListURI);
|
||||
if(directory.description)
|
||||
email = directory.description;
|
||||
else
|
||||
email = card.displayName;
|
||||
email = directory.description || card.displayName;
|
||||
}
|
||||
else
|
||||
email = card.primaryEmail;
|
||||
|
|
Загрузка…
Ссылка в новой задаче