diff --git a/mozilla/mailnews/base/prefs/resources/content/AccountWizard.js b/mozilla/mailnews/base/prefs/resources/content/AccountWizard.js index 947f68c874f..df6e41c1a27 100644 --- a/mozilla/mailnews/base/prefs/resources/content/AccountWizard.js +++ b/mozilla/mailnews/base/prefs/resources/content/AccountWizard.js @@ -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; + } +} diff --git a/mozilla/mailnews/base/prefs/resources/locale/en-US/am-server-top.dtd b/mozilla/mailnews/base/prefs/resources/locale/en-US/am-server-top.dtd index 3e36780fcdf..e7b905d300c 100644 --- a/mozilla/mailnews/base/prefs/resources/locale/en-US/am-server-top.dtd +++ b/mozilla/mailnews/base/prefs/resources/locale/en-US/am-server-top.dtd @@ -34,7 +34,7 @@ - + " + 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"); diff --git a/mozilla/mailnews/base/resources/content/mailWindowOverlay.js b/mozilla/mailnews/base/resources/content/mailWindowOverlay.js index b90bae3974c..e49179b9ef3 100644 --- a/mozilla/mailnews/base/resources/content/mailWindowOverlay.js +++ b/mozilla/mailnews/base/resources/content/mailWindowOverlay.js @@ -257,9 +257,9 @@ function MsgGetMessagesForAllServers(defaultServer) { var allServers = accountManager.allServers; - for (var i=0;iSetDefaultAccount(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; diff --git a/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp b/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp index bce498362f5..037404dacfa 100644 --- a/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp +++ b/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp @@ -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 ://[@]SetDumpListener(dumpListener); } + +NS_IMETHODIMP +nsImapIncomingServer::GetCanBeDefaultServer(PRBool *canBeDefaultServer) +{ + *canBeDefaultServer = PR_TRUE; + return NS_OK; +} + diff --git a/mozilla/mailnews/imap/src/nsImapIncomingServer.h b/mozilla/mailnews/imap/src/nsImapIncomingServer.h index 85123b22870..f9e5e1b969f 100644 --- a/mozilla/mailnews/imap/src/nsImapIncomingServer.h +++ b/mozilla/mailnews/imap/src/nsImapIncomingServer.h @@ -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); diff --git a/mozilla/mailnews/local/src/nsPop3IncomingServer.cpp b/mozilla/mailnews/local/src/nsPop3IncomingServer.cpp index accc1ee28dd..face8877525 100644 --- a/mozilla/mailnews/local/src/nsPop3IncomingServer.cpp +++ b/mozilla/mailnews/local/src/nsPop3IncomingServer.cpp @@ -302,3 +302,10 @@ nsPop3IncomingServer::GetDownloadMessagesAtStartup(PRBool *getMessagesAtStartup) return NS_OK; } +NS_IMETHODIMP +nsPop3IncomingServer::GetCanBeDefaultServer(PRBool *canBeDefaultServer) +{ + *canBeDefaultServer = PR_TRUE; + return NS_OK; +} + diff --git a/mozilla/mailnews/local/src/nsPop3IncomingServer.h b/mozilla/mailnews/local/src/nsPop3IncomingServer.h index a22dac3379e..98ae11c4a9f 100644 --- a/mozilla/mailnews/local/src/nsPop3IncomingServer.h +++ b/mozilla/mailnews/local/src/nsPop3IncomingServer.h @@ -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,