diff --git a/mail/base/content/commandglue.js b/mail/base/content/commandglue.js index 628d3c681f6..7ccd474ca94 100644 --- a/mail/base/content/commandglue.js +++ b/mail/base/content/commandglue.js @@ -24,6 +24,7 @@ # Jan Varga # Håkan Waara (hwaara@chello.se) # David Bienvenu (bienvenu@nventure.com) +# Jeremy Morton (bugzilla@game-point.net) # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or @@ -56,6 +57,7 @@ var gPrevSelectedFolder; var gMsgFolderSelected; /* keep in sync with nsMsgFolderFlags.h */ +var MSG_FOLDER_FLAG_MAIL = 0x0004; var MSG_FOLDER_FLAG_VIRTUAL = 0x0020; var MSG_FOLDER_FLAG_TRASH = 0x0100; var MSG_FOLDER_FLAG_SENTMAIL = 0x0200; @@ -320,6 +322,9 @@ function RerootFolder(uri, newFolder, viewType, viewFlags, sortType, sortOrder) // we show "Recipient" instead of "Author" SetSentFolderColumns(IsSpecialFolder(newFolder, MSG_FOLDER_FLAG_SENTMAIL | MSG_FOLDER_FLAG_DRAFTS | MSG_FOLDER_FLAG_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); // now create the db view, which will sort it. CreateDBView(newFolder, viewType, viewFlags, sortType, sortOrder); @@ -451,6 +456,39 @@ function ShowLocationColumn(show) } } +function UpdateReceivedColumn(newFolder) +{ + // 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. + var receivedColumn = document.getElementById("receivedCol"); + + var newFolderShowsRcvd = (newFolder.flags & MSG_FOLDER_FLAG_MAIL) && + !(newFolder.flags & (MSG_FOLDER_FLAG_QUEUE | MSG_FOLDER_FLAG_DRAFTS | + MSG_FOLDER_FLAG_SENTMAIL)); + + var tempHidden = receivedColumn.getAttribute("temphidden") == "true"; + var isHidden = receivedColumn.getAttribute("hidden") == "true"; + + if (!newFolderShowsRcvd && !isHidden) + { + // Record state & hide + receivedColumn.setAttribute("temphidden", "true"); + receivedColumn.setAttribute("hidden", "true"); + } + else if (newFolderShowsRcvd && tempHidden && isHidden) + { + receivedColumn.removeAttribute("hidden"); + } + + if (newFolderShowsRcvd) + { + receivedColumn.removeAttribute("ignoreincolumnpicker"); + receivedColumn.removeAttribute("temphidden"); + } + else + receivedColumn.setAttribute("ignoreincolumnpicker", "true"); +} + function SetNewsFolderColumns() { var sizeColumn = document.getElementById("sizeCol"); @@ -559,6 +597,9 @@ function ConvertColumnIDToSortType(columnID) case "dateCol": sortKey = nsMsgViewSortType.byDate; break; + case "receivedCol": + sortKey = nsMsgViewSortType.byReceived; + break; case "senderCol": sortKey = nsMsgViewSortType.byAuthor; break; @@ -631,14 +672,17 @@ function ConvertSortTypeToColumnID(sortKey) { var columnID; - // hack to turn this into an integer, if it was a string - // it would be a string if it came from localStore.rdf + // Hack to turn this into an integer, if it was a string. + // It would be a string if it came from localStore.rdf sortKey = sortKey - 0; switch (sortKey) { case nsMsgViewSortType.byDate: columnID = "dateCol"; break; + case nsMsgViewSortType.byReceived: + columnID = "receivedCol"; + break; case nsMsgViewSortType.byAuthor: columnID = "senderCol"; break; diff --git a/mail/base/content/mailWindowOverlay.js b/mail/base/content/mailWindowOverlay.js index 63da54d7e01..4f2c5ec44e9 100644 --- a/mail/base/content/mailWindowOverlay.js +++ b/mail/base/content/mailWindowOverlay.js @@ -29,6 +29,7 @@ # David Bienvenu # Karsten Düsterloh # Christopher Thomas +# Jeremy Morton # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or @@ -249,6 +250,7 @@ function InitViewSortByMenu() var sortType = gDBView.sortType; setSortByMenuItemCheckState("sortByDateMenuitem", (sortType == nsMsgViewSortType.byDate)); + setSortByMenuItemCheckState("sortByReceivedMenuitem", (sortType == nsMsgViewSortType.byReceived)); setSortByMenuItemCheckState("sortByFlagMenuitem", (sortType == nsMsgViewSortType.byFlagged)); setSortByMenuItemCheckState("sortByOrderReceivedMenuitem", (sortType == nsMsgViewSortType.byId)); setSortByMenuItemCheckState("sortByPriorityMenuitem", (sortType == nsMsgViewSortType.byPriority)); @@ -264,7 +266,7 @@ function InitViewSortByMenu() var sortOrder = gDBView.sortOrder; var sortTypeSupportsGrouping = (sortType == nsMsgViewSortType.byAuthor - || sortType == nsMsgViewSortType.byDate || sortType == nsMsgViewSortType.byPriority + || sortType == nsMsgViewSortType.byDate || sortType == nsMsgViewSortType.byReceived || sortType == nsMsgViewSortType.byPriority || sortType == nsMsgViewSortType.bySubject || sortType == nsMsgViewSortType.byTags || sortType == nsMsgViewSortType.byRecipient || sortType == nsMsgViewSortType.byAccount || sortType == nsMsgViewSortType.byStatus || sortType == nsMsgViewSortType.byFlagged diff --git a/mail/base/content/mailWindowOverlay.xul b/mail/base/content/mailWindowOverlay.xul index c729057a4f2..9948701ee1f 100644 --- a/mail/base/content/mailWindowOverlay.xul +++ b/mail/base/content/mailWindowOverlay.xul @@ -1350,6 +1350,7 @@ + diff --git a/mail/base/content/messenger.xul b/mail/base/content/messenger.xul index 3618046e17b..77f1696f326 100644 --- a/mail/base/content/messenger.xul +++ b/mail/base/content/messenger.xul @@ -347,7 +347,10 @@ class="treecol-image junkStatusHeader" label="&junkStatusColumn.label;" tooltiptext="&junkStatusColumn.tooltip;"/> -