From 86e6e3091694bde8799fddf5124510ee7756d52b Mon Sep 17 00:00:00 2001 From: "sspitzer%netscape.com" Date: Fri, 7 Dec 2001 21:31:58 +0000 Subject: [PATCH] clear card pane if selecting a directory with no cards, compose not working if you select a directory with now cards I thought this was a problem with nsOutlinerSelection, but it was really a problem with my js, selecting the first card even when there wasn't one. git-svn-id: svn://10.0.0.236/branches/AB_OUTLINER_BRANCH@110027 18797224-902f-48f8-a5cc-f745e15eee43 --- .../addrbook/resources/content/abCommon.js | 14 +++++++++++--- .../resources/content/abSelectAddressesDialog.js | 5 ++--- 2 files changed, 13 insertions(+), 6 deletions(-) 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); }