Bug 16967 implement Mark by Date p=frank.schoenheit@gmx.de r=me sr=bienvenu

This commit is contained in:
neil%parkwaycc.co.uk 2003-07-31 21:20:23 +00:00
Родитель a1e75e8d7c
Коммит 1db54cf6bc
15 изменённых файлов: 555 добавлений и 226 удалений

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

@ -0,0 +1,245 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alec Flett <alecf@netscape.com>
* Seth Spitzer <sspitzer@netscape.com>
*
* 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
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gSearchDateFormat = 0;
var gSearchDateSeparator;
// Get the short date format option of the current locale.
// This supports the common case which the date separator is
// either '/', '-', '.' and using Christian year.
function getLocaleShortDateFormat()
{
// default to mm/dd/yyyy
gSearchDateFormat = 3;
gSearchDateSeparator = "/";
try {
var dateFormatService = Components.classes["@mozilla.org/intl/scriptabledateformat;1"]
.getService(Components.interfaces.nsIScriptableDateFormat);
var dateString = dateFormatService.FormatDate("",
dateFormatService.dateFormatShort,
1999,
12,
31);
// find out the separator
var possibleSeparators = "/-.";
var arrayOfStrings;
for ( var i = 0; i < possibleSeparators.length; ++i )
{
arrayOfStrings = dateString.split( possibleSeparators[i] );
if ( arrayOfStrings.length == 3 )
{
gSearchDateSeparator = possibleSeparators[i];
break;
}
}
// check the format option
if ( arrayOfStrings.length != 3 ) // no successfull split
{
dump("getLocaleShortDateFormat: could not analyze the date format, defaulting to mm/dd/yyyy\n");
}
else
{
if ( arrayOfStrings[0] == "31" )
{
// 31.12.1999 or 31.1992.12
gSearchDateFormat = arrayOfStrings[1] == "12" ? 5 : 6;
}
else if ( arrayOfStrings[1] == "31" )
{
// 12.31.1999 or 1999.31.12
gSearchDateFormat = arrayOfStrings[0] == "12" ? 3 : 2;
}
else // implies arrayOfStrings[2] == "31"
{
// 12.1999.31 or 1999.12.31
gSearchDateFormat = arrayOfStrings[0] == "12" ? 4 : 1;
}
}
}
catch (e)
{
dump("getLocaleShortDateFormat: caught an exception!\n");
}
}
function initializeSearchDateFormat()
{
if (gSearchDateFormat)
return;
// get a search date format option and a seprator
try {
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
gSearchDateFormat =
pref.getComplexValue("mailnews.search_date_format",
Components.interfaces.nsIPrefLocalizedString);
gSearchDateFormat = parseInt(gSearchDateFormat);
// if the option is 0 then try to use the format of the current locale
if (gSearchDateFormat == 0)
getLocaleShortDateFormat();
else
{
if (gSearchDateFormat < 1 || gSearchDateFormat > 6)
gSearchDateFormat = 3;
gSearchDateSeparator =
pref.getComplexValue("mailnews.search_date_separator",
Components.interfaces.nsIPrefLocalizedString);
}
} catch (ex) {
// set to mm/dd/yyyy in case of error
gSearchDateFormat = 3;
gSearchDateSeparator = "/";
}
}
function convertPRTimeToString(tm)
{
var time = new Date();
// PRTime is in microseconds, Javascript time is in milliseconds
// so divide by 1000 when converting
time.setTime(tm / 1000);
return convertDateToString(time);
}
function convertDateToString(time)
{
var year, month, date;
initializeSearchDateFormat();
year = 1900 + time.getYear();
month = time.getMonth() + 1; // since js month is 0-11
date = time.getDate();
var dateStr;
var sep = gSearchDateSeparator;
switch (gSearchDateFormat)
{
case 1:
dateStr = year + sep + month + sep + date;
break;
case 2:
dateStr = year + sep + date + sep + month;
break;
case 3:
dateStr = month + sep + date + sep + year;
break;
case 4:
dateStr = month + sep + year + sep + date;
break;
case 5:
dateStr = date + sep + month + sep + year;
break;
case 6:
dateStr = date + sep + year + sep + month;
break;
default:
dump("valid search date format option is 1-6\n");
}
return dateStr;
}
function convertStringToPRTime(str)
{
initializeSearchDateFormat();
var arrayOfStrings = str.split(gSearchDateSeparator);
var year, month, date;
// set year, month, date based on the format option
switch (gSearchDateFormat)
{
case 1:
year = arrayOfStrings[0];
month = arrayOfStrings[1];
date = arrayOfStrings[2];
break;
case 2:
year = arrayOfStrings[0];
month = arrayOfStrings[2];
date = arrayOfStrings[1];
break;
case 3:
year = arrayOfStrings[2];
month = arrayOfStrings[0];
date = arrayOfStrings[1];
break;
case 4:
year = arrayOfStrings[1];
month = arrayOfStrings[0];
date = arrayOfStrings[2];
break;
case 5:
year = arrayOfStrings[2];
month = arrayOfStrings[1];
date = arrayOfStrings[0];
break;
case 6:
year = arrayOfStrings[1];
month = arrayOfStrings[2];
date = arrayOfStrings[0];
break;
default:
dump("valid search date format option is 1-6\n");
}
month -= 1; // since js month is 0-11
var time = new Date();
time.setMilliseconds(0);
time.setSeconds(0);
time.setMinutes(0);
time.setHours(0);
time.setYear(year);
time.setMonth(month);
time.setDate(date);
// Javascript time is in milliseconds, PRTime is in microseconds
// so multiply by 1000 when converting
return (time.getTime() * 1000);
}

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

