bug 77202. add option to download msgs on new pop account creation. r/sr=sspitzer.

This commit is contained in:
shliang%netscape.com 2003-04-16 06:41:51 +00:00
Родитель 6cc47df5b0
Коммит 4a2f45e005
5 изменённых файлов: 49 добавлений и 4 удалений

Просмотреть файл

@ -206,6 +206,16 @@ function FinishAccount() {
if (!serverIsNntp(pageData))
EnableCheckMailAtStartUpIfNeeded(gCurrentAccount);
if (!document.getElementById("downloadMsgs").hidden) {
if (document.getElementById("downloadMsgs").checked) {
window.opener.gNewAccountToLoad = gCurrentAccount; // load messages for new POP account
}
else if (gCurrentAccount == am.defaultAccount) {
// stop check for msgs when this is first account created from new profile
window.opener.gLoadStartFolder = false;
}
}
// in case we crash, force us a save of the prefs file NOW
try {
am.saveAccountInfo();
@ -225,7 +235,6 @@ function FinishAccount() {
}
}
// prepopulate pageData with stuff from accountData
// use: to prepopulate the wizard with account information
function AccountDataToPageData(accountData, pageData)

Просмотреть файл

@ -256,6 +256,10 @@ Rights Reserved.
</rows>
</grid>
<separator/>
<hbox id="downloadMsgsBox">
<checkbox id="downloadMsgs" label="&downloadOnLogin.label;" checked="true"/>
</hbox>
<spacer flex="1"/>
<description>&clickFinish.label;</description>
</vbox>
</wizardpage>

Просмотреть файл

@ -208,6 +208,8 @@ function msgOpenAccountWizard()
window.openDialog("chrome://messenger/content/AccountWizard.xul",
"AccountWizard", "chrome,modal,titlebar,resizable");
loadInboxForNewAccount();
//For the first account we need to reset the default smtp server in the panel.
var smtpService = Components.classes["@mozilla.org/messengercompose/smtp;1"].getService(Components.interfaces.nsISmtpService);
var serverCount = smtpService.smtpServers.Count();
@ -231,3 +233,19 @@ function MsgAccountManager(selectPage)
"AccountManager", "chrome,modal,titlebar,resizable",
{ server: server, selectPage: selectPage });
}
function loadInboxForNewAccount() {
// gNewAccountToLoad is set in the final screen of the Account Wizard if a POP account
// was created, the download messages box is checked, and the wizard was opened from the 3pane
if (gNewAccountToLoad) {
var rootMsgFolder = gNewAccountToLoad.incomingServer.rootMsgFolder;
var outNumFolders = new Object();
var inboxFolder = rootMsgFolder.getFoldersWithFlag(0x1000, 1, outNumFolders);
var selectedFolderResource = inboxFolder.QueryInterface(Components.interfaces.nsIRDFResource);
var selectedFolder = selectedFolderResource.QueryInterface(Components.interfaces.nsIFolder);
SelectFolder(selectedFolder.URI);
window.focus();
setTimeout(MsgGetMessage, 0);
gNewAccountToLoad = null;
}
}

Просмотреть файл

@ -124,6 +124,7 @@ function serverPageInit() {
// Set pop3 server type as default selection
var pop3RadioItem = document.getElementById("pop3");
serverTypeRadioGroup.selectedItem = pop3RadioItem;
setServerType();
}
}
@ -187,4 +188,14 @@ function setServerType()
var pageData = parent.GetPageData();
var serverType = (document.getElementById("servertype")).selectedItem.value;
setPageData(pageData, "server", "servertype", serverType);
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
// only show checkbox if (1) mail window is opener (2) this is a pop account and (3) we are online
var openedFromMail = (window.opener.location.href == "chrome://messenger/content/messenger.xul") ||
(window.opener.location.href == "chrome://messenger/content/mail3PaneWindowVertLayout.xul");
document.getElementById("downloadMsgs").hidden = (openedFromMail && serverType == "pop3" && !ioService.offline) ? false : true;
}

Просмотреть файл

@ -60,6 +60,8 @@ var gRightMouseButtonDown = false;
// This is used to make sure that the row with the currentIndex has the selection
// after a Delete or Move of a message that has a row index less than currentIndex.
var gThreadPaneCurrentSelectedIndex = -1;
var gLoadStartFolder = true;
var gNewAccountToLoad = null;
// Global var to keep track of if the 'Delete Message' or 'Move To' thread pane
// context menu item was triggered. This helps prevent the tree view from
@ -777,14 +779,15 @@ function loadStartFolder(initialUri)
var startFolder = startFolderResource.QueryInterface(Components.interfaces.nsIFolder);
SelectFolder(startFolder.URI);
// only do this on startup, when we pass in null
if (!initialUri && isLoginAtStartUpEnabled)
if (!initialUri && isLoginAtStartUpEnabled && gLoadStartFolder)
{
// Perform biff on the server to check for new mail, except for imap
if (defaultServer.type != "imap")
defaultServer.PerformBiff();
}
}
// because the "open" state persists, we'll call
// PerformExpand() for all servers that are open at startup.