fix for #17665, allow the user to configure if they want to use

the newsgroup name abbreviations in the folder pane.
default is yes.  comment out some dumps.  make it so the account manager
can deal with radio inputs.
This commit is contained in:
sspitzer%netscape.com 1999-12-24 08:57:54 +00:00
Родитель 726ab6fb1c
Коммит 33107dab44
12 изменённых файлов: 66 добавлений и 23 удалений

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

@ -284,6 +284,8 @@ function savePage(serverId, pageId) {
var accountValues = getValueArrayFor(serverId);
var pageElements = getPageFormElements(pageId);
if (pageElements == null) return;
// store the value in the account
for (var i=0; i<pageElements.length; i++) {
if (pageElements[i].name) {
@ -361,6 +363,8 @@ function restorePage(serverId, pageId) {
var accountValues = getValueArrayFor(serverId);
var pageElements = getPageFormElements(pageId);
if (pageElements == null) return;
// restore the value from the account
for (var i=0; i<pageElements.length; i++) {
if (pageElements[i].name) {
@ -385,13 +389,12 @@ function restorePage(serverId, pageId) {
function getFormElementValue(formElement) {
var type = formElement.type.toLowerCase();
if (type=="checkbox") {
if (type=="checkbox" || type=="radio") {
if (formElement.getAttribute("reversed"))
return !formElement.checked;
else
return formElement.checked;
}
else if (type == "text" &&
formElement.getAttribute("datatype") == "nsIFileSpec") {
if (formElement.value) {
@ -416,7 +419,7 @@ function setFormElementValue(formElement, value) {
//formElement.value = formElement.defaultValue;
// formElement.checked = formElement.defaultChecked;
var type = formElement.type.toLowerCase();
if (type == "checkbox") {
if (type == "checkbox" || type=="radio") {
if (value == undefined) {
formElement.checked = formElement.defaultChecked;
} else {
@ -427,7 +430,6 @@ function setFormElementValue(formElement, value) {
}
}
// handle nsIFileSpec
else if (type == "text" &&
formElement.getAttribute("datatype") == "nsIFileSpec") {
@ -479,11 +481,16 @@ function getAccountFromServerId(serverId) {
// get the array of form elements for the given page
//
function getPageFormElements(pageId) {
var pageFrame = top.frames[pageId];
var pageDoc = top.frames[pageId].document;
var pageElements = pageDoc.getElementsByTagName("FORM")[0].elements;
return pageElements;
try {
var pageFrame = top.frames[pageId];
var pageDoc = top.frames[pageId].document;
var pageElements = pageDoc.getElementsByTagName("FORM")[0].elements;
return pageElements;
}
catch (ex) {
dump("getPageFormElements(" + pageId +") failed: " + ex + "\n");
}
return null;
}
//

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

@ -52,7 +52,7 @@ function onLoad() {
dump("initialized with " + wizardContents["smtp.hostname"] + "\n");
}
catch (ex) {
dump("failed to get the smtp hostname\n");
//dump("failed to get the smtp hostname\n");
}
init();
}

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

@ -53,6 +53,7 @@ function initServerType() {
setDivText("servertype.verbose", verboseName);
setDivText("servername.verbose", hostname);
setDivText("username.verbose", username);
}
function setDivText(divname, value) {

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

@ -78,6 +78,23 @@
&maxMessagesEnd.label;
</html:div>
</box>
<box align="horizontal">
<box align="vertical" flex="100%">
<html:fieldset>
<html:legend align="left">
<html:div>&abbreviate.label;</html:div>
</html:legend>
<html:div>
<html:input reversed="true" name="nntp.abbreviate" type="radio"/>
<html:label>&abbreviateOn.label;</html:label>
</html:div>
<html:div>
<html:input name="nntp.abbreviate" type="radio"/>
<html:label>&abbreviateOff.label;</html:label>
</html:div>
</html:fieldset>
</box>
</box>
<html:div>&newsrcFilePath.label;</html:div>
<html:input type="text" name="nntp.newsrcFilePath" datatype="nsIFileSpec"/>
</box>

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

@ -37,3 +37,6 @@
<!ENTITY maxMessagesEnd.label "messages.">
<!ENTITY newsrcFilePath.label "newsrc file:">
<!ENTITY localPath.label "Local directory:">
<!ENTITY abbreviate.label "Show newsgroup names in the Mail Folder pane as:">
<!ENTITY abbreviateOn.label "Full names (For example, 'netscape.public.mozilla.mail-news')">
<!ENTITY abbreviateOff.label "Abbreviate names (For example, 'n.p.m.mail-news')">

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

@ -978,14 +978,14 @@ var gMeterObserver;
function GetMsgFolderFromUri(uri)
{
dump("GetMsgFolderFromUri of " + uri + "\n");
//dump("GetMsgFolderFromUri of " + uri + "\n");
try {
var resource = GetResourceFromUri(uri);
var msgfolder = resource.QueryInterface(Components.interfaces.nsIMsgFolder);
return msgfolder;
}
catch (ex) {
dump("failed to get the folder resource\n");
//dump("failed to get the folder resource\n");
}
return null;
}

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

@ -363,5 +363,7 @@ pref("mail.server.default.max_size", 50);
pref("mail.server.default.auth_login", true);
pref("mail.server.default.delete_mail_left_on_server", false);
pref("mail.server.default.abbreviate",true);
pref("mail.convert_emoticons",true);
pref("mail.convert_structs",true);

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

@ -42,4 +42,7 @@ interface nsINntpIncomingServer : nsISupports {
/* when we don't download all, do we mark the rest read? */
attribute boolean markOldRead;
/* abbreviate the newsgroup names in the folder pane? */
attribute boolean abbreviate;
};

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

@ -576,16 +576,21 @@ NS_IMETHODIMP nsMsgNewsFolder::GetAbbreviatedName(PRUnichar * *aAbbreviatedName)
if (NS_FAILED(rv)) return rv;
if (!isNewsServer) {
NS_WITH_SERVICE(nsIPref, prefs, kPrefServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
PRInt32 numFullWords;
rv = prefs->GetIntPref(PREF_NEWS_ABBREVIATE_PRETTY_NAMES, &numFullWords);
if (NS_FAILED(rv))
numFullWords = 1;
if (numFullWords != 0) {
rv = AbbreviatePrettyName(aAbbreviatedName, numFullWords);
nsCOMPtr<nsIMsgIncomingServer> server;
rv = GetServer(getter_AddRefs(server));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsINntpIncomingServer> nntpServer;
rv = server->QueryInterface(nsINntpIncomingServer::GetIID(),
getter_AddRefs(nntpServer));
if (NS_FAILED(rv)) return rv;
PRBool abbreviate = PR_TRUE;
rv = nntpServer->GetAbbreviate(&abbreviate);
if (NS_FAILED(rv)) return rv;
if (abbreviate) {
rv = AbbreviatePrettyName(aAbbreviatedName, 1 /* hardcoded for now */);
}
}
@ -881,7 +886,6 @@ NS_IMETHODIMP nsMsgNewsFolder::GetNewMessages(nsIMsgWindow *aWindow)
NS_WITH_SERVICE(nsINntpService, nntpService, kNntpServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
//Are we assured this is the server for this folder?
nsCOMPtr<nsIMsgIncomingServer> server;
rv = GetServer(getter_AddRefs(server));
if (NS_FAILED(rv)) return rv;

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

@ -64,6 +64,7 @@ nsNntpIncomingServer::~nsNntpIncomingServer()
NS_IMPL_SERVERPREF_INT(nsNntpIncomingServer, NotifySize, "notify.size");
NS_IMPL_SERVERPREF_BOOL(nsNntpIncomingServer, NotifyOn, "notify.on");
NS_IMPL_SERVERPREF_BOOL(nsNntpIncomingServer, MarkOldRead, "mark_old_read");
NS_IMPL_SERVERPREF_BOOL(nsNntpIncomingServer, Abbreviate, "abbreviate");
NS_IMPL_SERVERPREF_INT(nsNntpIncomingServer, MaxArticles, "max_articles");
NS_IMETHODIMP

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

@ -363,5 +363,7 @@ pref("mail.server.default.max_size", 50);
pref("mail.server.default.auth_login", true);
pref("mail.server.default.delete_mail_left_on_server", false);
pref("mail.server.default.abbreviate",true);
pref("mail.convert_emoticons",true);
pref("mail.convert_structs",true);

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

@ -37,3 +37,6 @@
<!ENTITY maxMessagesEnd.label "messages.">
<!ENTITY newsrcFilePath.label "newsrc file:">
<!ENTITY localPath.label "Local directory:">
<!ENTITY abbreviate.label "Show newsgroup names in the Mail Folder pane as:">
<!ENTITY abbreviateOn.label "Full names (For example, 'netscape.public.mozilla.mail-news')">
<!ENTITY abbreviateOff.label "Abbreviate names (For example, 'n.p.m.mail-news')">