@ -193,6 +193,7 @@ var DefaultController =
case "cmd_markAsRead":
case "cmd_markAllRead":
case "cmd_markThreadAsRead":
case "cmd_markReadByDate":
case "cmd_markAsFlagged":
case "cmd_markAsJunk":
case "cmd_markAsNotJunk":
@ -348,6 +349,7 @@ var DefaultController =
case "cmd_previousUnreadMsg":
return (MailAreaHasFocus() && IsViewNavigationItemEnabled());
case "cmd_markAllRead":
case "cmd_markReadByDate":
return (MailAreaHasFocus() && IsFolderSelected());
case "cmd_find":
case "cmd_findAgain":
@ -584,6 +586,9 @@ var DefaultController =
case "cmd_markAllRead":
gDBView.doCommand(nsMsgViewCommandType.markAllRead);
return;
case "cmd_markReadByDate":
MsgMarkReadByDate();
return;
case "button_junk":
MsgJunk();
return;

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

@ -1303,6 +1303,13 @@ function MsgMarkAsFlagged(markFlagged)
MarkSelectedMessagesFlagged(markFlagged);
}
function MsgMarkReadByDate()
{
window.openDialog( "chrome://messenger/content/markByDate.xul","",
"chrome,modal,titlebar,centerscreen",
GetLoadedMsgFolder() );
}
function MsgMarkAllRead()
{
var compositeDataSource = GetCompositeDataSource("MarkAllMessagesRead");
@ -1716,7 +1723,6 @@ function MsgSynchronizeOffline()
}
function MsgMarkByDate() {}
function MsgOpenAttachment() {}
function MsgUpdateMsgCount() {}
function MsgImport() {}

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

