Bug 317190 - Change "Check Now" to "Set Firefox as the default browser". r=jaws

This commit is contained in:
Christian Ascheberg 2012-05-17 12:04:49 -07:00
parent ec4fb61f6f
commit e976840b4a
5 changed files with 63 additions and 72 deletions

View File

@ -61,6 +61,9 @@ var gAdvancedPane = {
advancedPrefs.selectedIndex = preference.value;
}
#ifdef HAVE_SHELL_SERVICE
this.updateSetDefaultBrowser();
#endif
#ifdef MOZ_UPDATER
this.updateReadPrefs();
#endif
@ -704,37 +707,26 @@ var gAdvancedPane = {
*/
/**
* 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.
* Show button for setting browser as default browser or information that
* browser is already the default browser.
*/
checkNow: function ()
updateSetDefaultBrowser: 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);
}
let selectedIndex = shellSvc.isDefaultBrowser(false) ? 1 : 0;
document.getElementById("setDefaultPane").selectedIndex = selectedIndex;
},
/**
* Set browser as the operating system default browser.
*/
setDefaultBrowser: function()
{
var shellSvc = Components.classes["@mozilla.org/browser/shell-service;1"]
.getService(Components.interfaces.nsIShellService);
shellSvc.setDefaultBrowser(true, false);
document.getElementById("setDefaultPane").selectedIndex = 1;
}
#endif
};

View File

@ -204,14 +204,17 @@
<caption label="&systemDefaults.label;"/>
#ifdef HAVE_SHELL_SERVICE
<hbox id="checkDefaultBox" align="center" flex="1">
<checkbox id="alwaysCheckDefault" preference="browser.shell.checkDefaultBrowser"
label="&alwaysCheckDefault.label;" accesskey="&alwaysCheckDefault.accesskey;"
flex="1"/>
<button id="checkDefaultButton"
label="&checkNow.label;" accesskey="&checkNow.accesskey;"
oncommand="gAdvancedPane.checkNow()"
preference="pref.general.disable_button.default_browser"/>
<checkbox id="alwaysCheckDefault" preference="browser.shell.checkDefaultBrowser"
label="&alwaysCheckDefault.label;" accesskey="&alwaysCheckDefault.accesskey;"
flex="1"/>
<hbox class="indent">
<deck id="setDefaultPane">
<button id="setDefaultButton"
label="&setDefault.label;" accesskey="&setDefault.accesskey;"
oncommand="gAdvancedPane.setDefaultBrowser();"
preference="pref.general.disable_button.default_browser"/>
<description>&isDefault.label;</description>
</deck>
</hbox>
#ifdef MOZ_CRASHREPORTER
<checkbox id="submitCrashesBox" flex="1"

View File

@ -20,6 +20,9 @@ var gAdvancedPane = {
if (preference.value !== null)
advancedPrefs.selectedIndex = preference.value;
#ifdef HAVE_SHELL_SERVICE
this.updateSetDefaultBrowser();
#endif
#ifdef MOZ_UPDATER
this.updateReadPrefs();
#endif
@ -667,37 +670,26 @@ var gAdvancedPane = {
*/
/**
* 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.
* Show button for setting browser as default browser or information that
* browser is already the default browser.
*/
checkNow: function ()
updateSetDefaultBrowser: 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);
}
let selectedIndex = shellSvc.isDefaultBrowser(false) ? 1 : 0;
document.getElementById("setDefaultPane").selectedIndex = selectedIndex;
},
/**
* Set browser as the operating system default browser.
*/
setDefaultBrowser: function()
{
var shellSvc = Components.classes["@mozilla.org/browser/shell-service;1"]
.getService(Components.interfaces.nsIShellService);
shellSvc.setDefaultBrowser(true, false);
document.getElementById("setDefaultPane").selectedIndex = 1;
}
#endif
};

View File

@ -189,14 +189,17 @@
<caption label="&systemDefaults.label;"/>
#ifdef HAVE_SHELL_SERVICE
<hbox id="checkDefaultBox" align="center" flex="1">
<checkbox id="alwaysCheckDefault" preference="browser.shell.checkDefaultBrowser"
label="&alwaysCheckDefault.label;" accesskey="&alwaysCheckDefault.accesskey;"
flex="1"/>
<button id="checkDefaultButton"
label="&checkNow.label;" accesskey="&checkNow.accesskey;"
oncommand="gAdvancedPane.checkNow()"
preference="pref.general.disable_button.default_browser"/>
<checkbox id="alwaysCheckDefault" preference="browser.shell.checkDefaultBrowser"
label="&alwaysCheckDefault.label;" accesskey="&alwaysCheckDefault.accesskey;"
flex="1"/>
<hbox class="indent">
<deck id="setDefaultPane">
<button id="setDefaultButton"
label="&setDefault.label;" accesskey="&setDefault.accesskey;"
oncommand="gAdvancedPane.setDefaultBrowser();"
preference="pref.general.disable_button.default_browser"/>
<description>&isDefault.label;</description>
</deck>
</hbox>
#ifdef MOZ_CRASHREPORTER
<checkbox id="submitCrashesBox" flex="1"

View File

@ -25,8 +25,9 @@
<!ENTITY systemDefaults.label "System Defaults">
<!ENTITY alwaysCheckDefault.label "Always check to see if &brandShortName; is the default browser on startup"><!--XXX-->
<!ENTITY alwaysCheckDefault.accesskey "w">
<!ENTITY checkNow.label "Check Now">
<!ENTITY checkNow.accesskey "N">
<!ENTITY setDefault.label "Make &brandShortName; the default browser">
<!ENTITY setDefault.accesskey "d">
<!ENTITY isDefault.label "&brandShortName; is currently your default browser">
<!ENTITY submitCrashes.label "Submit crash reports">
<!ENTITY submitCrashes.accesskey "S">
<!ENTITY submitTelemetry.label "Submit performance data">