Bug 166254: Received date field; p=Jeremy Morton <bugzilla@game-point.net>, r=bienvenu/me, sr=mscott/bienvenu

This commit is contained in:
mnyromyr%tprac.de 2007-09-05 21:21:26 +00:00
Родитель 3283743bc2
Коммит 094275f0f9
23 изменённых файлов: 298 добавлений и 66 удалений

Просмотреть файл

@ -24,6 +24,7 @@
# Jan Varga <varga@nixcorp.com>
# 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;

Просмотреть файл

@ -29,6 +29,7 @@
# David Bienvenu <bienvenu@nventure.com>
# Karsten Düsterloh <mnyromyr@tprac.de>
# Christopher Thomas <cst@yecc.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
@ -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

Просмотреть файл

@ -1350,6 +1350,7 @@
<menu id="viewSortMenu" accesskey="&sortMenu.accesskey;" label="&sortMenu.label;">
<menupopup onpopupshowing="InitViewSortByMenu()">
<menuitem id="sortByDateMenuitem" type="radio" name="sortby" label="&sortByDateCmd.label;" accesskey="&sortByDateCmd.accesskey;" oncommand="MsgSortByDate()"/>
<menuitem id="sortByReceivedMenuitem" type="radio" name="sortby" label="&sortByReceivedCmd.label;" accesskey="&sortByReceivedCmd.accesskey;" oncommand="MsgSortByReceived()"/>
<menuitem id="sortByFlagMenuitem" type="radio" name="sortby" label="&sortByStarCmd.label;" accesskey="&sortByStarCmd.accesskey;" oncommand="MsgSortByFlagged()"/>
<menuitem id="sortByOrderReceivedMenuitem" type="radio" name="sortby" label="&sortByOrderReceivedCmd.label;" accesskey="&sortByOrderReceivedCmd.accesskey;" oncommand="MsgSortByOrderReceived()"/>
<menuitem id="sortByPriorityMenuitem" type="radio" name="sortby" label="&sortByPriorityCmd.label;" accesskey="&sortByPriorityCmd.accesskey;" oncommand="MsgSortByPriority()"/>

Просмотреть файл

@ -347,7 +347,10 @@
class="treecol-image junkStatusHeader"
label="&junkStatusColumn.label;" tooltiptext="&junkStatusColumn.tooltip;"/>
<splitter class="tree-splitter"/>
<treecol id="dateCol" persist="hidden ordinal width" flex="2"
<treecol id="receivedCol" persist="hidden ordinal width temphidden" flex="2" hidden="true"
label="&receivedColumn.label;" tooltiptext="&receivedColumn.tooltip;"/>
<splitter class="tree-splitter"/>
<treecol id="dateCol" persist="hidden ordinal width" flex="2"
label="&dateColumn.label;" tooltiptext="&dateColumn.tooltip;"/>
<splitter class="tree-splitter"/>
<treecol id="statusCol" persist="hidden ordinal width" flex="1" hidden="true"

Просмотреть файл

