From 832b1d63977d373d42a8ba37757e5b0a89f1e503 Mon Sep 17 00:00:00 2001 From: "bienvenu%nventure.com" Date: Thu, 2 Mar 2006 14:57:39 +0000 Subject: [PATCH] marking a message as junk w/o selecting it can move selection, sr=mscott 209748 --- mailnews/base/src/nsMsgDBView.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/mailnews/base/src/nsMsgDBView.cpp b/mailnews/base/src/nsMsgDBView.cpp index b6331e714bb7..63c6758c814c 100644 --- a/mailnews/base/src/nsMsgDBView.cpp +++ b/mailnews/base/src/nsMsgDBView.cpp @@ -2903,9 +2903,18 @@ nsMsgDBView::PerformActionsOnJunkMsgs() } if (movingJunkMessages) { - // tell the FE to call SetNextMessageAfterDelete() because a delete is coming - rv = mCommandUpdater->UpdateNextMessageAfterDelete(); - NS_ENSURE_SUCCESS(rv,rv); + // check if one of the messages to be junked is actually selected + // if more than one message being junked, one must be selected + PRBool junkedMsgSelected = mNumJunkIndices > 1; + for (nsMsgViewIndex junkIndex = 0; !junkedMsgSelected && junkIndex < mNumJunkIndices; junkIndex++) + mTreeSelection->IsSelected(mJunkIndices[junkIndex], &junkedMsgSelected); + + // if a junked msg is selected, tell the FE to call SetNextMessageAfterDelete() because a delete is coming + if (junkedMsgSelected) + { + rv = mCommandUpdater->UpdateNextMessageAfterDelete(); + NS_ENSURE_SUCCESS(rv,rv); + } NoteStartChange(nsMsgViewNotificationCode::none, 0, 0); if (junkTargetFolder)