1) add ui and backend support for "log into this account at startup".  all that is missing is the code to actually do the logging in at startup.  that comes next.

2) hide the user name for news servers in the account manager.

3) fix ui to allow users to edit the username and hostname for a server, but disable it until the back end can handle a live swap of those values.

sr=bienvenu
This commit is contained in:
sspitzer%netscape.com 2000-12-22 23:32:32 +00:00
Родитель 57b752def7
Коммит f4097c15ee
18 изменённых файлов: 108 добавлений и 84 удалений

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

@ -42,40 +42,30 @@ function initServerType() {
verboseName = stringBundle.GetStringFromName(propertyName);
var hostname = document.getElementById("server.hostName").getAttribute("value");
var username = document.getElementById("server.username").getAttribute("value");
setDivText("servertype.verbose", verboseName);
setDivText("servername.verbose", hostname);
setDivText("username.verbose", username);
}
function hideShowControls(serverType)
{
var controls = document.getElementsByAttribute("wsm_persist", "true");
var controls = document.getElementsByAttribute("hidable", "true");
var len = controls.length;
for (var i=0; i<len; i++) {
var control = controls[i];
var controlName = control.id;
if (!controlName) continue;
var controlNameSplit = controlName.split(".");
if (controlNameSplit.length < 2) continue;
var controlType = controlNameSplit[0];
// skip generic server/identity things
var hideFor = control.getAttribute("hidefor");
if ((!hideFor || hideFor == "") &&
(controlType == "server" ||
controlType == "identity")) continue;
if (!hideFor || hideFor == "") {
dump("this should not happen, things that are hidable should have hidefor set\n");
continue;
}
var box = getEnclosingContainer(control);
if (!box) continue;
if (!box) {
dump("this should not happen, things that are hidable should be in a box\n");
continue;
}
// hide unsupported server type
// adding support for hiding multiple server types using hideFor="server1,server2"
var hideForBool = false;
var hideForTokens = hideFor.split(",");
@ -86,20 +76,13 @@ function hideShowControls(serverType)
}
}
if ((controlType != "server" &&
controlType != "identity" &&
controlType != serverType) ||
hideForBool) {
if (hideForBool) {
box.setAttribute("hidden", "true");
}
else {
box.removeAttribute("hidden");
}
}
var serverPrefContainer = document.getElementById("serverPrefContainer");
if (serverPrefContainer)
serverPrefContainer.removeAttribute("hidden");
}

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

