Bug #202468 --> New SMTP Account Settings UI.

Make it easier to manage multiple SMTP servers.
Add the ability to set unique smtp servers for each identity associated with an account.

r=neil
sr=bienvenu
This commit is contained in:
scott%scott-macgregor.org 2005-03-03 18:08:47 +00:00
parent c0bff6d43b
commit ba82559445
34 changed files with 630 additions and 699 deletions

View File

@ -61,3 +61,19 @@
treechildren::-moz-tree-cell-text(isDefaultServer-true) {
font-weight: bold;
}
/* ::::: SMTP Server Panel :::::: */
.smtpServerListItem {
padding-left: 3px;
}
#backgroundBox {
background-color: #FFFFFF;
opacity: 0.5;
}
#smtpServerInfoBox textbox {
background-color: transparent;
}

View File

@ -184,9 +184,7 @@ function disableEditableFields()
gMsgCompose.editor.flags |= nsIPlaintextEditorMail.eEditorReadonlyMask;
var disableElements = document.getElementsByAttribute("disableonsend", "true");
for (i=0;i<disableElements.length;i++)
{
disableElements[i].setAttribute('disabled', 'true');
}
}
function enableEditableFields()

View File

@ -1,11 +0,0 @@
<!ENTITY smtpListTitle.label "Advanced Outgoing Server (SMTP) Settings">
<!ENTITY smtpListDesc.label "Although you can specify more than one outgoing server (SMTP), this is recommended only for advanced users. Setting up multiple SMTP servers can cause errors when sending messages.">
<!ENTITY smtpListAdd.label "Add...">
<!ENTITY smtpListAdd.accesskey "A">
<!ENTITY smtpListEdit.label "Edit...">
<!ENTITY smtpListEdit.accesskey "E">
<!ENTITY smtpListDelete.label "Delete">
<!ENTITY smtpListDelete.accesskey "D">
<!ENTITY smtpListSetDefault.label "Set Default">
<!ENTITY smtpListSetDefault.accesskey "f">

View File

@ -2,8 +2,21 @@
<!-- LOCALIZATION NOTE (smtpServer.label): do not translate "SMTP" in below line -->
<!ENTITY smtpServer.label "Outgoing Server (SMTP) Settings">
<!-- LOCALIZATION NOTE (smtpDesc.label): do not translate "SMTP" in below line -->
<!ENTITY smtpDesc.label "Only one outgoing server (SMTP) needs to be specified, even if you have several mail accounts. Enter the name of the server for outgoing messages.">
<!ENTITY advanced.label "Advanced...">
<!ENTITY advanced.accesskey "v">
<!-- LOCALIZATION NOTE (smtpDesc.label): do not translate "SMTP" in below line -->
<!ENTITY smtpDesc.label "Although you can specify more than one outgoing server (SMTP), this is only recommended for advanced users. Setting up multiple SMTP servers can cause errors when sending messages.">
<!ENTITY smtpListAdd.label "Add...">
<!ENTITY smtpListAdd.accesskey "d">
<!ENTITY smtpListEdit.label "Edit...">
<!ENTITY smtpListEdit.accesskey "E">
<!ENTITY smtpListDelete.label "Remove">
<!ENTITY smtpListDelete.accesskey "m">
<!ENTITY smtpListSetDefault.label "Set Default">
<!ENTITY smtpListSetDefault.accesskey "t">
<!ENTITY serverDescription.label "Description: ">
<!ENTITY serverName.label "Server Name: ">
<!ENTITY serverPort.label "Port: ">
<!ENTITY userName.label "User Name: ">
<!ENTITY useSecureConnection.label "Secure Connection: ">

View File

@ -1,7 +1,6 @@
<!-- extracted from am-main.xul -->
<!ENTITY accountTitle.label "Account Settings">
<!ENTITY accountSettingsDesc.label "The following information is needed before you can send messages. If you do not know the information requested, please contact your system administrator or Internet Service Provider.">
<!ENTITY accountName.label "Account Name:">
<!ENTITY accountName.accesskey "N">
<!ENTITY accountNameDesc.label "The account name is used to identify each account">
@ -28,3 +27,8 @@
<!ENTITY manageIdentities.label "Manage Identities...">
<!ENTITY manageIdentities.accesskey "M">
<!-- LOCALIZATION NOTE (smtpName.label) : do not translate "SMTP" in below line -->
<!ENTITY smtpName.label "Outgoing Server (SMTP):">
<!ENTITY smtpName.accesskey "u">
<!ENTITY smtpDefaultServer.label "Use Default Server">

View File

@ -1,9 +1,4 @@
<!ENTITY serverAdvanced.label "Advanced Account Settings">
<!-- LOCALIZATION NOTE (smtpDesc.label): DONT_TRANSLATE "SMTP" -->
<!ENTITY smtpDesc.label "When sending messages from this identity, always use the following outgoing server (SMTP):">
<!ENTITY smtpName.label "Server:">
<!ENTITY smtpName.accesskey "S">
<!ENTITY smtpDefaultServer.label "Always use default server">
<!-- LOCALIZATION NOTE (serverDirectory.label): DONT_TRANSLATE "IMAP" -->
<!ENTITY imapAdvanced.label "Advanced IMAP Server Settings">
<!ENTITY serverDirectory.label "IMAP server directory:">

View File

@ -110,6 +110,15 @@ filterFolderTruncateFailed=There was an error truncating the Inbox after filteri
defaultServerTag=(Default)
useDefaultServer=Use default server
# Used in the SMTP Account Settings panel when a server value has no properties
smtpServerList-NotSpecified=<not specified>
smtpServer-SecureConnection-Type-0=None
smtpServer-SecureConnection-Type-1=TLS (if available)
smtpServer-SecureConnection-Type-2=TLS
smtpServer-SecureConnection-Type-3=SSL
smtpServers-confirmServerDeletionTitle=Delete Server
smtpServers-confirmServerDeletion=Are you sure you want to delete the server: \n %S?
# LOCALIZATION NOTES(serverType-nntp): Do not translate "NNTP" in the line below
serverType-nntp=News Server (NNTP)
# LOCALIZATION NOTES(serverType-pop3): Do not translate "POP" in the line below

View File

@ -1,5 +1,9 @@
<!ENTITY settings.caption "Settings">
<!ENTITY security.caption "Security and Authentication">
<!ENTITY serverName.label "Server Name:">
<!ENTITY serverName.accesskey "S">
<!ENTITY serverDescription.label "Description:">
<!ENTITY serverDescription.accesskey "D">
<!ENTITY serverPort.label "Port:">
<!ENTITY serverPort.accesskey "P">
<!ENTITY alwaysUseUsername.label "Use name and password">

View File

@ -40,7 +40,6 @@
locale/@AB_CD@/messenger/am-identity-edit.dtd (@AB_CD@/chrome/messenger/am-identity-edit.dtd)
locale/@AB_CD@/messenger/prefs.properties (@AB_CD@/chrome/messenger/prefs.properties)
locale/@AB_CD@/messenger/am-serverwithnoidentities.dtd (@AB_CD@/chrome/messenger/am-serverwithnoidentities.dtd)
locale/@AB_CD@/messenger/SmtpServerList.dtd (@AB_CD@/chrome/messenger/SmtpServerList.dtd)
locale/@AB_CD@/messenger/smtpEditOverlay.dtd (@AB_CD@/chrome/messenger/smtpEditOverlay.dtd)
locale/@AB_CD@/messenger/pref-advanced.dtd (@AB_CD@/chrome/messenger/pref-advanced.dtd)
locale/@AB_CD@/messenger/pref-masterpass.dtd (@AB_CD@/chrome/messenger/pref-masterpass.dtd)

