2000-05-25 04:05:40 +00:00
|
|
|
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2000-04-11 20:19:32 +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 file stores variables common to mail windows
|
2000-09-13 23:57:52 +00:00
|
|
|
var messengerContractID = "@mozilla.org/messenger;1";
|
|
|
|
var statusFeedbackContractID = "@mozilla.org/messenger/statusfeedback;1";
|
|
|
|
var messageViewContractID = "@mozilla.org/messenger/messageview;1";
|
|
|
|
var mailSessionContractID = "@mozilla.org/messenger/services/session;1";
|
2001-01-10 03:39:56 +00:00
|
|
|
var secureUIContractID = "@mozilla.org/secure_browser_ui;1";
|
|
|
|
|
2000-04-11 20:19:32 +00:00
|
|
|
|
2000-09-13 23:57:52 +00:00
|
|
|
var prefContractID = "@mozilla.org/preferences;1";
|
|
|
|
var msgWindowContractID = "@mozilla.org/messenger/msgwindow;1";
|
2000-04-11 20:19:32 +00:00
|
|
|
|
|
|
|
var messenger;
|
|
|
|
var pref;
|
|
|
|
var statusFeedback;
|
|
|
|
var messageView;
|
|
|
|
var msgWindow;
|
|
|
|
|
|
|
|
var msgComposeService;
|
|
|
|
var accountManager;
|
|
|
|
var RDF;
|
|
|
|
var msgComposeType;
|
|
|
|
var msgComposeFormat;
|
|
|
|
|
|
|
|
var mailSession;
|
|
|
|
|
|
|
|
var Bundle;
|
|
|
|
var BrandBundle;
|
|
|
|
|
2000-09-14 04:18:07 +00:00
|
|
|
var datasourceContractIDPrefix = "@mozilla.org/rdf/datasource;1?name=";
|
2000-09-13 23:57:52 +00:00
|
|
|
var accountManagerDSContractID = datasourceContractIDPrefix + "msgaccountmanager";
|
|
|
|
var folderDSContractID = datasourceContractIDPrefix + "mailnewsfolders";
|
|
|
|
var messageDSContractID = datasourceContractIDPrefix + "mailnewsmessages";
|
2000-04-11 20:19:32 +00:00
|
|
|
|
|
|
|
var accountManagerDataSource;
|
|
|
|
var folderDataSource;
|
|
|
|
var messageDataSource;
|
2001-01-23 21:54:34 +00:00
|
|
|
|
|
|
|
var messagesBox = null;
|
|
|
|
var accountCentralBox = null;
|
|
|
|
var gAccountCentralLoaded = false;
|
2000-04-11 20:19:32 +00:00
|
|
|
//End progress and Status variables
|
|
|
|
|
2000-04-28 20:10:36 +00:00
|
|
|
function OnMailWindowUnload()
|
|
|
|
{
|
2000-08-16 22:57:20 +00:00
|
|
|
dump("we get here\n");
|
2000-09-13 23:57:52 +00:00
|
|
|
var mailSession = Components.classes[mailSessionContractID].getService();
|
2000-08-16 22:57:20 +00:00
|
|
|
if(mailSession)
|
|
|
|
{
|
|
|
|
mailSession = mailSession.QueryInterface(Components.interfaces.nsIMsgMailSession);
|
|
|
|
if(mailSession)
|
|
|
|
{
|
|
|
|
mailSession.RemoveFolderListener(folderListener);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-04-28 20:10:36 +00:00
|
|
|
mailSession.RemoveMsgWindow(msgWindow);
|
|
|
|
messenger.SetWindow(null, null);
|
|
|
|
|
|
|
|
var msgDS = folderDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
|
|
|
|
msgDS.window = null;
|
|
|
|
|
|
|
|
msgDS = messageDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
|
|
|
|
msgDS.window = null;
|
|
|
|
|
|
|
|
msgDS = accountManagerDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
|
|
|
|
msgDS.window = null;
|
|
|
|
|
|
|
|
|
|
|
|
msgWindow.closeWindow();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2000-04-11 20:19:32 +00:00
|
|
|
function CreateMailWindowGlobals()
|
|
|
|
{
|
|
|
|
// get the messenger instance
|
2000-09-13 23:57:52 +00:00
|
|
|
messenger = Components.classes[messengerContractID].createInstance();
|
2000-04-11 20:19:32 +00:00
|
|
|
messenger = messenger.QueryInterface(Components.interfaces.nsIMessenger);
|
|
|
|
|
2000-09-13 23:57:52 +00:00
|
|
|
pref = Components.classes[prefContractID].getService(Components.interfaces.nsIPref);
|
2000-04-11 20:19:32 +00:00
|
|
|
|
|
|
|
//Create windows status feedback
|
2000-04-14 02:49:35 +00:00
|
|
|
// set the JS implementation of status feedback before creating the c++ one..
|
|
|
|
window.MsgStatusFeedback = new nsMsgStatusFeedback();
|
2001-01-08 22:49:22 +00:00
|
|
|
// double register the status feedback object as the xul browser window implementation
|
|
|
|
window.XULBrowserWindow = window.MsgStatusFeedback;
|
|
|
|
|
2000-09-13 23:57:52 +00:00
|
|
|
statusFeedback = Components.classes[statusFeedbackContractID].createInstance();
|
2000-04-11 20:19:32 +00:00
|
|
|
statusFeedback = statusFeedback.QueryInterface(Components.interfaces.nsIMsgStatusFeedback);
|
|
|
|
|
2001-01-10 03:39:56 +00:00
|
|
|
// try to create and register ourselves with a security icon...
|
|
|
|
var securityIcon = document.getElementById("security-button");
|
|
|
|
if (securityIcon)
|
|
|
|
{
|
2001-01-11 00:08:47 +00:00
|
|
|
// if the client isn't built with psm enabled then we won't have a secure UI to monitor the lock icon
|
|
|
|
// so be sure to wrap this in a try / catch clause...
|
|
|
|
try
|
2001-01-10 03:39:56 +00:00
|
|
|
{
|
2001-01-11 00:08:47 +00:00
|
|
|
var secureUI = Components.classes[secureUIContractID].createInstance();
|
|
|
|
// we may not have a secure UI if psm isn't installed!
|
|
|
|
if (secureUI)
|
|
|
|
{
|
|
|
|
secureUI = secureUI.QueryInterface(Components.interfaces.nsSecureBrowserUI);
|
|
|
|
secureUI.init(_content, securityIcon);
|
|
|
|
}
|
2001-01-10 03:39:56 +00:00
|
|
|
}
|
2001-01-11 00:08:47 +00:00
|
|
|
catch (ex) {}
|
2001-01-10 03:39:56 +00:00
|
|
|
}
|
|
|
|
|
2000-04-28 20:10:36 +00:00
|
|
|
window.MsgWindowCommands = new nsMsgWindowCommands();
|
2000-04-11 20:19:32 +00:00
|
|
|
//Create message view object
|
2000-09-13 23:57:52 +00:00
|
|
|
messageView = Components.classes[messageViewContractID].createInstance();
|
2000-04-11 20:19:32 +00:00
|
|
|
messageView = messageView.QueryInterface(Components.interfaces.nsIMessageView);
|
|
|
|
|
|
|
|
//Create message window object
|
2000-09-13 23:57:52 +00:00
|
|
|
msgWindow = Components.classes[msgWindowContractID].createInstance();
|
2000-04-11 20:19:32 +00:00
|
|
|
msgWindow = msgWindow.QueryInterface(Components.interfaces.nsIMsgWindow);
|
|
|
|
|
2000-09-13 23:57:52 +00:00
|
|
|
msgComposeService = Components.classes['@mozilla.org/messengercompose;1'].getService();
|
2000-04-11 20:19:32 +00:00
|
|
|
msgComposeService = msgComposeService.QueryInterface(Components.interfaces.nsIMsgComposeService);
|
|
|
|
|
2000-09-13 23:57:52 +00:00
|
|
|
mailSession = Components.classes["@mozilla.org/messenger/services/session;1"].getService(Components.interfaces.nsIMsgMailSession);
|
2000-04-11 20:19:32 +00:00
|
|
|
|
2000-09-13 23:57:52 +00:00
|
|
|
accountManager = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
|
2000-04-11 20:19:32 +00:00
|
|
|
|
2000-09-13 23:57:52 +00:00
|
|
|
RDF = Components.classes['@mozilla.org/rdf/rdf-service;1'].getService();
|
2000-04-11 20:19:32 +00:00
|
|
|
RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
|
|
|
|
|
|
|
|
msgComposeType = Components.interfaces.nsIMsgCompType;
|
|
|
|
msgComposeFormat = Components.interfaces.nsIMsgCompFormat;
|
|
|
|
|
|
|
|
Bundle = srGetStrBundle("chrome://messenger/locale/messenger.properties");
|
2000-04-14 02:49:35 +00:00
|
|
|
BrandBundle = srGetStrBundle("chrome://global/locale/brand.properties");
|
2000-04-11 20:19:32 +00:00
|
|
|
|
|
|
|
//Create datasources
|
2000-09-13 23:57:52 +00:00
|
|
|
accountManagerDataSource = Components.classes[accountManagerDSContractID].createInstance();
|
|
|
|
folderDataSource = Components.classes[folderDSContractID].createInstance();
|
|
|
|
messageDataSource = Components.classes[messageDSContractID].createInstance();
|
2000-04-11 20:19:32 +00:00
|
|
|
|
2001-01-23 21:54:34 +00:00
|
|
|
messagesBox = document.getElementById("messagesBox");
|
|
|
|
accountCentralBox = document.getElementById("accountCentralBox");
|
2000-04-11 20:19:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function InitMsgWindow()
|
|
|
|
{
|
|
|
|
msgWindow.statusFeedback = statusFeedback;
|
|
|
|
msgWindow.messageView = messageView;
|
|
|
|
msgWindow.msgHeaderSink = messageHeaderSink;
|
2000-04-28 20:10:36 +00:00
|
|
|
msgWindow.SetDOMWindow(window);
|
|
|
|
mailSession.AddMsgWindow(msgWindow);
|
|
|
|
|
2000-04-11 20:19:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function AddDataSources()
|
|
|
|
{
|
|
|
|
|
|
|
|
accountManagerDataSource = accountManagerDataSource.QueryInterface(Components.interfaces.nsIRDFDataSource);
|
|
|
|
folderDataSource = folderDataSource.QueryInterface(Components.interfaces.nsIRDFDataSource);
|
|
|
|
//to move menu item
|
|
|
|
SetupMoveCopyMenus('moveMenu', accountManagerDataSource, folderDataSource);
|
|
|
|
|
|
|
|
//to copy menu item
|
|
|
|
SetupMoveCopyMenus('copyMenu', accountManagerDataSource, folderDataSource);
|
|
|
|
|
|
|
|
|
|
|
|
//To FileButton menu
|
2001-01-19 05:10:31 +00:00
|
|
|
SetupMoveCopyMenus('button-file', accountManagerDataSource, folderDataSource);
|
2000-05-11 02:52:07 +00:00
|
|
|
|
|
|
|
//To move and copy menus in message pane context
|
|
|
|
SetupMoveCopyMenus("messagePaneContext-copyMenu", accountManagerDataSource, folderDataSource);
|
|
|
|
SetupMoveCopyMenus("messagePaneContext-moveMenu", accountManagerDataSource, folderDataSource);
|
|
|
|
|
2000-04-11 20:19:32 +00:00
|
|
|
//Add statusFeedback
|
|
|
|
|
|
|
|
var msgDS = folderDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
|
|
|
|
msgDS.window = msgWindow;
|
|
|
|
|
|
|
|
msgDS = messageDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
|
|
|
|
msgDS.window = msgWindow;
|
|
|
|
|
|
|
|
msgDS = accountManagerDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
|
|
|
|
msgDS.window = msgWindow;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function SetupMoveCopyMenus(menuid, accountManagerDataSource, folderDataSource)
|
|
|
|
{
|
|
|
|
var menu = document.getElementById(menuid);
|
|
|
|
if(menu)
|
|
|
|
{
|
|
|
|
menu.database.AddDataSource(accountManagerDataSource);
|
|
|
|
menu.database.AddDataSource(folderDataSource);
|
|
|
|
menu.setAttribute('ref', 'msgaccounts:/');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function dumpProgress() {
|
|
|
|
var broadcaster = document.getElementById("Messenger:LoadingProgress");
|
|
|
|
dump( "broadcaster mode=" + broadcaster.getAttribute("mode") + "\n" );
|
|
|
|
dump( "broadcaster value=" + broadcaster.getAttribute("value") + "\n" );
|
|
|
|
dump( "meter mode=" + meter.getAttribute("mode") + "\n" );
|
|
|
|
dump( "meter value=" + meter.getAttribute("value") + "\n" );
|
|
|
|
}
|
2000-04-14 02:49:35 +00:00
|
|
|
|
|
|
|
// We're going to implement our status feedback for the mail window in JS now.
|
|
|
|
// the following contains the implementation of our status feedback object
|
|
|
|
|
|
|
|
function nsMsgStatusFeedback()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsMsgStatusFeedback.prototype =
|
|
|
|
{
|
2001-01-08 22:49:22 +00:00
|
|
|
// global variables for status / feedback information....
|
|
|
|
startTime : 0,
|
|
|
|
statusTextFld : null,
|
|
|
|
statusBar : null,
|
|
|
|
throbber : null,
|
|
|
|
stopMenu : null,
|
|
|
|
stopButton : null,
|
|
|
|
|
|
|
|
ensureStatusFields : function()
|
|
|
|
{
|
|
|
|
if (!this.statusTextFld ) this.statusTextFld = document.getElementById("statusText");
|
|
|
|
if (!this.statusBar) this.statusBar = document.getElementById("statusbar-icon");
|
|
|
|
if(!this.throbber) this.throbber = document.getElementById("navigator-throbber");
|
|
|
|
if(!this.stopButton) this.stopButton = document.getElementById("button-stop");
|
|
|
|
if(!this.stopMenu) this.stopMenu = document.getElementById("stopMenuitem");
|
|
|
|
},
|
|
|
|
|
|
|
|
// nsIXULBrowserWindow implementation
|
|
|
|
setJSStatus : function(status)
|
|
|
|
{
|
|
|
|
},
|
|
|
|
setJSDefaultStatus : function(status)
|
|
|
|
{
|
|
|
|
},
|
|
|
|
setDefaultStatus : function(status)
|
|
|
|
{
|
|
|
|
},
|
|
|
|
setOverLink : function(link)
|
|
|
|
{
|
|
|
|
this.showStatusString(link);
|
|
|
|
},
|
|
|
|
onProgress : function (channel, current, max)
|
|
|
|
{
|
|
|
|
},
|
|
|
|
onStateChange : function (progress, request, state, status)
|
|
|
|
{
|
|
|
|
},
|
|
|
|
onStatus : function(channel, url, message)
|
|
|
|
{
|
|
|
|
},
|
|
|
|
onLocationChange : function(location)
|
|
|
|
{
|
|
|
|
},
|
|
|
|
|
2000-04-14 02:49:35 +00:00
|
|
|
QueryInterface : function(iid)
|
|
|
|
{
|
2001-01-08 22:49:22 +00:00
|
|
|
if(iid.equals(Components.interfaces.nsIMsgStatusFeedback))
|
|
|
|
return this;
|
|
|
|
if(iid.equals(Components.interfaces.nsIXULBrowserWindow))
|
|
|
|
return this;
|
|
|
|
throw Components.results.NS_NOINTERFACE;
|
|
|
|
return null;
|
2000-04-14 02:49:35 +00:00
|
|
|
},
|
2001-01-08 22:49:22 +00:00
|
|
|
|
|
|
|
// nsIMsgStatusFeedback implementation.
|
|
|
|
showStatusString : function(statusText)
|
2000-04-14 02:49:35 +00:00
|
|
|
{
|
2001-01-08 22:49:22 +00:00
|
|
|
this.ensureStatusFields();
|
|
|
|
|
2000-04-14 02:49:35 +00:00
|
|
|
if ( statusText == "" )
|
2000-04-14 04:26:15 +00:00
|
|
|
statusText = defaultStatus;
|
2001-01-08 22:49:22 +00:00
|
|
|
this.statusTextFld.value = statusText;
|
2000-04-14 02:49:35 +00:00
|
|
|
},
|
2001-01-08 22:49:22 +00:00
|
|
|
startMeteors : function()
|
2000-04-14 02:49:35 +00:00
|
|
|
{
|
2001-01-08 22:49:22 +00:00
|
|
|
this.ensureStatusFields();
|
2000-05-03 21:17:33 +00:00
|
|
|
|
|
|
|
// Turn progress meter on.
|
2001-01-08 22:49:22 +00:00
|
|
|
this.statusBar.setAttribute("mode","undetermined");
|
2000-05-03 21:17:33 +00:00
|
|
|
|
|
|
|
// turn throbber on
|
2001-01-08 22:49:22 +00:00
|
|
|
this.throbber.setAttribute("busy", true);
|
2000-08-23 03:25:08 +00:00
|
|
|
|
2001-01-08 22:49:22 +00:00
|
|
|
//turn on stop button and menu
|
|
|
|
this.stopButton.setAttribute("disabled", false);
|
|
|
|
this.stopMenu.setAttribute("disabled", false);
|
2000-05-03 21:17:33 +00:00
|
|
|
|
|
|
|
// Remember when loading commenced.
|
2001-01-08 22:49:22 +00:00
|
|
|
this.startTime = (new Date()).getTime();
|
2000-04-14 02:49:35 +00:00
|
|
|
},
|
2001-01-08 22:49:22 +00:00
|
|
|
stopMeteors : function()
|
2000-04-14 02:49:35 +00:00
|
|
|
{
|
2001-01-08 22:49:22 +00:00
|
|
|
this.ensureStatusFields();
|
2000-05-03 21:17:33 +00:00
|
|
|
|
|
|
|
// Record page loading time.
|
2001-01-08 22:49:22 +00:00
|
|
|
var elapsed = ( (new Date()).getTime() - this.startTime ) / 1000;
|
|
|
|
var msg = Bundle.GetStringFromName("documentDonePrefix") +
|
2000-05-25 04:05:40 +00:00
|
|
|
elapsed + Bundle.GetStringFromName("documentDonePostfix");
|
2001-01-08 22:49:22 +00:00
|
|
|
|
|
|
|
this.showStatusString(msg);
|
2000-05-03 21:17:33 +00:00
|
|
|
defaultStatus = msg;
|
|
|
|
|
2001-01-08 22:49:22 +00:00
|
|
|
this.throbber.setAttribute("busy", false);
|
|
|
|
|
2000-05-03 21:17:33 +00:00
|
|
|
// Turn progress meter off.
|
2001-01-08 22:49:22 +00:00
|
|
|
this.statusBar.setAttribute("mode","normal");
|
|
|
|
this.statusBar.value = 0; // be sure to clear the progress bar
|
|
|
|
this.statusBar.progresstext = "";
|
|
|
|
this.stopButton.setAttribute("disabled", true);
|
|
|
|
this.stopMenu.setAttribute("disabled", true);
|
2000-08-23 03:25:08 +00:00
|
|
|
|
2000-04-14 02:49:35 +00:00
|
|
|
},
|
2001-01-08 22:49:22 +00:00
|
|
|
showProgress : function(percentage)
|
2000-04-14 02:49:35 +00:00
|
|
|
{
|
2001-01-08 22:49:22 +00:00
|
|
|
this.ensureStatusFields();
|
2000-04-14 02:49:35 +00:00
|
|
|
if (percentage >= 0)
|
2000-05-03 21:17:33 +00:00
|
|
|
{
|
2001-01-08 22:49:22 +00:00
|
|
|
this.statusBar.setAttribute("mode", "normal");
|
|
|
|
this.statusBar.value = percentage;
|
|
|
|
this.statusBar.progresstext = Math.round(percentage) + "%";
|
2000-05-03 21:17:33 +00:00
|
|
|
}
|
2000-04-14 02:49:35 +00:00
|
|
|
},
|
2000-06-22 22:52:05 +00:00
|
|
|
closeWindow : function(percent)
|
2000-04-14 02:49:35 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
2000-04-28 20:10:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
function nsMsgWindowCommands()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsMsgWindowCommands.prototype =
|
|
|
|
{
|
|
|
|
QueryInterface : function(iid)
|
|
|
|
{
|
|
|
|
if(iid.equals(Components.interfaces.nsIMsgWindowCommands))
|
|
|
|
return this;
|
|
|
|
throw Components.results.NS_NOINTERFACE;
|
2000-10-05 21:17:22 +00:00
|
|
|
return null;
|
2000-04-28 20:10:36 +00:00
|
|
|
},
|
|
|
|
SelectFolder: function(folderUri)
|
|
|
|
{
|
|
|
|
|
|
|
|
SelectFolder(folderUri);
|
|
|
|
|
|
|
|
},
|
|
|
|
SelectMessage: function(messageUri)
|
|
|
|
{
|
|
|
|
SelectMessage(messageUri);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-05-01 21:58:24 +00:00
|
|
|
function StopUrls()
|
|
|
|
{
|
|
|
|
msgWindow.StopUrls();
|
|
|
|
}
|
2000-08-26 20:54:51 +00:00
|
|
|
|
|
|
|
function loadStartPage() {
|
|
|
|
try {
|
2000-09-08 21:57:43 +00:00
|
|
|
var startpageenabled= pref.GetBoolPref("mailnews.start_page.enabled");
|
2000-08-26 20:54:51 +00:00
|
|
|
|
|
|
|
if (startpageenabled) {
|
2000-10-06 22:58:48 +00:00
|
|
|
var startpage = pref.getLocalizedUnicharPref("mailnews.start_page.url");
|
2000-08-26 20:54:51 +00:00
|
|
|
if (startpage != "") {
|
|
|
|
window.frames["messagepane"].location = startpage;
|
|
|
|
dump("start message pane with: " + startpage + "\n");
|
|
|
|
ClearMessageSelection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (ex) {
|
|
|
|
dump("Error loading start page.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-01-23 21:54:34 +00:00
|
|
|
// Display AccountCentral page when users clicks on the Account Folder.
|
|
|
|
// When AccountCentral page need to be shown, we need to hide
|
|
|
|
// the box containing threadPane, splitter and messagePane.
|
|
|
|
// Load iframe in the AccountCentral box with corresponding page
|
|
|
|
function ShowAccountCentral()
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
var acctCentralPage = pref.getLocalizedUnicharPref("mailnews.account_central_page.url");
|
|
|
|
messagesBox.setAttribute("hidden", "true");
|
|
|
|
accountCentralBox.removeAttribute("hidden");
|
|
|
|
window.frames["accountCentralPane"].location = acctCentralPage;
|
|
|
|
gAccountCentralLoaded = true;
|
|
|
|
}
|
|
|
|
catch (ex) {
|
|
|
|
dump("Error loading AccountCentral page -> " + ex + "\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Display thread and message panes with splitter when user tries
|
|
|
|
// to read messages by clicking on msgfolders. Hide AccountCentral
|
|
|
|
// box and display message box.
|
|
|
|
function HideAccountCentral()
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
accountCentralBox.setAttribute("hidden", "true");
|
|
|
|
messagesBox.removeAttribute("hidden");
|
|
|
|
gAccountCentralLoaded = false;
|
|
|
|
}
|
|
|
|
catch (ex) {
|
|
|
|
dump("Error hiding AccountCentral page -> " + ex + "\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Given the server, open the twisty and the set the selection
|
|
|
|
// on inbox of that server
|
|
|
|
function OpenInboxForServer(server)
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
HideAccountCentral();
|
|
|
|
OpenTwistyForServer(server);
|
|
|
|
var inboxFolder = GetInboxFolder(server);
|
|
|
|
var folderTree = GetFolderTree();
|
|
|
|
var inboxFolderUri = document.getElementById(inboxFolder.URI);
|
|
|
|
ChangeSelection(folderTree, inboxFolderUri);
|
|
|
|
}
|
|
|
|
catch (ex) {
|
|
|
|
dump("Error opening inbox for server -> " + ex + "\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|