Bug 472988 - thread pane loses saved search's folder location column when switching tabs. r=asuth,a=bienvenu
authorDavid :Bienvenu <bienvenu@nventure.com>
Tue, 17 Feb 2009 23:43:33 -0800
changeset 1986 80da30e973b679dca51f32794033f2eb0c8e32bf
parent 1985 9a04c76b65f020c5826e8da381059f47e4404639
child 1987 20c650e0e2084a7ebfe1979df2df21a3297dbca3
push id1611
push userbugmail@asutherland.org
push dateWed, 18 Feb 2009 07:43:52 +0000
treeherdercomm-central@80da30e973b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth, bienvenu
bugs472988
Bug 472988 - thread pane loses saved search's folder location column when switching tabs. r=asuth,a=bienvenu
mail/base/content/commandglue.js
mail/base/content/mailWindowOverlay.js
--- a/mail/base/content/commandglue.js
+++ b/mail/base/content/commandglue.js
@@ -219,16 +219,28 @@ function isNewsURI(uri)
     if (!uri || uri[0] != 'n') {
         return false;
     }
     else {
         return ((uri.substring(0,6) == "news:/") || (uri.substring(0,14) == "news-message:/"));
     }
 }
 
+function UpdateColumnsForView(folder, viewType)
+{
+  const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+  // if this is the drafts, sent, or send later folder,
+  // we show "Recipient" instead of "Author"
+  SetSentFolderColumns(IsSpecialFolder(folder, nsMsgFolderFlags.SentMail | nsMsgFolderFlags.Drafts | nsMsgFolderFlags.Queue, true));
+  ShowLocationColumn(viewType == nsMsgViewType.eShowVirtualFolderResults);
+  // Only show 'Received' column for e-mails.  For newsgroup messages, the 'Date' header is as reliable as an e-mail's
+  // 'Received' header, as it is replaced with the news server's (more reliable) date.
+  UpdateReceivedColumn(folder);
+}
+
 function RerootFolder(uri, newFolder, viewType, viewFlags, sortType, sortOrder)
 {
   viewDebug("In reroot folder, sortType = " +  sortType + "viewType = " + viewType + "\n");
 
   if (sortType == 0)
   {
     try
     {
@@ -274,24 +286,17 @@ function RerootFolder(uri, newFolder, vi
   if (gDBView) {
     gDBView.close();
     gDBView = null;
   }
 
   // cancel the pending mark as read timer
   ClearPendingReadTimer();
 
-  // if this is the drafts, sent, or send later folder,
-  // we show "Recipient" instead of "Author"
-  const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
-  SetSentFolderColumns(IsSpecialFolder(newFolder, nsMsgFolderFlags.SentMail | nsMsgFolderFlags.Drafts | nsMsgFolderFlags.Queue, true));
-  ShowLocationColumn(viewType == nsMsgViewType.eShowVirtualFolderResults);
-  // Only show 'Received' column for e-mails.  For newsgroup messages, the 'Date' header is as reliable as an e-mail's
-  // 'Received' header, as it is replaced with the news server's (more reliable) date.
-  UpdateReceivedColumn(newFolder);
+  UpdateColumnsForView(newFolder, viewType);
   // now create the db view, which will sort it.
   CreateDBView(newFolder, viewType, viewFlags, sortType, sortOrder);
 
   if (oldFolder)
   {
     /* we don't null out the db reference for inbox because inbox is like the "main" folder
                and performance outweighs footprint*/
     if (!IsSpecialFolder(oldFolder, Components.interfaces.nsMsgFolderFlags.Inbox, false))
--- a/mail/base/content/mailWindowOverlay.js
+++ b/mail/base/content/mailWindowOverlay.js
@@ -1623,18 +1623,19 @@ let mailTabType = {
       gMsgFolderSelected = folderToSelect;
       folderTreeSelection.selectEventsSuppressed = true;
       folderTreeSelection.select(row);
       treeBoxObj.ensureRowIsVisible(row);
       folderTreeSelection.selectEventsSuppressed = false;
     }
     if (gDBView)
     {
+      UpdateColumnsForView(gMsgFolderSelected, gDBView.viewType);
+      UpdateSortIndicators(gDBView.sortType, gDBView.sortOrder);
       // This sets the thread pane tree's view to the gDBView view.
-      UpdateSortIndicators(gDBView.sortType, gDBView.sortOrder);
       RerootThreadPane();
       // Only refresh the view picker if the views toolbar is visible.
       if (document.getElementById("mailviews-container")) 
         UpdateViewPickerByValue(aTab.mailView);
 
       // We need to restore the selection to what it was when we switched away
       // from this tab. We need to remember the selected keys, instead of the
       // selected indices, since the view might have changed. But maybe the