@ -14,8 +14,6 @@
<script src="chrome://global/content/strres.js"/>
<text hidden="true" wsm_persist="true" id="server.type"/>
<text hidden="true" wsm_persist="true" id="server.hostName"/>
<text hidden="true" wsm_persist="true" id="server.username"/>
<box class="box-smallheader" title="&serverSettings.label;"/>
@ -30,18 +28,25 @@
<text class="label" id="servertype.verbose"/>
</row>
<row autostretch="never">
<text class="label" value="&serverName.label;"/>
<text class="label" id="servername.verbose"/>
<text class="label" value="&serverName.label;"/>
<!-- when #14295 is fixed, remove disabled="true" -->
<textfield wsm_persist="true" disabled="true" size="25" id="server.hostName"/>
</row>
<row autostretch="never">
<text class="label" value="&userName.label;"/>
<text class="label" id="username.verbose"/>
<box iscontrolcontainer="true" autostretch="never">
<text hidable="true" hidefor="nntp" class="label" id="userNameLabel" value="&userName.label;"/>
</box>
<box iscontrolcontainer="true" autostretch="never">
<!-- when #14295 is fixed, remove disabled="true" -->
<textfield hidable="true" hidefor="nntp" wsm_persist="true" disabled="true" size="25" id="server.username"/>
</box>
</row>
<row autostretch="never">
<box>
<text class="label" value="&port.label;"/>
<textfield wsm_persist="true" size="4" id="server.port"/>
<spring flex="1"/>
<row>
<box autostretch="never">
<text class="label" value="&port.label;"/>
</box>
<box autostretch="never">
<textfield autostretch="never" wsm_persist="true" size="5" id="server.port"/>
</box>
</row>
</rows>
@ -51,11 +56,11 @@
<titledbox>
<title value="&serverSettings.label;"/>
<box id="serverPrefContainer" orient="vertical" flex="1">
<checkbox wsm_persist="true" id="server.isSecure" value="&isSecure.label;" hidefor="pop3" oncommand="secureSelect();"/>
<box orient="vertical" flex="1">
<checkbox iscontrolcontainer="true" hidable="true" wsm_persist="true" id="server.isSecure" value="&isSecure.label;" hidefor="pop3" oncommand="secureSelect();"/>
<checkbox iscontrolcontainer="true" hidable="true" wsm_persist="true" id="server.loginAtStartUp" hidefor="nntp" value="&loginAtStartup.label;"/>
<!--
<checkbox wsm_persist="true" id="server.rememberPassword" hidefor="nntp"
<checkbox iscontrolcontainer="true" hidable="true" wsm_persist="true" id="server.rememberPassword" hidefor="nntp"
value="&savePassword.label;"/>
-->
<box orient="horizontal" autostretch="never">
@ -63,16 +68,20 @@
<textfield wsm_persist="true" id="server.biffMinutes" size="3"/>
<text class="label" for="server.biffMinutes" value="&biffEnd.label;"/>
</box>
<checkbox style="margin-left: 2em" hidefor="imap,nntp"
<!-- POP3 -->
<box orient="vertical" iscontrolcontainer="true" autostretch="never">
<checkbox hidable="true" style="margin-left: 2em" hidefor="imap,nntp"
wsm_persist="true" id="server.downloadOnBiff"
value="&downloadOnBiff.label;"/>
<checkbox wsm_persist="true" id="pop3.leaveMessagesOnServer"
<checkbox wsm_persist="true" id="pop3.leaveMessagesOnServer"
value="&leaveOnServer.label;"/>
<checkbox wsm_persist="true" id="pop3.deleteMailLeftOnServer"
<checkbox wsm_persist="true" id="pop3.deleteMailLeftOnServer"
value="&deleteOnServer.label;"/>
</box>
<box iscontrolcontainer="true" autostretch="never">
<checkbox wsm_persist="true" value="&maxMessageSizePrefix.label;" id="pop3.limitMessageSize"/>
<checkbox hidable="true" hidefor="imap,nntp" wsm_persist="true" value="&maxMessageSizePrefix.label;" id="pop3.limitMessageSize"/>
<textfield wsm_persist="true" id="pop3.maxMessageSize" size="3"/>
<text value="&maxMessageSizePostfix.label;" for="pop3.limitMessageSize" class="label"/>
</box>
@ -80,7 +89,7 @@
<!-- IMAP -->
<box iscontrolcontainer="true" autostretch="never">
<text class="label" value="&deleteMessagePrefix.label;"/>
<menulist wsm_persist="true" id="imap.deleteModel">
<menulist hidable="true" hidefor="pop3,nntp" wsm_persist="true" id="imap.deleteModel">
<menupopup>
<menuitem data="1" value="&modelMoveToTrash.label;"/>
<menuitem data="0" value="&modelMarkDeleted.label;"/>
@ -91,10 +100,10 @@
</box>
<separator class="thin"/>
<checkbox wsm_persist="true" id="imap.cleanupInboxOnExit"
value="&expungeOnExit.label;"/>
<checkbox wsm_persist="true" id="server.emptyTrashOnExit" iscontrolcontainer="true"
value="&emptyTrashOnExit.label;" hidefor="nntp"/>
<checkbox hidable="true" hidefor="pop3,nntp" wsm_persist="true" id="imap.cleanupInboxOnExit"
value="&expungeOnExit.label;" iscontrolcontainer="true"/>
<checkbox hidable="true" hidefor="nntp" wsm_persist="true" id="server.emptyTrashOnExit"
value="&emptyTrashOnExit.label;" iscontrolcontainer="true"/>
<box iscontrolcontainer="true" flex="1">
<box flex="1">
@ -103,7 +112,7 @@
oncommand="openImapAdvanced(event);"/>
</box>
<checkbox hidden="true" wsm_persist="true" id="imap.dualUseFolders"/>
<checkbox hidable="true" hidefor="pop3,nntp" hidden="true" wsm_persist="true" id="imap.dualUseFolders"/>
<checkbox hidden="true" wsm_persist="true" id="imap.usingSubscription"/>
<text hidden="true" wsm_persist="true" id="imap.personalNamespace"/>
<text hidden="true" wsm_persist="true" id="imap.publicNamespace"/>
@ -112,9 +121,9 @@
<checkbox hidden="true" wsm_persist="true" id="imap.overrideNamespaces"/>
</box>
<!-- News -->
<box orient="horizontal">
<checkbox wsm_persist="true" id="nntp.notifyOn"
<!-- NNTP -->
<box iscontrolcontainer="true" orient="horizontal">
<checkbox hidable="true" hidefor="pop3,imap" wsm_persist="true" id="nntp.notifyOn"
value="&maxMessagesStart.label;"/>
<box iscontrolcontainer="true" autostretch="never">
<textfield wsm_persist="true" id="nntp.maxArticles" size="6"/>
@ -126,7 +135,7 @@
<titledbox orient="vertical">
<title><text class="header label" value="&abbreviate.label;"/></title>
<radiogroup orient="vertical" wsm_persist="true" id="nntp.abbreviate">
<radiogroup hidable="true" hidefor="pop3,imap" orient="vertical" wsm_persist="true" id="nntp.abbreviate">
<radio group="nntp.abbreviate" wsm_persist="true" data="true" value="&abbreviateOn.label;"/>
<radio group="nntp.abbreviate" wsm_persist="true" data="false" value="&abbreviateOff.label;"/>
</radiogroup>
@ -136,7 +145,7 @@
<box orient="vertical" iscontrolcontainer="true">
<text class="label" value="&newsrcFilePath.label;" for="nntp.newsrcFilePath"/>
<textfield wsm_persist="true" id="nntp.newsrcFilePath"
<textfield hidable="true" hidefor="imap,pop3" wsm_persist="true" id="nntp.newsrcFilePath"
datatype="nsIFileSpec"/>
</box>
</box>

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

