1999-06-08 00:59:02 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
1999-06-08 02:17:35 +00:00
|
|
|
* 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, released
|
|
|
|
* March 31, 1998.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
1999-06-08 00:59:02 +00:00
|
|
|
*/
|
|
|
|
|
1999-06-08 02:17:35 +00:00
|
|
|
|
1999-06-08 00:59:02 +00:00
|
|
|
/*
|
|
|
|
* Command-specific code. This stuff should be called by the widgets
|
|
|
|
*/
|
|
|
|
|
2000-04-11 20:19:32 +00:00
|
|
|
//The eventual goal is for this file to go away and for the functions to either be brought into
|
|
|
|
//mailCommands.js or into 3pane specific code.
|
1999-06-04 04:00:58 +00:00
|
|
|
|
1999-09-16 21:11:01 +00:00
|
|
|
var gBeforeFolderLoadTime;
|
2000-06-07 01:00:05 +00:00
|
|
|
var gRDFNamespace = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
1999-05-28 19:41:31 +00:00
|
|
|
function OpenURL(url)
|
|
|
|
{
|
|
|
|
dump("\n\nOpenURL from XUL\n\n\n");
|
1999-10-29 04:39:06 +00:00
|
|
|
messenger.SetWindow(window, msgWindow);
|
1999-06-08 00:26:29 +00:00
|
|
|
messenger.OpenURL(url);
|
1999-05-28 19:41:31 +00:00
|
|
|
}
|
|
|
|
|
1999-10-20 18:31:26 +00:00
|
|
|
|
2000-02-02 07:28:23 +00:00
|
|
|
|
1999-05-28 19:41:31 +00:00
|
|
|
|
2000-03-30 22:38:45 +00:00
|
|
|
function GetMsgFolderFromNode(folderNode)
|
|
|
|
{
|
|
|
|
var folderURI = folderNode.getAttribute("id");
|
|
|
|
return GetMsgFolderFromURI(folderURI);
|
|
|
|
}
|
|
|
|
|
|
|
|
function GetMsgFolderFromURI(folderURI)
|
|
|
|
{
|
|
|
|
var folderResource = RDF.GetResource(folderURI);
|
|
|
|
if(folderResource)
|
|
|
|
{
|
|
|
|
var msgFolder = folderResource.QueryInterface(Components.interfaces.nsIMsgFolder);
|
|
|
|
return msgFolder;
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
1999-05-28 19:41:31 +00:00
|
|
|
|
|
|
|
function LoadMessage(messageNode)
|
|
|
|
{
|
2000-05-01 21:58:24 +00:00
|
|
|
var uri = messageNode.getAttribute('id');
|
|
|
|
dump(uri + "\n");
|
|
|
|
|
|
|
|
LoadMessageByUri(uri);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function LoadMessageByUri(uri)
|
|
|
|
{
|
|
|
|
if(uri != gCurrentDisplayedMessage)
|
|
|
|
{
|
|
|
|
var resource = RDF.GetResource(uri);
|
|
|
|
var message = resource.QueryInterface(Components.interfaces.nsIMessage);
|
|
|
|
if (message)
|
|
|
|
setTitleFromFolder(message.msgFolder, message.mime2DecodedSubject);
|
|
|
|
|
2000-06-23 03:19:17 +00:00
|
|
|
var nsIMsgFolder = Components.interfaces.nsIMsgFolder;
|
|
|
|
if (message.msgFolder.server.downloadOnBiff)
|
|
|
|
message.msgFolder.biffState = nsIMsgFolder.nsMsgBiffState_NoMail;
|
|
|
|
|
2000-05-01 21:58:24 +00:00
|
|
|
gCurrentDisplayedMessage = uri;
|
|
|
|
gHaveLoadedMessage = true;
|
|
|
|
OpenURL(uri);
|
|
|
|
}
|
|
|
|
|
1999-05-28 19:41:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function ChangeFolderByDOMNode(folderNode)
|
|
|
|
{
|
|
|
|
var uri = folderNode.getAttribute('id');
|
|
|
|
dump(uri + "\n");
|
1999-09-08 07:03:03 +00:00
|
|
|
|
1999-11-11 00:23:29 +00:00
|
|
|
var isThreaded = folderNode.getAttribute('threaded');
|
2000-03-14 05:38:51 +00:00
|
|
|
var sortResource = folderNode.getAttribute('sortResource');
|
|
|
|
if(!sortResource)
|
|
|
|
sortResource = "";
|
|
|
|
|
|
|
|
var sortDirection = folderNode.getAttribute('sortDirection');
|
1999-11-11 00:23:29 +00:00
|
|
|
|
1999-09-08 07:03:03 +00:00
|
|
|
if (uri)
|
2000-03-14 05:38:51 +00:00
|
|
|
ChangeFolderByURI(uri, isThreaded == "true", sortResource, sortDirection);
|
1999-05-28 19:41:31 +00:00
|
|
|
}
|
|
|
|
|
2000-02-29 07:04:24 +00:00
|
|
|
function setTitleFromFolder(msgfolder, subject)
|
2000-02-15 07:11:11 +00:00
|
|
|
{
|
|
|
|
if (!msgfolder) return;
|
|
|
|
|
|
|
|
var title;
|
|
|
|
var server = msgfolder.server;
|
|
|
|
|
2000-02-29 07:04:24 +00:00
|
|
|
if (null != subject)
|
|
|
|
title = subject+" - ";
|
|
|
|
else
|
|
|
|
title = "";
|
|
|
|
|
2000-02-15 07:11:11 +00:00
|
|
|
if (msgfolder.isServer) {
|
|
|
|
// <hostname>
|
2000-02-29 07:04:24 +00:00
|
|
|
title += server.hostName;
|
2000-02-15 07:11:11 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
var middle;
|
|
|
|
var end;
|
|
|
|
if (server.type == "nntp") {
|
|
|
|
// <folder> on <hostname>
|
|
|
|
middle = Bundle.GetStringFromName("titleNewsPreHost");
|
|
|
|
end = server.hostName;
|
|
|
|
} else {
|
2000-03-05 21:25:53 +00:00
|
|
|
var identity;
|
|
|
|
try {
|
|
|
|
var identities = accountManager.GetIdentitiesForServer(server);
|
|
|
|
|
|
|
|
identity = identities.QueryElementAt(0, Components.interfaces.nsIMsgIdentity);
|
|
|
|
// <folder> for <email>
|
|
|
|
middle = Bundle.GetStringFromName("titleMailPreHost");
|
|
|
|
end = identity.email;
|
|
|
|
} catch (ex) {
|
|
|
|
}
|
2000-02-15 07:11:11 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2000-03-05 21:25:53 +00:00
|
|
|
title += msgfolder.prettyName;
|
|
|
|
if (middle) title += " " + middle;
|
|
|
|
if (end) title += " " + end;
|
2000-02-15 07:11:11 +00:00
|
|
|
}
|
2000-02-29 07:04:24 +00:00
|
|
|
|
2000-02-15 07:11:11 +00:00
|
|
|
title += " - " + BrandBundle.GetStringFromName("brandShortName");
|
|
|
|
window.title = title;
|
|
|
|
}
|
|
|
|
|
2000-03-14 05:38:51 +00:00
|
|
|
function ChangeFolderByURI(uri, isThreaded, sortID, sortDirection)
|
1999-05-28 19:41:31 +00:00
|
|
|
{
|
2000-09-05 23:52:44 +00:00
|
|
|
dump('In ChangeFolderByURI uri = ' + uri + "\n");
|
|
|
|
if (uri == gCurrentLoadingFolderURI)
|
|
|
|
return;
|
1999-09-08 07:03:03 +00:00
|
|
|
var resource = RDF.GetResource(uri);
|
|
|
|
var msgfolder =
|
|
|
|
resource.QueryInterface(Components.interfaces.nsIMsgFolder);
|
|
|
|
|
2000-02-15 07:11:11 +00:00
|
|
|
try {
|
2000-02-29 07:04:24 +00:00
|
|
|
setTitleFromFolder(msgfolder, null);
|
2000-02-15 07:11:11 +00:00
|
|
|
} catch (ex) {
|
|
|
|
dump("error setting title: " + ex + "\n");
|
|
|
|
}
|
2000-08-14 14:40:33 +00:00
|
|
|
|
2000-02-15 07:11:11 +00:00
|
|
|
|
2000-08-14 14:40:33 +00:00
|
|
|
//if it's a server, clear the threadpane and don't bother trying to load.
|
|
|
|
if(msgfolder.isServer)
|
|
|
|
{
|
|
|
|
ClearThreadPane();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-09-16 21:11:01 +00:00
|
|
|
gBeforeFolderLoadTime = new Date();
|
2000-01-09 19:47:58 +00:00
|
|
|
gCurrentLoadingFolderURI = uri;
|
2000-09-20 23:21:17 +00:00
|
|
|
gNextMessageAfterDelete = null; // forget what message to select, if any
|
1999-09-16 21:11:01 +00:00
|
|
|
|
1999-10-20 21:58:21 +00:00
|
|
|
if(msgfolder.manyHeadersToDownload())
|
1999-09-16 21:11:01 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2000-08-26 20:54:51 +00:00
|
|
|
SetBusyCursor(window, true);
|
2000-01-09 19:47:58 +00:00
|
|
|
gCurrentFolderToReroot = uri;
|
1999-11-11 00:23:29 +00:00
|
|
|
gCurrentLoadingFolderIsThreaded = isThreaded;
|
|
|
|
gCurrentLoadingFolderSortID = sortID;
|
2000-03-14 05:38:51 +00:00
|
|
|
gCurrentLoadingFolderSortDirection = sortDirection;
|
1999-10-20 21:58:21 +00:00
|
|
|
msgfolder.startFolderLoading();
|
1999-11-02 21:36:59 +00:00
|
|
|
msgfolder.updateFolder(msgWindow);
|
1999-09-16 21:11:01 +00:00
|
|
|
}
|
|
|
|
catch(ex)
|
|
|
|
{
|
2000-06-21 06:35:58 +00:00
|
|
|
dump("Error loading with many headers to download: " + ex + "\n");
|
1999-09-16 21:11:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-08-26 20:54:51 +00:00
|
|
|
SetBusyCursor(window, true);
|
2000-01-09 19:47:58 +00:00
|
|
|
gCurrentFolderToReroot = "";
|
1999-11-11 00:23:29 +00:00
|
|
|
gCurrentLoadingFolderIsThreaded = false;
|
|
|
|
gCurrentLoadingFolderSortID = "";
|
2000-03-14 05:38:51 +00:00
|
|
|
RerootFolder(uri, msgfolder, isThreaded, sortID, sortDirection);
|
|
|
|
|
2000-01-09 19:47:58 +00:00
|
|
|
//Need to do this after rerooting folder. Otherwise possibility of receiving folder loaded
|
|
|
|
//notification before folder has actually changed.
|
|
|
|
msgfolder.updateFolder(msgWindow);
|
1999-09-16 21:11:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-03-14 05:38:51 +00:00
|
|
|
function RerootFolder(uri, newFolder, isThreaded, sortID, sortDirection)
|
1999-09-16 21:11:01 +00:00
|
|
|
{
|
1999-11-11 00:23:29 +00:00
|
|
|
dump('In reroot folder\n');
|
1999-06-23 03:02:21 +00:00
|
|
|
var folder = GetThreadTreeFolder();
|
1999-09-13 21:11:45 +00:00
|
|
|
ClearThreadTreeSelection();
|
1999-10-28 23:27:21 +00:00
|
|
|
|
|
|
|
//Set the window's new open folder.
|
|
|
|
msgWindow.openFolder = newFolder;
|
|
|
|
|
1999-11-11 00:23:29 +00:00
|
|
|
//Set threaded state
|
|
|
|
ShowThreads(isThreaded);
|
2000-03-14 05:38:51 +00:00
|
|
|
|
2000-06-23 03:19:17 +00:00
|
|
|
|
2000-03-30 22:38:45 +00:00
|
|
|
//Clear the new messages of the old folder
|
|
|
|
var oldFolderURI = folder.getAttribute("ref");
|
2000-03-31 01:56:12 +00:00
|
|
|
if(oldFolderURI && (oldFolderURI != "null") && (oldFolderURI !=""))
|
2000-03-30 22:38:45 +00:00
|
|
|
{
|
2000-06-23 03:19:17 +00:00
|
|
|
var oldFolder = GetMsgFolderFromURI(oldFolderURI);
|
|
|
|
if(oldFolder)
|
|
|
|
{
|
|
|
|
if (oldFolder.hasNewMessages)
|
|
|
|
oldFolder.clearNewMessages();
|
|
|
|
}
|
2000-03-30 22:38:45 +00:00
|
|
|
}
|
2000-06-23 03:19:17 +00:00
|
|
|
|
|
|
|
//the new folder being selected should have its biff state get cleared.
|
|
|
|
if(newFolder)
|
|
|
|
{
|
|
|
|
newFolder.biffState =
|
|
|
|
Components.interfaces.nsIMsgFolder.nsMsgBiffState_NoMail;
|
|
|
|
}
|
|
|
|
|
2000-03-14 05:38:51 +00:00
|
|
|
//Clear out the thread pane so that we can sort it with the new sort id without taking any time.
|
|
|
|
folder.setAttribute('ref', "");
|
|
|
|
|
|
|
|
var column = FindThreadPaneColumnBySortResource(sortID);
|
|
|
|
|
|
|
|
if(column)
|
2000-08-26 20:54:51 +00:00
|
|
|
SortThreadPane(column, sortID, "http://home.netscape.com/NC-rdf#Date", false, sortDirection, false);
|
2000-03-14 05:38:51 +00:00
|
|
|
else
|
2000-08-26 20:54:51 +00:00
|
|
|
SortThreadPane("DateColumn", "http://home.netscape.com/NC-rdf#Date", "", false, null, false);
|
1999-11-11 00:23:29 +00:00
|
|
|
|
2000-04-20 05:30:32 +00:00
|
|
|
SetSentFolderColumns(IsSpecialFolder(newFolder, "Sent"));
|
2000-05-05 23:47:33 +00:00
|
|
|
|
|
|
|
// Since SetSentFolderColumns() may alter the template's structure,
|
|
|
|
// we need to explicitly force the builder to recompile its rules.
|
2000-08-11 01:14:59 +00:00
|
|
|
//when switching folders, switch back to closing threads
|
|
|
|
SetTemplateTreeItemOpen(false);
|
2000-05-05 23:47:33 +00:00
|
|
|
folder.builder.rebuild();
|
|
|
|
|
1999-07-27 17:20:28 +00:00
|
|
|
folder.setAttribute('ref', uri);
|
2000-03-14 05:38:51 +00:00
|
|
|
msgNavigationService.EnsureDocumentIsLoaded(document);
|
|
|
|
|
1999-11-22 22:08:23 +00:00
|
|
|
UpdateStatusMessageCounts(newFolder);
|
2000-08-26 20:54:51 +00:00
|
|
|
|
1999-05-28 19:41:31 +00:00
|
|
|
}
|
|
|
|
|
2000-04-20 05:30:32 +00:00
|
|
|
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");
|
2000-09-14 05:36:52 +00:00
|
|
|
authorColumnHeader.setAttribute("resource", "http://home.netscape.com/NC-rdf#Recipient");
|
2000-04-20 05:30:32 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
senderColumn.setAttribute("value", Bundle.GetStringFromName("senderColumnHeader"));
|
|
|
|
senderColumn.setAttribute("onclick", "return top.MsgSortBySender();");
|
|
|
|
senderColumnTemplate.setAttribute("value", "rdf:http://home.netscape.com/NC-rdf#Sender");
|
2000-09-14 05:36:52 +00:00
|
|
|
authorColumnHeader.setAttribute("resource", "http://home.netscape.com/NC-rdf#Sender");
|
2000-04-20 05:30:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
1999-11-22 22:08:23 +00:00
|
|
|
|
|
|
|
function UpdateStatusMessageCounts(folder)
|
|
|
|
{
|
|
|
|
var unreadElement = GetUnreadCountElement();
|
|
|
|
var totalElement = GetTotalCountElement();
|
|
|
|
if(folder && unreadElement && totalElement)
|
|
|
|
{
|
2000-07-27 07:11:15 +00:00
|
|
|
var numUnread =
|
|
|
|
Bundle.formatStringFromName("unreadMsgStatus",
|
|
|
|
[ folder.getNumUnread(false)], 1);
|
|
|
|
var numTotal =
|
|
|
|
Bundle.formatStringFromName("totalMsgStatus",
|
|
|
|
[folder.getTotalMessages(false)], 1);
|
1999-11-22 22:08:23 +00:00
|
|
|
|
|
|
|
unreadElement.setAttribute("value", numUnread);
|
|
|
|
totalElement.setAttribute("value", numTotal);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2000-02-04 01:56:38 +00:00
|
|
|
function SaveThreadPaneSelection()
|
|
|
|
{
|
|
|
|
var tree = GetThreadTree();
|
|
|
|
var selectedItems = tree.selectedItems;
|
|
|
|
var numSelected = selectedItems.length;
|
|
|
|
|
|
|
|
var selectionArray = new Array(numSelected);
|
|
|
|
|
|
|
|
for(var i = 0; i < numSelected; i++)
|
|
|
|
{
|
|
|
|
selectionArray[i] = selectedItems[i].getAttribute("id");
|
|
|
|
}
|
|
|
|
|
|
|
|
return selectionArray;
|
|
|
|
}
|
|
|
|
|
|
|
|
function RestoreThreadPaneSelection(selectionArray)
|
|
|
|
{
|
|
|
|
var tree = GetThreadTree();
|
|
|
|
var numSelected = selectionArray.length;
|
|
|
|
|
|
|
|
msgNavigationService.EnsureDocumentIsLoaded(document);
|
|
|
|
|
|
|
|
var messageElement;
|
|
|
|
for(var i = 0 ; i < numSelected; i++)
|
|
|
|
{
|
|
|
|
messageElement = document.getElementById(selectionArray[i]);
|
|
|
|
|
|
|
|
if(!messageElement && messageView.showThreads)
|
|
|
|
{
|
|
|
|
var treeFolder = GetThreadTreeFolder();
|
|
|
|
var folderURI = treeFolder.getAttribute('ref');
|
|
|
|
var folderResource = RDF.GetResource(folderURI);
|
|
|
|
var folder = folderResource.QueryInterface(Components.interfaces.nsIMsgFolder);
|
|
|
|
|
|
|
|
var messageResource = RDF.GetResource(selectionArray[i]);
|
|
|
|
var message = messageResource.QueryInterface(Components.interfaces.nsIMessage);
|
|
|
|
|
|
|
|
var topLevelMessage = GetTopLevelMessageForMessage(message, folder);
|
|
|
|
var topLevelResource = topLevelMessage.QueryInterface(Components.interfaces.nsIRDFResource);
|
|
|
|
var topLevelURI = topLevelResource.Value;
|
|
|
|
var topElement = document.getElementById(topLevelURI);
|
|
|
|
if(topElement)
|
|
|
|
{
|
|
|
|
msgNavigationService.OpenTreeitemAndDescendants(topElement);
|
|
|
|
}
|
|
|
|
|
|
|
|
messageElement = document.getElementById(selectionArray[i]);
|
|
|
|
|
|
|
|
}
|
2000-08-26 20:54:51 +00:00
|
|
|
if(messageElement)
|
|
|
|
{
|
|
|
|
dump("We have a messageElement\n");
|
|
|
|
tree.addItemToSelection(messageElement);
|
|
|
|
if(i==0)
|
|
|
|
tree.ensureElementIsVisible(messageElement);
|
|
|
|
}
|
2000-02-04 01:56:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2000-03-14 05:38:51 +00:00
|
|
|
function FindThreadPaneColumnBySortResource(sortID)
|
|
|
|
{
|
|
|
|
|
|
|
|
if(sortID == "http://home.netscape.com/NC-rdf#Date")
|
|
|
|
return "DateColumn";
|
|
|
|
else if(sortID == "http://home.netscape.com/NC-rdf#Sender")
|
|
|
|
return "AuthorColumn";
|
2000-04-20 05:30:32 +00:00
|
|
|
else if(sortID == "http://home.netscape.com/NC-rdf#Recipient")
|
|
|
|
return "AuthorColumn";
|
2000-03-14 05:38:51 +00:00
|
|
|
else if(sortID == "http://home.netscape.com/NC-rdf#Status")
|
|
|
|
return "StatusColumn";
|
|
|
|
else if(sortID == "http://home.netscape.com/NC-rdf#Subject")
|
|
|
|
return "SubjectColumn";
|
|
|
|
else if(sortID == "http://home.netscape.com/NC-rdf#Flagged")
|
|
|
|
return "FlaggedButtonColumn";
|
|
|
|
else if(sortID == "http://home.netscape.com/NC-rdf#Priority")
|
|
|
|
return "PriorityColumn";
|
|
|
|
else if(sortID == "http://home.netscape.com/NC-rdf#Size")
|
|
|
|
return "SizeColumn";
|
2000-08-13 17:04:46 +00:00
|
|
|
else if(sortID == "http://home.netscape.com/NC-rdf#IsUnread")
|
2000-03-14 05:38:51 +00:00
|
|
|
return "UnreadButtonColumn";
|
|
|
|
else if(sortID == "http://home.netscape.com/NC-rdf#TotalUnreadMessages")
|
|
|
|
return "UnreadColumn";
|
|
|
|
else if(sortID == "http://home.netscape.com/NC-rdf#TotalMessages")
|
|
|
|
return "TotalColumn";
|
2000-03-31 05:58:37 +00:00
|
|
|
else if(sortID == "http://home.netscape.com/NC-rdf#OrderReceived")
|
|
|
|
return "OrderReceivedColumn";
|
2000-03-14 05:38:51 +00:00
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//If toggleCurrentDirection is true, then get current direction and flip to opposite.
|
|
|
|
//If it's not true then use the direction passed in.
|
2000-08-26 20:54:51 +00:00
|
|
|
function SortThreadPane(column, sortKey, secondarySortKey, toggleCurrentDirection, direction, changeCursor)
|
1999-05-28 19:41:31 +00:00
|
|
|
{
|
2000-08-26 20:54:51 +00:00
|
|
|
//dump("In SortThreadPane\n");
|
1999-09-01 23:50:16 +00:00
|
|
|
var node = document.getElementById(column);
|
1999-05-28 19:41:31 +00:00
|
|
|
if(!node)
|
|
|
|
return false;
|
|
|
|
|
2000-03-14 05:38:51 +00:00
|
|
|
if(!direction)
|
|
|
|
{
|
|
|
|
direction = "ascending";
|
|
|
|
//If we just clicked on the same column, then change the direction
|
|
|
|
if(toggleCurrentDirection)
|
|
|
|
{
|
|
|
|
var currentDirection = node.getAttribute('sortDirection');
|
|
|
|
if (currentDirection == "ascending")
|
|
|
|
direction = "descending";
|
|
|
|
else if (currentDirection == "descending")
|
|
|
|
direction = "ascending";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-08-04 17:37:29 +00:00
|
|
|
UpdateSortIndicator(column, direction);
|
2000-08-18 14:35:32 +00:00
|
|
|
UpdateSortMenu(column);
|
2000-08-04 17:37:29 +00:00
|
|
|
|
2000-03-14 05:38:51 +00:00
|
|
|
var folder = GetSelectedFolder();
|
|
|
|
if(folder)
|
|
|
|
{
|
|
|
|
folder.setAttribute("sortResource", sortKey);
|
|
|
|
folder.setAttribute("sortDirection", direction);
|
|
|
|
}
|
|
|
|
|
|
|
|
SetActiveThreadPaneSortColumn(column);
|
|
|
|
|
2000-02-04 01:56:38 +00:00
|
|
|
var selection = SaveThreadPaneSelection();
|
|
|
|
var beforeSortTime = new Date();
|
1999-08-27 03:47:44 +00:00
|
|
|
|
2000-08-26 20:54:51 +00:00
|
|
|
if(changeCursor)
|
|
|
|
SetBusyCursor(window, true);
|
2000-03-14 05:38:51 +00:00
|
|
|
var result = SortColumn(node, sortKey, secondarySortKey, direction);
|
2000-08-26 20:54:51 +00:00
|
|
|
if(changeCursor)
|
|
|
|
SetBusyCursor(window, false);
|
2000-02-04 01:56:38 +00:00
|
|
|
var afterSortTime = new Date();
|
|
|
|
var timeToSort = (afterSortTime.getTime() - beforeSortTime.getTime())/1000;
|
1999-08-27 03:47:44 +00:00
|
|
|
|
2000-02-04 01:56:38 +00:00
|
|
|
if(showPerformance)
|
|
|
|
dump("timeToSort is " + timeToSort + "seconds\n");
|
|
|
|
RestoreThreadPaneSelection(selection);
|
|
|
|
return result;
|
1999-08-27 03:47:44 +00:00
|
|
|
}
|
|
|
|
|
2000-08-04 17:37:29 +00:00
|
|
|
//------------------------------------------------------------
|
|
|
|
// Sets the column header sort icon based on the requested
|
|
|
|
// column and direction.
|
|
|
|
//
|
|
|
|
// Notes:
|
|
|
|
// (1) This function relies on the first part of the
|
|
|
|
// <treecell id> matching the <treecol id>. The treecell
|
|
|
|
// id must have a "Header" suffix.
|
|
|
|
// (2) By changing the "sortDirection" attribute, a different
|
|
|
|
// CSS style will be used, thus changing the icon based on
|
|
|
|
// the "sortDirection" parameter.
|
|
|
|
//------------------------------------------------------------
|
|
|
|
function UpdateSortIndicator(column,sortDirection)
|
|
|
|
{
|
|
|
|
// Find the <treerow> element
|
|
|
|
var treerow = document.getElementById("headRow");
|
|
|
|
|
|
|
|
//The SortThreadPane function calls the Sender/Recipient column 'AuthorColumn'
|
|
|
|
//but it's treecell header id is actually 'SenderColumnHeader', so we need to flip
|
|
|
|
//it here so that the css can handle changing it's style correctly.
|
|
|
|
if(column == "AuthorColumn"){
|
|
|
|
column = "SenderColumn";
|
|
|
|
}
|
|
|
|
|
|
|
|
var id = column + "Header";
|
|
|
|
|
|
|
|
if (treerow)
|
|
|
|
{
|
|
|
|
// Grab all of the <treecell> elements
|
|
|
|
var treecell = treerow.getElementsByTagName("treecell");
|
|
|
|
if (treecell)
|
|
|
|
{
|
|
|
|
// Loop through each treecell...
|
|
|
|
var node_count = treecell.length;
|
|
|
|
for (var i=0; i < node_count; i++)
|
|
|
|
{
|
|
|
|
// Is this the requested column ?
|
|
|
|
if (id == treecell[i].getAttribute("id"))
|
|
|
|
{
|
|
|
|
// Set the sortDirection so the class (CSS) will add the
|
|
|
|
// appropriate icon to the header cell
|
|
|
|
treecell[i].setAttribute('sortDirection',sortDirection);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// This is not the sorted row
|
|
|
|
treecell[i].removeAttribute('sortDirection');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-08-18 14:35:32 +00:00
|
|
|
function UpdateSortMenu(currentSortColumn)
|
|
|
|
{
|
|
|
|
UpdateSortMenuitem(currentSortColumn, "sortByDateMenuitem", "DateColumn");
|
|
|
|
UpdateSortMenuitem(currentSortColumn, "sortByFlagMenuitem", "FlaggedButtonColumn");
|
|
|
|
UpdateSortMenuitem(currentSortColumn, "sortByOrderReceivedMenuitem", "OrderReceivedColumn");
|
|
|
|
UpdateSortMenuitem(currentSortColumn, "sortByPriorityMenuitem", "PriorityColumn");
|
|
|
|
UpdateSortMenuitem(currentSortColumn, "sortBySenderMenuitem", "AuthorColumn");
|
|
|
|
UpdateSortMenuitem(currentSortColumn, "sortBySizeMenuitem", "SizeColumn");
|
|
|
|
UpdateSortMenuitem(currentSortColumn, "sortByStatusMenuitem", "StatusColumn");
|
|
|
|
UpdateSortMenuitem(currentSortColumn, "sortBySubjectMenuitem", "SubjectColumn");
|
|
|
|
UpdateSortMenuitem(currentSortColumn, "sortByUnreadMenuitem", "UnreadButtonColumn");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function UpdateSortMenuitem(currentSortColumnID, menuItemID, columnID)
|
|
|
|
{
|
|
|
|
var menuItem = document.getElementById(menuItemID);
|
|
|
|
if(menuItem)
|
|
|
|
{
|
|
|
|
menuItem.setAttribute("checked", currentSortColumnID == columnID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-08-27 03:47:44 +00:00
|
|
|
function SortFolderPane(column, sortKey)
|
|
|
|
{
|
1999-09-16 21:11:01 +00:00
|
|
|
var node = FindInSidebar(window, column);
|
1999-08-27 03:47:44 +00:00
|
|
|
if(!node)
|
1999-09-16 21:11:01 +00:00
|
|
|
{
|
|
|
|
dump('Couldnt find sort column\n');
|
1999-08-27 03:47:44 +00:00
|
|
|
return false;
|
1999-09-16 21:11:01 +00:00
|
|
|
}
|
2000-08-18 14:35:32 +00:00
|
|
|
SortColumn(node, sortKey, null, null);
|
|
|
|
//Remove the sortActive attribute because we don't want this pane to have any
|
|
|
|
//sort styles.
|
|
|
|
node.setAttribute("sortActive", "false");
|
2000-09-08 05:46:35 +00:00
|
|
|
return true;
|
1999-08-27 03:47:44 +00:00
|
|
|
}
|
|
|
|
|
2000-03-14 05:38:51 +00:00
|
|
|
function SortColumn(node, sortKey, secondarySortKey, direction)
|
1999-08-27 03:47:44 +00:00
|
|
|
{
|
2000-08-04 17:37:29 +00:00
|
|
|
dump('In SortColumn\n');
|
2000-09-13 23:57:52 +00:00
|
|
|
var xulSortService = Components.classes["@mozilla.org/rdf/xul-sort-service;1"].getService();
|
1999-08-30 02:57:03 +00:00
|
|
|
|
|
|
|
if (xulSortService)
|
1999-05-28 19:41:31 +00:00
|
|
|
{
|
1999-08-30 02:57:03 +00:00
|
|
|
xulSortService = xulSortService.QueryInterface(Components.interfaces.nsIXULSortService);
|
|
|
|
if (xulSortService)
|
1999-05-28 19:41:31 +00:00
|
|
|
{
|
1999-08-30 02:57:03 +00:00
|
|
|
// sort!!!
|
2000-03-14 05:38:51 +00:00
|
|
|
var sortDirection;
|
|
|
|
if(direction)
|
|
|
|
sortDirection = direction;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var currentDirection = node.getAttribute('sortDirection');
|
|
|
|
if (currentDirection == "ascending")
|
|
|
|
sortDirection = "descending";
|
|
|
|
else if (currentDirection == "descending")
|
|
|
|
sortDirection = "ascending";
|
|
|
|
else sortDirection = "ascending";
|
|
|
|
}
|
1999-08-30 02:57:03 +00:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2000-01-13 06:02:29 +00:00
|
|
|
if(secondarySortKey)
|
2000-09-14 05:36:52 +00:00
|
|
|
node.setAttribute('resource2', secondarySortKey);
|
1999-08-30 02:57:03 +00:00
|
|
|
xulSortService.Sort(node, sortKey, sortDirection);
|
|
|
|
}
|
|
|
|
catch(e)
|
|
|
|
{
|
1999-12-21 21:43:29 +00:00
|
|
|
//dump("Sort failed: " + e + "\n");
|
1999-08-30 02:57:03 +00:00
|
|
|
}
|
1999-05-28 19:41:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
1999-06-03 22:56:45 +00:00
|
|
|
function GetSelectedFolderResource()
|
|
|
|
{
|
|
|
|
var folderTree = GetFolderTree();
|
1999-08-23 02:58:28 +00:00
|
|
|
var selectedFolderList = folderTree.selectedItems;
|
1999-06-03 22:56:45 +00:00
|
|
|
var selectedFolder = selectedFolderList[0];
|
|
|
|
var uri = selectedFolder.getAttribute('id');
|
|
|
|
|
|
|
|
|
|
|
|
var folderResource = RDF.GetResource(uri);
|
|
|
|
return folderResource;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function SetFolderCharset(folderResource, aCharset)
|
|
|
|
{
|
2000-06-30 06:02:30 +00:00
|
|
|
var db = GetFolderDatasource();
|
1999-06-03 22:56:45 +00:00
|
|
|
|
|
|
|
var charsetResource = RDF.GetLiteral(aCharset);
|
|
|
|
var charsetProperty = RDF.GetResource("http://home.netscape.com/NC-rdf#Charset");
|
|
|
|
|
2000-06-30 06:02:30 +00:00
|
|
|
db.Assert(folderResource, charsetProperty, charsetResource, true);
|
1999-06-03 22:56:45 +00:00
|
|
|
}
|
1999-06-23 03:02:21 +00:00
|
|
|
|
1999-09-01 23:50:16 +00:00
|
|
|
|
1999-06-24 20:23:28 +00:00
|
|
|
|
1999-07-15 03:11:33 +00:00
|
|
|
function ToggleMessageRead(treeItem)
|
|
|
|
{
|
|
|
|
|
|
|
|
var tree = GetThreadTree();
|
2000-04-14 14:07:23 +00:00
|
|
|
|
|
|
|
var messageResource = RDF.GetResource(treeItem.getAttribute('id'));
|
2000-08-12 01:08:09 +00:00
|
|
|
|
|
|
|
var property = RDF.GetResource('http://home.netscape.com/NC-rdf#IsUnread');
|
|
|
|
var result = tree.database.GetTarget(messageResource, property , true);
|
|
|
|
result = result.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
|
|
|
var isUnread = (result.Value == "true")
|
|
|
|
|
2000-04-14 14:07:23 +00:00
|
|
|
var message = messageResource.QueryInterface(Components.interfaces.nsIMessage);
|
|
|
|
var messageArray = new Array(1);
|
|
|
|
messageArray[0] = message;
|
|
|
|
|
2000-08-12 01:08:09 +00:00
|
|
|
MarkMessagesRead(tree.database, messageArray, isUnread);
|
1999-07-15 03:11:33 +00:00
|
|
|
}
|
|
|
|
|
1999-08-24 21:48:24 +00:00
|
|
|
function ToggleMessageFlagged(treeItem)
|
|
|
|
{
|
|
|
|
|
|
|
|
var tree = GetThreadTree();
|
2000-04-14 14:07:23 +00:00
|
|
|
|
|
|
|
var messageResource = RDF.GetResource(treeItem.getAttribute('id'));
|
2000-08-12 01:08:09 +00:00
|
|
|
|
|
|
|
var property = RDF.GetResource('http://home.netscape.com/NC-rdf#Flagged');
|
|
|
|
var result = tree.database.GetTarget(messageResource, property , true);
|
|
|
|
result = result.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
|
|
|
var flagged = (result.Value == "flagged")
|
|
|
|
|
2000-04-14 14:07:23 +00:00
|
|
|
var message = messageResource.QueryInterface(Components.interfaces.nsIMessage);
|
|
|
|
var messageArray = new Array(1);
|
|
|
|
messageArray[0] = message;
|
|
|
|
|
|
|
|
MarkMessagesFlagged(tree.database, messageArray, !flagged);
|
|
|
|
|
1999-08-24 21:48:24 +00:00
|
|
|
}
|
|
|
|
|
1999-11-11 20:24:46 +00:00
|
|
|
//Called when the splitter in between the thread and message panes is clicked.
|
|
|
|
function OnClickThreadAndMessagePaneSplitter()
|
|
|
|
{
|
2000-04-21 14:22:16 +00:00
|
|
|
dump("We are in OnClickThreadAndMessagePaneSplitter()\n");
|
1999-11-11 20:24:46 +00:00
|
|
|
var collapsed = IsThreadAndMessagePaneSplitterCollapsed();
|
|
|
|
//collapsed is the previous state so we know we are opening.
|
|
|
|
if(collapsed)
|
|
|
|
LoadSelectionIntoMessagePane();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//takes the selection from the thread pane and loads it into the message pane
|
|
|
|
function LoadSelectionIntoMessagePane()
|
1999-08-02 23:58:09 +00:00
|
|
|
{
|
1999-08-23 02:58:28 +00:00
|
|
|
var tree = GetThreadTree();
|
1999-08-02 23:58:09 +00:00
|
|
|
|
1999-08-23 02:58:28 +00:00
|
|
|
var selArray = tree.selectedItems;
|
2000-04-13 03:03:50 +00:00
|
|
|
if (!gNextMessageAfterDelete && selArray && (selArray.length == 1) )
|
1999-08-02 23:58:09 +00:00
|
|
|
LoadMessage(selArray[0]);
|
|
|
|
else
|
2000-01-06 00:54:09 +00:00
|
|
|
{
|
|
|
|
// don't necessarily clear the message pane...if you uncomment this,
|
|
|
|
// you'll be introducing a large inefficiency when deleting messages...as deleting
|
|
|
|
// a msg brings us here twice...so we end up clearing the message pane twice for no
|
|
|
|
// good reason...
|
|
|
|
// ClearMessagePane();
|
|
|
|
}
|
1999-08-02 23:58:09 +00:00
|
|
|
}
|
|
|
|
|
1999-10-05 04:14:26 +00:00
|
|
|
function FolderPaneSelectionChange()
|
|
|
|
{
|
|
|
|
var tree = GetFolderTree();
|
|
|
|
if(tree)
|
|
|
|
{
|
|
|
|
var selArray = tree.selectedItems;
|
|
|
|
if ( selArray && (selArray.length == 1) )
|
2000-06-21 06:35:58 +00:00
|
|
|
{
|
1999-10-05 04:14:26 +00:00
|
|
|
ChangeFolderByDOMNode(selArray[0]);
|
2000-06-21 06:35:58 +00:00
|
|
|
}
|
1999-10-05 04:14:26 +00:00
|
|
|
else
|
|
|
|
{
|
2000-08-14 14:40:33 +00:00
|
|
|
ClearThreadPane();
|
1999-10-05 04:14:26 +00:00
|
|
|
}
|
|
|
|
}
|
2000-08-14 14:40:33 +00:00
|
|
|
ClearMessagePane();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function ClearThreadPane()
|
|
|
|
{
|
|
|
|
var threadTree = GetThreadTree();
|
|
|
|
ClearThreadTreeSelection();
|
|
|
|
threadTree.setAttribute('ref', null);
|
1999-10-05 04:14:26 +00:00
|
|
|
}
|
|
|
|
|
1999-08-07 00:22:44 +00:00
|
|
|
function OpenFolderTreeToFolder(folderURI)
|
|
|
|
{
|
|
|
|
var tree = GetFolderTree();
|
|
|
|
return OpenToFolder(tree, folderURI);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function OpenToFolder(item, folderURI)
|
|
|
|
{
|
|
|
|
|
|
|
|
if(item.nodeType != Node.ELEMENT_NODE)
|
|
|
|
return null;
|
|
|
|
|
|
|
|
var uri = item.getAttribute('id');
|
|
|
|
dump(uri);
|
|
|
|
dump('\n');
|
|
|
|
if(uri == folderURI)
|
|
|
|
{
|
|
|
|
dump('found folder: ' + uri);
|
|
|
|
dump('\n');
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
|
|
|
var children = item.childNodes;
|
|
|
|
var length = children.length;
|
|
|
|
var i;
|
|
|
|
dump('folder ' + uri);
|
|
|
|
dump('has ' + length);
|
|
|
|
dump('children\n');
|
|
|
|
for(i = 0; i < length; i++)
|
|
|
|
{
|
|
|
|
var child = children[i];
|
|
|
|
var folder = OpenToFolder(child, folderURI);
|
|
|
|
if(folder)
|
|
|
|
{
|
|
|
|
child.setAttribute('open', 'true');
|
|
|
|
return folder;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
1999-08-09 19:51:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-04-20 05:30:32 +00:00
|
|
|
function IsSpecialFolder(msgFolder, specialFolderName)
|
|
|
|
{
|
2000-06-30 06:02:30 +00:00
|
|
|
var db = GetFolderDatasource();
|
2000-04-20 05:30:32 +00:00
|
|
|
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;
|
|
|
|
}
|
1999-08-20 22:47:12 +00:00
|
|
|
|
2000-04-20 05:30:32 +00:00
|
|
|
return false;
|
|
|
|
}
|
1999-08-25 23:56:54 +00:00
|
|
|
|
1999-08-20 22:47:12 +00:00
|
|
|
|
1999-08-25 23:56:54 +00:00
|
|
|
function ShowThreads(showThreads)
|
|
|
|
{
|
1999-09-01 23:50:16 +00:00
|
|
|
dump('in showthreads\n');
|
1999-09-09 06:18:40 +00:00
|
|
|
if(messageView)
|
1999-08-25 23:56:54 +00:00
|
|
|
{
|
1999-09-09 06:18:40 +00:00
|
|
|
messageView.showThreads = showThreads;
|
1999-09-01 23:50:16 +00:00
|
|
|
var threadColumn = document.getElementById('ThreadColumnHeader');
|
1999-08-25 23:56:54 +00:00
|
|
|
if(threadColumn)
|
|
|
|
{
|
|
|
|
if(showThreads)
|
|
|
|
{
|
|
|
|
threadColumn.setAttribute('currentView', 'threaded');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
threadColumn.setAttribute('currentView', 'unthreaded');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-08-20 22:47:12 +00:00
|
|
|
}
|
|
|
|
|
1999-09-13 21:11:45 +00:00
|
|
|
|
1999-09-14 04:41:46 +00:00
|
|
|
function GetNextMessageAfterDelete(messages)
|
1999-09-13 21:11:45 +00:00
|
|
|
{
|
|
|
|
var count = messages.length;
|
|
|
|
|
1999-09-14 04:41:46 +00:00
|
|
|
var curMessage = messages[0];
|
|
|
|
var nextMessage = null;
|
1999-10-27 04:46:12 +00:00
|
|
|
var tree = GetThreadTree();
|
|
|
|
|
1999-09-14 04:41:46 +00:00
|
|
|
//search forward
|
|
|
|
while(curMessage)
|
|
|
|
{
|
2000-01-28 23:25:17 +00:00
|
|
|
nextMessage = msgNavigationService.FindNextMessage(navigateAny, tree, curMessage, RDF, document, false, messageView.showThreads);
|
1999-09-14 04:41:46 +00:00
|
|
|
if(nextMessage)
|
|
|
|
{
|
2000-01-28 23:25:17 +00:00
|
|
|
if(nextMessage.getAttribute("selected") != "true")
|
1999-09-14 04:41:46 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
curMessage = nextMessage;
|
|
|
|
}
|
|
|
|
//if no nextmessage then search backwards
|
|
|
|
if(!nextMessage)
|
|
|
|
{
|
|
|
|
|
2000-09-08 05:46:35 +00:00
|
|
|
curMessage = messages[0];
|
|
|
|
nextMessage = null;
|
1999-09-14 04:41:46 +00:00
|
|
|
//search forward
|
|
|
|
while(curMessage)
|
|
|
|
{
|
2000-01-28 23:25:17 +00:00
|
|
|
nextMessage = msgNavigationService.FindPreviousMessage(navigateAny, tree, curMessage, RDF, document, false, messageView.showThreads);
|
1999-09-14 04:41:46 +00:00
|
|
|
if(nextMessage)
|
|
|
|
{
|
2000-01-28 23:25:17 +00:00
|
|
|
if(nextMessage.getAttribute("selected") != "true")
|
1999-09-14 04:41:46 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
curMessage = nextMessage;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
return nextMessage;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function SelectNextMessage(nextMessage)
|
|
|
|
{
|
1999-09-13 21:11:45 +00:00
|
|
|
var tree = GetThreadTree();
|
|
|
|
ChangeSelection(tree, nextMessage);
|
|
|
|
|
|
|
|
}
|
1999-12-03 05:59:57 +00:00
|
|
|
|
|
|
|
function GetSelectTrashUri(folder)
|
|
|
|
{
|
|
|
|
if (!folder) return null;
|
|
|
|
var uri = folder.getAttribute('id');
|
|
|
|
dump (uri + "\n");
|
|
|
|
var resource = RDF.GetResource(uri);
|
|
|
|
var msgFolder =
|
|
|
|
resource.QueryInterface(Components.interfaces.nsIMsgFolder);
|
|
|
|
if (msgFolder)
|
|
|
|
{
|
|
|
|
dump("GetSelectTrashUri" + "\n");
|
|
|
|
var rootFolder = msgFolder.rootFolder;
|
|
|
|
var numFolder;
|
2000-01-11 08:01:37 +00:00
|
|
|
var out = new Object();
|
|
|
|
var trashFolder = rootFolder.getFoldersWithFlag(0x0100, 1, out);
|
2000-01-11 08:20:31 +00:00
|
|
|
numFolder = out.value;
|
1999-12-03 05:59:57 +00:00
|
|
|
dump (numFolder + "\n");
|
|
|
|
if (trashFolder)
|
|
|
|
{
|
|
|
|
dump (trashFolder.URI + "\n");
|
|
|
|
return trashFolder.URI;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
2000-01-12 02:25:35 +00:00
|
|
|
|
2000-02-07 15:15:14 +00:00
|
|
|
function Undo()
|
|
|
|
{
|
|
|
|
messenger.Undo(msgWindow);
|
|
|
|
}
|
2000-01-12 02:25:35 +00:00
|
|
|
|
2000-02-07 15:15:14 +00:00
|
|
|
function Redo()
|
|
|
|
{
|
|
|
|
messenger.Redo(msgWindow);
|
|
|
|
}
|
2000-02-15 23:05:06 +00:00
|
|
|
|