@ -254,6 +254,7 @@ Rights Reserved.
<command id="cmd_markAsRead" oncommand="goDoCommand('cmd_markAsRead'); event.preventBubble()" disabled="true"/>
<command id="cmd_markAllRead" oncommand="goDoCommand('cmd_markAllRead'); event.preventBubble()" disabled="true"/>
<command id="cmd_markThreadAsRead" oncommand="goDoCommand('cmd_markThreadAsRead'); event.preventBubble()" disabled="true"/>
<command id="cmd_markReadByDate" oncommand="goDoCommand('cmd_markReadByDate');" disabled="true"/>
<command id="cmd_markAsFlagged" oncommand="goDoCommand('cmd_markAsFlagged'); event.preventBubble()" disabled="true"/>
<command id="cmd_markAsJunk" oncommand="goDoCommand('cmd_markAsJunk'); event.preventBubble()" disabled="true"/>
<command id="cmd_markAsNotJunk" oncommand="goDoCommand('cmd_markAsNotJunk'); event.preventBubble()" disabled="true"/>
@ -303,6 +304,7 @@ Rights Reserved.
<key id="key_toggleRead" key="&markAsReadCmd.key;" oncommand="goDoCommand('cmd_markAsRead');"/>
<key id="key_markAllRead" key="&markAllReadCmd.key;" oncommand="goDoCommand('cmd_markAllRead');" modifiers="accel, shift"/>
<key id="key_markThreadAsRead" key="&markThreadAsReadCmd.key;" oncommand="goDoCommand('cmd_markThreadAsRead')"/>
<key id="key_markReadByDate" key="&markReadByDateCmd.key;" oncommand="goDoCommand('cmd_markReadByDate')"/>
<key id="key_nextMsg" key="&nextMsgCmd.key;" oncommand="goDoCommand('cmd_nextMsg')"/>
<key id="key_nextUnreadMsg" key="&nextUnreadMsgCmd.key;" oncommand="goDoCommand('cmd_nextUnreadMsg')"/>
<key id="key_expandAllThreads" key="&expandAllThreadsCmd.key;" oncommand="goDoCommand('cmd_expandAllThreads')"/>
@ -581,6 +583,10 @@ Rights Reserved.
key="key_markThreadAsRead"
accesskey="&markThreadAsReadCmd.accesskey;"
observes="cmd_markThreadAsRead"/>
<menuitem label="&markReadByDateCmd.label;"
key="key_markReadByDate"
accesskey="&markReadByDateCmd.accesskey;"
command="cmd_markReadByDate"/>
<menuitem label="&markAllReadCmd.label;"
key="key_markAllRead"
accesskey="&markAllReadCmd.accesskey;"
@ -915,6 +921,10 @@ Rights Reserved.
key="key_markThreadAsRead"
accesskey="&markThreadAsReadCmd.accesskey;"
observes="cmd_markThreadAsRead"/>
<menuitem label="&markReadByDateCmd.label;"
key="key_markReadByDate"
accesskey="&markReadByDateCmd.accesskey;"
command="cmd_markReadByDate"/>
<menuitem label="&markAllReadCmd.label;"
key="key_markAllRead"
accesskey="&markAllReadCmd.accesskey;"
@ -1501,6 +1511,10 @@ Rights Reserved.
key="key_markThreadAsRead"
accesskey="&markThreadAsReadCmd.accesskey;"
observes="cmd_markThreadAsRead"/>
<menuitem label="&markReadByDateCmd.label;"
key="key_markReadByDate"
accesskey="&markReadByDateCmd.accesskey;"
command="cmd_markReadByDate"/>
<menuitem label="&markAllReadCmd.label;"
key="key_markAllRead"
accesskey="&markAllReadCmd.accesskey;"
@ -1700,6 +1714,7 @@ Rights Reserved.
<menupopup onpopupshowing="InitMessageMark()">
<menuitem type="checkbox" key="key_toggleRead" id="markReadToolbarItem" label="&markAsReadCmd.label;" accesskey="&markAsReadCmd.accesskey;" observes="cmd_markAsRead" default="true" />
<menuitem label="&markThreadAsReadCmd.label;" key="key_markThreadAsRead" accesskey="&markThreadAsReadCmd.accesskey;" observes="cmd_markThreadAsRead"/>
<menuitem label="&markReadByDateCmd.label;" key="key_markReadByDate" accesskey="&markReadByDateCmd.accesskey;" command="cmd_markReadByDate"/>
<menuitem label="&markAllReadCmd.label;" key="key_markAllRead" accesskey="&markAllReadCmd.accesskey;" observes="cmd_markAllRead"/>
<menuseparator/>
<menuitem type="checkbox" id="markFlaggedToolbarItem" label="&markFlaggedCmd.label;" accesskey="&markFlaggedCmd.accesskey;" observes="cmd_markAsFlagged"/>

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