View File

@ -1,249 +0,0 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alec Flett <alecf@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var smtpService;
var serverList; // the root <listbox> node
var addButton;
var editButton;
var deleteButton;
var setDefaultButton;
var gMessengerBundle;
var hasEdited=false; // whether any kind of edits have occured
var gOldDefaultSmtpServer;
var gAddedSmtpServers = new Array;
var gDeletedSmtpServers = new Array;
// event handlersn
function onLoad()
{
gMessengerBundle = document.getElementById("bundle_messenger");
if (!smtpService)
smtpService = Components.classes["@mozilla.org/messengercompose/smtp;1"].getService(Components.interfaces.nsISmtpService);
serverList = document.getElementById("smtpList");
addButton = document.getElementById("addButton");
editButton = document.getElementById("editButton");
deleteButton = document.getElementById("deleteButton");
setDefaultButton = document.getElementById("setDefaultButton");
gOldDefaultSmtpServer = smtpService.defaultServer;
refreshServerList();
}
function onSelectionChange(event)
{
updateButtons();
}
function onDelete(event)
{
var server = getSelectedServer();
if (!server) return;
// Instead of deleting the server we store the key in the array and delete it later only if the
// window is not cancelled.
gDeletedSmtpServers[gDeletedSmtpServers.length] = server.key;
refreshServerList();
}
function onAdd(event)
{
openServerEditor(null);
}
function onEdit(event)
{
if (serverList.selectedItems.length <= 0) return;
var server = getSelectedServer();
openServerEditor(server);
}
function onSetDefault(event)
{
if (serverList.selectedItems.length <= 0) return;
smtpService.defaultServer = getSelectedServer();
refreshServerList();
}
function onOk()
{
window.arguments[0].result = true;
window.opener.onExitAdvancedDialog(gDeletedSmtpServers,true);
return true;
}
function onCancel()
{
window.arguments[0].result = false;
// there might not be an old one. see bug #176056
if (gOldDefaultSmtpServer)
smtpService.defaultServer = gOldDefaultSmtpServer;
window.opener.onExitAdvancedDialog(gAddedSmtpServers,false);
return true;
}
function updateButtons()
{
if (serverList.selectedItems.length <= 0) {
editButton.setAttribute("disabled", "true");
deleteButton.setAttribute("disabled", "true");
setDefaultButton.setAttribute("disabled", "true");
} else {
editButton.removeAttribute("disabled");
// can't delete default server
var server = getSelectedServer();
if (smtpService.defaultServer == server) {
dump("Selected default server!\n");
setDefaultButton.setAttribute("disabled", "true");
deleteButton.setAttribute("disabled", "true");
}
else {
setDefaultButton.removeAttribute("disabled");
deleteButton.removeAttribute("disabled");
}
}
}
function refreshServerList()
{
// save selection
var oldSelectedIds = new Array;
serverList.clearSelection();
var selectedItems = serverList.selectedItems;
for (var i=0; i< selectedItems.length; i++)
oldSelectedIds[i] = selectedItems[0].id;
// remove all children
while (serverList.hasChildNodes())
serverList.removeChild(serverList.lastChild);
var defaultServer = smtpService.defaultServer;
fillSmtpServers(serverList, smtpService.smtpServers, defaultServer);
// restore selection
for (i = 0; i < oldSelectedIds.length; ++i) {
var element = document.getElementById(oldSelectedIds[i]);
if (element)
serverList.selectItem(element);
}
}
// helper functions
function fillSmtpServers(listbox, servers, defaultServer)
{
if (!listbox) return;
if (!servers) return;
var serverCount = servers.Count();
for (var i=0 ; i<serverCount; i++) {
var server = servers.QueryElementAt(i, Components.interfaces.nsISmtpServer);
var isDefault = (defaultServer.key == server.key);
//ToDoList: add code that allows for the redirector type to specify whether to show values or not
if (!server.redirectorType && !deletedServer(server.key))
{
var listitem = createSmtpListItem(server, isDefault);
listbox.appendChild(listitem);
}
}
}
function createSmtpListItem(server, isDefault)
{
var listitem = document.createElement("listitem");
var hostname = server.hostname;
if (server.port) {
hostname = hostname + ":" + server.port;
}
if (isDefault)
hostname += " " + gMessengerBundle.getString("defaultServerTag");
listitem.setAttribute("label", hostname);
listitem.setAttribute("key", server.key);
// give it some unique id
listitem.id = "smtpServer." + server.key;
return listitem;
}
function deletedServer(serverkey)
{
for (var index in gDeletedSmtpServers) {
if (serverkey == gDeletedSmtpServers[index])
return true;
}
return false;
}
function openServerEditor(serverarg)
{
var args = {server: serverarg,
result: false,
addSmtpServer: ""};
window.openDialog("chrome://messenger/content/SmtpServerEdit.xul",
"smtpEdit", "chrome,titlebar,modal", args);
if (args.result) {
if (args.addSmtpServer)
gAddedSmtpServers[gAddedSmtpServers.length] = args.addSmtpServer;
refreshServerList();
hasEdited = true;
}
return args.result;
}
function getSelectedServer()
{
var serverKey = serverList.selectedItems[0].getAttribute("key");
var server = smtpService.getServerByKey(serverKey);
return server;
}

View File

@ -1,79 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
<!-- ***** BEGIN LICENSE BLOCK *****
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is
Netscape Communications Corporation.
Portions created by the Initial Developer are Copyright (C) 1998-1999
the Initial Developer. All Rights Reserved.
Contributor(s):
Alec Flett <alecf@netscape.com>
Alternatively, the contents of this file may be used under the terms of
either of the GNU General Public License Version 2 or later (the "GPL"),
or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
***** END LICENSE BLOCK ***** -->
<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/SmtpServerList.dtd">
<dialog title="&smtpListTitle.label;"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="onLoad();"
ondialogaccept="return onOk();"
ondialogcancel="return onCancel();"
style="width: 30em;">
<stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
<script type="application/x-javascript" src="SmtpServerList.js"/>
<description flex="1">&smtpListDesc.label;</description>
<separator class="thin"/>
<hbox>
<listbox id="smtpList" onselect="onSelectionChange(event);" flex="1" style="height: 0px;"/>
<vbox>
<button id="addButton"
oncommand="onAdd(event);" label="&smtpListAdd.label;"
accesskey="&smtpListAdd.accesskey;"/>
<button id="editButton" disabled="true"
oncommand="onEdit(event);" label="&smtpListEdit.label;"
accesskey="&smtpListEdit.accesskey;"/>
<button id="deleteButton" disabled="true"
oncommand="onDelete(event);" label="&smtpListDelete.label;"
accesskey="&smtpListDelete.accesskey;"/>
<button id="setDefaultButton" disabled="true"
oncommand="onSetDefault(event);" label="&smtpListSetDefault.label;"
accesskey="&smtpListSetDefault.accesskey;"/>
</vbox>
</hbox>
</dialog>

View File

@ -95,7 +95,7 @@ function openIdentityEditor(identity)
var result = false;
var args = { identity: identity, account: gAccount, result: result };
window.openDialog('am-identity-edit.xul', 'identity-edit', 'modal,titlebar,chrome', args);
window.openDialog('am-identity-edit.xul', '', 'modal,titlebar,chrome', args);
var selectedItemIndex = gIdentityListBox.selectedIndex;

View File

