2000-06-21 06:34:59 +00:00
|
|
|
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
* 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-01-30 22:02:27 +00:00
|
|
|
var gLastMessageUriToLoad = null;
|
2001-03-17 01:59:34 +00:00
|
|
|
var gThreadPaneCommandUpdater = null;
|
2001-01-30 22:02:27 +00:00
|
|
|
|
2000-06-21 06:34:59 +00:00
|
|
|
function ThreadPaneOnClick(event)
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
// we are already handling marking as read and flagging
|
|
|
|
// in nsMsgDBView.cpp
|
|
|
|
// so all we need to worry about here is double clicks
|
|
|
|
// and column header.
|
|
|
|
//
|
|
|
|
// we get in here for clicks on the "outlinercol" (headers)
|
|
|
|
// and the "scrollbarbutton" (scrollbar buttons)
|
|
|
|
// we don't want those events to cause a "double click"
|
|
|
|
|
2000-12-30 20:48:15 +00:00
|
|
|
var t = event.originalTarget;
|
2000-09-07 08:17:32 +00:00
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
if (t.localName == "outlinercol") {
|
|
|
|
HandleColumnClick(t.id);
|
|
|
|
}
|
|
|
|
else if (event.detail == 2 && t.localName == "outlinerbody") {
|
|
|
|
ThreadPaneDoubleClick();
|
2000-12-30 20:48:15 +00:00
|
|
|
}
|
2001-03-17 01:59:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function SetHiddenAttributeOnThreadOnlyColumns(value)
|
|
|
|
{
|
|
|
|
// todo, cache these?
|
2000-09-07 08:17:32 +00:00
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
var totalCol = document.getElementById("totalCol");
|
|
|
|
var unreadCol = document.getElementById("unreadCol");
|
2000-08-16 07:26:45 +00:00
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
totalCol.setAttribute("hidden",value);
|
|
|
|
unreadCol.setAttribute("hidden",value);
|
|
|
|
}
|
2000-06-21 06:34:59 +00:00
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
|
|
|
|
function nsMsgDBViewCommandUpdater()
|
|
|
|
{}
|
|
|
|
|
|
|
|
nsMsgDBViewCommandUpdater.prototype =
|
|
|
|
{
|
|
|
|
updateCommandStatus : function()
|
|
|
|
{
|
|
|
|
// the back end is smart and is only telling us to update command status
|
|
|
|
// when the # of items in the selection has actually changed.
|
|
|
|
document.commandDispatcher.updateCommands('mail-toolbar');
|
|
|
|
},
|
|
|
|
|
|
|
|
displayMessageChanged : function(aFolder, aSubject)
|
|
|
|
{
|
|
|
|
setTitleFromFolder(aFolder, aSubject);
|
|
|
|
gHaveLoadedMessage = true;
|
|
|
|
},
|
|
|
|
|
|
|
|
QueryInterface : function(iid)
|
|
|
|
{
|
|
|
|
if(iid.equals(Components.interfaces.nsIMsgDBViewCommandUpdater))
|
|
|
|
return this;
|
|
|
|
|
|
|
|
throw Components.results.NS_NOINTERFACE;
|
|
|
|
return null;
|
2000-06-21 06:34:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
function HandleColumnClick(columnID)
|
|
|
|
{
|
|
|
|
// if they click on the "threadCol", we need to show the threaded-only columns
|
|
|
|
if ((columnID[0] == 't') && (columnID[1] == 'h')) {
|
|
|
|
SetHiddenAttributeOnThreadOnlyColumns(""); // this will show them
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
SetHiddenAttributeOnThreadOnlyColumns("true"); // this will hide them
|
|
|
|
}
|
|
|
|
|
2001-03-20 06:41:20 +00:00
|
|
|
dump("XXX fix UpdateSortMenu()\n");
|
2001-03-17 01:59:34 +00:00
|
|
|
//UpdateSortMenu(columnID);
|
|
|
|
|
|
|
|
ShowAppropriateColumns();
|
|
|
|
PersistViewAttributesOnFolder();
|
|
|
|
}
|
|
|
|
|
|
|
|
function PersistViewAttributesOnFolder()
|
|
|
|
{
|
|
|
|
var folder = GetSelectedFolder();
|
|
|
|
|
|
|
|
if (folder) {
|
|
|
|
folder.setAttribute("viewType", gDBView.viewType);
|
|
|
|
folder.setAttribute("viewFlags", gDBView.viewFlags);
|
|
|
|
folder.setAttribute("sortType", gDBView.sortType);
|
|
|
|
folder.setAttribute("sortOrder", gDBView.sortOrder);
|
|
|
|
}
|
|
|
|
}
|
2001-02-07 04:35:37 +00:00
|
|
|
|
|
|
|
function MsgComposeDraftMessage()
|
|
|
|
{
|
|
|
|
var loadedFolder = GetLoadedMsgFolder();
|
|
|
|
var messageArray = GetSelectedMessages();
|
|
|
|
|
|
|
|
ComposeMessage(msgComposeType.Draft, msgComposeFormat.Default, loadedFolder, messageArray);
|
|
|
|
}
|
|
|
|
|
2001-01-20 05:06:10 +00:00
|
|
|
function ThreadPaneDoubleClick()
|
2000-06-21 06:34:59 +00:00
|
|
|
{
|
2000-12-31 07:59:47 +00:00
|
|
|
var loadedFolder;
|
|
|
|
var messageArray;
|
|
|
|
var messageUri;
|
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
if (IsSpecialFolderSelected(MSG_FOLDER_FLAG_DRAFTS)) {
|
2001-02-07 04:35:37 +00:00
|
|
|
MsgComposeDraftMessage();
|
2000-06-21 06:34:59 +00:00
|
|
|
}
|
2001-03-17 01:59:34 +00:00
|
|
|
else if(IsSpecialFolderSelected(MSG_FOLDER_FLAG_TEMPLATES)) {
|
2000-12-31 07:59:47 +00:00
|
|
|
loadedFolder = GetLoadedMsgFolder();
|
|
|
|
messageArray = GetSelectedMessages();
|
2000-06-21 06:34:59 +00:00
|
|
|
ComposeMessage(msgComposeType.Template, msgComposeFormat.Default, loadedFolder, messageArray);
|
|
|
|
}
|
2001-03-17 01:59:34 +00:00
|
|
|
else {
|
2001-01-20 05:06:10 +00:00
|
|
|
MsgOpenSelectedMessages();
|
2000-09-14 22:58:41 +00:00
|
|
|
}
|
2000-06-21 06:34:59 +00:00
|
|
|
}
|
|
|
|
|
2000-09-14 22:58:41 +00:00
|
|
|
function ThreadPaneKeyPress(event)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2000-06-21 06:34:59 +00:00
|
|
|
|
|
|
|
function MsgSortByDate()
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
MsgSortThreadPane(nsMsgViewSortType.byDate);
|
2000-06-21 06:34:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function MsgSortBySender()
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
MsgSortThreadPane(nsMsgViewSortType.byAuthor);
|
2000-06-21 06:34:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function MsgSortByRecipient()
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
MsgSortThreadPane(nsMsgViewSortType.byRecipient);
|
2000-06-21 06:34:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function MsgSortByStatus()
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
MsgSortThreadPane(nsMsgViewSortType.byStatus);
|
2000-06-21 06:34:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function MsgSortBySubject()
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
MsgSortThreadPane(nsMsgViewSortType.bySubject);
|
2000-06-21 06:34:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function MsgSortByFlagged()
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
MsgSortThreadPane(nsMsgViewSortType.byFlagged);
|
2000-06-21 06:34:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function MsgSortByPriority()
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
MsgSortThreadPane(nsMsgViewSortType.byPriority);
|
2000-06-21 06:34:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function MsgSortBySize()
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
MsgSortThreadPane(nsMsgViewSortType.bySize);
|
2000-06-21 06:34:59 +00:00
|
|
|
}
|
|
|
|
|
2000-11-01 20:01:44 +00:00
|
|
|
function MsgSortByLines()
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
dump("XXX fix this\n");
|
|
|
|
//MsgSortThreadPane(nsMsgViewSortType.byLines);
|
2000-11-01 20:01:44 +00:00
|
|
|
}
|
|
|
|
|
2000-06-21 06:34:59 +00:00
|
|
|
function MsgSortByUnread()
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
MsgSortThreadPane(nsMsgViewSortType.byUnread);
|
2000-06-21 06:34:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function MsgSortByOrderReceived()
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
MsgSortThreadPane(nsMsgViewSortType.byId);
|
2000-06-21 06:34:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function MsgSortByTotal()
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
dump("XXX fix this\n");
|
|
|
|
//MsgSortThreadPane(nsMsgViewSortType.byTotal);
|
2000-06-21 06:34:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function MsgSortByThread()
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
MsgSortThreadPane(nsMsgViewSortType.byThread);
|
2000-06-21 06:34:59 +00:00
|
|
|
}
|
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
function MsgSortThreadPane(sortType)
|
2000-06-21 06:34:59 +00:00
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
gDBView.sort(sortType, nsMsgViewSortOrder.ascending);
|
2000-06-30 06:02:30 +00:00
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
ShowAppropriateColumns();
|
|
|
|
PersistViewAttributesOnFolder();
|
2000-06-30 06:02:30 +00:00
|
|
|
}
|
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
function IsSpecialFolderSelected(flags)
|
2000-06-30 06:02:30 +00:00
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
var selectedFolder = GetThreadPaneFolder();
|
|
|
|
if (!selectedFolder) return false;
|
2001-01-30 22:02:27 +00:00
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
if ((selectedFolder.flags & flags) == 0) {
|
|
|
|
return false;
|
2001-01-30 22:02:27 +00:00
|
|
|
}
|
2001-03-17 01:59:34 +00:00
|
|
|
else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2001-01-30 22:02:27 +00:00
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
function GetThreadOutliner()
|
|
|
|
{
|
|
|
|
if (gThreadOutliner) return gThreadOutliner;
|
|
|
|
gThreadOutliner = document.getElementById('threadOutliner');
|
|
|
|
return gThreadOutliner;
|
|
|
|
}
|
2001-01-30 22:02:27 +00:00
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
function GetThreadPaneFolder()
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
return gDBView.msgFolder;
|
|
|
|
}
|
|
|
|
catch (ex) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
2001-01-30 22:02:27 +00:00
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
function EnsureRowInThreadOutlinerIsVisible(index)
|
|
|
|
{
|
|
|
|
var outliner = GetThreadOutliner();
|
|
|
|
outliner.boxObject.QueryInterface(Components.interfaces.nsIOutlinerBoxObject).ensureRowIsVisible(index);
|
2000-06-30 06:02:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function GetThreadTree()
|
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
dump("GetThreadTree, fix (or remove?) this\n");
|
2000-06-30 06:02:30 +00:00
|
|
|
}
|
|
|
|
|
2001-03-17 01:59:34 +00:00
|
|
|
function GetThreadTreeFolder()
|
2000-06-30 06:02:30 +00:00
|
|
|
{
|
2001-03-17 01:59:34 +00:00
|
|
|
dump("GetThreadTreeFolder, fix (or remove?) this\n");
|
2000-06-30 06:02:30 +00:00
|
|
|
}
|
|
|
|
|