@ -0,0 +1,145 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Frank Schönheit <frank.schoenheit@gmx.de>
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Frank Schönheit <frank.schoenheit@gmx.de>
*
* 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
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
const MILLISECONDS_PER_HOUR = 60 * 60 * 1000;
const MICROSECONDS_PER_DAY = 1000 * MILLISECONDS_PER_HOUR * 24;
function onLoad()
{
var upperDateBox = document.getElementById("upperDate");
// focus the upper bound control - this is where we expect most users to enter
// a date
upperDateBox.focus();
// and give it an initial date - "yesterday"
var initialDate = new Date();
initialDate.setHours( 0 );
initialDate.setTime( initialDate.getTime() - MILLISECONDS_PER_HOUR );
// note that this is sufficient - though it is at the end of the previous day,
// we convert it to a date string, and then the time part is truncated
upperDateBox.value = convertDateToString( initialDate );
upperDateBox.select(); // allows to start overwriting immediately
}
function onAccept()
{
// get the times as entered by the user
var lowerDateString = document.getElementById( "lowerDate" ).value;
// the fallback for the lower bound, if not entered, is the "beginning of
// time" (1970-01-01), which actually is simply 0 :)
var prLower = lowerDateString ? convertStringToPRTime( lowerDateString ) : 0;
var upperDateString = document.getElementById( "upperDate" ).value;
var prUpper;
if ( upperDateString == "" )
{
// for the upper bound, the fallback is "today".
var dateThisMorning = new Date();
dateThisMorning.setMilliseconds( 0 );
dateThisMorning.setSeconds( 0 );
dateThisMorning.setMinutes( 0 );
dateThisMorning.setHours( 0 );
// Javascript time is in milliseconds, PRTime is in microseconds
prUpper = dateThisMorning.getTime() * 1000;
}
else
prUpper = convertStringToPRTime( upperDateString );
// for the upper date, we have to do a correction:
// if the user enters a date, then she means (hopefully) that all messages sent
// at this day should be marked, too, but the PRTime calculated from this would
// point to the beginning of the day. So we need to increment it by
// [number of micro seconds per day]. This will denote the first microsecond of
// the next day then, which is later used as exclusive boundary
prUpper += MICROSECONDS_PER_DAY;
markInDatabase( prLower, prUpper );
return true; // allow closing
}
/** marks all headers in the database, whose time is between the two
given times, as read.
@param lower
PRTime for the lower bound - this boundary is inclusive
@param upper
PRTime for the upper bound - this boundary is exclusive
*/
function markInDatabase( lower, upper )
{
var messageFolder;
var messageDatabase;
// extract the database
if ( window.arguments && window.arguments[0] )
{
messageFolder = window.arguments[0];
messageDatabase = messageFolder.getMsgDatabase( null );
}
if ( !messageDatabase )
{
dump( "markByDate::markInDatabase: there /is/ no database to operate on!\n" );
return;
}
// the headers which are going to be marked
var headers = Components.classes["@mozilla.org/supports-array;1"].createInstance( Components.interfaces.nsISupportsArray );
// create an enumerator for all messages in the database
var enumerator = messageDatabase.EnumerateMessages();
if ( enumerator )
{
while ( enumerator.hasMoreElements() )
{
var header = enumerator.getNext();
if ( ( header instanceof Components.interfaces.nsIMsgDBHdr )
&& !header.isRead ) // don't do anything until really necessary
{
var messageDate = header.date;
if ( ( lower <= messageDate ) && ( messageDate < upper ) )
headers.AppendElement( header );
}
else
dump("markByDate::markInDatabase: unexpected: the database gave us a header which is no nsIMsgDBHdr!\n" );
}
}
if ( headers.Count() )
messageFolder.markMessagesRead( headers, true );
}

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