@ -26,6 +26,7 @@
# Neil Rashbrook (neil@parkwaycc.co.uk)
# Seth Spitzer <sspitzer@netscape.com>
# 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
@ -145,6 +146,7 @@ function ScrollToMessageAfterFolderLoad (folder)
switch (gDBView.sortType)
{
case nsMsgViewSortType.byDate:
case nsMsgViewSortType.byReceived:
case nsMsgViewSortType.byId:
case nsMsgViewSortType.byThread:
scrolled = ScrollToMessage(nsMsgNavigationType.lastMessage, true, false /* selectMessage */);
@ -1144,38 +1146,51 @@ function UpgradeThreadPaneUI()
threadPaneUIVersion = pref.getIntPref("mailnews.ui.threadpane.version");
if (threadPaneUIVersion < 5) {
var threadTree = document.getElementById("threadTree");
// Note: threadTree._reorderColumn will throw an ERROR if the columns specified are already in the same order!
if (threadPaneUIVersion < 6)
{
var threadTree = document.getElementById("threadTree");
var dateCol = document.getElementById("dateCol");
var receivedCol = document.getElementById("receivedCol");
var junkCol = document.getElementById("junkStatusCol");
var beforeCol;
if (threadPaneUIVersion < 4) {
if (threadPaneUIVersion < 5)
{
if (threadPaneUIVersion < 4)
{
if (threadPaneUIVersion < 3)
{
if (threadPaneUIVersion < 3) {
// in thunderbird, we are inserting the junk column just before the
// date column.
var dateCol = document.getElementById("dateCol");
threadTree._reorderColumn(junkCol, dateCol, true);
}
// in thunderbird, we are inserting the junk column just before the
// date column.
threadTree._reorderColumn(junkCol, dateCol, true);
}
var senderCol = document.getElementById("senderCol");
var recipientCol = document.getElementById("recipientCol");
threadTree._reorderColumn(recipientCol, junkCol, true);
threadTree._reorderColumn(senderCol, recipientCol, true);
var senderCol = document.getElementById("senderCol");
var recipientCol = document.getElementById("recipientCol");
threadTree._reorderColumn(recipientCol, junkCol, true);
threadTree._reorderColumn(senderCol, recipientCol, true);
} // version 4 upgrades
} // version 4 upgrades
// version 5 adds a new column called attachments
var attachmentCol = document.getElementById("attachmentCol");
var subjectCol = document.getElementById("subjectCol");
threadTree._reorderColumn(attachmentCol, subjectCol, true);
// version 5 adds a new column called attachments
var attachmentCol = document.getElementById("attachmentCol");
var subjectCol = document.getElementById("subjectCol");
threadTree._reorderColumn(attachmentCol, subjectCol, true);
pref.setIntPref("mailnews.ui.threadpane.version", 5);
} // version 5 upgrades
} // version 5 upgrades
}
if (dateCol)
threadTree._reorderColumn(receivedCol, dateCol, true);
else
threadTree._reorderColumn(receivedCol, junkCol, false);
pref.setIntPref("mailnews.ui.threadpane.version", 6);
} // version 6 upgrades
}
catch (ex) {
dump("UpgradeThreadPane: ex = " + ex + "\n");
}

Просмотреть файл

@ -50,6 +50,7 @@
<!ENTITY unreadColumn.label "Unread">
<!ENTITY totalColumn.label "Total">
<!ENTITY readColumn.label "Read">
<!ENTITY receivedColumn.label "Received">
<!ENTITY starredColumn.label "Starred">
<!ENTITY locationColumn.label "Location">
<!ENTITY idColumn.label "Order Received">
@ -70,6 +71,7 @@
<!ENTITY unreadColumn.tooltip "Number of unread messages in thread">
<!ENTITY totalColumn.tooltip "Total number of messages in thread">
<!ENTITY readColumn.tooltip "Click to sort by read">
<!ENTITY receivedColumn.tooltip "Click to sort by date received">
<!ENTITY starredColumn.tooltip "Click to sort by star">
<!ENTITY locationColumn.tooltip "Click to sort by location">
<!ENTITY idColumn.tooltip "Click to sort by order received">

Просмотреть файл

@ -147,6 +147,8 @@
<!ENTITY sortMenu.accesskey "S">
<!ENTITY sortByDateCmd.label "Date">
<!ENTITY sortByDateCmd.accesskey "e">
<!ENTITY sortByReceivedCmd.label "Received">
<!ENTITY sortByReceivedCmd.accesskey "v">
<!ENTITY sortByStarCmd.label "Star">
<!ENTITY sortByStarCmd.accesskey "S">
<!ENTITY sortByAttachmentsCmd.label "Attachments">
@ -558,6 +560,7 @@
<!ENTITY unreadColumn.label "Unread">
<!ENTITY totalColumn.label "Total">
<!ENTITY readColumn.label "Read">
<!ENTITY receivedColumn.label "Received">
<!ENTITY starredColumn.label "Starred">
<!ENTITY locationColumn.label "Location">
<!ENTITY idColumn.label "Order Received">
@ -579,6 +582,7 @@
<!ENTITY unreadColumn.tooltip "Number of unread messages in thread">
<!ENTITY totalColumn.tooltip "Total number of messages in thread">
<!ENTITY readColumn.tooltip "Click to sort by read">
<!ENTITY receivedColumn.tooltip "Click to sort by date received">
<!ENTITY starredColumn.tooltip "Click to sort by star">
<!ENTITY locationColumn.tooltip "Click to sort by location">
<!ENTITY idColumn.tooltip "Click to sort by order received">