@ -50,6 +50,11 @@ function onLoadIdentityProperties()
initIdentityValues(gIdentity);
initCopiesAndFolder(gIdentity);
initCompositionAndAddressing(gIdentity);
loadSMTPServerList();
// the multiple identities editor isn't an account wizard panel so we have to do this ourselves:
document.getElementById('identity.smtpServerKey').value = gIdentity ? gIdentity.smtpServerKey
: gAccount.defaultIdentity.smtpServerKey;
}
// based on the values of gIdentity, initialize the identity fields we expose to the user
@ -182,6 +187,7 @@ function saveIdentitySettings(identity)
identity.attachVCard = document.getElementById('identity.attachVCard').checked;
identity.escapedVCard = document.getElementById('identity.escapedVCard').value;
identity.smtpServerKey = document.getElementById('identity.smtpServerKey').value;
var attachSignaturePath = document.getElementById('identity.signature').value;
if (attachSignaturePath)
@ -318,3 +324,38 @@ function getAccountForFolderPickerState()
{
return gAccount;
}
// when the identity panel is loaded, the smpt-list is created
// and the in prefs.js configured smtp is activated
function loadSMTPServerList()
{
var smtpService = Components.classes["@mozilla.org/messengercompose/smtp;1"].getService(Components.interfaces.nsISmtpService);
fillSmtpServers(document.getElementById('identity.smtpServerKey'), smtpService.smtpServers, smtpService.defaultServer);
}
function fillSmtpServers(smtpServerList, servers, defaultServer)
{
if (!smtpServerList || !servers)
return;
var serverCount = servers.Count();
for (var i = 0; i < serverCount; i++)
{
var server = servers.QueryElementAt(i, Components.interfaces.nsISmtpServer);
//ToDoList: add code that allows for the redirector type to specify whether to show values or not
if (!server.redirectorType)
{
var serverName = "";
if (server.description)
serverName = server.description + ' - ';
else if (server.username)
serverName = server.username + ' - ';
serverName += server.hostname;
if (defaultServer.key == server.key)
serverName += " " + document.getElementById("bundle_messenger").getString("defaultServerTag");
smtpServerList.appendItem(serverName, server.key);
}
}
}

View File

@ -58,6 +58,8 @@
<stringbundle id="bundle_prefutilities" src="chrome://communicator/locale/pref/prefutilities.properties"/>
<stringbundle id="bundle_prefs" src="chrome://messenger/locale/prefs.properties"/>
<stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
<script type="application/x-javascript" src="chrome://messenger/content/am-prefs.js"/>
<script type="application/x-javascript" src="am-identity-edit.js"/>
<script type="application/x-javascript">
@ -85,56 +87,69 @@
<!-- Identity Settings Tab -->
<vbox flex="1" name="settings">
<grid>
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row align="center">
<label value="&name.label;" control="identity.fullName" accesskey="&name.accesskey;"/>
<textbox id="identity.fullName" size="30"/>
</row>
<row align="center">
<label value="&email.label;" control="identity.email" accesskey="&email.accesskey;"/>
<textbox id="identity.email" class="uri-element"/>
</row>
<row align="center">
<label value="&replyTo.label;" control="identity.replyTo" accesskey="&replyTo.accesskey;"/>
<textbox id="identity.replyTo" class="uri-element"/>
</row>
<row align="center">
<label value="&organization.label;" control="identity.organization" accesskey="&organization.accesskey;"/>
<textbox id="identity.organization"/>
</row>
</rows>
</grid>
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row align="center">
<label value="&name.label;" control="identity.fullName" accesskey="&name.accesskey;"/>
<textbox id="identity.fullName" size="30"/>
</row>
<row align="center">
<label value="&email.label;" control="identity.email" accesskey="&email.accesskey;"/>
<textbox id="identity.email" class="uri-element"/>
</row>
<row align="center">
<label value="&replyTo.label;" control="identity.replyTo" accesskey="&replyTo.accesskey;"/>
<textbox id="identity.replyTo" class="uri-element"/>
</row>
<row align="center">
<label value="&organization.label;" control="identity.organization" accesskey="&organization.accesskey;"/>
<textbox id="identity.organization"/>
</row>
</rows>
</grid>
<separator class="thin"/>
<separator class="thin"/>
<hbox align="center">
<checkbox id="identity.attachSignature" label="&signature.label;" flex="1"
accesskey="&signature.accesskey;"
oncommand="setupSignatureItems();"/>
</hbox>
<hbox align="center">
<checkbox id="identity.attachSignature" label="&signature.label;" flex="1"
accesskey="&signature.accesskey;"
oncommand="setupSignatureItems();"/>
</hbox>
<hbox align="center" class="indent">
<textbox id="identity.signature" datatype="nsILocalFile" flex="1" name="identity.signature"
observes="broadcaster_attachSignature" class="uri-element"/>
<button class="push" name="browse" label="&choose.label;"
accesskey="&choose.accesskey;"
oncommand="selectFile()"
observes="broadcaster_attachSignature"
id="identity.sigbrowsebutton"/>
</hbox>
<hbox align="center" class="indent">
<textbox id="identity.signature" datatype="nsILocalFile" flex="1" name="identity.signature"
observes="broadcaster_attachSignature" class="uri-element"/>
<button class="push" name="browse" label="&choose.label;"
accesskey="&choose.accesskey;"
oncommand="selectFile()"
observes="broadcaster_attachSignature"
id="identity.sigbrowsebutton"/>
</hbox>
<hbox align="center">
<checkbox id="identity.attachVCard" label="&attachVCard.label;" flex="1"
accesskey="&attachVCard.accesskey;"/>
<button class="push" name="editVCard" label="&editVCard.label;"
accesskey="&editVCard.accesskey;"
oncommand="editVCard()"/>
<label hidden="true" id="identity.escapedVCard"/>
</hbox>
<hbox align="center">
<checkbox id="identity.attachVCard" label="&attachVCard.label;" flex="1"
accesskey="&attachVCard.accesskey;"/>
<button class="push" name="editVCard" label="&editVCard.label;"
accesskey="&editVCard.accesskey;"
oncommand="editVCard()"/>
<label hidden="true" id="identity.escapedVCard"/>
</hbox>
<separator class="thin"/>
<hbox align="center">
<label value="&smtpName.label;" control="identity.smtpServerKey"
accesskey="&smtpName.accesskey;"/>
<menulist id="identity.smtpServerKey" flex="1">
<menupopup id="smtpPopup">
<menuitem value="" label="&smtpDefaultServer.label;" id="useDefaultItem"/>
<menuseparator/>
<!-- list will be inserted here -->
</menupopup>
</menulist>
</hbox>
</vbox>
<!-- Copies & Folders Tab -->

View File

@ -50,7 +50,12 @@ function onInit()
title.setAttribute("title",titleValue);
setupSignatureItems();
setupSignatureItems();
}
function onPreInit(account, accountValues)
{
loadSMTPServerList();
}
function manageIdentities()

View File

