Enabled 'oncreate' for charset menu added code to hanlde reply/forward charset cases, bug 23540, r=cata.

This commit is contained in:
nhotta%netscape.com 2000-02-16 07:46:37 +00:00
Родитель f620060761
Коммит f9e280f75a
2 изменённых файлов: 26 добавлений и 13 удалений

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

@ -339,15 +339,15 @@ function ComposeUnload(calledFromExit)
function SetDocumentCharacterSet(aCharset)
{
dump("SetDocumentCharacterSet Callback!\n");
dump(aCharset + "\n");
dump("SetDocumentCharacterSet Callback!\n");
dump(aCharset + "\n");
if (msgCompose) {
msgCompose.SetDocumentCharset(aCharset);
if (msgCompose) {
msgCompose.SetDocumentCharset(aCharset);
currentMailSendCharset = aCharset;
}
else
dump("Compose has not been created!\n");
else
dump("Compose has not been created!\n");
}
function SetDefaultMailSendCharacterSet()
@ -378,12 +378,15 @@ function SetDefaultMailSendCharacterSet()
function InitCharsetMenuCheckMark()
{
// dump("msgCompose.compFields is " + msgCompose.compFields.GetCharacterSet() + "\n");
// return if the charset is already set explitily
if (currentMailSendCharset != null) {
dump("already set to " + currentMailSendCharset + "\n");
return;
}
var menuitem;
// try to get preferences service
var prefs = null;
try {
@ -395,13 +398,23 @@ function InitCharsetMenuCheckMark()
dump("failed to get prefs service!\n");
prefs = null;
}
var send_default_charset = prefs.CopyCharPref("mailnews.send_default_charset");
var menuitem = document.getElementById(send_default_charset);
if (menuitem)
menuitem.setAttribute('checked', 'true');
else
dump("getElementById failed for " + send_default_charset + "\n");
var compFieldsCharset = msgCompose.compFields.GetCharacterSet();
if (compFieldsCharset.toUpperCase() == "US-ASCII")
compFieldsCharset = "ISO-8859-1";
menuitem = document.getElementById(compFieldsCharset);
// charset may have been set implicitly in case of reply/forward
if (send_default_charset.toUpperCase() != compFieldsCharset.toUpperCase()) {
if (menuitem && menuitem.getAttribute('checked') == false) {
menuitem.setAttribute('checked', 'true');
return;
}
}
menuitem = document.getElementById(send_default_charset);
if (menuitem)
menuitem.setAttribute('checked', 'true');
// Set a document charset to a default mail send charset.
SetDocumentCharacterSet(send_default_charset);

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

@ -227,7 +227,7 @@ ACTUALLY, EVERY TIME YOU TYPE ANY OF THE KEY DEFINED HERE AFTER WITHOUT ANY OF T
<menuseparator/>
<menuitem value="&pageInfoCmd.label;" disabled="true" accesskey="&pageInfoCmd.accesskey;" cmd="nsCmd:ComposeNYI"/>
<menuseparator/>
<menu value="&dcharMenu.label;">
<menu value="&dcharMenu.label;" oncreate="InitCharsetMenuCheckMark();">
<menupopup>
<menuitem id="ISO-8859-1" type="radio" name="charsetGroup" value="&dcharIso1Cmd.label;" oncommand="SetDocumentCharacterSet(this.id);"/>
<menuitem id="ISO-8859-2" type="radio" name="charsetGroup" value="&dcharIso2Cmd.label;" oncommand="SetDocumentCharacterSet(this.id);"/>