@ -0,0 +1,74 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is mozilla.org code.
-
- The Initial Developer of the Original Code is
- Frank Schoenheit <frank.schoenheit@gmx.de>
- Portions created by the Initial Developer are Copyright (C) 2003
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Frank Schoenheit <frank.schoenheit@gmx.de>
-
- 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
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<?xml-stylesheet href="chrome://messenger/skin/dialogs.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/markByDate.dtd">
<dialog
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&messageMarkByDate.label;"
buttons="accept,cancel"
onload="onLoad();"
ondialogaccept="return onAccept();">
<script type="application/x-javascript" src="chrome://messenger/content/markByDate.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/dateFormat.js"/>
<description>&markByDateDesc.label;</description>
<grid flex="1">
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row align="center">
<label control="lowerDate" value="&markByDateLower.label;"/>
<textbox wsm_persist="true" id="lowerDate"/>
</row>
<row align="center">
<label control="upperDate" value="&markByDateUpper.label;"/>
<textbox wsm_persist="true" id="upperDate"/>
</row>
</rows>
</grid>
</dialog>

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

@ -705,6 +705,7 @@ var MessageWindowController =
case "cmd_markAsRead":
case "cmd_markAllRead":
case "cmd_markThreadAsRead":
case "cmd_markReadByDate":
case "cmd_markAsFlagged":
case "cmd_label0":
case "cmd_label1":
@ -800,6 +801,7 @@ var MessageWindowController =
case "cmd_markAsRead":
case "cmd_markAllRead":
case "cmd_markThreadAsRead":
case "cmd_markReadByDate":
case "cmd_label0":
case "cmd_label1":
case "cmd_label2":
@ -965,6 +967,9 @@ var MessageWindowController =
case "cmd_markAllRead":
MsgMarkAllRead();
return;
case "cmd_markReadByDate":
MsgMarkReadByDate();
return;
case "cmd_markAsFlagged":
MsgMarkAsFlagged(null);
return;

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

@ -0,0 +1,41 @@
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is mozilla.org code.
-
- The Initial Developer of the Original Code is
- Frank Schoenheit <frank.schoenheit@gmx.de>
- Portions created by the Initial Developer are Copyright (C) 2003
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Frank Schoenheit <frank.schoenheit@gmx.de>
-
- 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
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<!ENTITY messageMarkByDate.label "Mark Messages as Read by Date">
<!ENTITY markByDateDesc.label "Mark messages as read:">
<!ENTITY markByDateLower.label "From:">
<!ENTITY markByDateUpper.label "To:">

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

@ -382,8 +382,9 @@ Rights Reserved.
<!ENTITY markThreadAsReadCmd.label "Thread As Read">
<!ENTITY markThreadAsReadCmd.accesskey "T">
<!ENTITY markThreadAsReadCmd.key "r">
<!ENTITY markByDateCmd.label "by Date...">
<!ENTITY markByDateCmd.accesskey "D">
<!ENTITY markReadByDateCmd.label "As Read by Date...">
<!ENTITY markReadByDateCmd.accesskey "D">
<!ENTITY markReadByDateCmd.key "c">
<!ENTITY markAllReadCmd.label "All Read">
<!ENTITY markAllReadCmd.accesskey "A">
<!ENTITY markAllReadCmd.key "c">

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