@ -8,6 +8,8 @@
onload="parent.onPanelLoaded('am-main.xul');">
<stringbundle id="bundle_prefutilities" src="chrome://communicator/locale/pref/prefutilities.properties"/>
<stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
<script type="application/x-javascript" src="chrome://messenger/content/am-identity-edit.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/am-main.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/am-prefs.js"/>
@ -15,8 +17,7 @@
<broadcaster id="broadcaster_attachSignature"/>
<dialogheader id="am-main-title" defaultTitle="&accountTitle.label;"/>
<description>&accountSettingsDesc.label;</description>
<hbox align="center">
<label value="&accountName.label;" control="server.prettyName"
accesskey="&accountName.accesskey;"/>
@ -97,6 +98,21 @@
pref="true" preftype="string" prefattribute="value"
prefstring="mail.identity.%identitykey%.escapedVCard"/>
</hbox>
<separator class="thin"/>
<hbox align="center">
<label value="&smtpName.label;" control="identity.smtpServerKey"
accesskey="&smtpName.accesskey;"/>
<menulist wsm_persist="true" id="identity.smtpServerKey" flex="1"
pref="true" preftype="string" prefattribute="value"
prefstring="mail.identity.%identitykey%.smtpServer">
<menupopup id="smtpPopup">
<menuitem value="" label="&smtpDefaultServer.label;" id="useDefaultItem"/>
<menuseparator/>
<!-- list will be inserted here -->
</menupopup>
</menulist>
</hbox>
</groupbox>
<separator class="thin"/>

View File

@ -64,16 +64,12 @@ function onLoad()
{
if (gServerSettings.serverType == "imap")
{
document.getElementById("tabbox").selectedTab = document.getElementById("imapTab");
document.getElementById("pop3Tab").hidden = true;
// don't hide panel - it hides all subsequent panels
document.getElementById("pop3Panel").hidden = true;
}
else if (gServerSettings.serverType == "pop3")
{
var radioGroup = document.getElementById("folderStorage");
document.getElementById("tabbox").selectedTab = document.getElementById("pop3Tab");
document.getElementById("imapTab").hidden = true;
// just hide the tab, don't hide panel - it hides all subsequent panels
document.getElementById("imapPanel").hidden = true;
gAccountManager = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
gFirstDeferredAccount = gServerSettings.deferredToAccount;
var localFoldersAccount = getLocalFoldersAccount();
@ -111,11 +107,7 @@ function onLoad()
}
}
else
{
document.getElementById("imapTab").hidden = true;
document.getElementById("pop3Tab").hidden = true;
}
var controls = getControls();
for (var i = 0; i < controls.length; i++)

View File

@ -53,45 +53,8 @@
<script type="application/x-javascript" src="am-server-advanced.js"/>
<stringbundle id="bundle_prefs" src="chrome://messenger/locale/prefs.properties"/>
<tabbox id="tabbox" flex="1">
<tabs id="tabs">
<tab id="smtpTab" label="SMTP"/>
<tab id="imapTab" label="IMAP"/>
<tab id="pop3Tab" label="POP"/>
</tabs>
<tabpanels id="tabpanels" flex="1">
<!-- SMTP Tab -->
<vbox>
<description style="width: 20em; ">&smtpDesc.label;</description>
<separator class="thin"/>
<hbox align="center">
<label value="&smtpName.label;" control="smtpServerList"
accesskey="&smtpName.accesskey;"/>
<menulist datasources="rdf:smtp"
containment="http://home.netscape.com/NC-rdf#child"
ref="NC:smtpservers" amsa_persist="true"
id="smtpServerList">
<template>
<rule>
<menupopup>
<menuitem uri="..." value="rdf:http://home.netscape.com/NC-rdf#Key"
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
</menupopup>
</rule>
<menupopup/>
</template>
<menupopup id="smtpPopup">
<menuitem value="" label="&smtpDefaultServer.label;" id="useDefaultItem"/>
<menuseparator/>
<!-- template will be inserted here -->
</menupopup>
</menulist>
</hbox>
</vbox>
<!-- IMAP Tab -->
<vbox id="imapTabPanel">
<!-- IMAP Panel -->
<vbox id="imapPanel">
<hbox>
<label value="&serverDirectory.label;"
accesskey="&serverDirectory.accesskey;"
@ -165,9 +128,11 @@
</rows>
</grid>
</vbox>
<!-- POP3 Tab -->
<vbox id="pop3TabPanel">
<description style="width: 20em; ">&pop3Desc.label;</description>
<!-- POP3 Panel -->
<vbox id="pop3Panel">
<description style="width: 20em;">&pop3Desc.label;</description>
<separator class="thin"/>
<hbox align="center">
<radiogroup id="folderStorage"
@ -197,6 +162,4 @@
label="&deferGetNewMail.label;"
accesskey="&deferGetNewMail.accesskey;"/>
</vbox>
</tabpanels>
</tabbox>
</dialog>

View File

