CCK only - not part of build - properly support welcome and upgrade page

This commit is contained in:
mkaply%us.ibm.com 2008-02-15 13:40:50 +00:00
Родитель 84d1520ba9
Коммит 7f5ec9e4d4
4 изменённых файлов: 71 добавлений и 30 удалений

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

@ -53,14 +53,20 @@
<!ENTITY orgName.label "Enter Your Company Identifier (up to 10 characters; no spaces):">
<!ENTITY orgName.caption "Company Identifier">
<!ENTITY homePage.caption "Home Pages">
<!ENTITY homePage.caption "Home Page">
<!ENTITY homePage.label "Default Home Page URL:">
<!ENTITY homePage.description "This page is displayed when users first start the Firefox browser, or when they click the Home button.">
<!ENTITY homePageOverride.description "On the very first invocation of Firefox after a new profile is created, a welcome page is displayed. You can choose to replace this page or to not display it at all.">
<!ENTITY homePageOverride.label "Replacement Welcome Page URL:">
<!ENTITY homePageWelcome.caption "Welcome Page">
<!ENTITY homePageWelcome.description "On the very first invocation of Firefox after a new profile is created, a welcome page is displayed. You can choose to replace this page or to not display it at all.">
<!ENTITY homePageWelcome.label "Replacement Welcome Page URL:">
<!ENTITY noWelcomePage.label "Do not display the welcome page">
<!ENTITY homePageOverride.caption "Upgrade Page">
<!ENTITY homePageOverride.description "After upgrading to a new version of Firefox, an override page is displayed. You can choose to replace this page or to not display it at all.">
<!ENTITY homePageOverride.label "Upgrade Page URL:">
<!ENTITY noOverridePage.label "Do not display the upgrade page">
<!ENTITY titleBar.caption "Browser Window&apos;s Title Bar Text">
<!ENTITY titleBar.label "Custom Title Bar Text:">
<!ENTITY titleBar.description "The text you enter (for example, your company name) appears after the page title in the title bar. It is recommended that you use the format

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

