From d52a95d26f67ff7bc71b166a3065f556c227cd6d Mon Sep 17 00:00:00 2001 From: "sspitzer%netscape.com" Date: Sat, 5 Jan 2002 03:48:41 +0000 Subject: [PATCH] fix for #118276. multiple selection in the addressbook should clear out the card preview pane. r/sr=bienvenu --- mailnews/addrbook/resources/content/abResultsPane.js | 2 +- mailnews/addrbook/resources/content/addressbook.js | 12 +++++++----- mailnews/addrbook/src/nsAbView.cpp | 2 ++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/mailnews/addrbook/resources/content/abResultsPane.js b/mailnews/addrbook/resources/content/abResultsPane.js index eda03724884..e3c71b897a2 100644 --- a/mailnews/addrbook/resources/content/abResultsPane.js +++ b/mailnews/addrbook/resources/content/abResultsPane.js @@ -74,7 +74,7 @@ function AbResultsPaneOnClick(event) AbResultsPaneDoubleClick(gAbView.getCardFromRow(row.value)); } else { - OnClickedCard(gAbView.getCardFromRow(row.value)); + UpdateCardView(); } } } diff --git a/mailnews/addrbook/resources/content/addressbook.js b/mailnews/addrbook/resources/content/addressbook.js index 188db848cb0..80554c503d0 100644 --- a/mailnews/addrbook/resources/content/addressbook.js +++ b/mailnews/addrbook/resources/content/addressbook.js @@ -218,17 +218,19 @@ function ResultsPaneSelectionChanged() function UpdateCardView() { - var card = GetSelectedCard(); + var cards = GetSelectedAbCards(); // display the selected card, if exactly one card is selected. // either no cards, or more than one card is selected, clear the pane. - OnClickedCard(card) + if (cards.length == 1) + OnClickedCard(cards[0]) + else + ClearCardViewPane(); } -// if card is null, OnClickedCard() must clear the card pane function OnClickedCard(card) -{ - if (card) +{ + if (card) DisplayCardViewPane(card); else ClearCardViewPane(); diff --git a/mailnews/addrbook/src/nsAbView.cpp b/mailnews/addrbook/src/nsAbView.cpp index 8d28555d2ce..8405523ed91 100644 --- a/mailnews/addrbook/src/nsAbView.cpp +++ b/mailnews/addrbook/src/nsAbView.cpp @@ -839,6 +839,7 @@ nsresult nsAbView::AddCard(AbCard *abcard, PRBool selectCardAfterAdding, PRInt32 rv = mCards.InsertElementAt((void *)abcard, *index); NS_ENSURE_SUCCESS(rv,rv); + // this needs to happen after we insert the card, as RowCountChanged() will call GetRowCount() if (mOutliner) rv = mOutliner->RowCountChanged(*index, 1); @@ -911,6 +912,7 @@ nsresult nsAbView::RemoveCardAndSelectNextCard(nsISupports *item) rv = RemoveCardAt(index); NS_ENSURE_SUCCESS(rv,rv); + // this needs to happen after we remove the card, as RowCountChanged() will call GetRowCount() if (mOutliner) { rv = mOutliner->RowCountChanged(index, -1); NS_ENSURE_SUCCESS(rv,rv);