@ -34,6 +34,7 @@
<!-- LOCALIZATION NOTE (expungeOnExit.label) : do not translate two of "&quot;" in below line -->
<!ENTITY expungeOnExit.label "Clean up (&quot;Expunge&quot;) Inbox on Exit">
<!ENTITY emptyTrashOnExit.label "Empty Trash on Exit">
<!ENTITY loginAtStartup.label "Log into this account 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

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

@ -189,6 +189,7 @@ interface nsIMsgIncomingServer : nsISupports {
*/
attribute boolean canDelete;
attribute boolean loginAtStartUp;
};
%{C++

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

@ -63,6 +63,11 @@ interface nsIMsgProtocolInfo : nsISupports
*/
readonly attribute boolean canDelete;
/**
* can this type of server log in at startup?
*/
readonly attribute boolean canLoginAtStartUp;
/**
* can you duplicate this server?
* for instance, local mail is unique and should not be duplicated.

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

@ -158,10 +158,6 @@ function SubscribeOnLoad()
// look in arguments[0] for parameters
if (window.arguments && window.arguments[0]) {
if ( window.arguments[0].title ) {
top.window.title = window.arguments[0].title;
}
if ( window.arguments[0].okCallback ) {
top.okCallback = window.arguments[0].okCallback;
}

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

@ -32,8 +32,8 @@
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
nsMsgRDFDataSource::nsMsgRDFDataSource():
mInitialized(PR_FALSE),
m_shuttingDown(PR_FALSE),
mInitialized(PR_FALSE),
mRDFService(nsnull)
{
NS_INIT_REFCNT();

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

@ -68,10 +68,10 @@ MOZ_DECL_CTOR_COUNTER(nsMsgIncomingServer);
nsMsgIncomingServer::nsMsgIncomingServer():
m_prefs(0),
m_serverBusy(PR_FALSE),
m_rootFolder(0)
{
NS_INIT_REFCNT();
m_serverBusy = PR_FALSE;
}
nsMsgIncomingServer::~nsMsgIncomingServer()
@ -175,7 +175,6 @@ nsMsgIncomingServer::CloseCachedConnections()
return NS_OK;
}
// construct <localStoreType>://[<username>@]<hostname
NS_IMETHODIMP
nsMsgIncomingServer::GetServerURI(char* *aResult)
@ -802,7 +801,7 @@ nsMsgIncomingServer::SetRememberPassword(PRBool value)
ForgetPassword();
}
else {
StorePassword();
StorePassword();
}
return SetBoolValue("remember_password", value);
}
@ -1054,18 +1053,6 @@ nsMsgIncomingServer::getProtocolInfo(nsIMsgProtocolInfo **aResult)
return NS_OK;
}
NS_IMETHODIMP nsMsgIncomingServer::GetCanDelete(PRBool* value)
{
NS_ENSURE_ARG_POINTER(value);
return GetBoolValue("canDelete", value);
}
NS_IMETHODIMP nsMsgIncomingServer::SetCanDelete(PRBool value)
{
return SetBoolValue("canDelete", value);
}
// use the convenience macros to implement the accessors
NS_IMPL_SERVERPREF_STR(nsMsgIncomingServer, Username, "userName");
NS_IMPL_SERVERPREF_STR(nsMsgIncomingServer, PrefPassword, "password");
@ -1081,4 +1068,5 @@ NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, Valid, "valid");
NS_IMPL_SERVERPREF_STR(nsMsgIncomingServer, RedirectorType, "redirector_type");
NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, EmptyTrashOnExit,
"empty_trash_on_exit");
NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, CanDelete, "canDelete");
NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, LoginAtStartUp, "login_at_startup");

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

@ -61,7 +61,7 @@ public:
NS_IMETHOD PerformBiff();
NS_IMETHOD PerformExpand(nsIMsgWindow *aMsgWindow);
NS_IMETHOD CloseCachedConnections();
NS_IMETHOD GetConstructedPrettyName(PRUnichar **retval);
NS_IMETHOD GetConstructedPrettyName(PRUnichar **retval);
protected:
nsresult GetFolder(const char* name, nsIMsgFolder** pFolder);

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

@ -3049,6 +3049,14 @@ nsImapService::GetPreflightPrettyNameWithEmailAddress(PRBool *aPreflightPrettyNa
return NS_OK;
}
NS_IMETHODIMP
nsImapService::GetCanLoginAtStartUp(PRBool *aCanLoginAtStartUp)
{
NS_ENSURE_ARG_POINTER(aCanLoginAtStartUp);
*aCanLoginAtStartUp = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
nsImapService::GetCanDelete(PRBool *aCanDelete)
{

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

@ -584,6 +584,14 @@ nsMovemailService::GetPreflightPrettyNameWithEmailAddress(PRBool *aPreflightPret
return NS_OK;
}
NS_IMETHODIMP
nsMovemailService::GetCanLoginAtStartUp(PRBool *aCanLoginAtStartUp)
{
NS_ENSURE_ARG_POINTER(aCanLoginAtStartUp);
*aCanLoginAtStartUp = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsMovemailService::GetCanDelete(PRBool *aCanDelete)
{

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

@ -139,6 +139,14 @@ nsNoneService::GetPreflightPrettyNameWithEmailAddress(PRBool *aPreflightPrettyNa
return NS_OK;
}
NS_IMETHODIMP
nsNoneService::GetCanLoginAtStartUp(PRBool *aCanLoginAtStartUp)
{
NS_ENSURE_ARG_POINTER(aCanLoginAtStartUp);
*aCanLoginAtStartUp = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsNoneService::GetCanDelete(PRBool *aCanDelete)
{

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

@ -289,12 +289,11 @@ NS_IMETHODIMP nsPop3IncomingServer::CreateDefaultMailboxes(nsIFileSpec *path)
NS_IMETHODIMP nsPop3IncomingServer::GetNewMail(nsIMsgWindow *aMsgWindow, nsIUrlListener *aUrlListener, nsIMsgFolder *inbox, nsIURI **aResult)
{
//GGGG
nsresult rv;
NS_WITH_SERVICE(nsIPop3Service, pop3Service, kCPop3ServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
NS_ENSURE_SUCCESS(rv,rv);
rv = pop3Service->GetNewMail(aMsgWindow, aUrlListener, inbox, this, aResult);
rv = pop3Service->GetNewMail(aMsgWindow, aUrlListener, inbox, this, aResult);
return rv;
}

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

@ -505,6 +505,14 @@ nsPop3Service::GetPreflightPrettyNameWithEmailAddress(PRBool *aPreflightPrettyNa
return NS_OK;
}
NS_IMETHODIMP
nsPop3Service::GetCanLoginAtStartUp(PRBool *aCanLoginAtStartUp)
{
NS_ENSURE_ARG_POINTER(aCanLoginAtStartUp);
*aCanLoginAtStartUp = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
nsPop3Service::GetCanDelete(PRBool *aCanDelete)
{

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

@ -410,6 +410,7 @@ pref("mail.server.default.empty_trash_on_exit", false);
pref("mail.server.default.using_subscription", true);
pref("mail.server.default.dual_use_folders", true);
pref("mail.server.default.canDelete", false);
pref("mail.server.default.login_at_startup", true);
pref("mail.smtpserver.default.auth_method", 2); // auth login

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

@ -1369,6 +1369,14 @@ nsNntpService::GetPreflightPrettyNameWithEmailAddress(PRBool *aPreflightPrettyNa
return NS_OK;
}
NS_IMETHODIMP
nsNntpService::GetCanLoginAtStartUp(PRBool *aCanLoginAtStartUp)
{
NS_ENSURE_ARG_POINTER(aCanLoginAtStartUp);
*aCanLoginAtStartUp = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsNntpService::GetCanDelete(PRBool *aCanDelete)
{

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

@ -410,6 +410,7 @@ pref("mail.server.default.empty_trash_on_exit", false);
pref("mail.server.default.using_subscription", true);
pref("mail.server.default.dual_use_folders", true);
pref("mail.server.default.canDelete", false);
pref("mail.server.default.login_at_startup", true);
pref("mail.smtpserver.default.auth_method", 2); // auth login