bug 127993:selected theme doesnot have one checked flag

r=bryner sr=blake
Check in for Jerry Tan(jerry.tan@sun.com)'s fix
This commit is contained in:
pete.zha%sun.com 2002-04-24 06:52:30 +00:00
Родитель f85a738fa5
Коммит eac26beb25
2 изменённых файлов: 26 добавлений и 5 удалений

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

@ -1410,7 +1410,8 @@ function stylesheetSwitchAll(frameset, title) {
function applyTheme(themeName)
{
var name = themeName.getAttribute("name");
var id = themeName.getAttribute('id');
var name=id.substring('urn:mozilla.skin.'.length, id.length);
if (!name)
return;
@ -1456,7 +1457,7 @@ function applyTheme(themeName)
// we STILL haven't fixed editor skin switch problems
// hacking around it yet again
str.data = themeName.getAttribute("name");
str.data = name;
pref.setComplexValue("general.skins.selectedSkin", Components.interfaces.nsISupportsWString, str);
if (promptService) {
var dialogTitle = gNavigatorBundle.getString("switchskinstitle");
@ -1738,4 +1739,22 @@ function toHistory()
}
function checkTheme()
{
var theSkinKids = document.getElementById("theme");
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
.getService(Components.interfaces.nsIXULChromeRegistry);
for (var i = 0; i < theSkinKids.childNodes.length; ++i) {
var child = theSkinKids.childNodes[i];
var id=child.getAttribute("id");
if (id.length > 0) {
var themeName = id.substring('urn:mozilla:skin:'.length, id.length);
var selected = chromeRegistry.isSkinSelected(themeName, true);
if (selected == Components.interfaces.nsIChromeRegistry.FULL) {
var menuitem=document.getElementById(id);
menuitem.setAttribute("checked", true);
break;
}
}
}
}

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

@ -254,7 +254,7 @@
<menuitem accesskey="&pageInfoCmd.accesskey;" label="&pageInfoCmd.label;" key="key_viewInfo" command="View:PageInfo"/>
<menuseparator />
<menu label="&applyTheme.label;" accesskey="&applyTheme.accesskey;">
<menupopup datasources="rdf:chrome" ref="urn:mozilla:skin:root" oncommand="applyTheme(event.target)">
<menupopup id="theme" datasources="rdf:chrome" ref="urn:mozilla:skin:root" oncommand="applyTheme(event.target)" onpopupshowing="checkTheme()">
<menuitem label="&themePreferencesCmd.label;" accesskey="&themePreferencesCmd.accesskey;"
oncommand="goPreferences('pref-themes.xul','chrome://communicator/content/pref/pref-themes.xul')"/>
<menuitem label="&getNewThemesCmd.label;" accesskey="&getNewThemesCmd.accesskey;" oncommand="getNewThemes();"/>
@ -263,7 +263,9 @@
<menuitem uri="..."
label="rdf:http://www.mozilla.org/rdf/chrome#displayName"
accesskey="rdf:http://www.mozilla.org/rdf/chrome#accessKey"
name="rdf:http://www.mozilla.org/rdf/chrome#name"/>
id="rdf:http://www.mozilla.org/rdf/chrome#name"
type="radio"
name="themeGroup"/>
</template>
</menupopup>
</menu>