r=sspitzer. Move more functions into new FE files. Make sent folder display recipient column.

Make sorting by size and priority work correctly.
This commit is contained in:
putterman%netscape.com 2000-04-20 05:30:32 +00:00
Родитель 65031d8367
Коммит d2bfdc9f05
12 изменённых файлов: 359 добавлений и 144 удалений

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

@ -213,12 +213,36 @@ function RerootFolder(uri, newFolder, isThreaded, sortID, sortDirection)
else
SortThreadPane("DateColumn", "http://home.netscape.com/NC-rdf#Date", "", false, null);
SetSentFolderColumns(IsSpecialFolder(newFolder, "Sent"));
folder.setAttribute('ref', uri);
msgNavigationService.EnsureDocumentIsLoaded(document);
UpdateStatusMessageCounts(newFolder);
}
function SetSentFolderColumns(isSentFolder)
{
var senderColumn = document.getElementById("SenderColumnHeader");
var senderColumnTemplate = document.getElementById("SenderColumnTemplate");
var authorColumnHeader = document.getElementById("AuthorColumn");
if(isSentFolder)
{
senderColumn.setAttribute("value", Bundle.GetStringFromName("recipientColumnHeader"));
senderColumn.setAttribute("onclick", "return top.MsgSortByRecipient();");
senderColumnTemplate.setAttribute("value", "rdf:http://home.netscape.com/NC-rdf#Recipient");
authorColumnHeader.setAttribute("rdf:resource", "http://home.netscape.com/NC-rdf#Recipient");
}
else
{
senderColumn.setAttribute("value", Bundle.GetStringFromName("senderColumnHeader"));
senderColumn.setAttribute("onclick", "return top.MsgSortBySender();");
senderColumnTemplate.setAttribute("value", "rdf:http://home.netscape.com/NC-rdf#Sender");
authorColumnHeader.setAttribute("rdf:resource", "http://home.netscape.com/NC-rdf#Sender");
}
}
function UpdateStatusMessageCounts(folder)
{
@ -300,6 +324,8 @@ function FindThreadPaneColumnBySortResource(sortID)
return "DateColumn";
else if(sortID == "http://home.netscape.com/NC-rdf#Sender")
return "AuthorColumn";
else if(sortID == "http://home.netscape.com/NC-rdf#Recipient")
return "AuthorColumn";
else if(sortID == "http://home.netscape.com/NC-rdf#Status")
return "StatusColumn";
else if(sortID == "http://home.netscape.com/NC-rdf#Subject")
@ -606,7 +632,28 @@ function IsSpecialFolderSelected(folderName)
return false;
}
function IsSpecialFolder(msgFolder, specialFolderName)
{
var folderTree = GetFolderTree();
var db = folderTree.database;
var folderResource = msgFolder.QueryInterface(Components.interfaces.nsIRDFResource);
if(folderResource)
{
var property =
RDF.GetResource('http://home.netscape.com/NC-rdf#SpecialFolder');
if (!property) return false;
var result = db.GetTarget(folderResource, property , true);
if (!result) return false;
result = result.QueryInterface(Components.interfaces.nsIRDFLiteral);
if (!result) return false;
dump("We are looking for " + specialFolderName + "\n");
dump("special folder name = " + result.Value + "\n");
if(result.Value == specialFolderName)
return true;
}
return false;
}
function ChangeThreadView()
{

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

@ -30,7 +30,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<tree rdf:datasources="rdf:null"
<tree datasources="rdf:null"
id="folderTree" class="mail-folders"
rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild"
onselect="top.FolderPaneSelectionChange(); document.commandDispatcher.updateCommands('tree-select');"

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

@ -69,6 +69,26 @@ function GetNewMessages(selectedFolders, compositeDataSource)
}
}
function DeleteMessages(compositeDataSource, srcFolder, messages, reallyDelete)
{
var srcFolderResource = srcFolder.QueryInterface(Components.interfaces.nsIRDFResource);
var folderArray = Components.classes["component://netscape/supports-array"].createInstance(Components.interfaces.nsISupportsArray);
folderArray.AppendElement(srcFolderResource);
var argumentArray = ConvertMessagesToResourceArray(messages, null);
var command;
if(reallyDelete)
command = "http://home.netscape.com/NC-rdf#ReallyDelete"
else
command = "http://home.netscape.com/NC-rdf#Delete"
DoRDFCommand(compositeDataSource, command, folderArray, argumentArray);
}
function CopyMessages(compositeDataSource, srcFolder, destFolder, messages, isMove)
{
@ -83,7 +103,13 @@ function CopyMessages(compositeDataSource, srcFolder, destFolder, messages, isMo
argumentArray.AppendElement(srcFolderResource);
ConvertMessagesToResourceArray(messages, argumentArray);
DoRDFCommand(compositeDataSource, "http://home.netscape.com/NC-rdf#Copy", folderArray, argumentArray);
var command;
if(isMove)
command = "http://home.netscape.com/NC-rdf#Move"
else
command = "http://home.netscape.com/NC-rdf#Copy";
DoRDFCommand(compositeDataSource, command, folderArray, argumentArray);
}
}
@ -373,3 +399,45 @@ function MarkThreadAsRead(compositeDataSource, message)
}
function ViewPageSource(messages)
{
var url;
var uri;
var mailSessionProgID = "component://netscape/messenger/services/session";
var numMessages = messages.length;
if (numMessages == 0)
{
dump("MsgViewPageSource(): No messages selected.\n");
return false;
}
// First, get the mail session
var mailSession = Components.classes[mailSessionProgID].getService();
if (!mailSession)
return false;
mailSession = mailSession.QueryInterface(Components.interfaces.nsIMsgMailSession);
if (!mailSession)
return false;
for(var i = 0; i < numMessages; i++)
{
var messageResource = messages[i].QueryInterface(Components.interfaces.nsIRDFResource);
uri = messageResource.Value;
// Now, we need to get a URL from a URI
url = mailSession.ConvertMsgURIToMsgURL(uri, msgWindow);
if (url)
url += "?header=src";
// Use a browser window to view source
window.openDialog( "chrome://navigator/content/navigator.xul",
"_blank",
"chrome,menubar,status,dialog=no,resizable",
url,
"view-source" );
}
}

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

