diff --git a/mailnews/base/resources/content/mailWidgets.xml b/mailnews/base/resources/content/mailWidgets.xml index 7214221d29d0..d3d09403c9ff 100644 --- a/mailnews/base/resources/content/mailWidgets.xml +++ b/mailnews/base/resources/content/mailWidgets.xml @@ -181,7 +181,7 @@ } // now restore the selection - menulist.selectedItem = newSelection + menulist.selectedItem = newSelection; ]]> @@ -286,6 +286,7 @@ + null @@ -305,6 +306,8 @@ this.setAttribute("index", "1"); else if (val == Components.interfaces.nsMsgSearchAttrib.MsgStatus) this.setAttribute("index", "2"); + else if (val == Components.interfaces.nsMsgSearchAttrib.Date) + this.setAttribute("index", "3"); else this.setAttribute("index", "0"); return val; @@ -334,6 +337,8 @@ } else if (attrib == nsMsgSearchAttrib.AgeInDays) children[0].value = val.age; + else if (attrib == nsMsgSearchAttrib.Date) + children[3].value = convertPRTimeToString(val.date); else children[0].value = val.str; return val; @@ -356,6 +361,8 @@ searchValue.status = children[2].selectedItem.value; else if (searchAttribute == nsMsgSearchAttrib.AgeInDays) searchValue.age = children[0].value; + else if (searchAttribute == nsMsgSearchAttrib.Date) + searchValue.date = convertStringToPRTime(children[3].value); else searchValue.str = children[0].value; ]]> @@ -394,6 +401,11 @@ var bundle = srGetStrBundle("chrome://messenger/locale/messenger.properties"); this.fillStringsForChildren(document.getAnonymousNodes(this)[1].firstChild, bundle); this.fillStringsForChildren(document.getAnonymousNodes(this)[2].firstChild, bundle); + + // preflight the date picker to today's date + var datePicker = document.getAnonymousNodes(this)[3]; + var time = new Date(); + datePicker.setAttribute("value",convertDateToString(time)); ]]> diff --git a/mailnews/base/search/resources/content/searchTermOverlay.js b/mailnews/base/search/resources/content/searchTermOverlay.js index 70affdb5be74..90c28e4c58e8 100644 --- a/mailnews/base/search/resources/content/searchTermOverlay.js +++ b/mailnews/base/search/resources/content/searchTermOverlay.js @@ -382,3 +382,32 @@ function onReset(event) removeSearchRow(--gTotalSearchTerms); onMore(event); } + +function convertPRTimeToString(tm) +{ + var time = new Date(); + // PRTime is in microseconds, Javascript time is in seconds + // so divide by 1000 when converting + time.setTime(tm / 1000); + + return convertDateToString(time); +} + +function convertDateToString(time) +{ + var dateStr = time.getMonth() + 1; + dateStr += "/"; + dateStr += time.getDate(); + dateStr += "/"; + dateStr += 1900 + time.getYear(); + return dateStr; +} + +function convertStringToPRTime(str) +{ + var time = new Date(); + time.setTime(Date.parse(str)); + // Javascript time is in seconds, PRTime is in microseconds + // so multiply by 1000 when converting + return (time.getTime() * 1000); +}