Fixing busg 66460, 66442, 66447, 66376, 69358 and 69909. Bug 66460 - Check new mail at startup introduced. All the accounts with this option turned on will perform biff at startup. Bug 66442 - AccountCentral for alternate layout introduced. Bug 66447 - Modifying the AccountCentral header format. Bug 66376 - Read Messages link in AccountCentral fetches new mail. Bug 69358 - A performance improvement at startup. Bug 69909 - Fixing the AccountCentral headers broken by new stringbundle checkins. r=gayatrib, bienvenu, timeless, blakeross sr=sspitzer
git-svn-id: svn://10.0.0.236/trunk@87761 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -90,6 +90,9 @@ commonDialogsService = commonDialogsService.QueryInterface(Components.interfaces
|
||||
// the current nsIMsgAccount
|
||||
var gCurrentAccount;
|
||||
|
||||
// default account
|
||||
var gDefaultAccount;
|
||||
|
||||
// the current associative array that
|
||||
// will eventually be dumped into the account
|
||||
var gCurrentAccountData;
|
||||
@@ -132,6 +135,8 @@ function onLoad() {
|
||||
}
|
||||
else
|
||||
wizardManager.LoadPage("accounttype", false);
|
||||
|
||||
gDefaultAccount = accountm.defaultAccount;
|
||||
}
|
||||
|
||||
|
||||
@@ -213,6 +218,9 @@ function FinishAccount() {
|
||||
|
||||
verifyLocalFoldersAccount(gCurrentAccount);
|
||||
|
||||
if (!serverIsNntp(pageData))
|
||||
EnableCheckMailAtStartUpIfNeeded(gCurrentAccount);
|
||||
|
||||
// hack hack - save the prefs file NOW in case we crash
|
||||
try {
|
||||
var prefs = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPref);
|
||||
@@ -817,3 +825,18 @@ function onFlush() {
|
||||
prefs.SetBoolPref("nglayout.debug.disable_xul_cache", false);
|
||||
|
||||
}
|
||||
|
||||
/** If there are no default accounts..
|
||||
* this is will be the new default, so enable
|
||||
* check for mail at startup
|
||||
*/
|
||||
function EnableCheckMailAtStartUpIfNeeded(newAccount)
|
||||
{
|
||||
// Check if default account exists and if that account is alllowed to be
|
||||
// a default account. If no such account, make this one as the default account
|
||||
// and turn on the new mail check at startup for the current account
|
||||
if (!(gDefaultAccount && gDefaultAccount.incomingServer.canBeDefaultServer)) {
|
||||
accountm.defaultAccount = newAccount;
|
||||
newAccount.incomingServer.loginAtStartUp = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<!-- LOCALIZATION NOTE (expungeOnExit.label) : do not translate two of """ in below line -->
|
||||
<!ENTITY expungeOnExit.label "Clean up ("Expunge") Inbox on Exit">
|
||||
<!ENTITY emptyTrashOnExit.label "Empty Trash on Exit">
|
||||
<!ENTITY loginAtStartup.label "Log onto this account at startup of Mail">
|
||||
<!ENTITY loginAtStartup.label "Check for new mail at startup">
|
||||
<!-- LOCALIZATION NOTE (maxMessagesStart.label) : translate below 2 lines with grammar dependency
|
||||
maxMessengerStart.label will be followed by maxMessagesEnd.label with the number
|
||||
of messages between them
|
||||
|
||||
@@ -204,6 +204,9 @@ interface nsIMsgIncomingServer : nsISupports {
|
||||
attribute long maxMessageSize;
|
||||
|
||||
attribute nsIMsgRetentionSettings retentionSettings;
|
||||
|
||||
/* check if this server can be a default server */
|
||||
readonly attribute boolean canBeDefaultServer;
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
@@ -134,9 +134,30 @@ Rights Reserved.
|
||||
|
||||
<box orient="vertical" flex="1">
|
||||
<box align ="horizontal" persist="height" flex="1">
|
||||
<tree id="folderTree" flex="1" style="width:0px;" context="folderPaneContext" persist="collapsed width" />
|
||||
<splitter id="gray_vertical_splitter" collapse="before" persist="state"/>
|
||||
<tree id="threadTree" flex="2" persist="width" style="width:0px" context="threadPaneContext" class="window-focusborder" focusring="false"/>
|
||||
<box flex="1">
|
||||
<tree id="folderTree"
|
||||
style="width:0px;"
|
||||
context="folderPaneContext"
|
||||
persist="collapsed width"/>
|
||||
|
||||
<splitter id="gray_vertical_splitter" collapse="before" persist="state"/>
|
||||
|
||||
<box id="threadpaneBox" flex="2">
|
||||
<tree id="threadTree"
|
||||
flex="1"
|
||||
persist="width"
|
||||
style="width:0px"
|
||||
context="threadPaneContext"
|
||||
class="window-focusborder"
|
||||
focusring="false"/>
|
||||
</box>
|
||||
<box id="accountCentralBox" flex="2">
|
||||
<iframe name="accountCentralPane"
|
||||
style="width:0px;"
|
||||
flex="1"
|
||||
src="about:blank"/>
|
||||
</box>
|
||||
</box>
|
||||
</box>
|
||||
<!-- if you change this id, please change GetThreadAndMessagePaneSplitter() and MsgToggleMessagePane() -->
|
||||
<splitter id="threadpane-splitter" collapse="after" persist="state"
|
||||
|
||||
@@ -58,6 +58,7 @@ var messageDataSource;
|
||||
var messagesBox = null;
|
||||
var accountCentralBox = null;
|
||||
var gAccountCentralLoaded = false;
|
||||
var gPaneConfig = null;
|
||||
//End progress and Status variables
|
||||
|
||||
// for checking if the folder loaded is Draft or Unsent which msg is editable
|
||||
@@ -162,6 +163,7 @@ function CreateMailWindowGlobals()
|
||||
|
||||
messagesBox = document.getElementById("messagesBox");
|
||||
accountCentralBox = document.getElementById("accountCentralBox");
|
||||
gPaneConfig = pref.GetIntPref("mail.pane_config");
|
||||
}
|
||||
|
||||
function InitMsgWindow()
|
||||
@@ -447,14 +449,33 @@ function loadStartPage() {
|
||||
// Load iframe in the AccountCentral box with corresponding page
|
||||
function ShowAccountCentral()
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
var acctCentralPage = pref.getLocalizedUnicharPref("mailnews.account_central_page.url");
|
||||
messagesBox.setAttribute("hidden", "true");
|
||||
accountCentralBox.removeAttribute("hidden");
|
||||
window.frames["accountCentralPane"].location = acctCentralPage;
|
||||
gAccountCentralLoaded = true;
|
||||
switch (gPaneConfig)
|
||||
{
|
||||
case 0:
|
||||
messagesBox.setAttribute("hidden", "true");
|
||||
accountCentralBox.removeAttribute("hidden");
|
||||
window.frames["accountCentralPane"].location = acctCentralPage;
|
||||
gAccountCentralLoaded = true;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
var messagePaneBox = document.getElementById("messagepanebox");
|
||||
messagePaneBox.setAttribute("hidden", "true");
|
||||
var threadPaneBox = document.getElementById("threadpaneBox");
|
||||
threadPaneBox.setAttribute("hidden", "true");
|
||||
var threadPaneSplitter = document.getElementById("threadpane-splitter");
|
||||
threadPaneSplitter.setAttribute("hidden", "true");
|
||||
accountCentralBox.removeAttribute("hidden");
|
||||
window.frames["accountCentralPane"].location = acctCentralPage;
|
||||
gAccountCentralLoaded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (ex) {
|
||||
catch (ex)
|
||||
{
|
||||
dump("Error loading AccountCentral page -> " + ex + "\n");
|
||||
return;
|
||||
}
|
||||
@@ -465,12 +486,30 @@ function ShowAccountCentral()
|
||||
// box and display message box.
|
||||
function HideAccountCentral()
|
||||
{
|
||||
try {
|
||||
accountCentralBox.setAttribute("hidden", "true");
|
||||
messagesBox.removeAttribute("hidden");
|
||||
gAccountCentralLoaded = false;
|
||||
try
|
||||
{
|
||||
switch (gPaneConfig)
|
||||
{
|
||||
case 0:
|
||||
accountCentralBox.setAttribute("hidden", "true");
|
||||
messagesBox.removeAttribute("hidden");
|
||||
gAccountCentralLoaded = false;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
accountCentralBox.setAttribute("hidden", "true");
|
||||
var messagePaneBox = document.getElementById("messagepanebox");
|
||||
messagePaneBox.removeAttribute("hidden");
|
||||
var threadPaneBox = document.getElementById("threadpaneBox");
|
||||
threadPaneBox.removeAttribute("hidden");
|
||||
var threadPaneSplitter = document.getElementById("threadpane-splitter");
|
||||
threadPaneSplitter.removeAttribute("hidden");
|
||||
gAccountCentralLoaded = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (ex) {
|
||||
catch (ex)
|
||||
{
|
||||
dump("Error hiding AccountCentral page -> " + ex + "\n");
|
||||
return;
|
||||
}
|
||||
@@ -487,6 +526,7 @@ function OpenInboxForServer(server)
|
||||
var folderTree = GetFolderTree();
|
||||
var inboxFolderUri = document.getElementById(inboxFolder.URI);
|
||||
ChangeSelection(folderTree, inboxFolderUri);
|
||||
GetMessagesForInboxOnServer(server);
|
||||
}
|
||||
catch (ex) {
|
||||
dump("Error opening inbox for server -> " + ex + "\n");
|
||||
|
||||
@@ -257,9 +257,9 @@ function MsgGetMessagesForAllServers(defaultServer)
|
||||
{
|
||||
var allServers = accountManager.allServers;
|
||||
|
||||
for (var i=0;i<accountManager.allServers.Count();i++)
|
||||
for (var i=0;i<allServers.Count();i++)
|
||||
{
|
||||
var currentServer = accountManager.allServers.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgIncomingServer);
|
||||
var currentServer = allServers.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgIncomingServer);
|
||||
var protocolinfo = Components.classes["@mozilla.org/messenger/protocol/info;1?type=" + currentServer.type].getService(Components.interfaces.nsIMsgProtocolInfo);
|
||||
if (protocolinfo.canLoginAtStartUp && currentServer.loginAtStartUp)
|
||||
{
|
||||
@@ -269,8 +269,8 @@ function MsgGetMessagesForAllServers(defaultServer)
|
||||
}
|
||||
else
|
||||
{
|
||||
// this assumes "logging is" means getting message on the inbox...is that always true?
|
||||
GetMessagesForInboxOnServer(currentServer);
|
||||
// Check to see if there are new messages on the server
|
||||
currentServer.PerformBiff();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ function OnInit()
|
||||
brandName = brandBundle.getString("brandShortName");
|
||||
|
||||
// Get the account type
|
||||
messengerBundle = document.getElementById("brand_messenger");
|
||||
messengerBundle = document.getElementById("bundle_messenger");
|
||||
selectedServer = GetSelectedServer();
|
||||
var serverType = selectedServer.type;
|
||||
if (serverType == "nntp")
|
||||
|
||||
@@ -392,6 +392,8 @@ function loadStartFolder(initialUri)
|
||||
var defaultServer = null;
|
||||
var startFolderUri = initialUri;
|
||||
var isLoginAtStartUpEnabled = false;
|
||||
var enabledNewMailCheckOnce = false;
|
||||
var mailCheckOncePref = "mail.startup.enabledMailCheckOnce";
|
||||
|
||||
//First get default account
|
||||
try
|
||||
@@ -407,6 +409,17 @@ function loadStartFolder(initialUri)
|
||||
var folderResource = rootMsgFolder.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
startFolderUri = folderResource.Value;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// Get the user pref to see if the login at startup is enabled for default account
|
||||
isLoginAtStartUpEnabled = defaultServer.loginAtStartUp;
|
||||
|
||||
@@ -440,8 +453,8 @@ function loadStartFolder(initialUri)
|
||||
// only do this on startup, when we pass in null
|
||||
if (!initialUri && isLoginAtStartUpEnabled)
|
||||
{
|
||||
// Start downloading messages for the INBOX of the default server
|
||||
TriggerGetMessages(defaultServer);
|
||||
// Perform biff on the server to check for new mail
|
||||
defaultServer.PerformBiff();
|
||||
}
|
||||
|
||||
// because the "open" state persists, we'll call
|
||||
|
||||
@@ -139,7 +139,7 @@ adjust the Disk Space preference to prevent the downloading of large messages.
|
||||
|
||||
# accountCentral
|
||||
mailnews.account_central_page.url=chrome://messenger/content/msgAccountCentral.xul
|
||||
acctCentralTitleFormat=%brandName% %accountType% for %accountName%
|
||||
acctCentralTitleFormat=%brandName% %accountType% - %accountName%
|
||||
mailAcctType=Mail
|
||||
newsAcctType=News
|
||||
|
||||
|
||||
@@ -1424,6 +1424,11 @@ nsMessengerMigrator::MigratePopAccount(nsIMsgIdentity *identity)
|
||||
|
||||
// we could only have one pop account in 4.x, so we make it the default in 5.0
|
||||
rv = accountManager->SetDefaultAccount(account);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Set check for new mail option for default account to TRUE
|
||||
rv = server->SetLoginAtStartUp(PR_TRUE);
|
||||
|
||||
return rv;
|
||||
}
|
||||
nsresult
|
||||
@@ -1690,6 +1695,9 @@ nsMessengerMigrator::MigrateImapAccount(nsIMsgIdentity *identity, const char *ho
|
||||
if (isDefaultAccount) {
|
||||
rv = accountManager->SetDefaultAccount(account);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Set check for new mail option for default account to TRUE
|
||||
rv = server->SetLoginAtStartUp(PR_TRUE);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
||||
@@ -205,6 +205,14 @@ nsMsgIncomingServer::SetCanHaveFilters(PRBool canHaveFilters)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgIncomingServer::GetCanBeDefaultServer(PRBool *canBeDefaultServer)
|
||||
{
|
||||
// derived class should override if they need to do this.
|
||||
*canBeDefaultServer = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// construct <localStoreType>://[<username>@]<hostname
|
||||
NS_IMETHODIMP
|
||||
nsMsgIncomingServer::GetServerURI(char* *aResult)
|
||||
|
||||
@@ -2626,3 +2626,11 @@ nsImapIncomingServer::SetDumpListener(nsISubscribeDumpListener *dumpListener)
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
return mInner->SetDumpListener(dumpListener);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::GetCanBeDefaultServer(PRBool *canBeDefaultServer)
|
||||
{
|
||||
*canBeDefaultServer = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@ public:
|
||||
NS_IMETHOD PerformExpand(nsIMsgWindow *aMsgWindow);
|
||||
NS_IMETHOD CloseCachedConnections();
|
||||
NS_IMETHOD GetConstructedPrettyName(PRUnichar **retval);
|
||||
NS_IMETHOD GetCanBeDefaultServer(PRBool *canBeDefaultServer);
|
||||
|
||||
protected:
|
||||
nsresult GetFolder(const char* name, nsIMsgFolder** pFolder);
|
||||
|
||||
@@ -302,3 +302,10 @@ nsPop3IncomingServer::GetDownloadMessagesAtStartup(PRBool *getMessagesAtStartup)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPop3IncomingServer::GetCanBeDefaultServer(PRBool *canBeDefaultServer)
|
||||
{
|
||||
*canBeDefaultServer = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ public:
|
||||
NS_IMETHOD GetLocalStoreType(char **);
|
||||
NS_IMETHOD PerformBiff();
|
||||
NS_IMETHOD GetDownloadMessagesAtStartup(PRBool *getMessages);
|
||||
NS_IMETHOD GetCanBeDefaultServer(PRBool *canBeDefaultServer);
|
||||
private:
|
||||
|
||||
static nsresult setSubFolderFlag(nsIFolder *aRootFolder,
|
||||
|
||||
Reference in New Issue
Block a user