@ -358,6 +358,7 @@ Array.prototype.exists = function (x) {
}
var prefsLockOnly = ["browser.startup.homepage", "browser.throbber.url",
"startup.homepage_override_url", "startup.homepage_welcome_url",
"network.proxy.type", "network.proxy.http", "network.proxy.http_port",
"network.proxy.share_proxy_settings", "network.proxy.ssl",
"network.proxy.ssl_port", "network.proxy.ftp", "network.proxy.ftp_port",
@ -1751,8 +1752,9 @@ function CCKWriteDefaultJS(destdir)
{
var throbber1 = 'pref("browser.throbber.url", "';
var homepage1 = 'pref("browser.startup.homepage", "';
var homepage2 = 'pref("startup.homepage_override_url", "chrome://cck/content/cck.properties");\n';
var override = 'pref("browser.startup.homepage_override.mstone", "ignore");\n';
var homepage2 = 'pref("startup.homepage_override_url", "';
var homepage3 = 'pref("startup.homepage_welcome_url", "';
var chromeurl = "chrome://cck/content/cck.properties";
var prefend = '");\n';
var useragent1begin = 'pref("general.useragent.vendorComment", "CK-';
@ -1773,36 +1775,42 @@ function CCKWriteDefaultJS(destdir)
var logobuttonurl = document.getElementById("AnimatedLogoURL").value;
if (logobuttonurl && (logobuttonurl.length > 0)) {
fos.write(throbber1, throbber1.length);
if (prefIsLocked("browser.throbber.url")) {
fos.write(logobuttonurl, logobuttonurl.length);
} else {
/* If the pref is locked, we set it in our service using */
/* The value from properties */
if (!prefIsLocked("browser.throbber.url")) {
fos.write(throbber1, throbber1.length);
fos.write(chromeurl, chromeurl.length);
fos.write(prefend, prefend.length);
}
fos.write(prefend, prefend.length);
}
var browserstartuppage = document.getElementById("HomePageURL").value;
var overrideurl = document.getElementById('HomePageOverrideURL').value;
var welcomeurl = document.getElementById('HomePageWelcomeURL').value;
if (browserstartuppage && (browserstartuppage.length > 0)) {
fos.write(homepage1, homepage1.length);
if (prefIsLocked("browser.startup.homepage")) {
fos.write(browserstartuppage, browserstartuppage.length);
} else {
/* If the pref is locked, we set it in our service using */
/* The value from properties */
if (!prefIsLocked("browser.startup.homepage")) {
fos.write(homepage1, homepage1.length);
fos.write(chromeurl, chromeurl.length);
fos.write(prefend, prefend.length);
}
}
if ((overrideurl && overrideurl.length) || (document.getElementById("noOverridePage").checked)) {
fos.write(homepage2, homepage2.length);
if (!document.getElementById("noOverridePage").checked) {
fos.write(overrideurl, overrideurl.length);
}
fos.write(prefend, prefend.length);
}
if ((welcomeurl && welcomeurl.length) || (document.getElementById("noWelcomePage").checked)) {
fos.write(homepage3, homepage3.length);
if (!document.getElementById("noWelcomePage").checked) {
fos.write(welcomeurl, welcomeurl.length);
}
fos.write(prefend, prefend.length);
}
fos.write(homepage2, homepage2.length);
} else if (overrideurl && overrideurl.length) {
fos.write(homepage2, homepage2.length);
}
if (document.getElementById("noWelcomePage").checked) {
fos.write(override, override.length);
}
var bundle = document.getElementById("bundle_cckwizard");
if (document.getElementById("defaultSearchEngine").selectedItem.label != bundle.getString("useBrowserDefault")) {
@ -2712,6 +2720,9 @@ function CCKReadConfigFile(srcdir)
var noWelcomePage = document.getElementById("noWelcomePage");
noWelcomePage.checked = configarray["noWelcomePage"];
var noWelcomePage = document.getElementById("noOverridePage");
noWelcomePage.checked = configarray["noOverridePage"];
var proxyitem = document.getElementById("shareAllProxies");
proxyitem.checked = configarray["shareAllProxies"];

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

@ -216,15 +216,32 @@
<label control="HomePageURL">&homePage.label;</label>
<textbox id="HomePageURL" flex="1"/>
</hbox>
</groupbox>
<groupbox>
<caption label="&homePageWelcome.caption;"/>
<description>&homePageWelcome.description;</description>
<hbox align="center">
<label control="HomePageWelcomeURL">&homePageWelcome.label;</label>
<textbox id="HomePageWelcomeURL" flex="1"/>
</hbox>
<hbox align="center">
<checkbox id="noWelcomePage" label="&noWelcomePage.label;"/>
</hbox>
</groupbox>
<groupbox>
<caption label="&homePageOverride.caption;"/>
<description>&homePageOverride.description;</description>
<hbox align="center">
<label control="HomePageOverrideURL">&homePageOverride.label;</label>
<textbox id="HomePageOverrideURL" flex="1"/>
</hbox>
<hbox align="center">
<checkbox id="noWelcomePage" label="&noWelcomePage.label;"/>
<checkbox id="noOverridePage" label="&noOverridePage.label;"/>
</hbox>
</groupbox>
</wizardpage>
<wizardpage label="&customizePartTwo.label;" onpageshow="initimage('LargeStillPath','LargeStill');initimage('LargeAnimPath','LargeAnim');" onpageadvanced="return ValidateFile('LargeAnimPath','LargeStillPath');">
<groupbox>
<caption label="&titleBar.caption;"/>
<description>&titleBar.description;</description>
@ -233,9 +250,6 @@
<textbox id="CompanyName" flex="1"/>
</hbox>
</groupbox>
</wizardpage>
<wizardpage label="&customizePartTwo.label;" onpageshow="initimage('LargeStillPath','LargeStill');initimage('LargeAnimPath','LargeAnim');" onpageadvanced="return ValidateFile('LargeAnimPath','LargeStillPath');">
<groupbox>
<caption label="&animLogo.caption;"/>
<description>&animLogoURL.description;</description>

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

@ -93,6 +93,9 @@ CCKService.prototype={
var defprefbranch;
try {
prefbranch=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
defprefbranch = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService)
.getDefaultBranch(null);
} catch (ex) {
return;
}
@ -253,8 +256,15 @@ CCKService.prototype={
prefName = "";
}
if (prefName && prefName.length) {
if (prefName == "browser.startup.homepage") {
if ((prefName == "browser.startup.homepage") || (prefName == "browser.throbber.url")) {
var url = bundle.GetStringFromName(prefName);
if (url) {
defprefbranch.setCharPref(prefName, url);
} else {
url = defprefbranch.getComplexValue(prefName,
Components.interfaces.nsIPrefLocalizedString).data;
defprefbranch.setCharPref(prefName, url);
}
}
prefbranch.lockPref(prefName);
}