@ -36,6 +36,36 @@ function MsgGetMessage()
GetNewMessages(folders, compositeDataSource);
}
function MsgDeleteMessage(reallyDelete, fromToolbar)
{
if(reallyDelete)
dump("reallyDelete\n");
var srcFolder = GetLoadedMsgFolder();
var tree = GetThreadTree();
// if from the toolbar, return right away if this is a news message
// only allow cancel from the menu: "Edit | Cancel / Delete Message"
if (fromToolbar)
{
var folderResource = srcFolder.QueryInterface(Components.interfaces.nsIRDFResource);
var uri = folderResource.Value;
//dump("uri[0:6]=" + uri.substring(0,6) + "\n");
if (uri.substring(0,6) == "news:/")
{
//dump("delete ignored!\n");
return;
}
}
dump("tree is valid\n");
//get the selected elements
var compositeDataSource = GetCompositeDataSource("DeleteMessages");
var messages = GetSelectedMessages();
SetNextMessageAfterDelete(null, true);
DeleteMessages(compositeDataSource, srcFolder, messages, reallyDelete);
}
function MsgCopyMessage(destFolder)
{
// Get the id for the folder we're copying into
@ -47,10 +77,35 @@ function MsgCopyMessage(destFolder)
var compositeDataSource = GetCompositeDataSource("Copy");
var messages = GetSelectedMessages();
CopyMessages(compositeDataSource, srcFolder, destMsgFolder, messages);
CopyMessages(compositeDataSource, srcFolder, destMsgFolder, messages, false);
}
function MsgMoveMessage(destFolder)
{
// Get the id for the folder we're copying into
destUri = destFolder.getAttribute('id');
destResource = RDF.GetResource(destUri);
destMsgFolder = destResource.QueryInterface(Components.interfaces.nsIMsgFolder);
var srcFolder = GetLoadedMsgFolder();
var compositeDataSource = GetCompositeDataSource("Move");
var messages = GetSelectedMessages();
var srcResource = srcFolder.QueryInterface(Components.interfaces.nsIRDFResource);
var srcUri = srcResource.Value;
if (srcUri.substring(0,6) == "news:/")
{
CopyMessages(compositeDataSource, srcFolder, destMsgFolder, messages, false);
}
else
{
SetNextMessageAfterDelete(null, true);
CopyMessages(compositeDataSource, srcFolder, destMsgFolder, messages, true);
}
}
function MsgNewMessage(event)
{
var loadedFolder = GetFirstSelectedMsgFolder();
@ -277,6 +332,30 @@ function MsgMarkThreadAsRead()
}
function MsgViewPageSource()
{
dump("MsgViewPageSource(); \n ");
var messages = GetSelectedMessages();
ViewPageSource(messages);
}
function MsgFind() {
messenger.find();
}
function MsgFindAgain() {
messenger.findAgain();
}
function MsgSearchMessages() {
window.openDialog("chrome://messenger/content/SearchDialog.xul", "SearchMail", "chrome");
}
function MsgFilters() {
window.openDialog("chrome://messenger/content/FilterListDialog.xul", "FilterDialog", "chrome");
}
function MsgMarkByDate() {}
function MsgOpenAttachment() {}
function MsgUpdateMsgCount() {}

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

