2000-06-21 06:35:58 +00:00
|
|
|
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
1999-09-01 23:49:47 +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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* This is where functions related to the 3 pane window are kept */
|
|
|
|
|
2000-04-11 20:19:32 +00:00
|
|
|
|
2001-01-12 22:26:10 +00:00
|
|
|
var showPerformance = false;
|
2000-02-04 01:56:38 +00:00
|
|
|
|
2001-02-07 04:40:40 +00:00
|
|
|
var gFolderTree;
|
2001-03-17 01:59:34 +00:00
|
|
|
var gThreadOutliner;
|
2000-10-05 21:17:22 +00:00
|
|
|
var gMessagePane;
|
2001-02-07 04:40:40 +00:00
|
|
|
var gMessagePaneFrame;
|
|
|
|
|
1999-11-11 20:24:46 +00:00
|
|
|
var gThreadAndMessagePaneSplitter = null;
|
1999-11-22 22:08:23 +00:00
|
|
|
var gUnreadCount = null;
|
|
|
|
var gTotalCount = null;
|
1999-11-11 20:24:46 +00:00
|
|
|
|
1999-11-11 00:23:29 +00:00
|
|
|
var gCurrentLoadingFolderURI;
|
2000-01-09 19:47:58 +00:00
|
|
|
var gCurrentFolderToReroot;
|
2001-03-17 01:59:34 +00:00
|
|
|
var gCurrentLoadingFolderSortType = 0;
|
|
|
|
var gCurrentLoadingFolderSortOrder = 0;
|
|
|
|
var gCurrentLoadingFolderViewType = 0;
|
|
|
|
var gCurrentLoadingFolderViewFlags = 0;
|
1999-09-15 08:29:01 +00:00
|
|
|
|
2000-02-04 15:19:57 +00:00
|
|
|
var gCurrentDisplayedMessage = null;
|
2000-02-16 00:39:23 +00:00
|
|
|
var gNextMessageAfterDelete = null;
|
2001-04-04 04:32:10 +00:00
|
|
|
var gNextMessageAfterLoad = null;
|
2001-03-17 01:59:34 +00:00
|
|
|
var gNextMessageViewIndexAfterDelete = -1;
|
1999-12-24 01:08:05 +00:00
|
|
|
|
2000-03-14 05:38:51 +00:00
|
|
|
var gActiveThreadPaneSortColumn = "";
|
|
|
|
|
2000-03-17 01:10:57 +00:00
|
|
|
var gStartFolderUri = null;
|
|
|
|
|
2000-04-21 14:22:16 +00:00
|
|
|
//If we've loaded a message, set to true. Helps us keep the start page around.
|
|
|
|
var gHaveLoadedMessage;
|
|
|
|
|
2001-03-14 02:32:04 +00:00
|
|
|
var gDisplayStartupPage = false;
|
2001-01-30 22:02:27 +00:00
|
|
|
|
1999-09-13 21:11:45 +00:00
|
|
|
// the folderListener object
|
|
|
|
var folderListener = {
|
1999-11-11 00:23:29 +00:00
|
|
|
OnItemAdded: function(parentItem, item, view) {},
|
1999-09-13 21:11:45 +00:00
|
|
|
|
1999-11-11 00:23:29 +00:00
|
|
|
OnItemRemoved: function(parentItem, item, view){},
|
1999-09-13 21:11:45 +00:00
|
|
|
|
|
|
|
OnItemPropertyChanged: function(item, property, oldValue, newValue) {},
|
|
|
|
|
1999-11-22 22:08:23 +00:00
|
|
|
OnItemIntPropertyChanged: function(item, property, oldValue, newValue)
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
var currentLoadedFolder = GetThreadPaneFolder();
|
2001-03-22 01:26:58 +00:00
|
|
|
if (!currentLoadedFolder) return;
|
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
var currentURI = currentLoadedFolder.URI;
|
2000-03-14 05:38:51 +00:00
|
|
|
|
|
|
|
//if we don't have a folder loaded, don't bother.
|
|
|
|
if(currentURI)
|
1999-11-22 22:08:23 +00:00
|
|
|
{
|
2000-03-14 05:38:51 +00:00
|
|
|
if(property.GetUnicode() == "TotalMessages" || property.GetUnicode() == "TotalUnreadMessages")
|
1999-11-22 22:08:23 +00:00
|
|
|
{
|
2000-09-08 04:22:01 +00:00
|
|
|
var folder = item.QueryInterface(Components.interfaces.nsIMsgFolder);
|
2000-03-14 05:38:51 +00:00
|
|
|
if(folder)
|
1999-11-22 22:08:23 +00:00
|
|
|
{
|
2000-03-14 05:38:51 +00:00
|
|
|
var folderResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
|
|
|
|
if(folderResource)
|
1999-11-22 22:08:23 +00:00
|
|
|
{
|
2000-03-14 05:38:51 +00:00
|
|
|
var folderURI = folderResource.Value;
|
|
|
|
if(currentURI == folderURI)
|
|
|
|
{
|
|
|
|
UpdateStatusMessageCounts(folder);
|
|
|
|
}
|
1999-11-22 22:08:23 +00:00
|
|
|
}
|
2000-03-14 05:38:51 +00:00
|
|
|
}
|
2001-03-17 01:59:34 +00:00
|
|
|
}
|
1999-11-22 22:08:23 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) {},
|
|
|
|
|
2000-01-20 22:56:00 +00:00
|
|
|
OnItemUnicharPropertyChanged: function(item, property, oldValue, newValue){},
|
1999-09-16 21:11:01 +00:00
|
|
|
OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) {},
|
|
|
|
|
2000-05-14 20:36:26 +00:00
|
|
|
OnItemEvent: function(folder, event) {
|
2001-01-30 22:02:27 +00:00
|
|
|
var eventType = event.GetUnicode();
|
|
|
|
|
|
|
|
if (eventType == "FolderLoaded") {
|
1999-09-16 21:11:01 +00:00
|
|
|
if(folder)
|
|
|
|
{
|
|
|
|
var resource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
|
|
|
|
if(resource)
|
|
|
|
{
|
|
|
|
var uri = resource.Value;
|
2001-03-24 01:12:33 +00:00
|
|
|
//dump("In OnFolderLoaded for " + uri +"\n");
|
2001-01-05 08:34:29 +00:00
|
|
|
|
2000-01-09 19:47:58 +00:00
|
|
|
if(uri == gCurrentFolderToReroot)
|
1999-09-16 21:11:01 +00:00
|
|
|
{
|
2000-01-09 19:47:58 +00:00
|
|
|
gCurrentFolderToReroot="";
|
1999-09-21 21:04:52 +00:00
|
|
|
var msgFolder = folder.QueryInterface(Components.interfaces.nsIMsgFolder);
|
|
|
|
if(msgFolder)
|
1999-10-28 23:27:21 +00:00
|
|
|
{
|
1999-10-20 21:58:21 +00:00
|
|
|
msgFolder.endFolderLoading();
|
2001-03-17 01:59:34 +00:00
|
|
|
RerootFolder(uri, msgFolder, gCurrentLoadingFolderViewType, gCurrentLoadingFolderViewFlags, gCurrentLoadingFolderSortType, gCurrentLoadingFolderSortOrder);
|
2001-03-20 06:41:20 +00:00
|
|
|
gIsEditableMsgFolder = IsSpecialFolder(msgFolder, MSG_FOLDER_FLAG_DRAFTS);
|
2001-02-07 04:35:37 +00:00
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
gCurrentLoadingFolderSortType = 0;
|
|
|
|
gCurrentLoadingFolderSortOrder = 0;
|
|
|
|
gCurrentLoadingFolderViewType = 0;
|
|
|
|
gCurrentLoadingFolderViewFlags = 0;
|
2000-11-05 02:29:47 +00:00
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
SetFocusThreadPane();
|
2001-04-04 04:32:10 +00:00
|
|
|
var scrolled = false;
|
2001-03-17 01:59:34 +00:00
|
|
|
if (gNextMessageAfterLoad)
|
|
|
|
{
|
2001-04-04 04:32:10 +00:00
|
|
|
var type = gNextMessageAfterLoad;
|
|
|
|
gNextMessageAfterLoad = null;
|
2000-11-05 02:29:47 +00:00
|
|
|
|
2001-04-04 04:32:10 +00:00
|
|
|
// scroll to and select the proper message
|
|
|
|
scrolled = ScrollToMessage(type, true, true /* selectMessage */);
|
2001-03-17 01:59:34 +00:00
|
|
|
}
|
1999-10-28 23:27:21 +00:00
|
|
|
}
|
1999-09-16 21:11:01 +00:00
|
|
|
}
|
2000-01-09 19:47:58 +00:00
|
|
|
if(uri == gCurrentLoadingFolderURI)
|
|
|
|
{
|
|
|
|
gCurrentLoadingFolderURI = "";
|
|
|
|
//Now let's select the first new message if there is one
|
2001-04-04 04:32:10 +00:00
|
|
|
var beforeScrollToNew;
|
2001-01-12 22:26:10 +00:00
|
|
|
if(showPerformance) {
|
|
|
|
beforeScrollToNew = new Date();
|
|
|
|
}
|
2001-04-04 04:32:10 +00:00
|
|
|
if (!scrolled) {
|
|
|
|
// if we didn't just scroll, scroll to the first new message
|
|
|
|
// don't select it though
|
2001-04-04 04:43:15 +00:00
|
|
|
scrolled = ScrollToMessage(nsMsgNavigationType.firstNew, true, false /* selectMessage */);
|
|
|
|
|
|
|
|
// if we failed to find a new message, scroll to the top
|
|
|
|
if (!scrolled) {
|
|
|
|
EnsureRowInThreadOutlinerIsVisible(0);
|
|
|
|
}
|
2001-04-04 04:32:10 +00:00
|
|
|
}
|
2000-01-28 23:25:17 +00:00
|
|
|
|
2001-01-12 22:26:10 +00:00
|
|
|
if(showPerformance) {
|
|
|
|
var afterScrollToNew = new Date();
|
|
|
|
var timeToScroll = (afterScrollToNew.getTime() - beforeScrollToNew.getTime())/1000;
|
2000-01-28 23:25:17 +00:00
|
|
|
|
2001-01-12 22:26:10 +00:00
|
|
|
var afterFolderLoadTime = new Date();
|
|
|
|
var timeToLoad = (afterFolderLoadTime.getTime() - gBeforeFolderLoadTime.getTime())/1000;
|
2000-01-28 23:25:17 +00:00
|
|
|
dump("Time to load " + uri + " is " + timeToLoad + " seconds\n");
|
2001-01-12 22:58:34 +00:00
|
|
|
dump("of which scrolling to new is " + timeToScroll + " seconds\n");
|
2000-01-28 23:25:17 +00:00
|
|
|
}
|
2000-08-26 20:54:51 +00:00
|
|
|
SetBusyCursor(window, false);
|
2000-01-09 19:47:58 +00:00
|
|
|
}
|
1999-09-16 21:11:01 +00:00
|
|
|
}
|
2000-01-09 19:47:58 +00:00
|
|
|
|
1999-09-16 21:11:01 +00:00
|
|
|
}
|
2001-01-30 22:02:27 +00:00
|
|
|
} else if (eventType == "DeleteOrMoveMsgCompleted") {
|
2000-08-14 14:40:33 +00:00
|
|
|
HandleDeleteOrMoveMsgCompleted(folder);
|
2000-09-21 00:14:24 +00:00
|
|
|
}
|
2001-01-30 22:02:27 +00:00
|
|
|
else if (eventType == "DeleteOrMoveMsgFailed") {
|
2000-09-21 00:14:24 +00:00
|
|
|
HandleDeleteOrMoveMsgFailed(folder);
|
|
|
|
}
|
|
|
|
|
2000-08-14 14:40:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-21 00:14:24 +00:00
|
|
|
function HandleDeleteOrMoveMsgFailed(folder)
|
|
|
|
{
|
2001-01-30 22:02:27 +00:00
|
|
|
if(IsCurrentLoadedFolder(folder)) {
|
|
|
|
if(gNextMessageAfterDelete) {
|
|
|
|
gNextMessageAfterDelete = null;
|
2001-03-17 01:59:34 +00:00
|
|
|
gNextMessageViewIndexAfterDelete = -1;
|
2001-01-30 22:02:27 +00:00
|
|
|
}
|
|
|
|
}
|
2000-09-21 00:14:24 +00:00
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
// fix me???
|
2001-03-24 01:12:33 +00:00
|
|
|
// ThreadPaneSelectionChange(true);
|
2000-09-21 00:14:24 +00:00
|
|
|
}
|
|
|
|
|
2000-08-14 14:40:33 +00:00
|
|
|
function HandleDeleteOrMoveMsgCompleted(folder)
|
|
|
|
{
|
2001-03-24 01:12:33 +00:00
|
|
|
if (IsCurrentLoadedFolder(folder)) {
|
2001-04-30 03:17:34 +00:00
|
|
|
var outlinerView = gDBView.QueryInterface(Components.interfaces.nsIOutlinerView);
|
|
|
|
var outlinerSelection = outlinerView.selection;
|
2001-03-24 01:12:33 +00:00
|
|
|
if (gNextMessageViewIndexAfterDelete != -1) {
|
2001-03-17 01:59:34 +00:00
|
|
|
viewSize = outlinerView.rowCount;
|
2001-03-24 01:12:33 +00:00
|
|
|
if (gNextMessageViewIndexAfterDelete >= viewSize) {
|
2001-03-17 01:59:34 +00:00
|
|
|
if (viewSize > 0)
|
|
|
|
gNextMessageViewIndexAfterDelete = viewSize - 1;
|
|
|
|
else
|
|
|
|
gNextMessageViewIndexAfterDelete = -1;
|
|
|
|
}
|
2001-04-30 03:17:34 +00:00
|
|
|
}
|
2001-03-24 01:12:33 +00:00
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
// if we are about to set the selection with a new element then DON'T clear
|
|
|
|
// the selection then add the next message to select. This just generates
|
|
|
|
// an extra round of command updating notifications that we are trying to
|
|
|
|
// optimize away.
|
|
|
|
if (gNextMessageViewIndexAfterDelete != -1) {
|
|
|
|
outlinerSelection.select(gNextMessageViewIndexAfterDelete);
|
|
|
|
// since gNextMessageViewIndexAfterDelete probably has the same value
|
|
|
|
// as the last index we had selected, the outliner isn't generating a new
|
|
|
|
// selectionChanged notification for the outliner view. So we aren't loading the
|
|
|
|
// next message. to fix this, force the selection changed update.
|
|
|
|
if (outlinerView)
|
|
|
|
outlinerView.selectionChanged();
|
|
|
|
EnsureRowInThreadOutlinerIsVisible(gNextMessageViewIndexAfterDelete);
|
|
|
|
}
|
2001-03-24 01:12:33 +00:00
|
|
|
else {
|
2001-03-17 01:59:34 +00:00
|
|
|
outlinerSelection.clearSelection(); /* clear selection in either case */
|
2001-03-24 01:12:33 +00:00
|
|
|
ClearMessagePane();
|
|
|
|
}
|
2001-03-17 01:59:34 +00:00
|
|
|
|
2001-03-24 01:12:33 +00:00
|
|
|
}
|
2000-02-16 00:39:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function IsCurrentLoadedFolder(folder)
|
|
|
|
{
|
2000-09-08 04:22:01 +00:00
|
|
|
var msgfolder = folder.QueryInterface(Components.interfaces.nsIMsgFolder);
|
2000-02-16 00:39:23 +00:00
|
|
|
if(msgfolder)
|
|
|
|
{
|
|
|
|
var folderResource = msgfolder.QueryInterface(Components.interfaces.nsIRDFResource);
|
|
|
|
if(folderResource)
|
|
|
|
{
|
|
|
|
var folderURI = folderResource.Value;
|
2001-03-17 01:59:34 +00:00
|
|
|
var currentLoadedFolder = GetThreadPaneFolder();
|
|
|
|
var currentURI = currentLoadedFolder.URI;
|
2000-02-16 00:39:23 +00:00
|
|
|
return(currentURI == folderURI);
|
|
|
|
}
|
1999-09-16 21:11:01 +00:00
|
|
|
}
|
2000-02-16 00:39:23 +00:00
|
|
|
|
|
|
|
return false;
|
1999-09-13 21:11:45 +00:00
|
|
|
}
|
|
|
|
|
1999-09-01 23:49:47 +00:00
|
|
|
/* Functions related to startup */
|
|
|
|
function OnLoadMessenger()
|
|
|
|
{
|
2001-01-30 22:02:27 +00:00
|
|
|
showPerformance = pref.GetBoolPref('mail.showMessengerPerformance');
|
2001-01-30 04:19:30 +00:00
|
|
|
var beforeLoadMessenger;
|
|
|
|
if(showPerformance) {
|
|
|
|
beforeLoadMessenger = new Date();
|
|
|
|
}
|
2000-02-04 01:56:38 +00:00
|
|
|
|
2000-04-11 20:19:32 +00:00
|
|
|
CreateMailWindowGlobals();
|
|
|
|
Create3PaneGlobals();
|
2000-01-06 00:53:12 +00:00
|
|
|
verifyAccounts();
|
1999-09-11 01:54:15 +00:00
|
|
|
|
2001-01-23 21:54:34 +00:00
|
|
|
HideAccountCentral();
|
2000-01-06 00:53:12 +00:00
|
|
|
loadStartPage();
|
1999-10-27 22:38:47 +00:00
|
|
|
InitMsgWindow();
|
|
|
|
|
1999-10-29 04:39:06 +00:00
|
|
|
messenger.SetWindow(window, msgWindow);
|
|
|
|
|
2000-04-11 20:19:32 +00:00
|
|
|
InitializeDataSources();
|
1999-09-01 23:49:47 +00:00
|
|
|
InitPanes();
|
|
|
|
|
2000-08-30 14:51:10 +00:00
|
|
|
accountManager.SetSpecialFoldersForIdentities();
|
1999-09-13 21:11:45 +00:00
|
|
|
|
2000-01-06 00:53:12 +00:00
|
|
|
AddToSession();
|
2000-01-20 22:56:00 +00:00
|
|
|
//need to add to session before trying to load start folder otherwise listeners aren't
|
|
|
|
//set up correctly.
|
2000-12-21 01:26:18 +00:00
|
|
|
if ("arguments" in window && window.arguments[0])
|
2000-03-17 01:10:57 +00:00
|
|
|
{
|
|
|
|
gStartFolderUri = window.arguments[0];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gStartFolderUri = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
setTimeout("loadStartFolder(gStartFolderUri);", 0);
|
2000-01-06 00:53:12 +00:00
|
|
|
|
|
|
|
// FIX ME - later we will be able to use onload from the overlay
|
|
|
|
OnLoadMsgHeaderPane();
|
1999-12-24 01:08:05 +00:00
|
|
|
|
|
|
|
var id = null;
|
|
|
|
var headerchoice = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
headerchoice = pref.GetIntPref("mail.show_headers");
|
|
|
|
}
|
|
|
|
catch (ex) {
|
|
|
|
dump("failed to get the header pref\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (headerchoice) {
|
|
|
|
case 2:
|
|
|
|
id = "viewallheaders";
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
id = "viewbriefheaders";
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
id = "viewnormalheaders";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
id = "viewnormalheaders";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
var menuitem = document.getElementById(id);
|
|
|
|
|
|
|
|
try {
|
|
|
|
// not working right yet. see bug #??????
|
|
|
|
// menuitem.setAttribute("checked", "true");
|
|
|
|
}
|
|
|
|
catch (ex) {
|
|
|
|
dump("failed to set the view headers menu item\n");
|
|
|
|
}
|
2000-02-04 01:56:38 +00:00
|
|
|
|
2000-04-21 14:22:16 +00:00
|
|
|
gHaveLoadedMessage = false;
|
|
|
|
|
2000-09-22 02:51:23 +00:00
|
|
|
//Set focus to the Thread Pane the first time the window is opened.
|
|
|
|
SetFocusThreadPane();
|
|
|
|
|
2001-01-12 22:26:10 +00:00
|
|
|
if(showPerformance) {
|
|
|
|
var afterLoadMessenger = new Date();
|
|
|
|
var timeToLoad = (afterLoadMessenger.getTime() - beforeLoadMessenger.getTime())/1000;
|
2000-02-04 01:56:38 +00:00
|
|
|
dump("Time in OnLoadMessger is " + timeToLoad + " seconds\n");
|
|
|
|
}
|
2000-09-22 02:51:23 +00:00
|
|
|
|
1999-09-01 23:49:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function OnUnloadMessenger()
|
|
|
|
{
|
|
|
|
dump("\nOnUnload from XUL\nClean up ...\n");
|
2000-03-14 05:38:51 +00:00
|
|
|
|
2000-04-28 20:10:36 +00:00
|
|
|
OnMailWindowUnload();
|
1999-09-22 06:05:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-04-11 20:19:32 +00:00
|
|
|
function Create3PaneGlobals()
|
2000-02-04 01:56:38 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
1999-09-11 01:54:15 +00:00
|
|
|
|
2000-04-04 05:47:24 +00:00
|
|
|
function PerformExpandForAllOpenServers(tree)
|
|
|
|
{
|
2000-04-04 05:53:39 +00:00
|
|
|
//dump("PerformExpandForAllOpenServers()\n");
|
2000-04-04 05:47:24 +00:00
|
|
|
|
|
|
|
var uri = null;
|
|
|
|
var open = null;
|
|
|
|
var treechild = null;
|
|
|
|
var server = null;
|
|
|
|
|
|
|
|
if ( tree && tree.childNodes ) {
|
|
|
|
for ( var i = tree.childNodes.length - 1; i >= 0; i-- ) {
|
|
|
|
treechild = tree.childNodes[i];
|
2000-06-07 00:50:19 +00:00
|
|
|
if (treechild.localName == 'treechildren') {
|
2000-04-04 05:47:24 +00:00
|
|
|
var treeitems = treechild.childNodes;
|
|
|
|
for ( var j = treeitems.length - 1; j >= 0; j--) {
|
|
|
|
open = treeitems[j].getAttribute('open');
|
2000-04-04 05:53:39 +00:00
|
|
|
//dump("open="+open+"\n");
|
2000-04-04 05:47:24 +00:00
|
|
|
if (open == "true") {
|
|
|
|
var isServer = (treeitems[j].getAttribute('IsServer') == "true");
|
2000-04-04 05:53:39 +00:00
|
|
|
//dump("isServer="+isServer+"\n");
|
2000-04-04 05:47:24 +00:00
|
|
|
if (isServer) {
|
|
|
|
uri = treeitems[j].getAttribute('id');
|
2000-04-04 05:53:39 +00:00
|
|
|
//dump("uri="+uri+"\n");
|
2000-04-04 05:47:24 +00:00
|
|
|
server = GetServer(uri);
|
|
|
|
if (server) {
|
2000-06-09 04:55:29 +00:00
|
|
|
// don't do this for imap servers.
|
|
|
|
// see bug #41943
|
|
|
|
if (server.type != "imap") {
|
|
|
|
//dump("PerformExpand on " + uri + "\n");
|
|
|
|
server.PerformExpand(msgWindow);
|
|
|
|
}
|
2000-04-04 05:47:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-01-23 21:54:34 +00:00
|
|
|
function loadStartFolder(initialUri)
|
1999-09-14 06:27:36 +00:00
|
|
|
{
|
2001-01-23 21:54:34 +00:00
|
|
|
var defaultServer = null;
|
|
|
|
var startFolderUri = initialUri;
|
2001-02-07 03:55:46 +00:00
|
|
|
var isLoginAtStartUpEnabled = false;
|
2001-02-23 02:42:31 +00:00
|
|
|
var enabledNewMailCheckOnce = false;
|
|
|
|
var mailCheckOncePref = "mail.startup.enabledMailCheckOnce";
|
2000-01-10 01:34:36 +00:00
|
|
|
|
2001-01-23 21:54:34 +00:00
|
|
|
//First get default account
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if(!startFolderUri)
|
|
|
|
{
|
|
|
|
var defaultAccount = accountManager.defaultAccount;
|
2000-01-10 01:34:36 +00:00
|
|
|
|
2001-01-23 21:54:34 +00:00
|
|
|
defaultServer = defaultAccount.incomingServer;
|
|
|
|
var rootFolder = defaultServer.RootFolder;
|
|
|
|
var rootMsgFolder = rootFolder.QueryInterface(Components.interfaces.nsIMsgFolder);
|
2000-01-10 01:34:36 +00:00
|
|
|
|
2001-02-07 03:55:46 +00:00
|
|
|
var folderResource = rootMsgFolder.QueryInterface(Components.interfaces.nsIRDFResource);
|
|
|
|
startFolderUri = folderResource.Value;
|
2000-01-10 01:34:36 +00:00
|
|
|
|
2001-02-23 02:42:31 +00:00
|
|
|
enabledNewMailCheckOnce = pref.GetBoolPref(mailCheckOncePref);
|
|
|
|
|
|
|
|
// Enable checknew mail once by turning checkmail pref 'on' to bring
|
|
|
|
// all users to one plane. This allows all users to go to Inbox. User can
|
|
|
|
// always go to server settings panel and turn off "Check for new mail at startup"
|
|
|
|
if (!enabledNewMailCheckOnce)
|
|
|
|
{
|
|
|
|
pref.SetBoolPref(mailCheckOncePref, true);
|
|
|
|
defaultServer.loginAtStartUp = true;
|
|
|
|
}
|
|
|
|
|
2001-02-07 03:55:46 +00:00
|
|
|
// Get the user pref to see if the login at startup is enabled for default account
|
|
|
|
isLoginAtStartUpEnabled = defaultServer.loginAtStartUp;
|
2000-02-04 01:56:38 +00:00
|
|
|
|
2001-02-07 03:55:46 +00:00
|
|
|
// Get Inbox only if when we have to login
|
|
|
|
if (isLoginAtStartUpEnabled)
|
|
|
|
{
|
|
|
|
//now find Inbox
|
|
|
|
var outNumFolders = new Object();
|
|
|
|
var inboxFolder = rootMsgFolder.getFoldersWithFlag(0x1000, 1, outNumFolders);
|
|
|
|
if(!inboxFolder) return;
|
|
|
|
|
|
|
|
var resource = inboxFolder.QueryInterface(Components.interfaces.nsIRDFResource);
|
|
|
|
startFolderUri = resource.Value;
|
|
|
|
}
|
2001-01-23 21:54:34 +00:00
|
|
|
}
|
2000-01-10 01:34:36 +00:00
|
|
|
|
2001-01-23 21:54:34 +00:00
|
|
|
var startFolder = document.getElementById(startFolderUri);
|
2000-01-10 01:34:36 +00:00
|
|
|
|
2001-01-23 21:54:34 +00:00
|
|
|
//if it's not here we will have to make sure it's open.
|
2001-02-07 03:55:46 +00:00
|
|
|
if(!startFolder && startFolderUri && isLoginAtStartUpEnabled)
|
2001-01-23 21:54:34 +00:00
|
|
|
{
|
|
|
|
// Opens the twisty for the default account
|
|
|
|
OpenTwistyForServer(defaultServer);
|
|
|
|
startFolder = document.getElementById(startFolderUri);
|
|
|
|
}
|
2000-01-10 01:34:36 +00:00
|
|
|
|
2001-01-23 21:54:34 +00:00
|
|
|
var folderTree= GetFolderTree();
|
|
|
|
ChangeSelection(folderTree, startFolder);
|
|
|
|
|
|
|
|
// only do this on startup, when we pass in null
|
2001-02-07 03:55:46 +00:00
|
|
|
if (!initialUri && isLoginAtStartUpEnabled)
|
2001-01-23 21:54:34 +00:00
|
|
|
{
|
2001-03-30 05:07:20 +00:00
|
|
|
// Perform biff on the server to check for new mail, except for imap
|
|
|
|
if (defaultServer.type != "imap")
|
|
|
|
defaultServer.PerformBiff();
|
2001-01-23 21:54:34 +00:00
|
|
|
}
|
2000-04-04 05:47:24 +00:00
|
|
|
|
2001-01-23 21:54:34 +00:00
|
|
|
// because the "open" state persists, we'll call
|
|
|
|
// PerformExpand() for all servers that are open at startup.
|
|
|
|
PerformExpandForAllOpenServers(folderTree);
|
|
|
|
}
|
|
|
|
catch(ex)
|
|
|
|
{
|
|
|
|
dump(ex);
|
|
|
|
dump('Exception in LoadStartFolder caused by no default account. We know about this\n');
|
|
|
|
}
|
1999-09-14 06:27:36 +00:00
|
|
|
|
2001-01-23 21:54:34 +00:00
|
|
|
if (!initialUri)
|
|
|
|
{
|
|
|
|
MsgGetMessagesForAllServers(defaultServer);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function OpenTwistyForServer(server)
|
|
|
|
{
|
|
|
|
var treeNode = GetTreeNodeForServerURI(server.serverURI);
|
|
|
|
|
|
|
|
if (treeNode)
|
|
|
|
treeNode.setAttribute('open', 'true');
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function GetTreeNodeForServerURI(serverURI)
|
|
|
|
{
|
|
|
|
var treeNode = null;
|
|
|
|
|
|
|
|
var tree = GetFolderTree();
|
|
|
|
|
|
|
|
// Iterate through folder tree to find the node associated with given serverURI
|
|
|
|
if ( tree && tree.childNodes ) {
|
|
|
|
for ( var i = tree.childNodes.length - 1; i >= 0; i-- ) {
|
|
|
|
var treechild = tree.childNodes[i];
|
|
|
|
if (treechild.localName == 'treechildren') {
|
|
|
|
var treeitems = treechild.childNodes;
|
|
|
|
for ( var j = treeitems.length - 1; j >= 0; j--) {
|
|
|
|
var isServer = treeitems[j].getAttribute('IsServer');
|
|
|
|
if (isServer == "true") {
|
|
|
|
var uri = treeitems[j].getAttribute('id');
|
|
|
|
if (uri == serverURI) {
|
|
|
|
treeNode = treeitems[j];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return treeNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
function TriggerGetMessages(server)
|
|
|
|
{
|
|
|
|
// downloadMessagesAtStartup for a given server type indicates whether
|
|
|
|
// or not there is a need to Trigger GetMessages action
|
|
|
|
if (server.downloadMessagesAtStartup)
|
|
|
|
MsgGetMessage();
|
1999-09-14 06:27:36 +00:00
|
|
|
}
|
|
|
|
|
1999-10-28 23:27:21 +00:00
|
|
|
function AddToSession()
|
1999-09-15 04:57:24 +00:00
|
|
|
{
|
|
|
|
try {
|
2000-09-13 23:57:52 +00:00
|
|
|
var mailSession = Components.classes[mailSessionContractID].getService(Components.interfaces.nsIMsgMailSession);
|
1999-09-15 04:57:24 +00:00
|
|
|
|
|
|
|
mailSession.AddFolderListener(folderListener);
|
|
|
|
} catch (ex) {
|
1999-10-28 23:27:21 +00:00
|
|
|
dump("Error adding to session\n");
|
1999-09-15 04:57:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-01-12 02:25:35 +00:00
|
|
|
|
1999-09-01 23:49:47 +00:00
|
|
|
function InitPanes()
|
|
|
|
{
|
1999-09-16 21:11:01 +00:00
|
|
|
var folderTree = GetFolderTree();
|
|
|
|
if(folderTree)
|
|
|
|
OnLoadFolderPane(folderTree);
|
1999-11-02 03:55:59 +00:00
|
|
|
|
|
|
|
SetupCommandUpdateHandlers();
|
1999-09-01 23:49:47 +00:00
|
|
|
}
|
|
|
|
|
2000-04-11 20:19:32 +00:00
|
|
|
function InitializeDataSources()
|
|
|
|
{
|
|
|
|
//Setup common mailwindow stuff.
|
|
|
|
AddDataSources();
|
|
|
|
|
|
|
|
//To threadpane move context menu
|
|
|
|
SetupMoveCopyMenus('threadPaneContext-moveMenu', accountManagerDataSource, folderDataSource);
|
|
|
|
|
|
|
|
//To threadpane copy content menu
|
|
|
|
SetupMoveCopyMenus('threadPaneContext-copyMenu', accountManagerDataSource, folderDataSource);
|
|
|
|
}
|
|
|
|
|
1999-09-01 23:49:47 +00:00
|
|
|
function OnLoadFolderPane(folderTree)
|
|
|
|
{
|
1999-09-15 08:29:01 +00:00
|
|
|
gFolderTree = folderTree;
|
1999-10-29 20:46:15 +00:00
|
|
|
SortFolderPane('FolderColumn', 'http://home.netscape.com/NC-rdf#FolderTreeName');
|
1999-12-21 23:38:31 +00:00
|
|
|
|
1999-09-01 23:49:47 +00:00
|
|
|
//Add folderDataSource and accountManagerDataSource to folderPane
|
|
|
|
accountManagerDataSource = accountManagerDataSource.QueryInterface(Components.interfaces.nsIRDFDataSource);
|
|
|
|
folderDataSource = folderDataSource.QueryInterface(Components.interfaces.nsIRDFDataSource);
|
2000-06-30 06:02:30 +00:00
|
|
|
var database = GetFolderDatasource();
|
1999-10-27 22:38:47 +00:00
|
|
|
|
|
|
|
database.AddDataSource(accountManagerDataSource);
|
|
|
|
database.AddDataSource(folderDataSource);
|
1999-09-01 23:49:47 +00:00
|
|
|
folderTree.setAttribute('ref', 'msgaccounts:/');
|
|
|
|
}
|
|
|
|
|
2000-06-30 06:02:30 +00:00
|
|
|
function GetFolderDatasource()
|
|
|
|
{
|
|
|
|
var folderTree = GetFolderTree();
|
|
|
|
var db = folderTree.database;
|
|
|
|
if (!db) return false;
|
|
|
|
return db;
|
|
|
|
}
|
|
|
|
|
1999-09-01 23:49:47 +00:00
|
|
|
function OnLoadThreadPane(threadTree)
|
|
|
|
{
|
2000-02-12 00:55:14 +00:00
|
|
|
setTimeout("ShowThreads(false);", 0);
|
1999-09-01 23:49:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Functions for accessing particular parts of the window*/
|
|
|
|
function GetFolderTree()
|
|
|
|
{
|
1999-09-15 08:29:01 +00:00
|
|
|
if (gFolderTree) return gFolderTree;
|
|
|
|
|
1999-09-16 21:11:01 +00:00
|
|
|
var folderTree = document.getElementById('folderTree');
|
1999-09-15 08:39:28 +00:00
|
|
|
gFolderTree = folderTree;
|
1999-09-01 23:49:47 +00:00
|
|
|
return folderTree;
|
|
|
|
}
|
|
|
|
|
2000-10-05 21:17:22 +00:00
|
|
|
function GetMessagePane()
|
|
|
|
{
|
|
|
|
if (gMessagePane) return gMessagePane;
|
|
|
|
gMessagePane = document.getElementById("messagepanebox");
|
|
|
|
return gMessagePane;
|
|
|
|
}
|
|
|
|
|
2001-02-07 04:40:40 +00:00
|
|
|
function GetMessagePaneFrame()
|
|
|
|
{
|
|
|
|
if (gMessagePaneFrame) return gMessagePaneFrame;
|
|
|
|
gMessagePaneFrame = top.frames['messagepane'];
|
|
|
|
return gMessagePaneFrame;
|
|
|
|
}
|
|
|
|
|
1999-09-01 23:49:47 +00:00
|
|
|
function FindInSidebar(currentWindow, id)
|
|
|
|
{
|
|
|
|
var item = currentWindow.document.getElementById(id);
|
|
|
|
if(item)
|
|
|
|
return item;
|
|
|
|
|
1999-09-16 21:11:01 +00:00
|
|
|
for(var i = 0; i < currentWindow.frames.length; i++)
|
1999-09-01 23:49:47 +00:00
|
|
|
{
|
|
|
|
var frameItem = FindInSidebar(currentWindow.frames[i], id);
|
|
|
|
if(frameItem)
|
|
|
|
return frameItem;
|
|
|
|
}
|
2000-09-08 05:46:35 +00:00
|
|
|
|
|
|
|
return null;
|
1999-09-01 23:49:47 +00:00
|
|
|
}
|
|
|
|
|
1999-11-11 20:24:46 +00:00
|
|
|
function GetThreadAndMessagePaneSplitter()
|
|
|
|
{
|
|
|
|
if(gThreadAndMessagePaneSplitter) return gThreadAndMessagePaneSplitter;
|
2000-09-11 23:47:50 +00:00
|
|
|
var splitter = document.getElementById('threadpane-splitter');
|
1999-11-11 20:24:46 +00:00
|
|
|
gThreadAndMessagePaneSplitter = splitter;
|
|
|
|
return splitter;
|
|
|
|
}
|
|
|
|
|
1999-11-22 22:08:23 +00:00
|
|
|
function GetUnreadCountElement()
|
|
|
|
{
|
|
|
|
if(gUnreadCount) return gUnreadCount;
|
|
|
|
var unreadCount = document.getElementById('unreadMessageCount');
|
|
|
|
gUnreadCount = unreadCount;
|
|
|
|
return unreadCount;
|
|
|
|
}
|
|
|
|
function GetTotalCountElement()
|
|
|
|
{
|
|
|
|
if(gTotalCount) return gTotalCount;
|
|
|
|
var totalCount = document.getElementById('totalMessageCount');
|
|
|
|
gTotalCount = totalCount;
|
|
|
|
return totalCount;
|
|
|
|
}
|
2001-05-01 03:05:02 +00:00
|
|
|
|
1999-11-11 20:24:46 +00:00
|
|
|
function IsThreadAndMessagePaneSplitterCollapsed()
|
|
|
|
{
|
2001-05-01 03:05:02 +00:00
|
|
|
var messagePane = GetMessagePane();
|
|
|
|
try {
|
|
|
|
return (messagePane.getAttribute("collapsed") == "true");
|
1999-11-11 20:24:46 +00:00
|
|
|
}
|
2001-05-01 03:05:02 +00:00
|
|
|
catch (ex) {
|
1999-11-11 20:24:46 +00:00
|
|
|
return false;
|
2001-05-01 03:05:02 +00:00
|
|
|
}
|
1999-11-11 20:24:46 +00:00
|
|
|
}
|
|
|
|
|
1999-09-01 23:49:47 +00:00
|
|
|
function FindMessenger()
|
|
|
|
{
|
|
|
|
return messenger;
|
|
|
|
}
|
|
|
|
|
2001-03-24 01:12:33 +00:00
|
|
|
function ClearThreadPaneSelection()
|
1999-09-13 21:11:45 +00:00
|
|
|
{
|
2001-03-24 01:12:33 +00:00
|
|
|
try {
|
|
|
|
if (gDBView) {
|
|
|
|
var outlinerView = gDBView.QueryInterface(Components.interfaces.nsIOutlinerView);
|
|
|
|
var outlinerSelection = outlinerView.selection;
|
|
|
|
outlinerSelection.clearSelection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (ex) {
|
|
|
|
dump("ClearThreadPaneSelection: ex = " + ex + "\n");
|
|
|
|
}
|
1999-09-13 21:11:45 +00:00
|
|
|
}
|
|
|
|
|
1999-09-01 23:49:47 +00:00
|
|
|
function ClearMessagePane()
|
|
|
|
{
|
2000-04-21 14:22:16 +00:00
|
|
|
if(gHaveLoadedMessage)
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
gHaveLoadedMessage = false;
|
2000-04-21 14:22:16 +00:00
|
|
|
gCurrentDisplayedMessage = null;
|
|
|
|
if (window.frames["messagepane"].location != "about:blank")
|
|
|
|
window.frames["messagepane"].location = "about:blank";
|
|
|
|
// hide the message header view AND the message pane...
|
|
|
|
HideMessageHeaderPane();
|
|
|
|
}
|
1999-09-11 00:43:18 +00:00
|
|
|
}
|
1999-09-13 21:11:45 +00:00
|
|
|
|
|
|
|
|
1999-11-11 00:23:29 +00:00
|
|
|
function GetSelectedFolder()
|
|
|
|
{
|
2001-03-30 07:15:23 +00:00
|
|
|
try {
|
1999-11-11 00:23:29 +00:00
|
|
|
var tree = GetFolderTree();
|
|
|
|
var selection = tree.selectedItems;
|
|
|
|
if(selection.length > 0)
|
|
|
|
return selection[0];
|
|
|
|
else
|
|
|
|
return null;
|
2001-03-30 07:15:23 +00:00
|
|
|
}
|
|
|
|
catch (ex) {
|
|
|
|
return null;
|
|
|
|
}
|
1999-11-11 00:23:29 +00:00
|
|
|
}
|
1999-09-13 21:11:45 +00:00
|
|
|
|
2000-03-17 01:10:57 +00:00
|
|
|
function FolderPaneOnClick(event)
|
|
|
|
{
|
2000-04-22 17:13:59 +00:00
|
|
|
debug("in FolderPaneClick()\n");
|
|
|
|
|
2000-09-07 08:17:32 +00:00
|
|
|
var t = event.originalTarget;
|
2000-09-08 21:57:43 +00:00
|
|
|
var item;
|
|
|
|
var uri;
|
2000-04-04 02:31:43 +00:00
|
|
|
|
2000-09-07 08:17:32 +00:00
|
|
|
if (t.getAttribute('twisty') == 'true') {
|
2000-04-04 02:31:43 +00:00
|
|
|
// The twisty is nested three below the treeitem:
|
|
|
|
// <treeitem>
|
|
|
|
// <treerow>
|
|
|
|
// <treecell>
|
2000-11-25 01:19:03 +00:00
|
|
|
// <button class="tree-cell-twisty"> <!-- anonymous -->
|
2000-09-07 08:17:32 +00:00
|
|
|
var treeitem = t.parentNode.parentNode.parentNode;
|
2000-04-04 02:31:43 +00:00
|
|
|
var open = treeitem.getAttribute('open');
|
|
|
|
if(open == "true") {
|
2000-04-04 05:53:39 +00:00
|
|
|
//dump("twisty open\n");
|
2000-04-04 02:31:43 +00:00
|
|
|
|
2000-09-08 21:57:43 +00:00
|
|
|
item = t.parentNode.parentNode.parentNode;
|
2000-06-07 01:05:50 +00:00
|
|
|
if (item.localName == "treeitem") {
|
2000-04-04 05:47:24 +00:00
|
|
|
var isServer = (treeitem.getAttribute('IsServer') == "true");
|
|
|
|
if (isServer) {
|
2000-09-08 21:57:43 +00:00
|
|
|
uri = treeitem.getAttribute("id");
|
2000-04-04 05:47:24 +00:00
|
|
|
var server = GetServer(uri);
|
|
|
|
if (server) {
|
2000-04-21 22:55:18 +00:00
|
|
|
server.PerformExpand(msgWindow);
|
2000-04-04 05:47:24 +00:00
|
|
|
}
|
2000-04-04 02:31:43 +00:00
|
|
|
}
|
2000-06-03 00:22:07 +00:00
|
|
|
else {
|
|
|
|
var isImap = (treeitem.getAttribute('ServerType') == "imap");
|
|
|
|
if (isImap) {
|
2000-09-08 21:57:43 +00:00
|
|
|
uri = treeitem.getAttribute("id");
|
2000-06-03 00:22:07 +00:00
|
|
|
var folder = GetMsgFolderFromUri(uri);
|
|
|
|
if (folder) {
|
|
|
|
var imapFolder = folder.QueryInterface(Components.interfaces.nsIMsgImapMailFolder);
|
|
|
|
if (imapFolder) {
|
2001-03-17 01:59:34 +00:00
|
|
|
imapFolder.performExpand(msgWindow);
|
2000-06-03 00:22:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-04-04 02:31:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-05-16 11:35:12 +00:00
|
|
|
else if(event.detail == 2)
|
2000-03-17 01:10:57 +00:00
|
|
|
{
|
2000-09-08 21:57:43 +00:00
|
|
|
item = t.parentNode.parentNode;
|
2000-06-07 01:05:50 +00:00
|
|
|
if (item.localName == "treeitem")
|
2000-03-17 01:10:57 +00:00
|
|
|
FolderPaneDoubleClick(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function FolderPaneDoubleClick(treeitem)
|
|
|
|
{
|
2000-04-04 05:47:24 +00:00
|
|
|
var isServer = false;
|
2000-04-04 02:31:43 +00:00
|
|
|
|
2000-03-30 23:42:15 +00:00
|
|
|
if (treeitem) {
|
2000-04-04 05:47:24 +00:00
|
|
|
isServer = (treeitem.getAttribute('IsServer') == "true");
|
|
|
|
if (isServer) {
|
|
|
|
var open = treeitem.getAttribute('open');
|
|
|
|
if (open == "true") {
|
|
|
|
var uri = treeitem.getAttribute("id");
|
|
|
|
server = GetServer(uri);
|
|
|
|
if (server) {
|
2001-03-24 01:12:33 +00:00
|
|
|
// double clicking open, PerformExpand()
|
2000-04-21 22:55:18 +00:00
|
|
|
server.PerformExpand(msgWindow);
|
2000-04-04 05:47:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2001-03-24 01:12:33 +00:00
|
|
|
// double clicking close, don't PerformExpand()
|
2000-04-04 05:47:24 +00:00
|
|
|
}
|
2000-03-30 23:42:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-04-04 02:31:43 +00:00
|
|
|
// don't open a new msg window if we are double clicking on a server.
|
|
|
|
// only do it for folders or newsgroups
|
2000-04-04 05:47:24 +00:00
|
|
|
if (!isServer) {
|
2000-04-11 20:19:32 +00:00
|
|
|
MsgOpenNewWindowForFolder(treeitem.getAttribute('id'));
|
2000-04-04 02:31:43 +00:00
|
|
|
}
|
2000-03-17 01:10:57 +00:00
|
|
|
}
|
|
|
|
|
2000-01-10 01:34:36 +00:00
|
|
|
function ChangeSelection(tree, newSelection)
|
|
|
|
{
|
|
|
|
if(newSelection)
|
|
|
|
{
|
|
|
|
tree.clearItemSelection();
|
|
|
|
tree.selectItem(newSelection);
|
|
|
|
tree.ensureElementIsVisible(newSelection);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-03-14 05:38:51 +00:00
|
|
|
function SetActiveThreadPaneSortColumn(column)
|
|
|
|
{
|
|
|
|
gActiveThreadPaneSortColumn = column;
|
|
|
|
}
|
|
|
|
|
|
|
|
function GetActiveThreadPaneSortColumn()
|
|
|
|
{
|
|
|
|
return gActiveThreadPaneSortColumn;
|
|
|
|
}
|
|
|
|
|
|
|
|
function ClearActiveThreadPaneSortColumn()
|
|
|
|
{
|
|
|
|
var activeColumn = document.getElementById(gActiveThreadPaneSortColumn);
|
|
|
|
if(activeColumn)
|
|
|
|
{
|
|
|
|
activeColumn.removeAttribute("sortActive");
|
|
|
|
activeColumn = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2000-04-11 20:19:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
function GetSelectedMsgFolders()
|
|
|
|
{
|
|
|
|
var folderTree = GetFolderTree();
|
|
|
|
var selectedFolders = folderTree.selectedItems;
|
|
|
|
var numFolders = selectedFolders.length;
|
|
|
|
|
|
|
|
var folderArray = new Array(numFolders);
|
|
|
|
|
|
|
|
for(var i = 0; i < numFolders; i++)
|
|
|
|
{
|
|
|
|
var folder = selectedFolders[i];
|
|
|
|
var folderUri = folder.getAttribute("id");
|
|
|
|
var folderResource = RDF.GetResource(folderUri);
|
|
|
|
var msgFolder = folderResource.QueryInterface(Components.interfaces.nsIMsgFolder);
|
|
|
|
if(msgFolder)
|
|
|
|
{
|
|
|
|
folderArray[i] = msgFolder;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return folderArray;
|
|
|
|
}
|
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
function GetFirstSelectedMessage()
|
2000-08-26 20:54:51 +00:00
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
try {
|
|
|
|
return gDBView.URIForFirstSelectedMessage;
|
|
|
|
}
|
|
|
|
catch (ex) {
|
|
|
|
return null;
|
|
|
|
}
|
2000-08-26 20:54:51 +00:00
|
|
|
}
|
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
function GetSelectedIndices(dbView)
|
2000-08-26 20:54:51 +00:00
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
try {
|
|
|
|
var indicesArray = {};
|
|
|
|
var length = {};
|
|
|
|
dbView.getIndicesForSelection(indicesArray,length);
|
|
|
|
return indicesArray.value;
|
|
|
|
}
|
|
|
|
catch (ex) {
|
|
|
|
dump("ex = " + ex + "\n");
|
|
|
|
return null;
|
|
|
|
}
|
2000-08-26 20:54:51 +00:00
|
|
|
}
|
|
|
|
|
2000-04-11 20:19:32 +00:00
|
|
|
function GetSelectedMessages()
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
try {
|
|
|
|
var messageArray = {};
|
|
|
|
var length = {};
|
|
|
|
gDBView.getURIsForSelection(messageArray,length);
|
|
|
|
return messageArray.value;
|
|
|
|
}
|
|
|
|
catch (ex) {
|
|
|
|
dump("ex = " + ex + "\n");
|
|
|
|
return null;
|
|
|
|
}
|
2000-04-11 20:19:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function GetLoadedMsgFolder()
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
if (!gDBView) return null;
|
|
|
|
return gDBView.msgFolder;
|
2000-04-11 20:19:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function GetLoadedMessage()
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
try {
|
|
|
|
return gDBView.URIForFirstSelectedMessage;
|
|
|
|
}
|
|
|
|
catch (ex) {
|
|
|
|
return null;
|
|
|
|
}
|
2000-04-11 20:19:32 +00:00
|
|
|
}
|
|
|
|
|
2000-08-26 20:54:51 +00:00
|
|
|
//Clear everything related to the current message. called after load start page.
|
|
|
|
function ClearMessageSelection()
|
|
|
|
{
|
2001-03-24 01:12:33 +00:00
|
|
|
ClearThreadPaneSelection();
|
2000-08-26 20:54:51 +00:00
|
|
|
}
|
|
|
|
|
2000-04-11 20:19:32 +00:00
|
|
|
function GetCompositeDataSource(command)
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
if (command == "GetNewMessages" || command == "NewFolder" || command == "MarkAllMessagesRead")
|
2000-04-11 20:19:32 +00:00
|
|
|
{
|
2000-06-30 06:02:30 +00:00
|
|
|
return GetFolderDatasource();
|
2000-04-11 20:19:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
2000-04-12 15:32:27 +00:00
|
|
|
}
|
2000-04-20 05:30:32 +00:00
|
|
|
|
2001-01-30 22:02:27 +00:00
|
|
|
function SetNextMessageAfterDelete()
|
2000-04-20 05:30:32 +00:00
|
|
|
{
|
2001-04-30 03:17:34 +00:00
|
|
|
//dump("setting next msg view index after delete to " + gDBView.msgToSelectAfterDelete + "\n");
|
|
|
|
gNextMessageViewIndexAfterDelete = gDBView.msgToSelectAfterDelete;
|
2000-04-20 05:30:32 +00:00
|
|
|
}
|
2000-04-21 14:22:16 +00:00
|
|
|
|
2000-04-28 20:10:36 +00:00
|
|
|
function SelectFolder(folderUri)
|
|
|
|
{
|
|
|
|
var tree = GetFolderTree();
|
|
|
|
var treeitem = document.getElementById(folderUri);
|
|
|
|
if(tree && treeitem)
|
|
|
|
ChangeSelection(tree, treeitem);
|
|
|
|
}
|
|
|
|
|
|
|
|
function SelectMessage(messageUri)
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
// this isn't going to work anymore
|
2001-03-24 01:12:33 +00:00
|
|
|
dump("XXX fix this or remove SelectMessage()\n");
|
2000-04-28 20:10:36 +00:00
|
|
|
}
|
|
|
|
|
2000-05-01 21:58:24 +00:00
|
|
|
function ReloadMessage()
|
2000-04-21 14:22:16 +00:00
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
gDBView.reloadMessage();
|
2000-04-21 14:22:16 +00:00
|
|
|
}
|
|
|
|
|
2000-08-26 20:54:51 +00:00
|
|
|
function SetBusyCursor(window, enable)
|
|
|
|
{
|
|
|
|
if(enable)
|
|
|
|
window.setCursor("wait");
|
|
|
|
else
|
|
|
|
window.setCursor("auto");
|
2000-04-21 14:22:16 +00:00
|
|
|
|
2000-09-08 21:57:43 +00:00
|
|
|
var numFrames = window.frames.length;
|
2000-08-26 20:54:51 +00:00
|
|
|
for(var i = 0; i < numFrames; i++)
|
|
|
|
{
|
|
|
|
SetBusyCursor(window.frames[i], enable);
|
|
|
|
}
|
|
|
|
}
|
2001-03-17 01:59:34 +00:00
|
|
|
|
|
|
|
function GetDBView()
|
|
|
|
{
|
|
|
|
return gDBView;
|
|
|
|
}
|