Ongoing prefs work.

git-svn-id: svn://10.0.0.236/trunk@126914 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
blakeross%telocity.com 2002-08-09 23:21:19 +00:00
parent d97c99843b
commit cb967957aa
3 changed files with 87 additions and 101 deletions

View File

@ -34,7 +34,7 @@
src="chrome://browser/content/pref/pref-fonts.js"/>
<script type="application/x-javascript">
<![CDATA[
var _elementIDs = ["selectLangs", "foregroundText", "background", "browserUseSystemColors", "unvisitedLinks", "visitedLinks", "browserUnderlineAnchors", "browserUseDocumentColors"];
var _elementIDs = ["selectLangs", "foregroundText", "background", "browserUseSystemColors", "unvisitedLinks", "visitedLinks", "browserUnderlineAnchors", "browserUseMyColors"];
]]>
</script>
@ -68,26 +68,15 @@
</menulist>
</caption>
<separator class="thin"/>
<grid>
<columns>
<column/>
<column flex="1"/>
<column/>
<column/>
</columns>
<rows>
<row align="center">
<spacer/>
<hbox align="center">
<label value="&typefaces.label;"/>
</hbox>
<hbox align="center">
<label value="&sizes.label;"/>
</hbox>
</row>
<row>
<separator class="thin"/>
</row>
@ -107,6 +96,9 @@
label="&useDefaultFontSansSerif.label;"/>
</menupopup>
</menulist>
<hbox align="center" pack="end">
<label value="&sizes.label;"/>
</hbox>
<menulist id="sizeVar" class="small-margin">
<menupopup>
<menuitem value="8" label="8"/>
@ -133,9 +125,6 @@
</menupopup>
</menulist>
</row>
<row>
<separator class="thin"/>
</row>
<row align="center">
<hbox align="center" pack="end">
<label value="&serif.label;"
@ -168,6 +157,9 @@
flex="1" style="width: 0px;" crop="right">
<menupopup/>
</menulist>
<hbox align="center" pack="end">
<label value="&sizes.label;"/>
</hbox>
<menulist id="sizeMono">
<menupopup>
<menuitem value="8" label="8"/>
@ -194,16 +186,38 @@
</menupopup>
</menulist>
</row>
<row>
<separator class="thin"/>
</row>
<row>
<spacer/>
</rows>
</grid>
<hbox flex="1">
<hbox align="center" pack="end">
<label value="&resolution.label;"
accesskey="&resolution.accesskey;"
control="screenResolution"/>
<menulist id="screenResolution"
oncommand="changeScreenResolution()"
dpi="&resolution.dpival;">
<menupopup>
<menuitem value=""
label="&resolution.dpival;"
id="otherResolution"/>
<menuitem value=""
label="&resolution.dpival;"
id="defaultResolution"/>
<menuitem value="0"
label="&resolution.system.label;"
id="systemResolution"
hidden="true"/>
<menuseparator/>
<menuitem id="userResolution" hidden="true"/>
<menuitem value="other" label="&resolution.other;"/>
</menupopup>
</menulist>
</hbox>
<spacer flex="1"/>
<hbox align="center" pack="end">
<label value="&minSize.label;"
accesskey="&minSize.accesskey;"
control="minSize"/>
</hbox>
<menulist id="minSize">
<menupopup>
<menuitem value="0" label="&minSize.none;"/>
@ -224,46 +238,21 @@
<menuitem value="24" label="24"/>
</menupopup>
</menulist>
</row>
</rows>
</grid>
</hbox>
</hbox>
</groupbox>
<separator class="thin"/>
<hbox align="center">
<label value="Allow documents to use other: "/>
<!-- Unchecking this removes the ability to select dynamic fonts -->
<checkbox id="browserUseDocumentFonts"
label="&useDocumentFonts.label;"
accesskey="&useDocumentFonts.accesskey;"/>
</hbox>
<separator class="thin"/>
<hbox align="center">
<label value="&resolution.label;"
accesskey="&resolution.accesskey;"
control="screenResolution"/>
<menulist id="screenResolution"
oncommand="changeScreenResolution()"
dpi="&resolution.dpival;">
<menupopup>
<menuitem value=""
label="&resolution.dpival;"
id="otherResolution"/>
<menuitem value=""
label="&resolution.dpival;"
id="defaultResolution"/>
<menuitem value="0"
label="&resolution.system.label;"
id="systemResolution"
hidden="true"/>
<menuseparator/>
<menuitem id="userResolution" hidden="true"/>
<menuitem value="other" label="&resolution.other;"/>
</menupopup>
</menulist>
<checkbox id="browserUseMyColors" label="&alwaysUseMyColors.label;"
accesskey="&alwaysUseMyColors.accesskey;"
prefstring="browser.display.use_document_colors"/>
</hbox>
<hbox>
<groupbox flex="1" id="pageColours">
@ -308,13 +297,4 @@
</hbox>
</groupbox>
</hbox>
<groupbox>
<caption label="&someProvColors;"/>
<checkbox id="browserUseDocumentColors" label="&alwaysUseMyColors.label;"
accesskey="&alwaysUseMyColors.accesskey;"
prefstring="browser.display.use_document_colors"/>
</groupbox>
</page>

View File