@ -28,6 +28,8 @@ var gCompositeDataSource;
var gCurrentMessageUri;
var gCurrentFolderUri;
var gCurrentMessageIsDeleted = false;
function OnLoadMessageWindow()
{
CreateMailWindowGlobals();
@ -138,3 +140,11 @@ function GetCompositeDataSource(command)
{
return gCompositeDataSource;
}
//Sets the next message after a delete. If useSelection is true then use the
//current selection to determine this. Otherwise use messagesToCheck which will
//be an array of nsIMessage's.
function SetNextMessageAfterDelete(messagesToCheck, useSelection)
{
gCurrentMessageIsDeleted = true;
}

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

@ -1219,14 +1219,14 @@ function GetLoadedMessage()
function GetCompositeDataSource(command)
{
if(command == "GetNewMessages" || command == "Copy" || command == "NewFolder" ||
command == "MarkAllMessagesRead")
if(command == "GetNewMessages" || command == "Copy" || command == "Move" ||
command == "NewFolder" || command == "MarkAllMessagesRead")
{
var folderTree = GetFolderTree();
return folderTree.database;
}
else if(command == "MarkMessageRead" || command == "MarkMessageFlagged" ||
command == "MarkThreadAsRead")
else if(command == "DeleteMessages" || command == "MarkMessageRead" ||
command == "MarkMessageFlagged" || command == "MarkThreadAsRead")
{
var threadTree = GetThreadTree();
return threadTree.database;
@ -1235,3 +1235,19 @@ function GetCompositeDataSource(command)
return null;
}
//Sets the next message after a delete. If useSelection is true then use the
//current selection to determine this. Otherwise use messagesToCheck which will
//be an array of nsIMessage's.
function SetNextMessageAfterDelete(messagesToCheck, useSelection)
{
if(useSelection)
{
var tree = GetThreadTree();
var nextMessage = GetNextMessageAfterDelete(tree.selectedItems);
if(nextMessage)
gNextMessageAfterDelete = nextMessage.getAttribute('id');
else
gNextMessageAfterDelete = null;
}
}

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

@ -62,7 +62,7 @@ Rights Reserved.
<treerow>
<treecell value="rdf:http://home.netscape.com/NC-rdf#Thread"/>
<treecell indent="true" value="rdf:http://home.netscape.com/NC-rdf#Subject"/>
<treecell value="rdf:http://home.netscape.com/NC-rdf#Sender"/>
<treecell value="rdf:http://home.netscape.com/NC-rdf#Sender" id ="SenderColumnTemplate"/>
<treecell allowevents="true" class="unreadcol image" onclick="return top.ToggleMessageRead(event.target.parentNode.parentNode.parentNode)"/>
<treecell value="rdf:http://home.netscape.com/NC-rdf#Date"/>
<treecell class="prioritycol" value="rdf:http://home.netscape.com/NC-rdf#Priority"/>
@ -99,7 +99,7 @@ Rights Reserved.
<treerow id="headRow">
<treecell display="Thread" onclick="return top.ChangeThreadView();" class='threadColumnHeader' id="ThreadColumnHeader"/>
<treecell value="&subjectColumn.label;" onclick="return top.MsgSortBySubject();"/>
<treecell onclick="return top.MsgSortBySender();" value="&senderColumn.label;"/>
<treecell onclick="return top.MsgSortBySender();" value="&senderColumn.label;" id="SenderColumnHeader"/>
<treecell display="Read" onclick="return top.MsgSortByRead();" class="readColumnHeader"/>
<treecell value="&dateColumn.label;" onclick="return top.MsgSortByDate();"/>
<treecell value="&priorityColumn.label;" onclick="return top.MsgSortByPriority();"/>

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

@ -34,39 +34,6 @@ var viewShowUnread =2;
var viewShowWatched = 3;
function MsgDeleteMessage(reallyDelete, fromToolbar)
{
//dump("\nMsgDeleteMessage from XUL\n");
//dump("from toolbar? " + fromToolbar + "\n");
if(reallyDelete)
dump("reallyDelete\n");
var tree = GetThreadTree();
if(tree) {
var srcFolder = GetThreadTreeFolder();
// if from the toolbar, return right away if this is a news message
// only allow cancel from the menu: "Edit | Cancel / Delete Message"
if (fromToolbar) {
uri = srcFolder.getAttribute('ref');
//dump("uri[0:6]=" + uri.substring(0,6) + "\n");
if (uri.substring(0,6) == "news:/") {
//dump("delete ignored!\n");
return;
}
}
dump("tree is valid\n");
//get the selected elements
var messageList = ConvertDOMListToResourceArray(tree.selectedItems);
var nextMessage = GetNextMessageAfterDelete(tree.selectedItems);
if(nextMessage)
gNextMessageAfterDelete = nextMessage.getAttribute('id');
else
gNextMessageAfterDelete = null;
messenger.DeleteMessages(tree.database, srcFolder.resource, messageList, reallyDelete);
}
}
function ConvertDOMListToResourceArray(nodeList)
{
@ -113,40 +80,7 @@ function MsgDeleteFolder()
function MsgMoveMessage(destFolder)
{
// Get the id for the folder we're copying into
destUri = destFolder.getAttribute('id');
dump(destUri);
var tree = GetThreadTree();
if(tree)
{
//Get the selected messages to copy
var messageList = ConvertDOMListToResourceArray(tree.selectedItems);
//get the current folder
var nextMessage = GetNextMessageAfterDelete(tree.selectedItems);
var srcFolder = GetThreadTreeFolder();
var srcUri = srcFolder.getAttribute('ref');
if (srcUri.substring(0,6) == "news:/")
{
messenger.CopyMessages(tree.database,
srcFolder.resource,
destFolder.resource, messageList, false);
}
else
{
if(nextMessage)
gNextMessageAfterDelete = nextMessage.getAttribute('id');
else
gNextMessageAfterDelete = null;
messenger.CopyMessages(tree.database,
srcFolder.resource,
destFolder.resource, messageList, true);
}
}
}
function MsgViewAllMsgs()
{
@ -195,6 +129,11 @@ function MsgSortBySender()
SortThreadPane('AuthorColumn', 'http://home.netscape.com/NC-rdf#Sender', 'http://home.netscape.com/NC-rdf#Date', true, null);
}
function MsgSortByRecipient()
{
SortThreadPane('AuthorColumn', 'http://home.netscape.com/NC-rdf#Recipient', 'http://home.netscape.com/NC-rdf#Date', true, null);
}
function MsgSortByStatus()
{
SortThreadPane('StatusColumn', 'http://home.netscape.com/NC-rdf#Status', 'http://home.netscape.com/NC-rdf#Date', true, null);
@ -421,20 +360,6 @@ function MsgCompactFolder()
}
}
function MsgFind() {
messenger.find();
}
function MsgFindAgain() {
messenger.findAgain();
}
function MsgSearchMessages() {
window.openDialog("chrome://messenger/content/SearchDialog.xul", "SearchMail", "chrome");
}
function MsgFilters() {
window.openDialog("chrome://messenger/content/FilterListDialog.xul", "FilterDialog", "chrome");
}
function MsgToggleMessagePane()
{
@ -484,51 +409,6 @@ function MsgReload()
}
function MsgViewPageSource()
{
dump("MsgViewPageSource(); \n ");
var tree = GetThreadTree();
var selectedItems = tree.selectedItems;
var numSelected = selectedItems.length;
var url;
var uri;
var mailSessionProgID = "component://netscape/messenger/services/session";
if (numSelected == 0)
{
dump("MsgViewPageSource(): No messages selected.\n");
return false;
}
// First, get the mail session
var mailSession = Components.classes[mailSessionProgID].getService();
if (!mailSession)
return false;
mailSession = mailSession.QueryInterface(Components.interfaces.nsIMsgMailSession);
if (!mailSession)
return false;
for(var i = 0; i < numSelected; i++)
{
uri = selectedItems[i].getAttribute("id");
// Now, we need to get a URL from a URI
url = mailSession.ConvertMsgURIToMsgURL(uri, msgWindow);
if (url)
url += "?header=src";
// Use a browser window to view source
window.openDialog( "chrome://navigator/content/navigator.xul",
"_blank",
"chrome,menubar,status,dialog=no,resizable",
url,
"view-source" );
}
}
function MsgStop() {
StopUrls();
}

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

@ -61,3 +61,7 @@ serverType-pop3=POP Mail Server
serverType-imap=IMAP Mail Server
serverType-none=Local Mail Store
serverType-movemail=Unix Movemail
recipientColumnHeader=Recipient
senderColumnHeader=Sender

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

@ -52,11 +52,15 @@ nsIRDFResource* nsMsgMessageDataSource::kNC_Subject = nsnull;
nsIRDFResource* nsMsgMessageDataSource::kNC_SubjectCollation = nsnull;
nsIRDFResource* nsMsgMessageDataSource::kNC_Sender= nsnull;
nsIRDFResource* nsMsgMessageDataSource::kNC_SenderCollation = nsnull;
nsIRDFResource* nsMsgMessageDataSource::kNC_Recipient= nsnull;
nsIRDFResource* nsMsgMessageDataSource::kNC_RecipientCollation = nsnull;
nsIRDFResource* nsMsgMessageDataSource::kNC_Date= nsnull;
nsIRDFResource* nsMsgMessageDataSource::kNC_Status= nsnull;
nsIRDFResource* nsMsgMessageDataSource::kNC_Flagged= nsnull;
nsIRDFResource* nsMsgMessageDataSource::kNC_Priority= nsnull;
nsIRDFResource* nsMsgMessageDataSource::kNC_PrioritySort= nsnull;
nsIRDFResource* nsMsgMessageDataSource::kNC_Size= nsnull;
nsIRDFResource* nsMsgMessageDataSource::kNC_SizeSort= nsnull;
nsIRDFResource* nsMsgMessageDataSource::kNC_Total = nsnull;
nsIRDFResource* nsMsgMessageDataSource::kNC_Unread = nsnull;
nsIRDFResource* nsMsgMessageDataSource::kNC_MessageChild = nsnull;
@ -108,11 +112,15 @@ nsMsgMessageDataSource::~nsMsgMessageDataSource (void)
NS_RELEASE2(kNC_SubjectCollation, refcnt);
NS_RELEASE2(kNC_Sender, refcnt);
NS_RELEASE2(kNC_SenderCollation, refcnt);
NS_RELEASE2(kNC_Recipient, refcnt);
NS_RELEASE2(kNC_RecipientCollation, refcnt);
NS_RELEASE2(kNC_Date, refcnt);
NS_RELEASE2(kNC_Status, refcnt);
NS_RELEASE2(kNC_Flagged, refcnt);
NS_RELEASE2(kNC_Priority, refcnt);
NS_RELEASE2(kNC_PrioritySort, refcnt);
NS_RELEASE2(kNC_Size, refcnt);
NS_RELEASE2(kNC_SizeSort, refcnt);
NS_RELEASE2(kNC_Total, refcnt);
NS_RELEASE2(kNC_Unread, refcnt);
NS_RELEASE2(kNC_MessageChild, refcnt);
@ -165,11 +173,15 @@ nsresult nsMsgMessageDataSource::Init()
rdf->GetResource(NC_RDF_SUBJECT_COLLATION_SORT, &kNC_SubjectCollation);
rdf->GetResource(NC_RDF_SENDER, &kNC_Sender);
rdf->GetResource(NC_RDF_SENDER_COLLATION_SORT, &kNC_SenderCollation);
rdf->GetResource(NC_RDF_RECIPIENT, &kNC_Recipient);
rdf->GetResource(NC_RDF_RECIPIENT_COLLATION_SORT, &kNC_RecipientCollation);
rdf->GetResource(NC_RDF_DATE, &kNC_Date);
rdf->GetResource(NC_RDF_STATUS, &kNC_Status);
rdf->GetResource(NC_RDF_FLAGGED, &kNC_Flagged);
rdf->GetResource(NC_RDF_PRIORITY, &kNC_Priority);
rdf->GetResource(NC_RDF_PRIORITY_SORT, &kNC_PrioritySort);
rdf->GetResource(NC_RDF_SIZE, &kNC_Size);
rdf->GetResource(NC_RDF_SIZE_SORT, &kNC_SizeSort);
rdf->GetResource(NC_RDF_TOTALMESSAGES, &kNC_Total);
rdf->GetResource(NC_RDF_TOTALUNREADMESSAGES, &kNC_Unread);
rdf->GetResource(NC_RDF_MESSAGECHILD, &kNC_MessageChild);
@ -212,6 +224,16 @@ nsresult nsMsgMessageDataSource::CreateLiterals(nsIRDFService *rdf)
createNode(str, getter_AddRefs(kHighLiteral), rdf);
str = "highest";
createNode(str, getter_AddRefs(kHighestLiteral), rdf);
str = "4";
createNode(str, getter_AddRefs(kLowestSortLiteral), rdf);
str = "3";
createNode(str, getter_AddRefs(kLowSortLiteral), rdf);
str = "2";
createNode(str, getter_AddRefs(kNormalSortLiteral), rdf);
str = "1";
createNode(str, getter_AddRefs(kHighSortLiteral), rdf);
str = "0";
createNode(str, getter_AddRefs(kHighestSortLiteral), rdf);
str = "flagged";
createNode(str, getter_AddRefs(kFlaggedLiteral), rdf);
str = "unflagged";
@ -526,6 +548,7 @@ nsMsgMessageDataSource::getMessageArcLabelsOut(PRBool showThreads,
(*arcs)->AppendElement(kNC_Subject);
(*arcs)->AppendElement(kNC_Sender);
(*arcs)->AppendElement(kNC_Recipient);
(*arcs)->AppendElement(kNC_Date);
(*arcs)->AppendElement(kNC_Status);
(*arcs)->AppendElement(kNC_Flagged);
@ -915,6 +938,10 @@ nsMsgMessageDataSource::createMessageNode(nsIMessage *message,
rv = createMessageSenderNode(message, PR_TRUE, target);
else if (kNC_Sender == property)
rv = createMessageSenderNode(message, PR_FALSE, target);
else if (kNC_RecipientCollation == property)
rv = createMessageRecipientNode(message, PR_TRUE, target);
else if (kNC_Recipient == property)
rv = createMessageRecipientNode(message, PR_FALSE, target);
else if ((kNC_Date == property))
rv = createMessageDateNode(message, target);
else if ((kNC_Status == property))
@ -923,8 +950,12 @@ nsMsgMessageDataSource::createMessageNode(nsIMessage *message,
rv = createMessageFlaggedNode(message, target);
else if ((kNC_Priority == property))
rv = createMessagePriorityNode(message, target);
else if ((kNC_PrioritySort == property))
rv = createMessagePrioritySortNode(message, target);
else if ((kNC_Size == property))
rv = createMessageSizeNode(message, target);
rv = createMessageSizeNode(message, target, PR_FALSE);
else if ((kNC_SizeSort == property))
rv = createMessageSizeNode(message, target, PR_TRUE);
else if (( kNC_Total == property))
rv = createMessageTotalNode(message, target);
else if ((kNC_Unread == property))
@ -1006,6 +1037,31 @@ nsMsgMessageDataSource::createMessageSenderNode(nsIMessage *message,
return rv;
}
nsresult
nsMsgMessageDataSource::createMessageRecipientNode(nsIMessage *message,
PRBool sort,
nsIRDFNode **target)
{
nsresult rv = NS_OK;
nsXPIDLString recipients;
nsAutoString recipientUserName;
if(sort)
{
rv = message->GetRecipientsCollationKey(getter_Copies(recipients));
if(NS_SUCCEEDED(rv))
rv = createNode(recipients, target, getRDFService());
}
else
{
rv = message->GetMime2DecodedRecipients(getter_Copies(recipients));
if(NS_SUCCEEDED(rv))
rv = GetSenderName(recipients, &recipientUserName);
if(NS_SUCCEEDED(rv))
rv = createNode(recipientUserName, target, getRDFService());
}
return rv;
}
nsresult
nsMsgMessageDataSource::createMessageDateNode(nsIMessage *message,
nsIRDFNode **target)
@ -1253,8 +1309,41 @@ nsMsgMessageDataSource::createMessagePriorityNode(nsIMessage *message,
}
nsresult
nsMsgMessageDataSource::createMessageSizeNode(nsIMessage *message,
nsIRDFNode **target)
nsMsgMessageDataSource::createMessagePrioritySortNode(nsIMessage *message, nsIRDFNode **target)
{
nsresult rv;
nsMsgPriority priority;
rv = message->GetPriority(&priority);
if(NS_FAILED(rv))
return rv;
*target = kNormalSortLiteral;
switch (priority)
{
case nsMsgPriorityNotSet:
case nsMsgPriorityNone:
case nsMsgPriorityNormal:
*target = kNormalSortLiteral;
break;
case nsMsgPriorityLowest:
*target = kLowestSortLiteral;
break;
case nsMsgPriorityLow:
*target = kLowSortLiteral;
break;
case nsMsgPriorityHigh:
*target = kHighSortLiteral;
break;
case nsMsgPriorityHighest:
*target = kHighestSortLiteral;
break;
}
NS_IF_ADDREF(*target);
return NS_OK;
}
nsresult
nsMsgMessageDataSource::createMessageSizeNode(nsIMessage *message, nsIRDFNode **target, PRBool sort)
{
nsresult rv;
PRUint32 size;
@ -1266,13 +1355,18 @@ nsMsgMessageDataSource::createMessageSizeNode(nsIMessage *message,
size = 1024;
PRUint32 sizeInKB = size/1024;
char * kbStr = PR_smprintf("%uKB", sizeInKB);
if(kbStr)
if(!sort)
{
sizeStr =kbStr;
PR_smprintf_free(kbStr);
char * kbStr = PR_smprintf("%uKB", sizeInKB);
if(kbStr)
{
sizeStr =kbStr;
PR_smprintf_free(kbStr);
}
rv = createNode(sizeStr, target, getRDFService());
}
rv = createNode(sizeStr, target, getRDFService());
else
rv = createIntNode(sizeInKB, target, getRDFService());
return rv;
}

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

@ -123,6 +123,9 @@ protected:
nsresult createMessageSenderNode(nsIMessage *message,
PRBool sort,
nsIRDFNode **target);
nsresult createMessageRecipientNode(nsIMessage *message,
PRBool sort,
nsIRDFNode **target);
nsresult createMessageDateNode(nsIMessage *message,
nsIRDFNode **target);
nsresult createMessageStatusNode(nsIMessage *message,
@ -136,10 +139,11 @@ protected:
nsresult createMessagePriorityNode(nsIMessage *message,
nsIRDFNode **target);
nsresult createMessagePrioritySortNode(nsIMessage *message, nsIRDFNode **target);
nsresult createPriorityString(nsMsgPriority priority, nsCAutoString &priorityStr);
nsresult createMessageSizeNode(nsIMessage *message,
nsIRDFNode **target);
nsresult createMessageSizeNode(nsIMessage *message, nsIRDFNode **target, PRBool sort);
nsresult createMessageIsUnreadNode(nsIMessage *message, nsIRDFNode **target);
nsresult createMessageHasAttachmentNode(nsIMessage *message, nsIRDFNode **target);
@ -188,11 +192,15 @@ protected:
static nsIRDFResource* kNC_SubjectCollation;
static nsIRDFResource* kNC_Sender;
static nsIRDFResource* kNC_SenderCollation;
static nsIRDFResource* kNC_Recipient;
static nsIRDFResource* kNC_RecipientCollation;
static nsIRDFResource* kNC_Date;
static nsIRDFResource* kNC_Status;
static nsIRDFResource* kNC_Flagged;
static nsIRDFResource* kNC_Priority;
static nsIRDFResource* kNC_PrioritySort;
static nsIRDFResource* kNC_Size;
static nsIRDFResource* kNC_SizeSort;
static nsIRDFResource* kNC_Total;
static nsIRDFResource* kNC_Unread;
static nsIRDFResource* kNC_MessageChild;
@ -217,6 +225,11 @@ protected:
nsCOMPtr<nsIRDFNode> kLowLiteral;
nsCOMPtr<nsIRDFNode> kHighLiteral;
nsCOMPtr<nsIRDFNode> kHighestLiteral;
nsCOMPtr<nsIRDFNode> kLowestSortLiteral;
nsCOMPtr<nsIRDFNode> kLowSortLiteral;
nsCOMPtr<nsIRDFNode> kNormalSortLiteral;
nsCOMPtr<nsIRDFNode> kHighSortLiteral;
nsCOMPtr<nsIRDFNode> kHighestSortLiteral;
nsCOMPtr<nsIRDFNode> kFlaggedLiteral;
nsCOMPtr<nsIRDFNode> kUnflaggedLiteral;
nsCOMPtr<nsIRDFNode> kRepliedLiteral;

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

@ -40,6 +40,7 @@ typedef struct _nsMsgRDFNotification {
#define NC_RDF_SUBJECT NC_NAMESPACE_URI "Subject"
#define NC_RDF_SENDER NC_NAMESPACE_URI "Sender"
#define NC_RDF_RECIPIENT NC_NAMESPACE_URI "Recipient"
#define NC_RDF_DATE NC_NAMESPACE_URI "Date"
#define NC_RDF_STATUS NC_NAMESPACE_URI "Status"
#define NC_RDF_FLAGGED NC_NAMESPACE_URI "Flagged"
@ -75,7 +76,10 @@ typedef struct _nsMsgRDFNotification {
//Sort Properties
#define NC_RDF_SUBJECT_COLLATION_SORT NC_NAMESPACE_URI "Subject?collation=true"
#define NC_RDF_SENDER_COLLATION_SORT NC_NAMESPACE_URI "Sender?collation=true"
#define NC_RDF_RECIPIENT_COLLATION_SORT NC_NAMESPACE_URI "Recipient?collation=true"
#define NC_RDF_ORDERRECEIVED_SORT NC_NAMESPACE_URI "OrderReceived?sort=true"
#define NC_RDF_PRIORITY_SORT NC_NAMESPACE_URI "Priority?sort=true"
#define NC_RDF_SIZE_SORT NC_NAMESPACE_URI "Size?sort=true"
#define NC_RDF_NAME_SORT NC_NAMESPACE_URI "Name?sort=true"
#define NC_RDF_FOLDERTREENAME_SORT NC_NAMESPACE_URI "FolderTreeName?sort=true"