Fixing bug 48092. Enabling the ability to change the port value automatically depending on the state of secure checkbox option. r=sspitzer, sr=mscott

This commit is contained in:
racham%netscape.com 2000-12-09 03:03:58 +00:00
Родитель 03266140d5
Коммит 9c8dd187c0
9 изменённых файлов: 55 добавлений и 15 удалений

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

@ -176,3 +176,15 @@ function getEnclosingContainer(startNode) {
return box;
}
function secureSelect() {
var serverType = document.getElementById("server.type").getAttribute("value");
var protocolInfo = Components.classes["@mozilla.org/messenger/protocol/info;1?type=" + serverType].getService(Components.interfaces.nsIMsgProtocolInfo);
// If the secure option is checked, protocolInfo returns a secure port value
// for the corresponding protocol. Otherwise, a default value is returned.
if (document.getElementById("server.isSecure").checked)
document.getElementById("server.port").value = protocolInfo.getDefaultServerPort(true);
else
document.getElementById("server.port").value = protocolInfo.getDefaultServerPort(false);
}

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

@ -38,18 +38,22 @@
<text class="label" id="username.verbose"/>
</row>
<row autostretch="never">
<text class="label" value="&port.label;"/>
<textfield wsm_persist="true" size="3" id="server.port"/>
<box>
<text class="label" value="&port.label;"/>
<textfield wsm_persist="true" size="4" id="server.port"/>
<spring flex="1"/>
</box>
</row>
</rows>
</grid>
<spring class="spacer"/>
<titledbox>
<title value="&serverSettings.label;"/>
<box id="serverPrefContainer" orient="vertical" flex="1">
<checkbox wsm_persist="true" id="server.isSecure" value="&isSecure.label;" hidefor="pop3"/>
<checkbox wsm_persist="true" id="server.isSecure" value="&isSecure.label;" hidefor="pop3" oncommand="secureSelect();"/>
<!--
<checkbox wsm_persist="true" id="server.rememberPassword" hidefor="nntp"
value="&savePassword.label;"/>

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

@ -77,7 +77,10 @@ interface nsIMsgProtocolInfo : nsISupports
/* the default port
This is similar to nsIProtocolHanderl.defaultPort,
but for architectural reasons, there is a mail-specific interface to this */
readonly attribute long defaultServerPort;
but for architectural reasons, there is a mail-specific interface to this.
When the input param isSecure is set to true, for all supported protocols,
the secure port value is returned. If isSecure is set to false the default
port value is returned */
long getDefaultServerPort(in boolean isSecure);
};

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

@ -1005,7 +1005,9 @@ nsMsgIncomingServer::GetPort(PRInt32 *aPort)
rv = getProtocolInfo(getter_AddRefs(protocolInfo));
NS_ENSURE_SUCCESS(rv, rv);
return protocolInfo->GetDefaultServerPort(aPort);
// First param is set to FALSE so that the non-secure
// default port is returned
return protocolInfo->GetDefaultServerPort(PR_FALSE, aPort);
}
NS_IMETHODIMP
@ -1018,7 +1020,9 @@ nsMsgIncomingServer::SetPort(PRInt32 aPort)
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 defaultPort;
rv = protocolInfo->GetDefaultServerPort(&defaultPort);
// First param is set to FALSE so that the non-secure
// default port is returned
rv = protocolInfo->GetDefaultServerPort(PR_FALSE, &defaultPort);
if (NS_SUCCEEDED(rv) && aPort == defaultPort)
// clear it out by setting it to the default
rv = SetIntValue("port", PORT_NOT_SET);

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

@ -2790,13 +2790,22 @@ NS_IMETHODIMP nsImapService::GetDefaultPort(PRInt32 *aDefaultPort)
{
NS_ENSURE_ARG_POINTER(aDefaultPort);
*aDefaultPort = IMAP_PORT;
return NS_OK;
return NS_OK;
}
NS_IMETHODIMP
nsImapService::GetDefaultServerPort(PRInt32 *aDefaultPort)
nsImapService::GetDefaultServerPort(PRBool isSecure, PRInt32 *aDefaultPort)
{
return GetDefaultPort(aDefaultPort);
nsresult rv = NS_OK;
// Return Secure IMAP Port if secure option chosen i.e., if isSecure is TRUE
if (isSecure)
*aDefaultPort = SECURE_IMAP_PORT;
else
rv = GetDefaultPort(aDefaultPort);
return rv;
}
NS_IMETHODIMP nsImapService::NewURI(const char *aSpec, nsIURI *aBaseURI, nsIURI **_retval)

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

@ -612,7 +612,7 @@ nsMovemailService::GetDefaultCopiesAndFoldersPrefsToServer(PRBool *aDefaultCopie
}
NS_IMETHODIMP
nsMovemailService::GetDefaultServerPort(PRInt32 *aDefaultPort)
nsMovemailService::GetDefaultServerPort(PRBool isSecure, PRInt32 *aDefaultPort)
{
NS_ASSERTION(0, "This should probably never be called!");
NS_ENSURE_ARG_POINTER(aDefaultPort);

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

@ -167,7 +167,7 @@ nsNoneService::GetDefaultCopiesAndFoldersPrefsToServer(PRBool *aDefaultCopiesAnd
}
NS_IMETHODIMP
nsNoneService::GetDefaultServerPort(PRInt32 *aDefaultPort)
nsNoneService::GetDefaultServerPort(PRBool isSecure, PRInt32 *aDefaultPort)
{
NS_ASSERTION(0, "This should probably never be called!");
NS_ENSURE_ARG_POINTER(aDefaultPort);

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

@ -522,7 +522,7 @@ nsPop3Service::GetCanDuplicate(PRBool *aCanDuplicate)
}
NS_IMETHODIMP
nsPop3Service::GetDefaultServerPort(PRInt32 *aPort)
nsPop3Service::GetDefaultServerPort(PRBool isSecure, PRInt32 *aPort)
{
return GetDefaultPort(aPort);
}

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

@ -1202,9 +1202,17 @@ NS_IMETHODIMP nsNntpService::GetDefaultPort(PRInt32 *aDefaultPort)
}
NS_IMETHODIMP
nsNntpService::GetDefaultServerPort(PRInt32 *aDefaultPort)
nsNntpService::GetDefaultServerPort(PRBool isSecure, PRInt32 *aDefaultPort)
{
return GetDefaultPort(aDefaultPort);
nsresult rv = NS_OK;
// Return Secure NNTP Port if secure option chosen i.e., if isSecure is TRUE
if (isSecure)
*aDefaultPort = SECURE_NEWS_PORT;
else
rv = GetDefaultPort(aDefaultPort);
return rv;
}
NS_IMETHODIMP nsNntpService::NewURI(const char *aSpec, nsIURI *aBaseURI, nsIURI **_retval)