@ -50,9 +50,6 @@ var gBooleanOrText;
var gBooleanAndText;
var gBooleanInitialText;
var gSearchDateFormat = 0;
var gSearchDateSeparator;
//
function searchTermContainer() {}
@ -497,216 +494,6 @@ function onReset(event)
onMore(event);
}
// Get the short date format option of the current locale.
// This supports the common case which the date separator is
// either '/', '-', '.' and using Christian year.
function getLocaleShortDateFormat()
{
// default to mm/dd/yyyy
gSearchDateFormat = 3;
gSearchDateSeparator = "/";
try {
var dateFormatService = Components.classes["@mozilla.org/intl/scriptabledateformat;1"]
.getService(Components.interfaces.nsIScriptableDateFormat);
var dateString = dateFormatService.FormatDate("",
dateFormatService.dateFormatShort,
1999,
12,
31);
// find out the separator
var arrayOfStrings = dateString.split("/");
if (arrayOfStrings.length == 3)
gSearchDateSeparator = "/";
else
{
arrayOfStrings = dateString.split("-");
if (arrayOfStrings.length == 3)
gSearchDateSeparator = "-";
else
{
arrayOfStrings = dateString.split(".");
if (arrayOfStrings.length == 3)
gSearchDateSeparator = ".";
}
}
// check the format option
if (arrayOfStrings.length == 3)
{
switch (arrayOfStrings[0])
{
case "1999":
if (arrayOfStrings[1] == "12" &&
arrayOfStrings[2] == "31")
gSearchDateFormat = 1;
else if (arrayOfStrings[1] == "31" &&
arrayOfStrings[2] == "12")
gSearchDateFormat = 2;
break;
case "12":
if (arrayOfStrings[1] == "31" &&
arrayOfStrings[2] == "1999")
gSearchDateFormat = 3;
else if (arrayOfStrings[1] == "1999" &&
arrayOfStrings[2] == "31")
gSearchDateFormat = 4;
break;
case "31":
if (arrayOfStrings[1] == "12" &&
arrayOfStrings[2] == "1999")
gSearchDateFormat = 5;
else if (arrayOfStrings[1] == "1999" &&
arrayOfStrings[2] == "12")
gSearchDateFormat = 6;
break;
}
}
}
catch (e) {}
}
function initializeSearchDateFormat()
{
if (gSearchDateFormat)
return;
// get a search date format option and a seprator
try {
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
gSearchDateFormat =
pref.getComplexValue("mailnews.search_date_format",
Components.interfaces.nsIPrefLocalizedString);
gSearchDateFormat = parseInt(gSearchDateFormat);
// if the option is 0 then try to use the format of the current locale
if (gSearchDateFormat == 0)
getLocaleShortDateFormat();
else
{
if (gSearchDateFormat < 1 || gSearchDateFormat > 6)
gSearchDateFormat = 3;
gSearchDateSeparator =
pref.getComplexValue("mailnews.search_date_separator",
Components.interfaces.nsIPrefLocalizedString);
}
} catch (ex) {
// set to mm/dd/yyyy in case of error
gSearchDateFormat = 3;
gSearchDateSeparator = "/";
}
}
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 year, month, date;
initializeSearchDateFormat();
year = 1900 + time.getYear();
month = time.getMonth() + 1; // since js month is 0-11
date = time.getDate();
var dateStr;
var sep = gSearchDateSeparator;
switch (gSearchDateFormat)
{
case 1:
dateStr = year + sep + month + sep + date;
break;
case 2:
dateStr = year + sep + date + sep + month;
break;
case 3:
dateStr = month + sep + date + sep + year;
break;
case 4:
dateStr = month + sep + year + sep + date;
break;
case 5:
dateStr = date + sep + month + sep + year;
break;
case 6:
dateStr = date + sep + year + sep + month;
break;
default:
dump("valid search date format option is 1-6\n");
}
return dateStr;
}
function convertStringToPRTime(str)
{
initializeSearchDateFormat();
var arrayOfStrings = str.split(gSearchDateSeparator);
var year, month, date;
// set year, month, date based on the format option
switch (gSearchDateFormat)
{
case 1:
year = arrayOfStrings[0];
month = arrayOfStrings[1];
date = arrayOfStrings[2];
break;
case 2:
year = arrayOfStrings[0];
month = arrayOfStrings[2];
date = arrayOfStrings[1];
break;
case 3:
year = arrayOfStrings[2];
month = arrayOfStrings[0];
date = arrayOfStrings[1];
break;
case 4:
year = arrayOfStrings[1];
month = arrayOfStrings[0];
date = arrayOfStrings[2];
break;
case 5:
year = arrayOfStrings[2];
month = arrayOfStrings[1];
date = arrayOfStrings[0];
break;
case 6:
year = arrayOfStrings[1];
month = arrayOfStrings[2];
date = arrayOfStrings[0];
break;
default:
dump("valid search date format option is 1-6\n");
}
month -= 1; // since js month is 0-11
var time = new Date();
time.setSeconds(0);
time.setMinutes(0);
time.setHours(0);
time.setDate(date);
time.setMonth(month);
time.setYear(year);
// Javascript time is in seconds, PRTime is in microseconds
// so multiply by 1000 when converting
return (time.getTime() * 1000);
}
// this is a helper routine used by our search term xbl widget
var gLabelStrings = new Array;
function GetLabelStrings()

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