@ -56,35 +56,35 @@ function onInit()
function onPreInit(account, accountValues)
{
// Bug 134238
// Make sure server.isSecure will be saved before server.port preference
parent.getAccountValue(account, accountValues, "server", "isSecure", null, false);
// Bug 134238
// Make sure server.isSecure will be saved before server.port preference
parent.getAccountValue(account, accountValues, "server", "isSecure", null, false);
var type = parent.getAccountValue(account, accountValues, "server", "type", null, false);
gRedirectorType = parent.getAccountValue(account, accountValues, "server", "redirectorType", null, false);
hideShowControls(type);
var type = parent.getAccountValue(account, accountValues, "server", "type", null, false);
gRedirectorType = parent.getAccountValue(account, accountValues, "server", "redirectorType", null, false);
hideShowControls(type);
gServer = account.incomingServer;
if(!account.incomingServer.canEmptyTrashOnExit)
{
document.getElementById("server.emptyTrashOnExit").setAttribute("hidden", "true");
document.getElementById("imap.deleteModel.box").setAttribute("hidden", "true");
gServer = account.incomingServer;
if(!account.incomingServer.canEmptyTrashOnExit)
{
document.getElementById("server.emptyTrashOnExit").setAttribute("hidden", "true");
document.getElementById("imap.deleteModel.box").setAttribute("hidden", "true");
}
var hideButton = false;
try {
if (gRedirectorType) {
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var prefString = "mail.accountmanager." + gRedirectorType + ".hide_advanced_button";
hideButton = prefs.getBoolPref(prefString);
}
var hideButton = false;
try {
if (gRedirectorType) {
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var prefString = "mail.accountmanager." + gRedirectorType + ".hide_advanced_button";
hideButton = prefs.getBoolPref(prefString);
}
}
catch (ex) { }
if (hideButton)
document.getElementById("server.advancedbutton").setAttribute("hidden", "true");
else
document.getElementById("server.advancedbutton").removeAttribute("hidden");
}
catch (ex) { }
if (hideButton)
document.getElementById("server.advancedbutton").setAttribute("hidden", "true");
else
document.getElementById("server.advancedbutton").removeAttribute("hidden");
}
function initServerType()
@ -107,28 +107,24 @@ function initServerType()
document.getElementById("defaultPort").value = protocolInfo.getDefaultServerPort(isSecureSelected);
}
function setDivText(divname, value) {
var div = document.getElementById(divname);
if (!div) return;
div.setAttribute("value", value);
function setDivText(divname, value)
{
var div = document.getElementById(divname);
if (!div)
return;
div.setAttribute("value", value);
}
function onAdvanced()
{
dump("onAdvanced..\n");
var serverKeyElement = document.getElementById("identity.smtpServerKey");
var oldSmtpServerKey = serverKeyElement.getAttribute("value");
dump("selected key = " + oldSmtpServerKey + "\n");
var serverSettings = {};
serverSettings.smtpServerList = oldSmtpServerKey;
// Store the server type and, if an IMAP or POP3 server,
// the settings needed for the IMAP/POP3 tab into the array
var serverSettings = {};
var serverType = document.getElementById("server.type").getAttribute("value");
serverSettings.serverType = serverType;
if (serverType == "imap")
{
serverSettings.dualUseFolders = document.getElementById("imap.dualUseFolders").checked;
@ -151,15 +147,6 @@ function onAdvanced()
window.openDialog("chrome://messenger/content/am-server-advanced.xul",
"_blank", "chrome,modal,titlebar", serverSettings);
if (serverSettings.smtpServerList != oldSmtpServerKey)
{
// save the identity back to the page as a key
dump("Setting the smtp server to " + serverSettings.smtpServerList + "\n");
if (serverSettings.smtpServerList)
serverKeyElement.setAttribute("value", serverSettings.smtpServerList);
else
serverKeyElement.removeAttribute("value");
}
if (serverType == "imap")
{
document.getElementById("imap.dualUseFolders").checked = serverSettings.dualUseFolders;
@ -178,29 +165,8 @@ function onAdvanced()
document.getElementById("pop3.deferGetNewMail").checked = serverSettings.deferGetNewMail;
document.getElementById("pop3.deferredToAccount").setAttribute("value", serverSettings.deferredToAccount);
var pop3Server = gServer.QueryInterface(Components.interfaces.nsIPop3IncomingServer);
// if we were using default special folders for this server, and we're deferring it,
// switch the special folders to the deferred to account.
if (serverSettings.deferredToAccount.length > 0)
{
var account = parent.getAccountFromServerId(gServer.serverURI);
var identity = account.defaultIdentity;
var accountManager = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
account = accountManager.getAccount(serverSettings.deferredToAccount);
if (!account)
{
throw "UNEXPECTED: deferredToAccount '" +
serverSettings.deferredToAccount + "' not found!";
}
if (identity.fccFolder == (pop3Server.serverURI + "/Sent"))
identity.fccFolder = account.incomingServer.serverURI + "/Sent";
if (identity.draftFolder == (pop3Server.serverURI + "/Drafts"))
identity.draftFolder = account.incomingServer.serverURI + "/Drafts";
if (identity.stationeryFolder == (pop3Server.serverURI + "/Templates"))
identity.stationeryFolder = account.incomingServer.serverURI + "/Templates";
}
// we're explicitly setting this so we'll go through the SetDeferredToAccount method
pop3Server.deferredToAccount = serverSettings.deferredToAccount;
}
}
@ -304,16 +270,16 @@ function setupFixedUI()
function setupNotifyUI()
{
var broadcaster = document.getElementById("broadcaster_notify");
var broadcaster = document.getElementById("broadcaster_notify");
var notify = document.getElementById("nntp.notifyOn");
var checked = notify.checked;
var locked = getAccountValueIsLocked(notify);
var notify = document.getElementById("nntp.notifyOn");
var checked = notify.checked;
var locked = getAccountValueIsLocked(notify);
if (checked && !locked)
broadcaster.removeAttribute("disabled");
else
broadcaster.setAttribute("disabled", "true");
if (checked && !locked)
broadcaster.removeAttribute("disabled");
else
broadcaster.setAttribute("disabled", "true");
}
function BrowseForNewsrc()

View File

@ -302,8 +302,8 @@
accesskey="&advancedButton.accesskey;"
oncommand="onAdvanced();"
wsm_persist="true" id="server.advancedbutton"
prefstring="mail.server.%serverkey%.advanced.disable"/>
<label hidden="true" wsm_persist="true" id="identity.smtpServerKey"/>
prefstring="mail.server.%serverkey%.advanced.disable"
hidefor="nntp,movemail"/>
</hbox>
<vbox hidefor="imap,pop3,movemail">

View File

@ -21,6 +21,7 @@
*
* Contributor(s):
* Alec Flett <alecf@netscape.com>
* Scott MacGregor <mscott@mozilla.org>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -36,85 +37,196 @@
*
* ***** END LICENSE BLOCK ***** */
const nsIPromptService = Components.interfaces.nsIPromptService;
var smtpService = Components.classes["@mozilla.org/messengercompose/smtp;1"].getService(Components.interfaces.nsISmtpService);
var gPrefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
function onLoad()
var gSmtpServerListWindow =
{
mBundle: null,
mServerList: null,
mAddButton: null,
mEditButton: null,
mDeleteButton: null,
mSetDefaultServerButton: null,
onLoad: function()
{
parent.onPanelLoaded('am-smtp.xul');
var defaultSmtpServer = smtpService.defaultServer;
this.mBundle = document.getElementById("bundle_messenger");
this.mServerList = document.getElementById("smtpList");
this.mAddButton = document.getElementById("addButton");
this.mEditButton = document.getElementById("editButton");
this.mDeleteButton = document.getElementById("deleteButton");
this.mSetDefaultServerButton = document.getElementById("setDefaultButton");
initSmtpSettings(defaultSmtpServer);
// Get the default smtp server preference to check if we need to lock the
// advance button on the panel.
if (defaultSmtpServer) {
var defaultSmtpServerKey = gPrefBranch.getCharPref("mail.smtp.defaultserver");
var prefString = "mail.smtpserver."+ defaultSmtpServerKey + ".advanced.disable";
var advButton = document.getElementById("smtp.advancedbutton");
if (gPrefBranch.prefIsLocked(prefString)) {
advButton.setAttribute("disabled", "true");
}
}
}
function onSave()
{
var defaultSmtpServer = smtpService.defaultServer;
//if we have a null defaultSmtpServer and if the hostname field has valid
//values then we create a server and make it as the default.
if ((defaultSmtpServer == null) && (!hostnameIsIllegal(gSmtpHostname.value))) {
defaultSmtpServer = smtpService.createSmtpServer();
}
saveSmtpSettings(defaultSmtpServer);
}
function onExitAdvancedDialog(deleteSmtpServers,replaceWithDefault)
{
for (var index in deleteSmtpServers) {
var server = smtpService.getServerByKey(deleteSmtpServers[index]);
smtpService.deleteSmtpServer(server);
if (replaceWithDefault)
window.parent.replaceWithDefaultSmtpServer(deleteSmtpServers[index]);
}
}
function onAdvanced(event)
{
if (smtpService.defaultServer && hostnameIsIllegal(gSmtpHostname.value)) {
var alertTitle = window.parent.gBrandBundle.getString("brandShortName");
var alertMsg = window.parent.gPrefsBundle.getString("enterValidHostname");
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
if (promptService)
promptService.alert(window, alertTitle, alertMsg);
else
window.alert(alertMsg);
this.refreshServerList();
},
onSelectionChanged: function(aEvent)
{
if (this.mServerList.selectedItems.length <= 0)
return;
var server = this.getSelectedServer();
this.updateButtons(server);
this.updateServerInfoBox(server);
},
onDeleteServer: function (aEvent)
{
var server = this.getSelectedServer();
if (server)
{
// confirm deletion
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(nsIPromptService);
var cancel = promptService.confirmEx(window, this.mBundle.getString('smtpServers-confirmServerDeletionTitle'),
this.mBundle.getFormattedString('smtpServers-confirmServerDeletion', [server.hostname], 1),
(nsIPromptService.BUTTON_TITLE_YES * nsIPromptService.BUTTON_POS_0) +
(nsIPromptService.BUTTON_TITLE_NO * nsIPromptService.BUTTON_POS_1),
null, null, null, null, { });
if (!cancel)
{
smtpService.deleteSmtpServer(server);
parent.replaceWithDefaultSmtpServer(server.key);
this.refreshServerList();
}
}
},
onAddServer: function (aEvent)
{
this.openServerEditor(null);
},
onEditServer: function (aEvent)
{
if (this.mServerList.selectedItems.length <= 0)
return;
this.openServerEditor(this.getSelectedServer());
},
onSetDefaultServer: function(aEvent)
{
if (this.mServerList.selectedItems.length <= 0)
return;
smtpService.defaultServer = this.getSelectedServer();
this.refreshServerList();
},
updateButtons: function(aServer)
{
// can't delete default server
if (smtpService.defaultServer == aServer)
{
this.mSetDefaultServerButton.setAttribute("disabled", "true");
this.mDeleteButton.setAttribute("disabled", "true");
}
else
{
this.mSetDefaultServerButton.removeAttribute("disabled");
this.mDeleteButton.removeAttribute("disabled");
}
},
updateServerInfoBox: function(aServer)
{
var noneSelected = this.mBundle.getString("smtpServerList-NotSpecified");
document.getElementById('nameValue').value = aServer.hostname;
document.getElementById('descriptionValue').value = aServer.description || noneSelected;
document.getElementById('portValue').value = aServer.port;
document.getElementById('userNameValue').value = aServer.username || noneSelected;
document.getElementById('useSecureConnectionValue').value = this.mBundle.getString("smtpServer-SecureConnection-Type-" +
aServer.trySSL);
},
refreshServerList: function(aServerKeyToSelect)
{
// remove all children
while (this.mServerList.hasChildNodes())
this.mServerList.removeChild(this.mServerList.lastChild);
var defaultServer = smtpService.defaultServer;
this.fillSmtpServers(this.mServerList, smtpService.smtpServers, defaultServer);
if (aServerKeyToSelect)
this.mServerList.selectItem(this.mServerList.getElementsByAttribute("key", aServerKeyToSelect)[0]);
else // select the default server
this.mServerList.selectItem(this.mServerList.getElementsByAttribute("default", "true")[0]);
this.mServerList.focus();
},
fillSmtpServers: function(aListBox, aServers, aDefaultServer)
{
if (!aListBox || !aServers)
return;
var serverCount = aServers.Count();
for (var i=0; i < serverCount; i++)
{
var server = aServers.QueryElementAt(i, Components.interfaces.nsISmtpServer);
var isDefault = (aDefaultServer.key == server.key);
//ToDoList: add code that allows for the redirector type to specify whether to show values or not
if (!server.redirectorType)
{
var listitem = this.createSmtpListItem(server, isDefault);
aListBox.appendChild(listitem);
}
}
},
createSmtpListItem: function(aServer, aIsDefault)
{
var listitem = document.createElement("listitem");
var serverName = "";
if (aServer.description)
serverName = aServer.description + ' - ';
else if (aServer.username)
serverName = aServer.username + ' - ';
serverName += aServer.hostname;
if (aIsDefault)
{
serverName += " " + this.mBundle.getString("defaultServerTag");
listitem.setAttribute("default", "true");
}
// fix for bug #60647
// when the user presses "Advanced..." we save any changes
// they made so that the changes will show up in the advanced dialog
// and when they return from the advanced dialog, the changes they
// made won't be blown away.
//
// the only remaing problem is if the user "cancels" out of the
// account manager dialog, those changes will get saved.
// that is covered in bug #63825
onSave();
listitem.setAttribute("label", serverName);
listitem.setAttribute("key", aServer.key);
listitem.setAttribute("class", "smtpServerListItem");
// give it some unique id
listitem.id = "smtpServer." + aServer.key;
return listitem;
},
var args = {result: false};
window.openDialog('chrome://messenger/content/SmtpServerList.xul', 'smtp', 'modal,titlebar,chrome', args);
openServerEditor: function(aServer)
{
var args = {server: aServer,
result: false,
addSmtpServer: ""};
window.openDialog("chrome://messenger/content/SmtpServerEdit.xul",
"smtpEdit", "chrome,titlebar,modal,centerscreen", args);
// now re-select the server which was just added
if (args.result)
this.refreshServerList(aServer ? aServer.key : args.addSmtpServer);
return args.result;
},
getSelectedServer: function()
{
var serverKey = this.mServerList.selectedItems[0].getAttribute("key");
return smtpService.getServerByKey(serverKey);
}
};
if (args.result) {
// this is the wrong way to do this.
dump("reloading panel...\n");
onLoad();
}
}

View File

@ -7,30 +7,71 @@
<!DOCTYPE page SYSTEM "chrome://messenger/locale/am-advanced.dtd" >
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="onLoad();">
onload="gSmtpServerListWindow.onLoad();">
<script type="application/x-javascript" src="amUtils.js"/>
<script type="application/x-javascript" src="am-smtp.js"/>
<stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
<dialogheader title="&smtpServer.label;"/>
<groupbox>
<description>&smtpDesc.label;</description>
<separator class="thin"/>
<separator/>
<vbox id="smtpServerEditor"/>
<separator/>
<hbox>
<spacer flex="1"/>
<button label="&advanced.label;" oncommand="onAdvanced(event);"
accesskey="&advanced.accesskey;"
wsm_persist="true" id="smtp.advancedbutton"
prefstring="mail.smtpserver.%serverkey%.advanced.disable"/>
<listbox id="smtpList" onselect="gSmtpServerListWindow.onSelectionChanged(event);"
ondblclick="gSmtpServerListWindow.onEditServer(event);" flex="1" style="height: 0px;"/>
<vbox>
<button id="addButton"
oncommand="gSmtpServerListWindow.onAddServer(event);" label="&smtpListAdd.label;"
accesskey="&smtpListAdd.accesskey;"/>
<button id="editButton"
oncommand="gSmtpServerListWindow.onEditServer(event);" label="&smtpListEdit.label;"
accesskey="&smtpListEdit.accesskey;"/>
<button id="deleteButton" disabled="true"
oncommand="gSmtpServerListWindow.onDeleteServer(event);" label="&smtpListDelete.label;"
accesskey="&smtpListDelete.accesskey;"/>
<button id="setDefaultButton" disabled="true"
oncommand="gSmtpServerListWindow.onSetDefaultServer(event);" label="&smtpListSetDefault.label;"
accesskey="&smtpListSetDefault.accesskey;"/>
</vbox>
</hbox>
</groupbox>
<separator/>
<hbox id="smtpServerInfoBox">
<stack flex="1" class="inset">
<spacer id="backgroundBox"/>
<grid>
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row align="center">
<hbox pack="end"><label id="descriptionLabel" value="&serverDescription.label;"/></hbox>
<textbox id="descriptionValue" readonly="true" class="plain"/>
</row>
<row align="center">
<hbox pack="end"><label id="nameLabel" value="&serverName.label;"/></hbox>
<textbox id="nameValue" readonly="true" class="plain"/>
</row>
<row align="center">
<hbox pack="end"><label id="portLabel" value="&serverPort.label;"/></hbox>
<textbox id="portValue" readonly="true" class="plain"/>
</row>
<row align="center">
<hbox pack="end"><label id="userNameLabel" value="&userName.label;"/></hbox>
<textbox id="userNameValue" readonly="true" class="plain"/>
</row>
<row align="center">
<hbox pack="end"><label id="useSecureConnectionLabel" value="&useSecureConnection.label;"/></hbox>
<textbox id="useSecureConnectionValue" readonly="true" class="plain"/>
</row>
</rows>
</grid>
</stack>
</hbox>
</page>

View File

@ -41,6 +41,7 @@
// with the new XUL widgets
var gSmtpUsername;
var gSmtpDescription;
var gSmtpUsernameLabel;
var gSmtpHostname;
var gSmtpPort;
@ -57,6 +58,7 @@ var gDefaultPort;
function initSmtpSettings(server) {
gSmtpUsername = document.getElementById("smtp.username");
gSmtpDescription = document.getElementById("smtp.description");
gSmtpUsernameLabel = document.getElementById("smtpusernamelabel");
gSmtpHostname = document.getElementById("smtp.hostname");
gSmtpPort = document.getElementById("smtp.port");
@ -68,6 +70,7 @@ function initSmtpSettings(server) {
if (server) {
gSmtpHostname.value = server.hostname;
gSmtpDescription.value = server.description;
gSmtpPort.value = server.port ? server.port : "";
gSmtpUsername.value = server.username;
gSmtpAuthMethod.setAttribute("value", server.authMethod);
@ -99,6 +102,7 @@ function onLockPreference()
var allPrefElements = [
{ prefstring:"hostname", id:"smtp.hostname"},
{ prefstring:"description", id:"smtp.description"},
{ prefstring:"port", id:"smtp.port"},
{ prefstring:"use_username", id:"smtp.useUsername"},
{ prefstring:"try_ssl", id:"smtp.trySSL"}
@ -140,6 +144,7 @@ function saveSmtpSettings(server)
//dump("Saving to " + server + "\n");
if (server) {
server.hostname = gSmtpHostname.value;
server.description = gSmtpDescription.value;
server.port = gSmtpPort.value;
server.authMethod = (gSmtpUseUsername.checked ? 1 : 0);
//dump("Saved authmethod = " + server.authMethod +

View File

@ -46,60 +46,86 @@
<script src="smtpEditOverlay.js"/>
<vbox id="smtpServerEditor">
<hbox align = "center">
<label value="&serverName.label;" accesskey="&serverName.accesskey;" control="smtp.hostname"/>
<textbox id="smtp.hostname" flex="1"
preftype="string"
class="uri-element"
prefstring="mail.smtpserver.%serverkey%.hostname"/>
<label value="&serverPort.label;" accesskey="&serverPort.accesskey;"
control="smtp.port"/>
<textbox id="smtp.port" size="5"
preftype="int"
prefstring="mail.smtpserver.%serverkey%.port"/>
<label value="&serverPortDefault.label;"/>
<label id="smtp.defaultPort"/>
</hbox>
<vbox>
<!-- This hidden one will hold the integer version
of smtp.useUsername -->
<label hidden="true" id="smtp.authMethod"/>
<hbox align="center">
<checkbox id="smtp.useUsername" label="&alwaysUseUsername.label;"
accesskey="&alwaysUseUsername.accesskey;"
oncommand="onUseUsername(event.target,true);"
prefattribute="value"
prefstring="mail.smtpserver.%serverkey%.use_username"/>
</hbox>
<vbox class="indent">
<groupbox>
<caption label="&settings.caption;"/>
<grid flex="1">
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row align="center">
<hbox pack="end"><label value="&serverDescription.label;" accesskey="&serverDescription.accesskey;"
control="smtp.description"/></hbox>
<textbox id="smtp.description" flex="1" preftype="string" prefstring="mail.smtpserver.%serverkey%.description"/>
</row>
<row align="center">
<hbox pack="end"><label value="&serverName.label;" accesskey="&serverName.accesskey;" control="smtp.hostname"/></hbox>
<textbox id="smtp.hostname" flex="1" preftype="string" class="uri-element" prefstring="mail.smtpserver.%serverkey%.hostname"/>
</row>
<row align="center">
<hbox pack="end"><label value="&serverPort.label;" accesskey="&serverPort.accesskey;" control="smtp.port"/>
</hbox>
<hbox>
<textbox id="smtp.port" size="4"
preftype="int"
prefstring="mail.smtpserver.%serverkey%.port"/>
<label value="&serverPortDefault.label;"/>
<label id="smtp.defaultPort"/>
</hbox>
</row>
</rows>
</grid>
</groupbox>
<separator class="thin"/>
<groupbox>
<caption label="&security.caption;"/>
<vbox>
<!-- This hidden one will hold the integer version
of smtp.useUsername -->
<label hidden="true" id="smtp.authMethod"/>
<hbox align="center">
<checkbox id="smtp.useUsername" label="&alwaysUseUsername.label;"
accesskey="&alwaysUseUsername.accesskey;"
oncommand="onUseUsername(event.target,true);"
prefattribute="value"
prefstring="mail.smtpserver.%serverkey%.use_username"/>
</hbox>
<vbox class="indent">
<hbox align="center">
<label id="smtpusernamelabel" value="&userName.label;"
accesskey="&userName.accesskey;" control="smtp.username"/>
<textbox id="smtp.username" flex="1"
preftype="string"
prefstring="mail.smtpserver.%serverkey%.username"/>
</hbox>
</vbox>
</vbox>
<separator class="thin"/>
<hbox align="center">
<label id="smtpusernamelabel" value="&userName.label;"
accesskey="&userName.accesskey;" control="smtp.username"/>
<textbox id="smtp.username" flex="1"
preftype="string"
prefstring="mail.smtpserver.%serverkey%.username"/>
<label value="&isSecure.label;"/>
</hbox>
</vbox>
</vbox>
<separator class="thin"/>
<hbox align="center">
<label value="&isSecure.label;"/>
</hbox>
<radiogroup id="smtp.trySSL"
prefstring="mail.smtpserver.%serverkey%.try_ssl"
oncommand="selectProtocol(0);">
<hbox class="indent">
<radio value="0" id="smtp.neverSecure"
label="&neverSecure.label;" accesskey="&neverSecure.accesskey;"/>
<radio value="1" id="smtp.sometimesSecure"
label="&sometimesSecure.label;" accesskey="&sometimesSecure.accesskey;"/>
<radio value="2" id="smtp.alwaysSecure"
label="&alwaysSecure.label;" accesskey="&alwaysSecure.accesskey;"/>
<radio value="3" id="smtp.alwaysSmtpS"
label="&alwaysSmtpS.label;" accesskey="&alwaysSmtpS.accesskey;"/>
</hbox>
</radiogroup>
<radiogroup id="smtp.trySSL"
prefstring="mail.smtpserver.%serverkey%.try_ssl"
oncommand="selectProtocol(0);">
<hbox class="indent">
<radio value="0" id="smtp.neverSecure"
label="&neverSecure.label;" accesskey="&neverSecure.accesskey;"/>
<radio value="1" id="smtp.sometimesSecure"
label="&sometimesSecure.label;" accesskey="&sometimesSecure.accesskey;"/>
<radio value="2" id="smtp.alwaysSecure"
label="&alwaysSecure.label;" accesskey="&alwaysSecure.accesskey;"/>
<radio value="3" id="smtp.alwaysSmtpS"
label="&alwaysSmtpS.label;" accesskey="&alwaysSmtpS.accesskey;"/>
</hbox>
</radiogroup>
</groupbox>
</vbox>
</overlay>

View File

@ -1,11 +0,0 @@
<!ENTITY smtpListTitle.label "Advanced Outgoing Server (SMTP) Settings">
<!ENTITY smtpListDesc.label "Although you can specify more than one outgoing server (SMTP), this is recommended only for advanced users. Setting up multiple SMTP servers can cause errors when sending messages.">
<!ENTITY smtpListAdd.label "Add...">
<!ENTITY smtpListAdd.accesskey "A">
<!ENTITY smtpListEdit.label "Edit...">
<!ENTITY smtpListEdit.accesskey "E">
<!ENTITY smtpListDelete.label "Delete">
<!ENTITY smtpListDelete.accesskey "D">
<!ENTITY smtpListSetDefault.label "Set Default">
<!ENTITY smtpListSetDefault.accesskey "f">

View File

@ -1,7 +1,20 @@
<!-- LOCALIZATION NOTE (smtpServer.label): do not translate "SMTP" in below line -->
<!ENTITY smtpServer.label "Outgoing Server (SMTP) Settings">
<!-- LOCALIZATION NOTE (smtpDesc.label): do not translate "SMTP" in below line -->
<!ENTITY smtpDesc.label "Only one outgoing server (SMTP) needs to be specified, even if you have several mail accounts. Enter the name of the server for outgoing messages.">
<!ENTITY advanced.label "Advanced...">
<!ENTITY advanced.accesskey "v">
<!ENTITY smtpDesc.label "Although you can specify more than one outgoing server (SMTP), this is only recommended for advanced users. Setting up multiple SMTP servers can cause errors when sending messages.">
<!ENTITY smtpListAdd.label "Add...">
<!ENTITY smtpListAdd.accesskey "d">
<!ENTITY smtpListEdit.label "Edit...">
<!ENTITY smtpListEdit.accesskey "E">
<!ENTITY smtpListDelete.label "Remove">
<!ENTITY smtpListDelete.accesskey "m">
<!ENTITY smtpListSetDefault.label "Set Default">
<!ENTITY smtpListSetDefault.accesskey "t">
<!ENTITY serverDescription.label "Description: ">
<!ENTITY serverName.label "Server Name: ">
<!ENTITY serverPort.label "Port: ">
<!ENTITY userName.label "User Name: ">
<!ENTITY useSecureConnection.label "Secure Connection: ">

View File

@ -1,7 +1,6 @@
<!-- extracted from am-main.xul -->
<!ENTITY accountTitle.label "Account Settings">
<!ENTITY accountSettingsDesc.label "The following information is needed before you can send messages. If you do not know the information requested, please contact your system administrator or Internet Service Provider.">
<!ENTITY accountName.label "Account Name:">
<!ENTITY accountName.accesskey "N">
<!ENTITY accountNameDesc.label "The account name is used to identify each account">
@ -28,3 +27,9 @@
<!ENTITY manageIdentities.label "Manage Identities...">
<!ENTITY manageIdentities.accesskey "M">
<!-- LOCALIZATION NOTE (smtpName.label) : do not translate "SMTP" in below line -->
<!ENTITY smtpName.label "Outgoing Server (SMTP):">
<!ENTITY smtpName.accesskey "u">
<!ENTITY smtpDefaultServer.label "Use Default Server">

View File

@ -1,9 +1,4 @@
<!ENTITY serverAdvanced.label "Advanced Account Settings">
<!-- LOCALIZATION NOTE (smtpDesc.label): DONT_TRANSLATE "SMTP" -->
<!ENTITY smtpDesc.label "When sending messages from this identity, always use the following outgoing server (SMTP):">
<!ENTITY smtpName.label "Server:">
<!ENTITY smtpName.accesskey "S">
<!ENTITY smtpDefaultServer.label "Always use default server">
<!-- LOCALIZATION NOTE (serverDirectory.label): DONT_TRANSLATE "IMAP" -->
<!ENTITY imapAdvanced.label "Advanced IMAP Server Settings">
<!ENTITY serverDirectory.label "IMAP server directory:">

View File

@ -1,5 +1,9 @@
<!ENTITY settings.caption "Settings">
<!ENTITY security.caption "Security and Authentication">
<!ENTITY serverName.label "Server Name:">
<!ENTITY serverName.accesskey "S">
<!ENTITY serverDescription.label "Description:">
<!ENTITY serverDescription.accesskey "D">
<!ENTITY serverPort.label "Port:">
<!ENTITY serverPort.accesskey "P">
<!ENTITY alwaysUseUsername.label "Use name and password">

View File

@ -40,11 +40,12 @@
interface nsIAuthPrompt;
[scriptable, uuid(c165b634-1dd1-11b2-a849-82dd67b7519e)]
[scriptable, uuid(556ee1e9-8221-4c00-a502-8ce44f029b47)]
interface nsISmtpServer : nsISupports {
attribute string key; // unique identifier
attribute AUTF8String description; // user provided description for the server
attribute string hostname;
attribute PRInt32 port;
attribute string username;

View File

@ -136,6 +136,24 @@ nsSmtpServer::SetHostname(const char * aHostname)
return NS_OK;
}
NS_IMETHODIMP
nsSmtpServer::GetDescription(nsACString &aDescription)
{
nsXPIDLCString temp;
mPrefBranch->GetCharPref("description", getter_Copies(temp));
aDescription.Assign(temp);
return NS_OK;
}
NS_IMETHODIMP
nsSmtpServer::SetDescription(const nsACString &aDescription)
{
if (!aDescription.IsEmpty())
return mPrefBranch->SetCharPref("description", PromiseFlatCString(aDescription).get());
else
return mPrefBranch->ClearUserPref("description");
}
// if GetPort returns 0, it means default port
NS_IMETHODIMP
nsSmtpServer::GetPort(PRInt32 *aPort)

View File

@ -81,8 +81,6 @@ messenger.jar:
content/messenger/accountUtils.js (base/prefs/resources/content/accountUtils.js)
content/messenger/amUtils.js (base/prefs/resources/content/amUtils.js)
content/messenger/ispUtils.js (base/prefs/resources/content/ispUtils.js)
content/messenger/SmtpServerList.xul (base/prefs/resources/content/SmtpServerList.xul)
content/messenger/SmtpServerList.js (base/prefs/resources/content/SmtpServerList.js)
content/messenger/SmtpServerEdit.xul (base/prefs/resources/content/SmtpServerEdit.xul)
content/messenger/SmtpServerEdit.js (base/prefs/resources/content/SmtpServerEdit.js)
content/messenger/smtpEditOverlay.xul (base/prefs/resources/content/smtpEditOverlay.xul)
@ -279,7 +277,6 @@ en-US.jar:
locale/en-US/messenger/am-identity-edit.dtd (base/prefs/resources/locale/en-US/am-identity-edit.dtd)
locale/en-US/messenger/prefs.properties (base/prefs/resources/locale/en-US/prefs.properties)
locale/en-US/messenger/am-serverwithnoidentities.dtd (base/prefs/resources/locale/en-US/am-serverwithnoidentities.dtd)
locale/en-US/messenger/SmtpServerList.dtd (base/prefs/resources/locale/en-US/SmtpServerList.dtd)
locale/en-US/messenger/smtpEditOverlay.dtd (base/prefs/resources/locale/en-US/smtpEditOverlay.dtd)
locale/en-US/messenger/mailPrefsOverlay.dtd (base/prefs/resources/locale/en-US/mailPrefsOverlay.dtd)
locale/en-US/messenger/addressbook/pref-addressing.dtd (addrbook/prefs/resources/locale/en-US/pref-addressing.dtd)

View File

@ -61,3 +61,17 @@
treechildren::-moz-tree-cell-text(isDefaultServer-true) {
font-weight: bold;
}
/* ::::: SMTP Server Panel :::::: */
.smtpServerListItem {
padding-left: 3px;
}
#backgroundBox {
background-color: ThreeDLightShadow;
}
#smtpServerInfoBox textbox {
background-color: transparent;
}

View File

@ -61,3 +61,17 @@
treechildren::-moz-tree-cell-text(isDefaultServer-true) {
font-weight: bold;
}
/* ::::: SMTP Server Panel :::::: */
.smtpServerListItem {
padding-left: 3px;
}
#backgroundBox {
background-color: #BBC6D1;
}
#smtpServerInfoBox textbox {
background-color: transparent;
}