Просмотреть файл

@ -107,6 +107,7 @@ interface nsMsgViewSortType
const nsMsgViewSortTypeValue byAttachments = 0x20;
const nsMsgViewSortTypeValue byAccount = 0x21;
const nsMsgViewSortTypeValue byCustom = 0x22;
const nsMsgViewSortTypeValue byReceived = 0x23;
};
[scriptable, uuid(255d1c1e-fde7-11d4-a5be-0060b0fc04b7)]

Просмотреть файл

@ -23,6 +23,7 @@
* Contributor(s):
* Jan Varga <varga@ku.sk>
* Håkan Waara (hwaara@chello.se)
* Jeremy Morton (bugzilla@game-point.net)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -57,7 +58,8 @@ var gPrevSelectedFolder;
var gMsgFolderSelected;
/* keep in sync with nsMsgFolderFlags.h */
var MSG_FOLDER_FLAG_VIRTUAL = 0x0020;
const MSG_FOLDER_FLAG_MAIL = 0x0004;
const MSG_FOLDER_FLAG_VIRTUAL = 0x0020;
const MSG_FOLDER_FLAG_TRASH = 0x0100;
const MSG_FOLDER_FLAG_SENTMAIL = 0x0200;
const MSG_FOLDER_FLAG_DRAFTS = 0x0400;
@ -339,6 +341,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);
@ -486,6 +491,40 @@ 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");
@ -534,6 +573,9 @@ function ConvertColumnIDToSortType(columnID)
case "dateCol":
sortKey = nsMsgViewSortType.byDate;
break;
case "receivedCol":
sortKey = nsMsgViewSortType.byReceived;
break;
case "senderCol":
sortKey = nsMsgViewSortType.byAuthor;
break;
@ -588,7 +630,7 @@ function ConvertColumnIDToSortType(columnID)
// it exists - save this column ID in the customSortCol property of dbFolderInfo
// for later use (see nsIMsgDBView.cpp)
gDBView.db.dBFolderInfo.setProperty("customSortCol", columnID);
sortKey = nsMsgViewSortType.byCustom;
}
catch (err) {
@ -604,14 +646,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;

Просмотреть файл

@ -30,6 +30,7 @@
* Ian Neal <bugzilla@arlen.demon.co.uk>
* Karsten Düsterloh <mnyromyr@tprac.de>
* Christopher Thomas <cst@yecc.com>
* Jeremy Morton <bugzilla@game-point.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -221,6 +222,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));
@ -236,7 +238,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.byFlagged
|| sortType == nsMsgViewSortType.byAttachments);

Просмотреть файл

@ -1217,6 +1217,7 @@
accesskey="&sortMenu.accesskey;" observes="mailHideMenus">
<menupopup onpopupshowing="InitViewSortByMenu()">
<menuitem id="sortByDateMenuitem" type="radio" name="sortby" label="&sortByDateCmd.label;" accesskey="&sortByDateCmd.accesskey;" oncommand="MsgSortByDate()"/>
<menuitem id="sortByReceivedMenuitem" type="radio" name="sortby" label="&sortByReceivedCmd.label;" accesskey="&sortByReceivedCmd.accesskey;" oncommand="MsgSortByReceived()"/>
<menuitem id="sortByFlagMenuitem" type="radio" name="sortby" label="&sortByFlagCmd.label;" accesskey="&sortByFlagCmd.accesskey;" oncommand="MsgSortByFlagged()"/>
<menuitem id="sortByOrderReceivedMenuitem" type="radio" name="sortby" label="&sortByOrderReceivedCmd.label;" accesskey="&sortByOrderReceivedCmd.accesskey;" oncommand="MsgSortByOrderReceived()"/>
<menuitem id="sortByPriorityMenuitem" type="radio" name="sortby" label="&sortByPriorityCmd.label;" accesskey="&sortByPriorityCmd.accesskey;" oncommand="MsgSortByPriority()"/>

Просмотреть файл

