From 1233c40440250591161de425ec4708df4354acc2 Mon Sep 17 00:00:00 2001 From: David Bienvenu Date: Tue, 2 Jun 2009 14:29:22 -0700 Subject: [PATCH] don't load first message in collapsed thread before displaying summary, r=asuth, sr=standard8, 495304 --- mail/base/content/SearchDialog.js | 2 +- mail/base/content/messageWindow.js | 2 +- mail/base/content/threadPane.js | 5 +++-- mailnews/base/public/nsIMsgDBView.idl | 6 ++++-- mailnews/base/src/nsMsgDBView.cpp | 13 +++++++------ suite/mailnews/messageWindow.js | 2 +- suite/mailnews/search/SearchDialog.js | 2 +- suite/mailnews/threadPane.js | 2 +- 8 files changed, 19 insertions(+), 15 deletions(-) diff --git a/mail/base/content/SearchDialog.js b/mail/base/content/SearchDialog.js index 658d417791..aa57dc384b 100644 --- a/mail/base/content/SearchDialog.js +++ b/mail/base/content/SearchDialog.js @@ -527,7 +527,7 @@ nsMsgSearchCommandUpdater.prototype = SetNextMessageAfterDelete(); }, - summarizeSelection : function() {}, + summarizeSelection : function() {return false}, QueryInterface : function(iid) { diff --git a/mail/base/content/messageWindow.js b/mail/base/content/messageWindow.js index e99ed44c61..c6a06b8267 100644 --- a/mail/base/content/messageWindow.js +++ b/mail/base/content/messageWindow.js @@ -188,7 +188,7 @@ nsMsgDBViewCommandUpdater.prototype = SetNextMessageAfterDelete(); }, - summarizeSelection : function() {}, + summarizeSelection : function() {return false}, QueryInterface : function(iid) { diff --git a/mail/base/content/threadPane.js b/mail/base/content/threadPane.js index 1ded387fbf..0dd5e11d4f 100644 --- a/mail/base/content/threadPane.js +++ b/mail/base/content/threadPane.js @@ -121,12 +121,12 @@ nsMsgDBViewCommandUpdater.prototype = let selectedMsgUris = GetSelectedMessages(); if (!selectedMsgUris || (selectedMsgUris.length == 1)) { pickMessagePane("singlemessage"); - return; + return false; } if (! gPrefBranch.getBoolPref("mail.operate_on_msgs_in_collapsed_threads")) { ClearMessagePane(); - return; + return false; } let firstThreadId = messenger.msgHdrFromURI(selectedMsgUris[0]).threadId; @@ -138,6 +138,7 @@ nsMsgDBViewCommandUpdater.prototype = } // must be just one thread. summarizeThread(selectedMsgUris); + return true; }, QueryInterface : function(iid) diff --git a/mailnews/base/public/nsIMsgDBView.idl b/mailnews/base/public/nsIMsgDBView.idl index a002b9eaa1..ff00ffb4d0 100644 --- a/mailnews/base/public/nsIMsgDBView.idl +++ b/mailnews/base/public/nsIMsgDBView.idl @@ -442,7 +442,9 @@ interface nsIMsgDBViewCommandUpdater : nsISupports /** * tell the front end that the selection has changed, and may need to be - * resummarized + * resummarized. + * + * @return true if we did summarize, false otherwise. */ - void summarizeSelection(); + boolean summarizeSelection(); }; diff --git a/mailnews/base/src/nsMsgDBView.cpp b/mailnews/base/src/nsMsgDBView.cpp index bd55c6b66e..09ba998d0b 100644 --- a/mailnews/base/src/nsMsgDBView.cpp +++ b/mailnews/base/src/nsMsgDBView.cpp @@ -1045,8 +1045,14 @@ NS_IMETHODIMP nsMsgDBView::SelectionChanged() if (!NonDummyMsgSelected(indices, numSelected)) commandsNeedDisablingBecauseOfSelection = PR_TRUE; } + PRBool selectionSummarized = PR_FALSE; + // let the front-end adjust the message pane appropriately with either + // the message body, or a summary of the selection + if (mCommandUpdater) + mCommandUpdater->SummarizeSelection(&selectionSummarized); + // if only one item is selected then we want to display a message - if (numSelected == 1) + if (numSelected == 1 && !selectionSummarized) { PRInt32 startRange; PRInt32 endRange; @@ -1073,11 +1079,6 @@ NS_IMETHODIMP nsMsgDBView::SelectionChanged() m_currentlyDisplayedViewIndex = nsMsgViewIndex_None; } - // let the front-end adjust the message pane appropriately with either - // the message body, or a summary of the selection - if (mCommandUpdater) - mCommandUpdater->SummarizeSelection(); - // determine if we need to push command update notifications out to the UI or not. // we need to push a command update notification iff, one of the following conditions are met diff --git a/suite/mailnews/messageWindow.js b/suite/mailnews/messageWindow.js index 1afa40f68b..fde972c918 100644 --- a/suite/mailnews/messageWindow.js +++ b/suite/mailnews/messageWindow.js @@ -184,7 +184,7 @@ nsMsgDBViewCommandUpdater.prototype = SetNextMessageAfterDelete(); }, - summarizeSelection: function() {}, + summarizeSelection: function() {return false}, QueryInterface : function(iid) { diff --git a/suite/mailnews/search/SearchDialog.js b/suite/mailnews/search/SearchDialog.js index 8aa5558813..9d812e4d8a 100644 --- a/suite/mailnews/search/SearchDialog.js +++ b/suite/mailnews/search/SearchDialog.js @@ -527,7 +527,7 @@ nsMsgSearchCommandUpdater.prototype = SetNextMessageAfterDelete(); }, - summarizeSelection: function() {}, + summarizeSelection: function() {return false}, QueryInterface : function(iid) { diff --git a/suite/mailnews/threadPane.js b/suite/mailnews/threadPane.js index b6d6df0024..b436baed02 100644 --- a/suite/mailnews/threadPane.js +++ b/suite/mailnews/threadPane.js @@ -116,7 +116,7 @@ nsMsgDBViewCommandUpdater.prototype = SetNextMessageAfterDelete(); }, - summarizeSelection: function() {}, + summarizeSelection: function() {return false}, QueryInterface : function(iid) {