зеркало из https://github.com/mozilla/pjs.git
Fix for 44025 - clean up UI of themes pref panel; 49763 - enable 'restore default' theme
This commit is contained in:
Родитель
a2cdabb893
Коммит
b9a77a3b74
|
@ -2,95 +2,86 @@
|
|||
// Theme Selector
|
||||
// ( 05/09/2000, Ben Goodger <ben@netscape.com> )
|
||||
|
||||
var bundle = srGetStrBundle("chrome://communicator/locale/pref/prefutilities.properties");
|
||||
|
||||
const DEBUG_USE_PROFILE = true;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
var chromeRegistry = Components.classes["component://netscape/chrome/chrome-registry"].getService();
|
||||
if ( chromeRegistry )
|
||||
chromeRegistry = chromeRegistry.QueryInterface( Components.interfaces.nsIChromeRegistry );
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
}
|
||||
try {
|
||||
var chromeRegistry = Components.classes["component://netscape/chrome/chrome-registry"].getService();
|
||||
if ( chromeRegistry )
|
||||
chromeRegistry = chromeRegistry.QueryInterface( Components.interfaces.nsIChromeRegistry );
|
||||
}
|
||||
catch(e) {}
|
||||
|
||||
function selectSkin()
|
||||
{
|
||||
function Startup()
|
||||
{
|
||||
var tree = document.getElementById( "skinsTree" );
|
||||
var theSkinKids = document.getElementById("theSkinKids");
|
||||
if (theSkinKids.hasChildNodes() && theSkinKids.firstChild)
|
||||
tree.selectItem(theSkinKids.firstChild);
|
||||
}
|
||||
|
||||
function applySkin()
|
||||
{
|
||||
var tree = document.getElementById( "skinsTree" );
|
||||
var selectedSkinItem = tree.selectedItems[0];
|
||||
var skinName = selectedSkinItem.getAttribute( "name" );
|
||||
chromeRegistry.selectSkin( skinName, DEBUG_USE_PROFILE );
|
||||
chromeRegistry.refreshSkins();
|
||||
}
|
||||
|
||||
function deselectSkin()
|
||||
{
|
||||
var tree = document.getElementById( "skinsTree" );
|
||||
var selectedSkinItem = tree.selectedItems[0];
|
||||
var skinName = selectedSkinItem.getAttribute( "name" );
|
||||
chromeRegistry.deselectSkin( skinName, DEBUG_USE_PROFILE );
|
||||
chromeRegistry.refreshSkins();
|
||||
}
|
||||
|
||||
// XXX DEBUG ONLY. DO NOT LOCALIZE
|
||||
function installSkin()
|
||||
{
|
||||
var themeURL = prompt( "Enter URL for a skin to install:","");
|
||||
chromeRegistry.installSkin( themeURL, DEBUG_USE_PROFILE, false );
|
||||
}
|
||||
|
||||
function themeSelect()
|
||||
{
|
||||
var tree = document.getElementById("skinsTree");
|
||||
var selectedItem = tree.selectedItems.length ? tree.selectedItems[0] : null;
|
||||
if (selectedItem && selectedItem.getAttribute("skin") == "true") {
|
||||
var themeName = selectedItem.getAttribute("displayName");
|
||||
var nameField = document.getElementById("displayName");
|
||||
nameField.setAttribute("value", themeName);
|
||||
var author = document.getElementById("author");
|
||||
author.setAttribute("value", selectedItem.getAttribute("author"));
|
||||
var image = document.getElementById("previewImage");
|
||||
image.setAttribute("src", selectedItem.getAttribute("image"));
|
||||
var descText = document.createTextNode(selectedItem.getAttribute("description"));
|
||||
var description = document.getElementById("description");
|
||||
while (description.hasChildNodes())
|
||||
description.removeChild(description.firstChild);
|
||||
description.appendChild(descText);
|
||||
var applyButton = document.getElementById("applySkin");
|
||||
var applyLabel = bundle.GetStringFromName("applyThemePrefix");
|
||||
applyLabel = applyLabel.replace(/%theme_name%/, themeName);
|
||||
applyButton.value = applyLabel;
|
||||
}
|
||||
}
|
||||
|
||||
function restoreDefaults()
|
||||
{
|
||||
var theSkinKids = document.getElementById("theSkinKids");
|
||||
if (theSkinKids.hasChildNodes()) {
|
||||
var defaultTheme = theSkinKids.firstChild;
|
||||
var tree = document.getElementById( "skinsTree" );
|
||||
|
||||
var commonDialogs = nsJSComponentManager.getService("component://netscape/appshell/commonDialogs",
|
||||
"nsICommonDialogs");
|
||||
|
||||
var selectedSkinItem = tree.selectedItems[0];
|
||||
var skinName = selectedSkinItem.getAttribute( "name" );
|
||||
chromeRegistry.selectSkin( skinName, DEBUG_USE_PROFILE );
|
||||
chromeRegistry.refreshSkins();
|
||||
}
|
||||
|
||||
function deselectSkin()
|
||||
{
|
||||
var tree = document.getElementById( "skinsTree" );
|
||||
var selectedSkinItem = tree.selectedItems[0];
|
||||
var skinName = selectedSkinItem.getAttribute( "name" );
|
||||
chromeRegistry.deselectSkin( skinName, DEBUG_USE_PROFILE );
|
||||
chromeRegistry.refreshSkins();
|
||||
}
|
||||
}
|
||||
|
||||
// XXX DEBUG ONLY. DO NOT LOCALIZE
|
||||
function installSkin()
|
||||
{
|
||||
var themeURL = prompt( "Enter URL for a skin to install:","");
|
||||
chromeRegistry.installSkin( themeURL, DEBUG_USE_PROFILE, false );
|
||||
}
|
||||
|
||||
function themeSelect()
|
||||
{
|
||||
var tree = document.getElementById("skinsTree");
|
||||
var selectedItem = tree.selectedItems.length ? tree.selectedItems[0] : null;
|
||||
if (selectedItem && selectedItem.getAttribute("skin") == "true")
|
||||
{
|
||||
var displayName = document.getElementById("displayName");
|
||||
displayName.setAttribute("value", selectedItem.getAttribute("displayName"));
|
||||
var author = document.getElementById("author");
|
||||
author.setAttribute("value", selectedItem.getAttribute("author"));
|
||||
var email = document.getElementById("email");
|
||||
var address = selectedItem.getAttribute("email");
|
||||
if (address)
|
||||
{
|
||||
email.removeAttribute("disabled");
|
||||
email.setAttribute("emailaddress", address);
|
||||
email.setAttribute("tooltiptext", address);
|
||||
email.setAttribute("emailtitle", selectedItem.getAttribute("displayName"));
|
||||
}
|
||||
else
|
||||
email.setAttribute("disabled", "true");
|
||||
var website = document.getElementById("website");
|
||||
var url = selectedItem.getAttribute("website");
|
||||
if (url)
|
||||
{
|
||||
website.removeAttribute("disabled");
|
||||
website.setAttribute("website", url);
|
||||
website.setAttribute("tooltiptext", url);
|
||||
}
|
||||
else
|
||||
website.setAttribute("disabled", "true");
|
||||
var image = document.getElementById("previewImage");
|
||||
image.setAttribute("src", selectedItem.getAttribute("image"));
|
||||
}
|
||||
}
|
||||
|
||||
function gotoWebsite(aElement)
|
||||
{
|
||||
openTopWin(aElement.getAttribute("website"));
|
||||
}
|
||||
|
||||
function sendEmail(aElement)
|
||||
{
|
||||
window.openDialog( "chrome://messenger/content/messengercompose/messengercompose.xul", "_blank",
|
||||
"chrome,all,dialog=no", "subject='" + aElement.getAttribute('displayName') + "',bodyislink=true");
|
||||
|
||||
}
|
||||
|
||||
var bundle = srGetStrBundle("chrome://communicator/locale/pref/prefutilities.properties");
|
||||
|
|
@ -32,6 +32,7 @@
|
|||
<window xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
class="color-dialog"
|
||||
onload="Startup()"
|
||||
orient="vertical">
|
||||
|
||||
<script language="JavaScript" src="chrome://global/content/strres.js"></script>
|
||||
|
@ -46,19 +47,18 @@
|
|||
|
||||
<tree class="inset" id="skinsTree" datasources="rdf:chrome"
|
||||
onselect="themeSelect();"
|
||||
ref="urn:mozilla:skin:root" flex="1">
|
||||
ref="urn:mozilla:skin:root" rows="5">
|
||||
<treecolgroup>
|
||||
<treecol flex="1"/>
|
||||
</treecolgroup>
|
||||
<template>
|
||||
<rule>
|
||||
<treechildren flex="1">
|
||||
<treechildren>
|
||||
<treeitem uri="..." skin="true"
|
||||
author="rdf:http://www.mozilla.org/rdf/chrome#author"
|
||||
displayName="rdf:http://www.mozilla.org/rdf/chrome#displayName"
|
||||
name="rdf:http://www.mozilla.org/rdf/chrome#name"
|
||||
email="rdf:http://www.mozilla.org/rdf/chrome#email"
|
||||
website="rdf:http://www.mozilla.org/rdf/chrome#website"
|
||||
description="rdf:http://www.mozilla.org/rdf/chrome#description"
|
||||
image="rdf:http://www.mozilla.org/rdf/chrome#image">
|
||||
<treerow>
|
||||
<treecell value="rdf:http://www.mozilla.org/rdf/chrome#displayName"/>
|
||||
|
@ -67,49 +67,34 @@
|
|||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
<treechildren id="theSkinKids" flex="1"/>
|
||||
</tree>
|
||||
|
||||
<tabcontrol id="skinsTabcontrol" orient="vertical">
|
||||
<tabbox>
|
||||
<tab selected="true" value="&preview.label;"/>
|
||||
<tab value="&general.label;"/>
|
||||
</tabbox>
|
||||
<tabpanel>
|
||||
<box class="inset" style="overflow: auto; height: 8em;">
|
||||
<image id="previewImage"/>
|
||||
</box>
|
||||
<grid flex="1">
|
||||
<columns>
|
||||
<column/>
|
||||
<column flex="1"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<text class="label" value="&displayName.label;"/>
|
||||
<text class="label" id="displayName"/>
|
||||
</row>
|
||||
<row>
|
||||
<text class="label" value="&author.label;"/>
|
||||
<text class="label" id="author"/>
|
||||
</row>
|
||||
<row>
|
||||
<spring/>
|
||||
<box>
|
||||
<button id="email" value="&email.label;" accesskey="&email.accesskey;"
|
||||
oncommand="sendEmail(this);" tooltip="aTooltip" disabled="true"/>
|
||||
<button id="website" value="&website.label;" accesskey="&website.accesskey;"
|
||||
oncommand="gotoWebsite(this);" tooltip="aTooltip" disabled="true"/>
|
||||
</box>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</tabpanel>
|
||||
</tabcontrol>
|
||||
|
||||
<separator class="thin"/>
|
||||
|
||||
<box autostretch="never" halign="right">
|
||||
<button value="&selectSkin.label;" accesskey="&selectSkin.accesskey;" oncommand="selectSkin();"/>
|
||||
<box class="inset" style="overflow: auto; height: 8em;">
|
||||
<image id="previewImage"/>
|
||||
</box>
|
||||
|
||||
<separator class="thin"/>
|
||||
|
||||
<box flex="1">
|
||||
<box orient="vertical" flex="1">
|
||||
<text class="label header" id="displayName" value="foopy"/>
|
||||
<box autostretch="never">
|
||||
<text class="label" value="&author.label;"/>
|
||||
<text class="label" id="author"/>
|
||||
</box>
|
||||
<html id="description" flex="1"/>
|
||||
</box>
|
||||
<box orient="vertical" align="top">
|
||||
<button id="applySkin" value="&selectSkin.label;" accesskey="&selectSkin.accesskey;" oncommand="applySkin();"/>
|
||||
</box>
|
||||
</box>
|
||||
|
||||
<separator class="groove"/>
|
||||
<box>
|
||||
<button value="&restoreDefaults.label;" accesskey="&restoreDefaults.accesskey;" oncommand="restoreDefaults();"/>
|
||||
</box>
|
||||
|
||||
</window>
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
</script>
|
||||
</box>
|
||||
|
||||
<separator class="groove"/>
|
||||
<separator/>
|
||||
|
||||
<box id="okCancelButtonsRight" />
|
||||
|
||||
|
|
|
@ -5,18 +5,12 @@
|
|||
<!ENTITY skinIntro.label "Selecting a new theme changes the look of buttons, dialog boxes, menus, toolbars, and other items. It does not change the way these items function.">
|
||||
<!ENTITY installedThemes.label "Installed themes:">
|
||||
|
||||
<!ENTITY selectSkin.label "Switch Theme">
|
||||
<!ENTITY selectSkin.accesskey "s">
|
||||
|
||||
<!ENTITY installSkin.label "Install Theme...">
|
||||
<!ENTITY installSkin.accesskey "i">
|
||||
<!ENTITY selectSkin.label "Apply Theme">
|
||||
<!ENTITY selectSkin.accesskey "a">
|
||||
|
||||
<!ENTITY general.label "General">
|
||||
<!ENTITY preview.label "Preview Image">
|
||||
<!ENTITY displayName.label "Theme Name">
|
||||
<!ENTITY author.label "Author">
|
||||
<!ENTITY email.label "Email">
|
||||
<!ENTITY email.accesskey "e">
|
||||
<!ENTITY website.label "Website">
|
||||
<!ENTITY website.accesskey "w">
|
||||
|
||||
<!ENTITY restoreDefaults.label "Restore Default">
|
||||
<!ENTITY restoreDefaults.accesskey "r">
|
||||
|
|
|
@ -4,3 +4,7 @@ choosefile=Choose a file
|
|||
viewrow=View...
|
||||
hiderow=Hide
|
||||
nofontsforlang=No fonts available for this language
|
||||
|
||||
# Themes preferences panel inserts the name of the selected
|
||||
# theme into the %theme_name% segment
|
||||
applyThemePrefix=Apply %theme_name%
|
Загрузка…
Ссылка в новой задаче