@ -136,6 +136,7 @@ function ScrollToMessageAfterFolderLoad(folder)
switch (gDBView.sortType)
{
case nsMsgViewSortType.byDate:
case nsMsgViewSortType.byReceived:
case nsMsgViewSortType.byId:
case nsMsgViewSortType.byThread:
scrolled = ScrollToMessage(nsMsgNavigationType.lastMessage, true, false /* selectMessage */);
@ -964,7 +965,15 @@ function OnLoadFolderPane()
function UpgradeThreadPaneUI()
{
// placeholder in case any new columns get added to the thread pane
try
{
if (pref.getIntPref("mailnews.ui.threadpane.version") < 6)
pref.setIntPref("mailnews.ui.threadpane.version", 6);
}
catch (ex)
{
dump("UpgradeThreadPane: ex = " + ex + "\n");
}
}
function OnLoadThreadPane()

Просмотреть файл

@ -201,6 +201,11 @@ function MsgSortByDate()
MsgSortThreadPane(nsMsgViewSortType.byDate);
}
function MsgSortByReceived()
{
MsgSortThreadPane(nsMsgViewSortType.byReceived);
}
function MsgSortByFrom()
{
MsgSortThreadPane(nsMsgViewSortType.byAuthor);
@ -358,7 +363,7 @@ function MsgGroupBySort()
var msgFolder = dbview.msgFolder;
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.byStatus || sortType == nsMsgViewSortType.byRecipient
|| sortType == nsMsgViewSortType.byAccount || sortType == nsMsgViewSortType.byFlagged

Просмотреть файл

@ -74,7 +74,10 @@
<treecol id="unreadButtonColHeader" persist="hidden ordinal" fixed="true" cycler="true" class="treecol-image readColumnHeader"
label="&readColumn.label;" tooltiptext="&readColumn.tooltip;"/>
<splitter class="tree-splitter"/>
<treecol id="dateCol" persist="hidden ordinal width" flex="2"
<treecol id="receivedCol" persist="hidden ordinal width temphidden" flex="2" hidden="true" temphidden="false"
label="&receivedColumn.label;" tooltiptext="&receivedColumn.tooltip;"/>
<splitter class="tree-splitter"/>
<treecol id="dateCol" persist="hidden ordinal width" flex="2"
label="&dateColumn.label;" tooltiptext="&dateColumn.tooltip;"/>
<splitter class="tree-splitter"/>
<treecol id="statusCol" persist="hidden ordinal width" flex="1" hidden="true"

Просмотреть файл

@ -68,7 +68,7 @@ var gViewSearchListener;
var gSearchStopButton;
var gMailSession;
var MSG_FOLDER_FLAG_VIRTUAL = 0x0020;
// var MSG_FOLDER_FLAG_VIRTUAL = 0x0020; is defined in commandglue.js
// Controller object for search results thread pane
var nsSearchResultsController =

Просмотреть файл

@ -22,6 +22,7 @@
* Contributor(s):
* Jan Varga (varga@ku.sk)
* Håkan Waara (hwaara@chello.se)
* Jeremy Morton (bugzilla@game-point.net)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -456,17 +457,28 @@ nsresult nsMsgDBView::FetchSubject(nsIMsgDBHdr * aMsgHdr, PRUint32 aFlags, nsASt
}
// in case we want to play around with the date string, I've broken it out into
// a separate routine.
nsresult nsMsgDBView::FetchDate(nsIMsgDBHdr * aHdr, nsAString &aDateString)
// a separate routine. Set rcvDate to PR_TRUE to get the Received: date instead
// of the Date: date.
nsresult nsMsgDBView::FetchDate(nsIMsgDBHdr * aHdr, nsAString &aDateString, PRBool rcvDate)
{
PRTime dateOfMsg;
PRTime dateOfMsgLocal;
PRUint32 rcvDateSecs;
nsresult rv;
if (!mDateFormater)
mDateFormater = do_CreateInstance(NS_DATETIMEFORMAT_CONTRACTID);
NS_ENSURE_TRUE(mDateFormater, NS_ERROR_FAILURE);
nsresult rv = aHdr->GetDate(&dateOfMsg);
// Silently return Date: instead if Received: is unavailable
if (rcvDate)
{
rv = aHdr->GetUint32Property("dateReceived", &rcvDateSecs);
if (rcvDateSecs != 0)
Seconds2PRTime(rcvDateSecs, &dateOfMsg);
}
if (!rcvDate || rcvDateSecs == 0)
rv = aHdr->GetDate(&dateOfMsg);
PRTime currentTime = PR_Now();
PRExplodedTime explodedCurrentTime;
@ -486,10 +498,9 @@ nsresult nsMsgDBView::FetchDate(nsIMsgDBHdr * aHdr, nsAString &aDateString)
// same day...
dateFormat = m_dateFormatToday;
}
// the following chunk of code causes us to show a day instead of a number if the message was received
// within the last 7 days. i.e. Mon 5:10pm.
// The concrete format used is dependent on a preference setting (see InitDisplayFormats), but the default
// is the format described above.
// the following chunk of code allows us to show a day instead of a number if the message was received
// within the last 7 days. i.e. Mon 5:10pm. (depending on the mail.ui.display.dateformat.thisweek pref)
// The concrete format used is dependent on a preference setting (see InitDisplayFormats).
else if (LL_CMP(currentTime, >, dateOfMsg))
{
// some constants for calculation
@ -1739,8 +1750,11 @@ NS_IMETHODIMP nsMsgDBView::GetCellText(PRInt32 aRow, nsITreeColumn* aCol, nsAStr
rv = FetchStatus(flags, aValue);
}
break;
case 'r': // recipient
rv = FetchRecipients(msgHdr, aValue);
case 'r':
if (colID[3] == 'i') // recipient
rv = FetchRecipients(msgHdr, aValue);
else if (colID[3] == 'e') // received
rv = FetchDate(msgHdr, aValue, PR_TRUE);
break;
case 'd': // date
rv = FetchDate(msgHdr, aValue);
@ -3361,6 +3375,7 @@ nsresult nsMsgDBView::GetFieldTypeAndLenForSort(nsMsgViewSortTypeValue sortType,
*pMaxLen = kMaxAuthorKey;
break;
case nsMsgViewSortType::byDate:
case nsMsgViewSortType::byReceived:
case nsMsgViewSortType::byPriority:
case nsMsgViewSortType::byThread:
case nsMsgViewSortType::byId:
@ -3507,6 +3522,24 @@ nsresult nsMsgDBView::GetLongField(nsIMsgDBHdr *msgHdr, nsMsgViewSortTypeValue s
else
rv = msgHdr->GetDateInSeconds(result);
break;
case nsMsgViewSortType::byReceived:
// when sorting threads by received date, we want the received date of the newest msg
// in the thread
if (m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay
&& ! (m_viewFlags & nsMsgViewFlagsType::kGroupBySort))
{
nsCOMPtr <nsIMsgThread> thread;
rv = m_db->GetThreadContainingMsgHdr(msgHdr, getter_AddRefs(thread));
NS_ENSURE_SUCCESS(rv, rv);
thread->GetNewestMsgDate(result);
}
else
{
rv = msgHdr->GetUint32Property("dateReceived", result); // Already in seconds...
if (*result == 0) // Use Date instead, we have no Received property
rv = msgHdr->GetDateInSeconds(result);
}
break;
case nsMsgViewSortType::byCustom:
if (colHandler != nsnull)
{

Просмотреть файл

@ -186,7 +186,7 @@ protected:
nsresult FetchAuthor(nsIMsgDBHdr * aHdr, nsAString &aAuthorString);
nsresult FetchRecipients(nsIMsgDBHdr * aHdr, nsAString &aRecipientsString);
nsresult FetchSubject(nsIMsgDBHdr * aMsgHdr, PRUint32 aFlags, nsAString &aValue);
nsresult FetchDate(nsIMsgDBHdr * aHdr, nsAString & aDateString);
nsresult FetchDate(nsIMsgDBHdr * aHdr, nsAString & aDateString, PRBool rcvDate = PR_FALSE);
nsresult FetchStatus(PRUint32 aFlags, nsAString &aStatusString);
nsresult FetchSize(nsIMsgDBHdr * aHdr, nsAString & aSizeString);
nsresult FetchPriority(nsIMsgDBHdr *aHdr, nsAString & aPriorityString);

Просмотреть файл

@ -20,6 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jeremy Morton (bugzilla@game-point.net)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -36,6 +37,7 @@
* ***** END LICENSE BLOCK ***** */
#include "msgCore.h"
#include "nsMsgUtils.h"
#include "nsMsgGroupView.h"
#include "nsIMsgHdr.h"
#include "nsIMsgThread.h"
@ -77,7 +79,11 @@ NS_IMETHODIMP nsMsgGroupView::Open(nsIMsgFolder *aFolder, nsMsgViewSortTypeValue
void nsMsgGroupView::InternalClose()
{
if (m_db && m_sortType == nsMsgViewSortType::byDate)
PRBool rcvDate = PR_FALSE;
if (m_sortType == nsMsgViewSortType::byReceived)
rcvDate = PR_TRUE;
if (m_db && (m_sortType == nsMsgViewSortType::byDate) || (m_sortType == nsMsgViewSortType::byReceived))
{
nsCOMPtr <nsIDBFolderInfo> dbFolderInfo;
nsresult rv = m_db->GetDBFolderInfo(getter_AddRefs(dbFolderInfo));
@ -95,7 +101,7 @@ void nsMsgGroupView::InternalClose()
if (msgHdr)
{
PRUint32 ageBucket;
rv = GetAgeBucketValue(msgHdr, &ageBucket);
rv = GetAgeBucketValue(msgHdr, &ageBucket, rcvDate);
if (NS_SUCCEEDED(rv))
expandFlags |= 1 << ageBucket;
}
@ -113,13 +119,22 @@ NS_IMETHODIMP nsMsgGroupView::Close()
return nsMsgThreadedDBView::Close();
}
nsresult nsMsgGroupView::GetAgeBucketValue(nsIMsgDBHdr *aMsgHdr, PRUint32 * aAgeBucket)
// Set rcvDate to PR_TRUE to get the Received: date instead of the Date: date.
nsresult nsMsgGroupView::GetAgeBucketValue(nsIMsgDBHdr *aMsgHdr, PRUint32 * aAgeBucket, PRBool rcvDate)
{
NS_ENSURE_ARG_POINTER(aMsgHdr);
NS_ENSURE_ARG_POINTER(aAgeBucket);
PRTime dateOfMsg;
nsresult rv = aMsgHdr->GetDate(&dateOfMsg);
nsresult rv;
if (!rcvDate)
rv = aMsgHdr->GetDate(&dateOfMsg);
else
{
PRUint32 rcvDateSecs;
rv = aMsgHdr->GetUint32Property("dateReceived", &rcvDateSecs);
Seconds2PRTime(rcvDateSecs, &dateOfMsg);
}
NS_ENSURE_SUCCESS(rv, rv);
PRTime currentTime = PR_Now();
@ -203,6 +218,7 @@ nsresult nsMsgGroupView::HashHdr(nsIMsgDBHdr *msgHdr, nsString& aHashKey)
nsCString cStringKey;
aHashKey.Truncate();
nsresult rv = NS_OK;
PRBool rcvDate = PR_FALSE;
switch (m_sortType)
{
@ -258,10 +274,12 @@ nsresult nsMsgGroupView::HashHdr(nsIMsgDBHdr *msgHdr, nsString& aHashKey)
aHashKey.AppendInt(status);
}
break;
case nsMsgViewSortType::byReceived:
rcvDate = PR_TRUE;
case nsMsgViewSortType::byDate:
{
PRUint32 ageBucket;
rv = GetAgeBucketValue(msgHdr, &ageBucket);
rv = GetAgeBucketValue(msgHdr, &ageBucket, rcvDate);
if (NS_SUCCEEDED(rv))
aHashKey.AppendInt(ageBucket);
break;
@ -625,14 +643,17 @@ NS_IMETHODIMP nsMsgGroupView::GetCellText(PRInt32 aRow, nsITreeColumn* aCol, nsA
if (colID[0] == 's' && colID[1] == 'u' )
{
PRUint32 flags;
PRBool rcvDate = PR_FALSE;
msgHdr->GetFlags(&flags);
aValue.SetCapacity(0);
switch (m_sortType)
{
case nsMsgViewSortType::byReceived:
rcvDate = PR_TRUE;
case nsMsgViewSortType::byDate:
{
PRUint32 ageBucket = 0;
GetAgeBucketValue(msgHdr, &ageBucket);
GetAgeBucketValue(msgHdr, &ageBucket, rcvDate);
switch (ageBucket)
{
case 1:

Просмотреть файл

@ -67,7 +67,7 @@ protected:
void InternalClose();
nsMsgGroupThread *AddHdrToThread(nsIMsgDBHdr *msgHdr, PRBool *pNewThread);
nsresult HashHdr(nsIMsgDBHdr *msgHdr, nsString& aHashKey);
nsresult GetAgeBucketValue(nsIMsgDBHdr *aMsgHdr, PRUint32 * aAgeBucket); // helper function to get the age bucket for a hdr, useful when grouped by date
nsresult GetAgeBucketValue(nsIMsgDBHdr *aMsgHdr, PRUint32 * aAgeBucket, PRBool rcvDate = PR_FALSE); // helper function to get the age bucket for a hdr, useful when grouped by date
nsresult OnNewHeader(nsIMsgDBHdr *newHdr, nsMsgKey aParentKey, PRBool /*ensureListed*/);
virtual nsresult GetThreadContainingMsgHdr(nsIMsgDBHdr *msgHdr, nsIMsgThread **pThread);
virtual PRInt32 FindLevelInThread(nsIMsgDBHdr *msgHdr, nsMsgViewIndex startOfThread, nsMsgViewIndex viewIndex);

Просмотреть файл

@ -23,6 +23,7 @@
* Pierre Phaneuf <pp@ludusdesign.com>
* David Bienvenu <bienvenu@mozilla.org>
* Karsten Düsterloh <mnyromyr@tprac.de>
* Jeremy Morton <bugzilla@game-point.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -471,7 +472,6 @@ nsParseMailMessageState::nsParseMailMessageState()
{
m_position = 0;
m_IgnoreXMozillaStatus = PR_FALSE;
m_useReceivedDate = PR_FALSE;
m_state = nsIMsgParseMailMsgState::ParseBodyState;
// setup handling of custom db headers, headers that are added to .msf files
@ -494,7 +494,6 @@ nsParseMailMessageState::nsParseMailMessageState()
if (!m_customDBHeaderValues)
m_customDBHeaders.Clear();
}
pPrefBranch->GetBoolPref("mailnews.use_received_date", &m_useReceivedDate);
}
Clear();
m_HeaderAddressParser = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID);
@ -519,6 +518,7 @@ NS_IMETHODIMP nsParseMailMessageState::Clear()
m_message_id.length = 0;
m_references.length = 0;
m_date.length = 0;
m_delivery_date.length = 0;
m_from.length = 0;
m_sender.length = 0;
m_newsgroups.length = 0;
@ -896,6 +896,8 @@ int nsParseMailMessageState::ParseHeaders ()
header = &m_date;
else if (!PL_strncasecmp("Disposition-Notification-To", buf, end - buf))
header = &m_mdn_dnt;
else if (!PL_strncasecmp("Delivery-date", buf, end - buf))
header = &m_delivery_date;
break;
case 'F': case 'f':
if (!PL_strncasecmp ("From", buf, end - buf))
@ -1191,6 +1193,7 @@ int nsParseMailMessageState::FinalizeHeaders()
struct message_header *replyTo;
struct message_header *references;
struct message_header *date;
struct message_header *deliveryDate;
struct message_header *statush;
struct message_header *mozstatus;
struct message_header *mozstatus2;
@ -1235,6 +1238,7 @@ int nsParseMailMessageState::FinalizeHeaders()
date = (m_date.length ? &m_date :
m_envelope_date.length ? &m_envelope_date :
0);
deliveryDate = (m_delivery_date.length ? &m_delivery_date : 0);
priority = (m_priority.length ? &m_priority : 0);
keywords = (m_keywords.length ? &m_keywords : 0);
mdn_dnt = (m_mdn_dnt.length ? &m_mdn_dnt : 0);
@ -1443,20 +1447,52 @@ int nsParseMailMessageState::FinalizeHeaders()
else if (inReplyTo != nsnull)
m_newMsgHdr->SetReferences(inReplyTo->value);
if (!LL_IS_ZERO(m_receivedTime) && (!date || m_useReceivedDate))
m_newMsgHdr->SetDate(m_receivedTime);
// 'Received' should be as reliable an indicator of the receipt
// date+time as possible, whilst always giving something *from
// the message*. It won't use PR_Now() under any circumstance.
// Therefore, the fall-thru order for 'Received' is:
// Received: -> Delivery-date: -> date
// 'Date' uses:
// date -> PR_Now()
//
// date is:
// Date: -> m_envelope_date
PRUint32 rcvTimeSecs = 0;
if (date)
{ // Date:
PRTime resultTime;
PRStatus timeStatus = PR_ParseTimeString (date->value, PR_FALSE, &resultTime);
if (PR_SUCCESS == timeStatus)
{
m_newMsgHdr->SetDate(resultTime);
PRTime2Seconds(resultTime, &rcvTimeSecs);
}
}
else
{
// if there's no date, or it's mal-formed, use now as the time.
{ // PR_Now()
// If there was some problem parsing the Date header *AND* we
// couldn't get a valid envelope date, use now as the time.
// PR_ParseTimeString won't touch resultTime unless it succeeds.
// (this doesn't affect local messages, because we use the envelope
// date if there's no Date: header, but it would affect IMAP msgs
// w/o a Date: hdr or Received: headers)
// This doesn't affect local (POP3) messages, because we use the envelope
// date if there's no Date: header, but it will affect IMAP msgs
// w/o a Date: hdr or Received: headers.
PRTime resultTime = PR_Now();
if (date)
PR_ParseTimeString (date->value, PR_FALSE, &resultTime);
m_newMsgHdr->SetDate(resultTime);
}
if (!LL_IS_ZERO(m_receivedTime))
{ // Upgrade 'Received' to Received: ?
PRTime2Seconds(m_receivedTime, &rcvTimeSecs);
}
else if (deliveryDate)
{ // Upgrade 'Received' to Delivery-date: ?
PRTime resultTime;
PRStatus timeStatus = PR_ParseTimeString (deliveryDate->value, PR_FALSE, &resultTime);
if (PR_SUCCESS == timeStatus)
PRTime2Seconds(resultTime, &rcvTimeSecs);
}
m_newMsgHdr->SetUint32Property("dateReceived", rcvTimeSecs);
if (priority)
m_newMsgHdr->SetPriorityString(priority->value);
else if (priorityFlags == nsMsgPriority::notSet)

Просмотреть файл

@ -116,6 +116,7 @@ public:
struct message_header m_message_id;
struct message_header m_references;
struct message_header m_date;
struct message_header m_delivery_date;
struct message_header m_from;
struct message_header m_sender;
struct message_header m_newsgroups;
@ -148,7 +149,6 @@ public:
PRUint16 m_body_lines;
PRBool m_IgnoreXMozillaStatus;
PRBool m_useReceivedDate;
// this enables extensions to add the values of particular headers to
// the .msf file as properties of nsIMsgHdr. It is initialized from a

Просмотреть файл

@ -21,6 +21,7 @@
Contributor(s):
Karsten Düsterloh <mnyromyr@tprac.de>
Jeremy Morton <bugzilla@game-point.net>
Alternatively, the contents of this file may be used under the terms of
either of the GNU General Public License Version 2 or later (the "GPL"),
@ -185,6 +186,8 @@
<!ENTITY sortByDateCmd.label "Date">
<!ENTITY sortByDateCmd.accesskey "e">
<!ENTITY sortByReceivedCmd.label "Received">
<!ENTITY sortByReceivedCmd.accesskey "v">
<!ENTITY sortByFlagCmd.label "Flag">
<!ENTITY sortByFlagCmd.accesskey "l">
<!ENTITY sortByPriorityCmd.label "Priority">

Просмотреть файл

@ -51,6 +51,7 @@
<!ENTITY unreadColumn.label "Unread in Thread">
<!ENTITY totalColumn.label "Total in Thread">
<!ENTITY readColumn.label "Read">
<!ENTITY receivedColumn.label "Received">
<!ENTITY flagColumn.label "Flag">
<!ENTITY locationColumn.label "Location">
<!ENTITY idColumn.label "Order Received">
@ -72,6 +73,7 @@
<!ENTITY unreadColumn.tooltip "Number of unread messages in thread">
<!ENTITY totalColumn.tooltip "Total number of messages in thread">
<!ENTITY readColumn.tooltip "Click to sort by read">
<!ENTITY receivedColumn.tooltip "Click to sort by date received">
<!ENTITY flagColumn.tooltip "Click to sort by flag">
<!ENTITY locationColumn.tooltip "Click to sort by location">
<!ENTITY idColumn.tooltip "Click to sort by order received">