@ -28,6 +28,7 @@
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="chrome://messenger/content/searchTermOverlay.js"/>
<script src="chrome://messenger/content/dateFormat.js"/>
<vbox id="searchTermListBox" >

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

@ -88,9 +88,9 @@ interface nsIMsgImapMailFolder : nsISupports {
void renameClient(in nsIMsgWindow msgWindow, in nsIMsgFolder msgFolder, in string oldName, in string newName);
// these are used for offline synchronization
void storeImapFlags(in long flags, in boolean addFlags, out nsMsgKey keysToFlag, in long numKeys);
void storeImapFlags(in long flags, in boolean addFlags, [array, size_is (numKeys)] in nsMsgKey keysToFlag, in unsigned long numKeys);
void setImapFlags(in string uids, in long flags, out nsIURI url);
void replayOfflineMoveCopy(out nsMsgKey keys, in long numKeys, in boolean isMove, in nsIMsgFolder aDstFolder,
void replayOfflineMoveCopy([array, size_is (numKeys)] in nsMsgKey keys, in unsigned long numKeys, in boolean isMove, in nsIMsgFolder aDstFolder,
in nsIUrlListener aUrlListener, in nsIMsgWindow aWindow);
void playbackOfflineFolderCreate(in wstring folderName, in nsIMsgWindow aWindow, out nsIURI url);
void liteSelect(in nsIUrlListener aUrlListener);
@ -108,8 +108,8 @@ interface nsIMsgImapMailFolder : nsISupports {
nsIURI storeCustomKeywords(in nsIMsgWindow aMsgWindow,
in string aFlagsToAdd,
in string aFlagsToSubtract,
out nsMsgKey aKeysToStore,
in long aNumKeys);
[array, size_is (aNumKeys)] in nsMsgKey aKeysToStore,
in unsigned long aNumKeys);
attribute boolean verifiedAsOnlineFolder;
attribute boolean explicitlyVerify;

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

@ -1849,9 +1849,9 @@ static int PR_CALLBACK CompareKey (const void *v1, const void *v2, void *)
}
/* static */nsresult
nsImapMailFolder::AllocateUidStringFromKeys(nsMsgKey *keys, PRInt32 numKeys, nsCString &msgIds)
nsImapMailFolder::AllocateUidStringFromKeys(nsMsgKey *keys, PRUint32 numKeys, nsCString &msgIds)
{
if (numKeys <= 0)
if (!numKeys)
return NS_ERROR_INVALID_ARG;
nsresult rv = NS_OK;
PRUint32 startSequence;
@ -3004,7 +3004,7 @@ NS_IMETHODIMP nsImapMailFolder::PlaybackOfflineFolderCreate(const PRUnichar *aFo
aFolderName, this, url);
}
NS_IMETHODIMP nsImapMailFolder::ReplayOfflineMoveCopy(nsMsgKey *msgKeys, PRInt32 numKeys, PRBool isMove, nsIMsgFolder *aDstFolder,
NS_IMETHODIMP nsImapMailFolder::ReplayOfflineMoveCopy(nsMsgKey *msgKeys, PRUint32 numKeys, PRBool isMove, nsIMsgFolder *aDstFolder,
nsIUrlListener *aUrlListener, nsIMsgWindow *aWindow)
{
nsresult rv;
@ -3036,7 +3036,7 @@ NS_IMETHODIMP nsImapMailFolder::ReplayOfflineMoveCopy(nsMsgKey *msgKeys, PRInt32
return rv;
}
NS_IMETHODIMP nsImapMailFolder::StoreImapFlags(PRInt32 flags, PRBool addFlags, nsMsgKey *keys, PRInt32 numKeys)
NS_IMETHODIMP nsImapMailFolder::StoreImapFlags(PRInt32 flags, PRBool addFlags, nsMsgKey *keys, PRUint32 numKeys)
{
nsresult rv = NS_OK;
if (!WeAreOffline())
@ -7181,7 +7181,7 @@ nsImapMailFolder::SpamFilterClassifyMessages(const char **aURIArray, PRUint32 aU
NS_IMETHODIMP
nsImapMailFolder::StoreCustomKeywords(nsIMsgWindow *aMsgWindow, const char *aFlagsToAdd,
const char *aFlagsToSubtract, nsMsgKey *aKeysToStore, PRInt32 aNumKeys, nsIURI **_retval)
const char *aFlagsToSubtract, nsMsgKey *aKeysToStore, PRUint32 aNumKeys, nsIURI **_retval)
{
nsresult rv;
nsCOMPtr<nsIImapService> imapService(do_GetService(NS_IMAPSERVICE_CONTRACTID, &rv));

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

@ -344,7 +344,7 @@ public:
virtual nsresult SpamFilterClassifyMessage(const char *aURI, nsIMsgWindow *aMsgWindow, nsIJunkMailPlugin *aJunkMailPlugin);
virtual nsresult SpamFilterClassifyMessages(const char **aURIArray, PRUint32 aURICount, nsIMsgWindow *aMsgWindow, nsIJunkMailPlugin *aJunkMailPlugin);
static nsresult AllocateUidStringFromKeys(nsMsgKey *keys, PRInt32 numKeys, nsCString &msgIds);
static nsresult AllocateUidStringFromKeys(nsMsgKey *keys, PRUint32 numKeys, nsCString &msgIds);
protected:
// Helper methods

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

@ -180,6 +180,9 @@ messenger.jar:
content/messenger/mime.js (mime/resources/content/mime.js)
content/messenger/downloadheaders.js (news/resources/content/downloadheaders.js)
content/messenger/downloadheaders.xul (news/resources/content/downloadheaders.xul)
content/messenger/markByDate.js (base/resources/content/markByDate.js)
content/messenger/markByDate.xul (base/resources/content/markByDate.xul)
content/messenger/dateFormat.js (base/resources/content/dateFormat.js)
en-US.jar:
locale/en-US/messenger/contents.rdf (base/resources/locale/en-US/contents.rdf)
@ -277,6 +280,7 @@ en-US.jar:
locale/en-US/messenger/mimeheader.properties (mime/resources/mimeheader.properties)
locale/en-US/messenger/vcard.properties (mime/cthandlers/resources/vcard.properties)
locale/en-US/messenger/smime.properties (mime/cthandlers/resources/smime.properties)
locale/en-US/messenger/markByDate.dtd (base/resources/locale/en-US/markByDate.dtd)
US.jar:
locale/US/messenger-region/contents.rdf (base/resources/locale/en-US/contents-region.rdf)