@ -56,7 +56,7 @@ function Startup()
return;
}
gData.loaded = true;
parent.hPrefWindow.registerOKCallbackFunc( applySkin );
parent.hPrefWindow.registerOKCallbackFunc(applyTheme);
const kPrefSvcContractID = "@mozilla.org/preferences;1";
const kPrefSvcIID = Components.interfaces.nsIPref;
@ -93,16 +93,12 @@ function Startup()
}
}
function applySkin()
function applyTheme()
{
var data = parent.hPrefWindow.wsm.dataManager.pageData["chrome://communicator/content/pref/pref-themes.xul"];
if (data.name == null)
return;
const kPrefSvcContractID = "@mozilla.org/preferences;1";
const kPrefSvcIID = Components.interfaces.nsIPref;
const kPrefSvc = Components.classes[kPrefSvcContractID].getService(kPrefSvcIID);
var theme = null;
try {
theme = kPrefSvc.getComplexValue("general.skins.selectedSkin",
@ -122,36 +118,55 @@ function applySkin()
var inUse = reg.isSkinSelected(data.name, true);
if (!theme && inUse == Components.interfaces.nsIChromeRegistry.FULL) return;
var str = Components.classes["@mozilla.org/supports-wstring;1"]
.createInstance(Components.interfaces.nsISupportsWString);
str.data = data.name;
var chromeRegistry = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
.getService(Components.interfaces.nsIXULChromeRegistry);
kPrefSvc.setComplexValue("general.skins.selectedSkin", Components.interfaces.nsISupportsWString, str);
// shut down quicklaunch so the next launch will have the new skin
var appShell = Components.classes['@mozilla.org/appshell/appShellService;1'].getService();
appShell = appShell.QueryInterface(Components.interfaces.nsIAppShellService);
var oldTheme = false;
try {
appShell.nativeAppSupport.isServerMode = false;
oldTheme = !chromeRegistry.checkThemeVersion(data.name);
}
catch(ex) {
catch(e) {
}
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
if (oldTheme) {
var title = gNavigatorBundle.getString("oldthemetitle");
var message = gNavigatorBundle.getString("oldTheme");
var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].getService();
strBundleService = strBundleService.QueryInterface(Components.interfaces.nsIStringBundleService);
var navbundle = strBundleService.createBundle("chrome://navigator/locale/navigator.properties");
var brandbundle = strBundleService.createBundle("chrome://global/locale/brand.properties");
if (promptService && navbundle && brandbundle) {
var dialogTitle = navbundle.GetStringFromName("switchskinstitle");
var brandName = brandbundle.GetStringFromName("brandShortName");
var msg = navbundle.formatStringFromName("switchskins", [brandName], 1);
promptService.alert(window, dialogTitle, msg);
message = message.replace(/%theme_name%/, themeName.getAttribute("displayName"));
message = message.replace(/%brand%/g, gBrandBundle.getString("brandShortName"));
if (promptService.confirm(window, title, message)){
var inUse = chromeRegistry.isSkinSelected(data.name, true);
chromeRegistry.uninstallSkin(data.name, true);
var str = Components.classes["@mozilla.org/supports-wstring;1"]
.createInstance(Components.interfaces.nsISupportsWString);
str.data = true;
pref.setComplexValue("general.skins.removelist." + data.name,
Components.interfaces.nsISupportsWString, str);
if (inUse)
chromeRegistry.refreshSkins();
}
return;
}
var str = Components.classes["@mozilla.org/supports-wstring;1"]
.createInstance(Components.interfaces.nsISupportsWString);
str.data = data.name;
kPrefSvc.setComplexValue("general.skins.selectedSkin", Components.interfaces.nsISupportsWString, str);
chromeRegistry.selectSkin(data.name, true);
chromeRegistry.refreshSkins();
}
function uninstallSkin()
{
var list = document.getElementById("skinsList");

View File

@ -52,8 +52,8 @@
<!ENTITY newLanguages.label "New languages can be configured using the Languages Panel.">
<!ENTITY useDocumentFonts.label "Allow documents to use other fonts">
<!ENTITY useDocumentFonts.accesskey "o">
<!ENTITY useDocumentFonts.label "Fonts">
<!ENTITY useDocumentFonts.accesskey "F">
<!-- leaving this stuff in for now -->
@ -83,7 +83,6 @@
<!ENTITY units.inches "inches">
<!ENTITY units.centimetres "centimeters">
<!-- LOCALIZATION NOTE : FILE Color management prefs -->
<!ENTITY lHeader "Colors">
<!ENTITY color "Text and Background">
<!ENTITY textColor.label "Text:">
@ -100,14 +99,6 @@
<!ENTITY linkColor.accesskey "l">
<!ENTITY visitedLinkColor.label "Visited Links:">
<!ENTITY visitedLinkColor.accesskey "v">
<!-- LOCALIZATION NOTE (someProvColors): This is the start of a sentence and will be followed by the following radio buttons. -->
<!ENTITY someProvColors "When a web page provides its own colors and background">
<!-- LOCALIZATION NOTE (alwaysUseDocColors.label): This is option one, and it appends to 'someProvColors' above. -->
<!ENTITY alwaysUseDocumentColors.label "Always use the colors and background specified by the web page">
<!ENTITY alwaysUseDocumentColors.accesskey "a">
<!-- LOCALIZATION NOTE (ignoreDocColors.label): This is option two, and it appends to 'someProvColors' above. -->
<!ENTITY useMyColors.label "Use my chosen colors, ignoring the colors and background image specified">
<!ENTITY useMyColors.accesskey "i">
<!ENTITY viewsource "View Source Window">
<!ENTITY syntaxHighlight.label "Enable syntax highlighting">
<!ENTITY syntaxHighlight.accesskey "e">
<!ENTITY alwaysUseMyColors.label "Colors">
<!ENTITY alwaysUseMyColors.accesskey "C">