зеркало из https://github.com/mozilla/pjs.git
Bug #315057 --> Display - Fonts tab: The pull-down menu of Character Encodings doesn't work.
build the menu popup by hand instead of using the xul template builder (which doesn't work with dynamic overlays) sr=bienvenu
This commit is contained in:
Родитель
9258492ae5
Коммит
09e8cdbd29
|
@ -44,6 +44,12 @@ var gDisplayPane = {
|
||||||
var preference = document.getElementById("mail.preferences.display.selectedTabIndex");
|
var preference = document.getElementById("mail.preferences.display.selectedTabIndex");
|
||||||
if (preference.value)
|
if (preference.value)
|
||||||
document.getElementById("displayPrefs").selectedIndex = preference.value;
|
document.getElementById("displayPrefs").selectedIndex = preference.value;
|
||||||
|
|
||||||
|
// build the charset menu list. We do this by hand instead of using the xul template
|
||||||
|
// builder because of Bug #285076,
|
||||||
|
this.createCharsetMenus(document.getElementById("viewDefaultCharset-menupopup"), "NC:DecodersRoot",
|
||||||
|
document.getElementById('mailnews.view_default_charset').value);
|
||||||
|
|
||||||
this.mInitialized = true;
|
this.mInitialized = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -74,6 +80,44 @@ var gDisplayPane = {
|
||||||
{
|
{
|
||||||
document.documentElement.openSubDialog("chrome://messenger/content/preferences/fonts.xul", "", null);
|
document.documentElement.openSubDialog("chrome://messenger/content/preferences/fonts.xul", "", null);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
addMenuItem: function(aMenuPopup, aLabel, aValue)
|
||||||
|
{
|
||||||
|
var menuItem = document.createElement('menuitem');
|
||||||
|
menuItem.setAttribute('label', aLabel);
|
||||||
|
menuItem.setAttribute('value', aValue);
|
||||||
|
aMenuPopup.appendChild(menuItem);
|
||||||
|
},
|
||||||
|
|
||||||
|
readRDFString: function(aDS,aRes,aProp)
|
||||||
|
{
|
||||||
|
var n = aDS.GetTarget(aRes, aProp, true);
|
||||||
|
return (n) ? n.QueryInterface(Components.interfaces.nsIRDFLiteral).Value : "";
|
||||||
|
},
|
||||||
|
|
||||||
|
createCharsetMenus: function(aMenuPopup, aRoot, aPreferenceValue)
|
||||||
|
{
|
||||||
|
var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"]
|
||||||
|
.getService(Components.interfaces.nsIRDFService);
|
||||||
|
var kNC_Root = rdfService.GetResource(aRoot);
|
||||||
|
var kNC_Name = rdfService.GetResource("http://home.netscape.com/NC-rdf#Name");
|
||||||
|
|
||||||
|
var rdfDataSource = rdfService.GetDataSource("rdf:charset-menu");
|
||||||
|
var rdfContainer = Components.classes["@mozilla.org/rdf/container;1"].getService(Components.interfaces.nsIRDFContainer);
|
||||||
|
rdfContainer.Init(rdfDataSource, kNC_Root);
|
||||||
|
|
||||||
|
var charset;
|
||||||
|
var availableCharsets = rdfContainer.GetElements();
|
||||||
|
|
||||||
|
for (var i = 0; i < rdfContainer.GetCount(); i++)
|
||||||
|
{
|
||||||
|
charset = availableCharsets.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
|
||||||
|
|
||||||
|
this.addMenuItem(aMenuPopup, this.readRDFString(rdfDataSource, charset, kNC_Name), charset.Value);
|
||||||
|
if (charset.Value == aPreferenceValue)
|
||||||
|
aMenuPopup.parentNode.value = charset.Value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
mCharsetMenuInitialized: false,
|
mCharsetMenuInitialized: false,
|
||||||
readDefaultCharset: function()
|
readDefaultCharset: function()
|
||||||
|
@ -83,6 +127,10 @@ var gDisplayPane = {
|
||||||
Components.classes["@mozilla.org/observer-service;1"]
|
Components.classes["@mozilla.org/observer-service;1"]
|
||||||
.getService(Components.interfaces.nsIObserverService)
|
.getService(Components.interfaces.nsIObserverService)
|
||||||
.notifyObservers(null, "charsetmenu-selected", "mailedit");
|
.notifyObservers(null, "charsetmenu-selected", "mailedit");
|
||||||
|
// build the charset menu list. We do this by hand instead of using the xul template
|
||||||
|
// builder because of Bug #285076,
|
||||||
|
this.createCharsetMenus(document.getElementById("sendDefaultCharset-menupopup"), "NC:MaileditCharsetMenuRoot",
|
||||||
|
document.getElementById('mailnews.send_default_charset').value);
|
||||||
this.mCharsetMenuInitialized = true;
|
this.mCharsetMenuInitialized = true;
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|
|
@ -229,26 +229,19 @@
|
||||||
<row align="center" class="indent">
|
<row align="center" class="indent">
|
||||||
<label control="sendDefaultCharsetList"
|
<label control="sendDefaultCharsetList"
|
||||||
value="&sendDefaultCharset.label;" accesskey="&sendDefaultCharset.accesskey;"/>
|
value="&sendDefaultCharset.label;" accesskey="&sendDefaultCharset.accesskey;"/>
|
||||||
<menulist id="sendDefaultCharsetList" ref="NC:MaileditCharsetMenuRoot" datasources="rdf:charset-menu"
|
|
||||||
preference="mailnews.send_default_charset" onsyncfrompreference="return gDisplayPane.readDefaultCharset();">
|
<menulist id="sendDefaultCharsetList" flex="1" preference="mailnews.send_default_charset" onsyncfrompreference="return gDisplayPane.readDefaultCharset();">
|
||||||
<template>
|
<menupopup id="sendDefaultCharset-menupopup">
|
||||||
<menupopup>
|
</menupopup>
|
||||||
<menuitem label="rdf:http://home.netscape.com/NC-rdf#Name" value="..." uri="..."/>
|
|
||||||
</menupopup>
|
|
||||||
</template>
|
|
||||||
</menulist>
|
</menulist>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
<row align="center" class="indent">
|
<row align="center" class="indent">
|
||||||
<label control="viewDefaultCharsetList"
|
<label control="viewDefaultCharsetList"
|
||||||
value="&viewDefaultCharsetList.label;" accesskey="&viewDefaultCharsetList.accesskey;"/>
|
value="&viewDefaultCharsetList.label;" accesskey="&viewDefaultCharsetList.accesskey;"/>
|
||||||
<menulist id="viewDefaultCharsetList" ref="NC:DecodersRoot" datasources="rdf:charset-menu"
|
<menulist id="viewDefaultCharsetList" preference="mailnews.view_default_charset">
|
||||||
preference="mailnews.view_default_charset">
|
<menupopup id="viewDefaultCharset-menupopup">
|
||||||
<template>
|
</menupopup>
|
||||||
<menupopup>
|
|
||||||
<menuitem label="rdf:http://home.netscape.com/NC-rdf#Name" value="..." uri="..."/>
|
|
||||||
</menupopup>
|
|
||||||
</template>
|
|
||||||
</menulist>
|
</menulist>
|
||||||
</row>
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче