From b0132a26a6efe9275b663c2c476da95ae8f1e09b Mon Sep 17 00:00:00 2001 From: "rob_strong@exchangecode.com" Date: Mon, 3 Dec 2007 18:38:06 -0800 Subject: [PATCH] Bug 406387 - Move System Defaults from Main to Advanced - General. r=sspitzer, approval1.9=dsicore --- browser/components/preferences/advanced.js | 47 ++++++++++++++++++ browser/components/preferences/advanced.xul | 32 ++++++++++++- browser/components/preferences/main.js | 48 ------------------- browser/components/preferences/main.xul | 33 +------------ .../components/preferences/preferences.xul | 6 +-- .../chrome/browser/preferences/advanced.dtd | 10 +++- .../en-US/chrome/browser/preferences/main.dtd | 19 ++------ .../browser/preferences/preferences.dtd | 6 +-- 8 files changed, 99 insertions(+), 102 deletions(-) diff --git a/browser/components/preferences/advanced.js b/browser/components/preferences/advanced.js index 080a68400ca5..8b094d61bcd1 100644 --- a/browser/components/preferences/advanced.js +++ b/browser/components/preferences/advanced.js @@ -399,4 +399,51 @@ var gAdvancedPane = { "chrome://pippki/content/device_manager.xul", "", null); } +#ifdef HAVE_SHELL_SERVICE + , + + // SYSTEM DEFAULTS + + /* + * Preferences: + * + * browser.shell.checkDefault + * - true if a default-browser check (and prompt to make it so if necessary) + * occurs at startup, false otherwise + */ + + /** + * Checks whether the browser is currently registered with the operating + * system as the default browser. If the browser is not currently the + * default browser, the user is given the option of making it the default; + * otherwise, the user is informed that this browser already is the browser. + */ + checkNow: function () + { + var shellSvc = Components.classes["@mozilla.org/browser/shell-service;1"] + .getService(Components.interfaces.nsIShellService); + var brandBundle = document.getElementById("bundleBrand"); + var shellBundle = document.getElementById("bundleShell"); + var brandShortName = brandBundle.getString("brandShortName"); + var promptTitle = shellBundle.getString("setDefaultBrowserTitle"); + var promptMessage; + const IPS = Components.interfaces.nsIPromptService; + var psvc = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] + .getService(IPS); + if (!shellSvc.isDefaultBrowser(false)) { + promptMessage = shellBundle.getFormattedString("setDefaultBrowserMessage", + [brandShortName]); + var rv = psvc.confirmEx(window, promptTitle, promptMessage, + IPS.STD_YES_NO_BUTTONS, + null, null, null, null, { }); + if (rv == 0) + shellSvc.setDefaultBrowser(true, false); + } + else { + promptMessage = shellBundle.getFormattedString("alreadyDefaultBrowser", + [brandShortName]); + psvc.alert(window, promptTitle, promptMessage); + } + } +#endif }; diff --git a/browser/components/preferences/advanced.xul b/browser/components/preferences/advanced.xul index 672fe37af079..de3c07756f6a 100644 --- a/browser/components/preferences/advanced.xul +++ b/browser/components/preferences/advanced.xul @@ -72,6 +72,15 @@ +#ifdef HAVE_SHELL_SERVICE + + + +#endif @@ -114,6 +123,11 @@ type="bool"/> +#ifdef HAVE_SHELL_SERVICE + + +#endif +