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.
|
2001-08-15 05:07:48 +00:00
|
|
|
|
*
|
|
|
|
|
* Contributor(s):
|
|
|
|
|
* Jan Varga (varga@utcru.sk)
|
|
|
|
|
* H<EFBFBD>kan Waara (hwaara@chello.se)
|
1999-09-01 23:49:47 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* This is where functions related to the 3 pane window are kept */
|
|
|
|
|
|
2001-01-12 22:26:10 +00:00
|
|
|
|
var showPerformance = false;
|
2000-02-04 01:56:38 +00:00
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
var gFolderOutliner;
|
2000-10-05 21:17:22 +00:00
|
|
|
|
var gMessagePane;
|
2001-02-07 04:40:40 +00:00
|
|
|
|
var gMessagePaneFrame;
|
2001-08-15 05:07:48 +00:00
|
|
|
|
var gThreadOutliner;
|
2001-02-07 04:40:40 +00:00
|
|
|
|
|
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-05-01 05:25:49 +00:00
|
|
|
|
var gNextMessageViewIndexAfterDelete = -2;
|
2001-08-02 03:09:33 +00:00
|
|
|
|
var gCurrentlyDisplayedMessage=-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;
|
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);
|
|
|
|
|
}
|
2001-08-02 03:09:33 +00:00
|
|
|
|
else if (eventType == "CompactCompleted") {
|
2001-08-15 05:07:48 +00:00
|
|
|
|
HandleCompactCompleted(folder);
|
2001-08-02 03:09:33 +00:00
|
|
|
|
}
|
2001-08-15 05:07:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var folderObserver = {
|
|
|
|
|
canDropOn: function(index)
|
|
|
|
|
{
|
|
|
|
|
return CanDropOnFolderOutliner(index);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
canDropBeforeAfter: function(index, before)
|
|
|
|
|
{
|
|
|
|
|
return CanDropBeforeAfterFolderOutliner(index, before);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onDrop: function(row, orientation)
|
|
|
|
|
{
|
|
|
|
|
DropOnFolderOutliner(row, orientation);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onToggleOpenState: function()
|
|
|
|
|
{
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onCycleHeader: function(colID, elt)
|
|
|
|
|
{
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onCycleCell: function(row, colID)
|
|
|
|
|
{
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onSelectionChanged: function()
|
|
|
|
|
{
|
|
|
|
|
},
|
2001-08-02 03:09:33 +00:00
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
isEditable: function(row, colID)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onSetCellText: function(row, colID, value)
|
|
|
|
|
{
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onPerformAction: function(action)
|
|
|
|
|
{
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onPerformActionOnRow: function(action, row)
|
|
|
|
|
{
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onPerformActionOnCell: function(action, row, colID)
|
|
|
|
|
{
|
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-05-01 05:25:49 +00:00
|
|
|
|
gNextMessageViewIndexAfterDelete = -2;
|
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-05-01 05:25:49 +00:00
|
|
|
|
if (gNextMessageViewIndexAfterDelete != -2)
|
|
|
|
|
{
|
|
|
|
|
if (IsCurrentLoadedFolder(folder))
|
|
|
|
|
{
|
|
|
|
|
var outlinerView = gDBView.QueryInterface(Components.interfaces.nsIOutlinerView);
|
|
|
|
|
var outlinerSelection = outlinerView.selection;
|
|
|
|
|
if (gNextMessageViewIndexAfterDelete != -1)
|
|
|
|
|
{
|
|
|
|
|
viewSize = outlinerView.rowCount;
|
|
|
|
|
if (gNextMessageViewIndexAfterDelete >= viewSize)
|
|
|
|
|
{
|
|
|
|
|
if (viewSize > 0)
|
|
|
|
|
gNextMessageViewIndexAfterDelete = viewSize - 1;
|
|
|
|
|
else
|
|
|
|
|
gNextMessageViewIndexAfterDelete = -1;
|
|
|
|
|
}
|
2001-03-17 01:59: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.
|
2001-05-01 05:25:49 +00:00
|
|
|
|
if (gNextMessageViewIndexAfterDelete != -1)
|
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
|
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-05-01 05:25:49 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
|
outlinerSelection.clearSelection(); /* clear selection in either case */
|
2001-06-19 00:33:09 +00:00
|
|
|
|
setTitleFromFolder(folder,null);
|
2001-03-24 01:12:33 +00:00
|
|
|
|
ClearMessagePane();
|
|
|
|
|
}
|
2001-05-01 05:25:49 +00:00
|
|
|
|
}
|
|
|
|
|
gNextMessageViewIndexAfterDelete = -2;
|
|
|
|
|
//default value after delete/move/copy is over
|
2001-03-24 01:12:33 +00:00
|
|
|
|
}
|
2000-02-16 00:39:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-08-02 03:09:33 +00:00
|
|
|
|
function HandleCompactCompleted (folder)
|
|
|
|
|
{
|
|
|
|
|
if(folder)
|
|
|
|
|
{
|
|
|
|
|
var resource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
|
|
|
|
|
if(resource)
|
|
|
|
|
{
|
|
|
|
|
var uri = resource.Value;
|
|
|
|
|
var msgFolder = msgWindow.openFolder;
|
|
|
|
|
if (msgFolder && uri == msgFolder.URI)
|
|
|
|
|
{
|
|
|
|
|
var msgdb = msgFolder.getMsgDatabase(msgWindow);
|
|
|
|
|
if (msgdb)
|
|
|
|
|
{
|
|
|
|
|
var dbFolderInfo = msgdb.dBFolderInfo;
|
|
|
|
|
sortType = dbFolderInfo.sortType;
|
|
|
|
|
sortOrder = dbFolderInfo.sortOrder;
|
|
|
|
|
viewFlags = dbFolderInfo.viewFlags;
|
|
|
|
|
viewType = dbFolderInfo.viewType;
|
2001-10-08 02:06:15 +00:00
|
|
|
|
dbFolderInfo = null;
|
2001-08-02 03:09:33 +00:00
|
|
|
|
}
|
|
|
|
|
RerootFolder(uri, msgFolder, viewType, viewFlags, sortType, sortOrder);
|
|
|
|
|
SetFocusThreadPane();
|
|
|
|
|
if (gCurrentlyDisplayedMessage != -1)
|
|
|
|
|
{
|
|
|
|
|
var outlinerView = gDBView.QueryInterface(Components.interfaces.nsIOutlinerView);
|
|
|
|
|
var outlinerSelection = outlinerView.selection;
|
|
|
|
|
outlinerSelection.select(gCurrentlyDisplayedMessage);
|
|
|
|
|
if (outlinerView)
|
|
|
|
|
outlinerView.selectionChanged();
|
|
|
|
|
EnsureRowInThreadOutlinerIsVisible(gCurrentlyDisplayedMessage);
|
|
|
|
|
}
|
|
|
|
|
gCurrentlyDisplayedMessage = -1; //reset
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
2001-09-26 01:01:49 +00:00
|
|
|
|
function ServerContainsFolder(server, folder)
|
|
|
|
|
{
|
|
|
|
|
if (!folder || !server)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return server.equals(folder.server);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function SelectServer(server)
|
|
|
|
|
{
|
|
|
|
|
SelectFolder(server.RootFolder.URI);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// we have this incoming server listener in case we need to
|
|
|
|
|
// alter the folder pane selection when a server is removed
|
|
|
|
|
// or changed (currently, when the real username or real hostname change)
|
|
|
|
|
var gThreePaneIncomingServerListener = {
|
|
|
|
|
onServerLoaded: function(server) {},
|
|
|
|
|
onServerUnloaded: function(server) {
|
|
|
|
|
var selectedFolders = GetSelectedMsgFolders();
|
|
|
|
|
for (var i = 0; i < selectedFolders.length; i++) {
|
|
|
|
|
if (ServerContainsFolder(server, selectedFolders[i])) {
|
|
|
|
|
SelectServer(accountManager.defaultAccount.incomingServer);
|
|
|
|
|
// we've made a new selection, we're done
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if nothing is selected at this point, better go select the default
|
|
|
|
|
// this could happen if nothing was selected when the server was removed
|
|
|
|
|
selectedFolders = GetSelectedMsgFolders();
|
|
|
|
|
if (selectedFolders.length == 0) {
|
|
|
|
|
SelectServer(accountManager.defaultAccount.incomingServer);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onServerChanged: function(server) {
|
|
|
|
|
// if the current selected folder is on the server that changed
|
|
|
|
|
// and that server is an imap or news server,
|
|
|
|
|
// we need to update the selection.
|
|
|
|
|
// on those server types, we'll be reconnecting to the server
|
|
|
|
|
// and our currently selected folder will need to be reloaded
|
|
|
|
|
// or worse, be invalid.
|
|
|
|
|
if (server.type != "imap" && server.type !="nntp")
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var selectedFolders = GetSelectedMsgFolders();
|
|
|
|
|
for (var i = 0; i < selectedFolders.length; i++) {
|
|
|
|
|
// if the selected item is a server, we don't have to update
|
|
|
|
|
// the selection
|
|
|
|
|
if (!(selectedFolders[i].isServer) && ServerContainsFolder(server, selectedFolders[i])) {
|
|
|
|
|
SelectServer(server);
|
|
|
|
|
// we've made a new selection, we're done
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2001-05-15 05:49:09 +00:00
|
|
|
|
AddMailOfflineObserver();
|
2000-04-11 20:19:32 +00:00
|
|
|
|
CreateMailWindowGlobals();
|
|
|
|
|
Create3PaneGlobals();
|
2001-09-18 06:56:08 +00:00
|
|
|
|
verifyAccounts(null);
|
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();
|
2001-08-15 05:07:48 +00:00
|
|
|
|
InitMsgWindow();
|
1999-10-27 22:38:47 +00:00
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
messenger.SetWindow(window, msgWindow);
|
1999-10-29 04:39:06 +00:00
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
InitializeDataSources();
|
|
|
|
|
InitPanes();
|
1999-09-01 23:49:47 +00:00
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
accountManager.SetSpecialFoldersForIdentities();
|
2001-09-26 01:01:49 +00:00
|
|
|
|
accountManager.addIncomingServerListener(gThreePaneIncomingServerListener);
|
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");
|
|
|
|
|
}
|
1999-09-01 23:49:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function OnUnloadMessenger()
|
|
|
|
|
{
|
2001-09-26 01:01:49 +00:00
|
|
|
|
accountManager.removeIncomingServerListener(gThreePaneIncomingServerListener);
|
2001-05-15 05:49:09 +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
|
|
|
|
{
|
|
|
|
|
}
|
2001-08-21 06:18:58 +00:00
|
|
|
|
|
|
|
|
|
// because the "open" state persists, we'll call
|
|
|
|
|
// PerformExpand() for all servers that are open at startup.
|
|
|
|
|
function PerformExpandForAllOpenServers()
|
2001-08-15 05:07:48 +00:00
|
|
|
|
{
|
|
|
|
|
var folderOutliner = GetFolderOutliner();
|
|
|
|
|
var view = folderOutliner.outlinerBoxObject.view;
|
|
|
|
|
for (var i = 0; i < view.rowCount; i++)
|
|
|
|
|
{
|
|
|
|
|
if (view.isContainer(i))
|
|
|
|
|
{
|
|
|
|
|
var folderResource = GetFolderResource(folderOutliner, i);
|
|
|
|
|
var msgFolder = folderResource.QueryInterface(Components.interfaces.nsIMsgFolder);
|
2001-08-21 06:18:58 +00:00
|
|
|
|
var isServer = GetFolderAttribute(folderOutliner, folderResource, "IsServer");
|
|
|
|
|
if (isServer == "true")
|
2001-08-15 05:07:48 +00:00
|
|
|
|
{
|
2001-08-21 06:18:58 +00:00
|
|
|
|
if (view.isContainerOpen(i))
|
2001-08-15 05:07:48 +00:00
|
|
|
|
{
|
|
|
|
|
var server = msgFolder.server;
|
|
|
|
|
// Don't do this for imap servers. See bug #41943
|
|
|
|
|
if (server.type != "imap")
|
2001-08-21 06:18:58 +00:00
|
|
|
|
server.performExpand(msgWindow);
|
2001-08-15 05:07:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
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-08-15 05:07:48 +00:00
|
|
|
|
var folderOutliner = GetFolderOutliner();
|
2001-01-23 21:54:34 +00:00
|
|
|
|
var defaultServer = null;
|
2001-08-15 05:07:48 +00:00
|
|
|
|
var startFolderResource = null;
|
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
|
|
|
|
|
{
|
2001-08-15 05:07:48 +00:00
|
|
|
|
if(initialUri)
|
|
|
|
|
startFolderResource = RDF.GetResource(initialUri);
|
|
|
|
|
else
|
2001-01-23 21:54:34 +00:00
|
|
|
|
{
|
|
|
|
|
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-08-15 05:07:48 +00:00
|
|
|
|
startFolderResource = rootMsgFolder.QueryInterface(Components.interfaces.nsIRDFResource);
|
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);
|
2001-08-15 05:07:48 +00:00
|
|
|
|
if (!inboxFolder) return;
|
2001-02-07 03:55:46 +00:00
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
startFolderResource = inboxFolder.QueryInterface(Components.interfaces.nsIRDFResource);
|
2001-02-07 03:55:46 +00:00
|
|
|
|
}
|
2001-08-23 01:10:05 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// set the startFolderResource to the server, so we select it
|
|
|
|
|
// so we'll get account central
|
|
|
|
|
startFolderResource = RDF.GetResource(defaultServer.serverURI);
|
|
|
|
|
}
|
2001-01-23 21:54:34 +00:00
|
|
|
|
}
|
2000-01-10 01:34:36 +00:00
|
|
|
|
|
2001-08-22 18:41:59 +00:00
|
|
|
|
var startFolder = startFolderResource.QueryInterface(Components.interfaces.nsIFolder);
|
|
|
|
|
SelectFolder(startFolder.URI);
|
2001-01-23 21:54:34 +00:00
|
|
|
|
|
|
|
|
|
// 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
|
2001-08-15 05:07:48 +00:00
|
|
|
|
if (defaultServer.type != "imap")
|
2001-06-29 01:05:25 +00:00
|
|
|
|
{
|
|
|
|
|
var localFolder = inboxFolder.QueryInterface(Components.interfaces.nsIMsgLocalMailFolder);
|
|
|
|
|
if (localFolder)
|
|
|
|
|
{
|
2001-08-15 05:07:48 +00:00
|
|
|
|
if (!localFolder.parsingInbox)
|
|
|
|
|
defaultServer.PerformBiff();
|
|
|
|
|
else
|
|
|
|
|
localFolder.checkForNewMessagesAfterParsing = true;
|
2001-06-29 01:05:25 +00:00
|
|
|
|
}
|
|
|
|
|
else //it can be only nntp
|
|
|
|
|
defaultServer.PerformBiff();
|
|
|
|
|
}
|
2001-01-23 21:54:34 +00:00
|
|
|
|
}
|
2001-08-21 06:18:58 +00:00
|
|
|
|
|
|
|
|
|
// because the "open" state persists, we'll call
|
|
|
|
|
// PerformExpand() for all servers that are open at startup.
|
|
|
|
|
PerformExpandForAllOpenServers();
|
2001-01-23 21:54:34 +00:00
|
|
|
|
}
|
|
|
|
|
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 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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-09-01 23:49:47 +00:00
|
|
|
|
function InitPanes()
|
|
|
|
|
{
|
2001-08-15 05:07:48 +00:00
|
|
|
|
OnLoadFolderPane();
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
function OnFolderUnreadColAttrModified(event)
|
|
|
|
|
{
|
|
|
|
|
if (event.attrName == "hidden")
|
|
|
|
|
{
|
|
|
|
|
var folderNameCell = document.getElementById("folderNameCell");
|
|
|
|
|
if (event.newValue == "true")
|
|
|
|
|
{
|
|
|
|
|
folderNameCell.setAttribute("label", "?folderTreeName");
|
|
|
|
|
}
|
|
|
|
|
else if (event.attrChange == Components.interfaces.nsIDOMMutationEvent.REMOVAL)
|
|
|
|
|
{
|
|
|
|
|
folderNameCell.setAttribute("label", "?folderTreeSimpleName");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-09-22 00:13:21 +00:00
|
|
|
|
// builds prior to 8-14-2001 did not have the unread and total columns
|
|
|
|
|
// in the folder pane. so if a user ran an old build, and then
|
|
|
|
|
// upgraded, they get the new columns, and this causes problems
|
|
|
|
|
// because it looks like all the folder names are gone (see bug #96979)
|
|
|
|
|
// to work around this, we hide those columns once, using the
|
|
|
|
|
// "mail.ui.folderpane.version" pref.
|
|
|
|
|
function UpgradeFolderPaneUI()
|
|
|
|
|
{
|
|
|
|
|
var folderPaneUIVersion = pref.GetIntPref("mail.ui.folderpane.version");
|
|
|
|
|
|
|
|
|
|
if (folderPaneUIVersion == 1) {
|
|
|
|
|
var folderUnreadCol = document.getElementById("folderUnreadCol");
|
|
|
|
|
folderUnreadCol.setAttribute("hidden", "true");
|
|
|
|
|
var folderTotalCol = document.getElementById("folderTotalCol");
|
|
|
|
|
folderTotalCol.setAttribute("hidden", "true");
|
|
|
|
|
pref.SetIntPref("mail.ui.folderpane.version", 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
function OnLoadFolderPane()
|
1999-09-01 23:49:47 +00:00
|
|
|
|
{
|
2001-09-22 00:13:21 +00:00
|
|
|
|
UpgradeFolderPaneUI();
|
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
var folderUnreadCol = document.getElementById("folderUnreadCol");
|
|
|
|
|
var hidden = folderUnreadCol.getAttribute("hidden");
|
|
|
|
|
if (!hidden)
|
|
|
|
|
{
|
|
|
|
|
var folderNameCell = document.getElementById("folderNameCell");
|
|
|
|
|
folderNameCell.setAttribute("label", "?folderTreeSimpleName");
|
|
|
|
|
}
|
|
|
|
|
folderUnreadCol.addEventListener("DOMAttrModified", OnFolderUnreadColAttrModified, false);
|
1999-12-21 23:38:31 +00:00
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
SortFolderPane("folderNameCol");
|
1999-10-27 22:38:47 +00:00
|
|
|
|
|
2001-10-08 20:05:00 +00:00
|
|
|
|
//Add folderDataSource and accountManagerDataSource to folderPane
|
|
|
|
|
accountManagerDataSource = accountManagerDataSource.QueryInterface(Components.interfaces.nsIRDFDataSource);
|
|
|
|
|
folderDataSource = folderDataSource.QueryInterface(Components.interfaces.nsIRDFDataSource);
|
|
|
|
|
var database = GetFolderDatasource();
|
|
|
|
|
|
|
|
|
|
database.AddDataSource(accountManagerDataSource);
|
|
|
|
|
database.AddDataSource(folderDataSource);
|
2001-08-15 05:07:48 +00:00
|
|
|
|
var folderOutliner = GetFolderOutliner();
|
2001-10-08 20:05:00 +00:00
|
|
|
|
folderOutliner.outlinerBoxObject.outlinerBody.setAttribute("ref", "msgaccounts:/");
|
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
var folderOutlinerBuilder = folderOutliner.outlinerBoxObject.outlinerBody.builder.QueryInterface(Components.interfaces.nsIXULOutlinerBuilder);
|
|
|
|
|
folderOutlinerBuilder.addObserver(folderObserver);
|
|
|
|
|
folderOutliner.addEventListener("click",FolderPaneOnClick,true);
|
2000-06-30 06:02:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
function GetFolderDatasource()
|
1999-09-01 23:49:47 +00:00
|
|
|
|
{
|
2001-08-15 05:07:48 +00:00
|
|
|
|
var folderOutliner = GetFolderOutliner();
|
|
|
|
|
return folderOutliner.outlinerBoxObject.outlinerBody.database;
|
1999-09-01 23:49:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Functions for accessing particular parts of the window*/
|
2001-08-15 05:07:48 +00:00
|
|
|
|
function GetFolderOutliner()
|
1999-09-01 23:49:47 +00:00
|
|
|
|
{
|
2001-08-15 05:07:48 +00:00
|
|
|
|
if (! gFolderOutliner)
|
|
|
|
|
gFolderOutliner = document.getElementById("folderOutliner");
|
|
|
|
|
return gFolderOutliner;
|
1999-09-01 23:49:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
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;
|
2001-08-15 05:07:48 +00:00
|
|
|
|
if (outlinerSelection)
|
|
|
|
|
outlinerSelection.clearSelection();
|
2001-03-24 01:12:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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")
|
2001-06-19 00:58:15 +00:00
|
|
|
|
window.frames["messagepane"].location = "about:blank";
|
2000-04-21 14:22:16 +00:00
|
|
|
|
// 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
|
|
|
|
|
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
function GetSelectedFolderIndex()
|
1999-11-11 00:23:29 +00:00
|
|
|
|
{
|
2001-08-15 05:07:48 +00:00
|
|
|
|
var folderOutliner = GetFolderOutliner();
|
|
|
|
|
var startIndex = {};
|
|
|
|
|
var endIndex = {};
|
|
|
|
|
folderOutliner.outlinerBoxObject.selection.getRangeAt(0, startIndex, endIndex);
|
|
|
|
|
return startIndex.value;
|
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)
|
|
|
|
|
{
|
2001-08-15 05:07:48 +00:00
|
|
|
|
// we only care about button 0 (left click) events
|
|
|
|
|
if (event.button != 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var folderOutliner = GetFolderOutliner();
|
|
|
|
|
var row = {};
|
|
|
|
|
var col = {};
|
|
|
|
|
var elt = {};
|
|
|
|
|
folderOutliner.outlinerBoxObject.getCellAt(event.clientX, event.clientY, row, col, elt);
|
|
|
|
|
|
|
|
|
|
if (elt.value == "twisty")
|
|
|
|
|
{
|
|
|
|
|
var folderResource = GetFolderResource(folderOutliner, row.value);
|
|
|
|
|
var msgFolder = folderResource.QueryInterface(Components.interfaces.nsIMsgFolder);
|
|
|
|
|
|
2001-08-21 06:18:58 +00:00
|
|
|
|
if (!(folderOutliner.outlinerBoxObject.view.isContainerOpen(row.value)))
|
2001-08-15 05:07:48 +00:00
|
|
|
|
{
|
|
|
|
|
var isServer = GetFolderAttribute(folderOutliner, folderResource, "IsServer");
|
|
|
|
|
if (isServer == "true")
|
|
|
|
|
{
|
|
|
|
|
var server = msgFolder.server;
|
2001-08-21 06:18:58 +00:00
|
|
|
|
server.performExpand(msgWindow);
|
2001-08-15 05:07:48 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var serverType = GetFolderAttribute(folderOutliner, folderResource, "ServerType");
|
|
|
|
|
if (serverType == "imap")
|
|
|
|
|
{
|
|
|
|
|
var imapFolder = folderResource.QueryInterface(Components.interfaces.nsIMsgImapMailFolder);
|
|
|
|
|
imapFolder.performExpand(msgWindow);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ((event.originalTarget.localName == "outlinercol") ||
|
2001-08-29 22:14:18 +00:00
|
|
|
|
(event.originalTarget.localName == "slider") ||
|
2001-08-15 05:07:48 +00:00
|
|
|
|
(event.originalTarget.localName == "scrollbarbutton")) {
|
|
|
|
|
// clicking on the name column in the folder pane should not sort
|
|
|
|
|
event.preventBubble();
|
|
|
|
|
}
|
|
|
|
|
else if (event.detail == 2) {
|
|
|
|
|
FolderPaneDoubleClick(row.value, event);
|
2000-04-04 02:31:43 +00:00
|
|
|
|
}
|
2000-03-17 01:10:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
function FolderPaneDoubleClick(folderIndex, event)
|
2000-03-17 01:10:57 +00:00
|
|
|
|
{
|
2001-08-15 05:07:48 +00:00
|
|
|
|
var folderOutliner = GetFolderOutliner();
|
|
|
|
|
var folderResource = GetFolderResource(folderOutliner, folderIndex);
|
|
|
|
|
var msgFolder = folderResource.QueryInterface(Components.interfaces.nsIMsgFolder);
|
|
|
|
|
var isServer = GetFolderAttribute(folderOutliner, folderResource, "IsServer");
|
2000-04-04 02:31:43 +00:00
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
if (isServer == "true")
|
|
|
|
|
{
|
2001-08-21 06:18:58 +00:00
|
|
|
|
if (!(folderOutliner.outlinerBoxObject.view.isContainerOpen(folderIndex)))
|
2001-08-15 05:07:48 +00:00
|
|
|
|
{
|
|
|
|
|
var server = msgFolder.server;
|
2001-08-21 06:18:58 +00:00
|
|
|
|
server.performExpand(msgWindow);
|
2001-08-15 05:07:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Open a new msg window only if we are double clicking on
|
|
|
|
|
// folders or newsgroups.
|
|
|
|
|
MsgOpenNewWindowForFolder(folderResource.Value);
|
|
|
|
|
|
|
|
|
|
// double clicking should not toggle the open / close state of the
|
|
|
|
|
// folder. this will happen if we don't prevent the event from
|
|
|
|
|
// bubbling to the default handler in outliner.xml
|
|
|
|
|
event.preventBubble();
|
|
|
|
|
}
|
2000-03-17 01:10:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
function ChangeSelection(outliner, newIndex)
|
2000-01-10 01:34:36 +00:00
|
|
|
|
{
|
2001-08-15 05:07:48 +00:00
|
|
|
|
if(newIndex >= 0)
|
|
|
|
|
{
|
|
|
|
|
outliner.outlinerBoxObject.selection.select(newIndex);
|
|
|
|
|
outliner.outlinerBoxObject.ensureRowIsVisible(newIndex);
|
|
|
|
|
}
|
2000-01-10 01:34:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
function GetSelectedFolders()
|
|
|
|
|
{
|
|
|
|
|
var folderArray = [];
|
|
|
|
|
var k = 0;
|
|
|
|
|
var folderOutliner = GetFolderOutliner();
|
|
|
|
|
var rangeCount = folderOutliner.outlinerBoxObject.selection.getRangeCount();
|
|
|
|
|
|
|
|
|
|
for(var i = 0; i < rangeCount; i++)
|
|
|
|
|
{
|
|
|
|
|
var startIndex = {};
|
|
|
|
|
var endIndex = {};
|
|
|
|
|
folderOutliner.outlinerBoxObject.selection.getRangeAt(i, startIndex, endIndex);
|
|
|
|
|
for (var j = startIndex.value; j <= endIndex.value; j++)
|
|
|
|
|
{
|
|
|
|
|
var folderResource = GetFolderResource(folderOutliner, j);
|
|
|
|
|
folderArray[k++] = folderResource.Value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return folderArray;
|
|
|
|
|
}
|
2000-04-11 20:19:32 +00:00
|
|
|
|
|
|
|
|
|
function GetSelectedMsgFolders()
|
|
|
|
|
{
|
2001-08-15 05:07:48 +00:00
|
|
|
|
var folderArray = [];
|
|
|
|
|
var k = 0;
|
|
|
|
|
var folderOutliner = GetFolderOutliner();
|
|
|
|
|
var rangeCount = folderOutliner.outlinerBoxObject.selection.getRangeCount();
|
2000-04-11 20:19:32 +00:00
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
for(var i = 0; i < rangeCount; i++)
|
|
|
|
|
{
|
|
|
|
|
var startIndex = {};
|
|
|
|
|
var endIndex = {};
|
|
|
|
|
folderOutliner.outlinerBoxObject.selection.getRangeAt(i, startIndex, endIndex);
|
|
|
|
|
for (var j = startIndex.value; j <= endIndex.value; j++)
|
|
|
|
|
{
|
|
|
|
|
var msgFolder = GetFolderResource(folderOutliner, j).QueryInterface(Components.interfaces.nsIMsgFolder);
|
|
|
|
|
if(msgFolder)
|
|
|
|
|
folderArray[k++] = msgFolder;
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-04-11 20:19:32 +00:00
|
|
|
|
|
2001-08-15 05:07:48 +00:00
|
|
|
|
return folderArray;
|
2000-04-11 20:19:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
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-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
|
|
|
|
gNextMessageViewIndexAfterDelete = gDBView.msgToSelectAfterDelete;
|
2000-04-20 05:30:32 +00:00
|
|
|
|
}
|
2000-04-21 14:22:16 +00:00
|
|
|
|
|
2001-08-22 03:24:52 +00:00
|
|
|
|
function EnsureAllAncestorsAreExpanded(outliner, resource)
|
|
|
|
|
{
|
|
|
|
|
// get the parent of the desired folder, and then try to get
|
|
|
|
|
// the index of the parent in the outliner
|
|
|
|
|
var folder = resource.QueryInterface(Components.interfaces.nsIFolder);
|
2001-08-23 01:10:05 +00:00
|
|
|
|
|
|
|
|
|
// if this is a server, there are no ancestors, so stop.
|
|
|
|
|
var msgFolder = folder.QueryInterface(Components.interfaces.nsIMsgFolder);
|
|
|
|
|
if (msgFolder.isServer)
|
|
|
|
|
return;
|
|
|
|
|
|
2001-08-22 03:24:52 +00:00
|
|
|
|
var parentFolderResource = RDF.GetResource(folder.parent.URI);
|
|
|
|
|
var folderIndex = GetFolderIndex(outliner, parentFolderResource);
|
|
|
|
|
|
|
|
|
|
if (folderIndex == -1) {
|
|
|
|
|
// if we couldn't find the parent, recurse
|
|
|
|
|
EnsureAllAncestorsAreExpanded(outliner, parentFolderResource);
|
|
|
|
|
// ok, now we should be able to find the parent
|
|
|
|
|
folderIndex = GetFolderIndex(outliner, parentFolderResource);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if the parent isn't open, open it
|
|
|
|
|
if (!(outliner.outlinerBoxObject.view.isContainerOpen(folderIndex)))
|
|
|
|
|
outliner.outlinerBoxObject.view.toggleOpenState(folderIndex);
|
|
|
|
|
}
|
|
|
|
|
|
2000-04-28 20:10:36 +00:00
|
|
|
|
function SelectFolder(folderUri)
|
|
|
|
|
{
|
2001-08-15 05:07:48 +00:00
|
|
|
|
var folderOutliner = GetFolderOutliner();
|
|
|
|
|
var folderResource = RDF.GetResource(folderUri);
|
2001-08-22 03:24:52 +00:00
|
|
|
|
|
|
|
|
|
// before we can select a folder, we need to make sure it is "visible"
|
|
|
|
|
// in the outliner. to do that, we need to ensure that all its
|
|
|
|
|
// ancestors are expanded
|
|
|
|
|
EnsureAllAncestorsAreExpanded(folderOutliner, folderResource);
|
2001-08-15 05:07:48 +00:00
|
|
|
|
var folderIndex = GetFolderIndex(folderOutliner, folderResource);
|
|
|
|
|
ChangeSelection(folderOutliner, folderIndex);
|
2000-04-28 20:10:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
2001-08-15 05:07:48 +00:00
|
|
|
|
|
|
|
|
|
function GetFolderResource(outliner, index)
|
|
|
|
|
{
|
|
|
|
|
var outlinerBuilder = outliner.outlinerBoxObject.outlinerBody.builder.QueryInterface(Components.interfaces.nsIXULOutlinerBuilder);
|
|
|
|
|
return outlinerBuilder.getResourceAtIndex(index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function GetFolderIndex(outliner, resource)
|
|
|
|
|
{
|
|
|
|
|
var outlinerBuilder = outliner.outlinerBoxObject.outlinerBody.builder.QueryInterface(Components.interfaces.nsIXULOutlinerBuilder);
|
|
|
|
|
return outlinerBuilder.getIndexOfResource(resource);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function GetFolderAttribute(outliner, source, attribute)
|
|
|
|
|
{
|
|
|
|
|
var property = RDF.GetResource("http://home.netscape.com/NC-rdf#" + attribute);
|
|
|
|
|
var target = outliner.outlinerBoxObject.outlinerBody.database.GetTarget(source, property, true);
|
|
|
|
|
if (target)
|
|
|
|
|
target = target.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
|
|
|
|
|
return target;
|
|
|
|
|
}
|