diff --git a/mozilla/mailnews/addrbook/resources/content/abCommon.js b/mozilla/mailnews/addrbook/resources/content/abCommon.js index 7bf86b285eb..066e89fdf06 100644 --- a/mozilla/mailnews/addrbook/resources/content/abCommon.js +++ b/mozilla/mailnews/addrbook/resources/content/abCommon.js @@ -297,8 +297,10 @@ function GetSelectedAddresses() var selectedAddresses = ""; var cards = GetSelectedAbCards(); - var count = cards.length; + if (!cards) + return selectedAddresses; + var count = cards.length; for (var i = 0; i < count; i++) { var generatedAddress = GenerateAddressFromCard(cards[i]); @@ -501,8 +503,14 @@ function ChangeDirectoryByDOMNode(dirNode) UpdateSortIndicators(actualSortColumn, sortDirection); - setTimeout('SelectFirstCard();',0); - + // only select the first card if there is a first card + if (gAbView && gAbView.getCardFromRow(0)) { + SelectFirstCard(); + } + else { + // the selection changes if we were switching directories. + ResultsPaneSelectionChanged() + } return; } diff --git a/mozilla/mailnews/addrbook/resources/content/abSelectAddressesDialog.js b/mozilla/mailnews/addrbook/resources/content/abSelectAddressesDialog.js index d4e29268066..b9e048e82ba 100644 --- a/mozilla/mailnews/addrbook/resources/content/abSelectAddressesDialog.js +++ b/mozilla/mailnews/addrbook/resources/content/abSelectAddressesDialog.js @@ -195,8 +195,8 @@ function AddSelectedAddressesIntoBucket(prefix) for (var i = 0; i < count; i++) { AddCardIntoBucket(prefix, cards[i]); - } - } + } +} function AddCardIntoBucket(prefix, card) { @@ -368,7 +368,6 @@ function DropOnBucketPane(event) if (!address) continue; - //dump(" Address #" + i + " = " + address + "\n"); AddAddressIntoBucket(prefixTo + address, address); }