Added a charset load listener for mail, bug 28869,r=cata.

This commit is contained in:
nhotta%netscape.com 2000-07-13 20:57:46 +00:00
Родитель 8db59d1ce5
Коммит 592e028e47
2 изменённых файлов: 52 добавлений и 4 удалений

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

@ -133,6 +133,18 @@ function UpdateCurrentCharset()
}
}
function UpdateCurrentMailCharset()
{
var charset = msgWindow.mailCharacterSet;
dump("UPdate current mail charset: " + charset + " \n");
var menuitem = document.getElementById('charset.' + charset);
if (menuitem) {
menuitem.setAttribute('checked', 'true');
}
}
function UpdateCharsetDetector()
{
var pref = Components.classes['component://netscape/preferences'];
@ -160,6 +172,12 @@ function UpdateMenus(event)
UpdateCharsetDetector();
}
function UpdateMailMenus(event)
{
UpdateCurrentMailCharset();
UpdateCharsetDetector();
}
function charsetLoadListener (event)
{
var menu = Components.classes['component://netscape/rdf/datasource?name=charset-menu'];
@ -180,6 +198,36 @@ function charsetLoadListener (event)
// weird assertion!
}
contentArea = window.document.getElementById("appcontent");
if (contentArea)
contentArea.addEventListener("load", charsetLoadListener, true);
function mailCharsetLoadListener (event)
{
var menu = Components.classes['component://netscape/rdf/datasource?name=charset-menu'];
if (menu) {
menu = menu.getService();
menu = menu.QueryInterface(Components.interfaces.nsICurrentCharsetListener);
var charset = msgWindow.mailCharacterSet;
if (charset.length > 0) {
menu.SetCurrentMailCharset(charset);
dump("mailCharsetLoadListener: " + charset + " \n");
}
}
}
var wintype = document.firstChild.getAttribute('windowtype');
if (window && (wintype == "navigator:browser"))
{
contentArea = window.document.getElementById("appcontent");
if (contentArea)
contentArea.addEventListener("load", charsetLoadListener, true);
}
else
{
var arrayOfStrings = wintype.split(":");
if (window && arrayOfStrings[0] == "mail")
{
contentArea = window.document.getElementById("messagepane");
if (contentArea)
contentArea.addEventListener("load", mailCharsetLoadListener, true);
}
}

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

@ -113,7 +113,7 @@
</menu>
<!-- Mail View Charset Menu -->
<menu id="mailviewCharsetMenu" value="&charsetMenu.label;" datasources="rdf:charset-menu" ref="NC:MailviewCharsetMenuRoot" oncommand="MailMultiplexHandler(event)" oncreate="UpdateCharsetDetector()">
<menu id="mailviewCharsetMenu" value="&charsetMenu.label;" datasources="rdf:charset-menu" ref="NC:MailviewCharsetMenuRoot" oncommand="MailMultiplexHandler(event)" oncreate="UpdateMailMenus()">
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#CharsetDetector">
<menupopup>