Bug 1040868 - Move 'default browser'stuff back to the General preferences pane. r=jaws.

This commit is contained in:
Asaf Romano 2014-08-18 15:02:58 +03:00
Родитель 4e4c94ea80
Коммит 485af060ec
15 изменённых файлов: 250 добавлений и 228 удалений

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

@ -30,43 +30,6 @@ var gAdvancedPane = {
advancedPrefs.selectedIndex = preference.value;
}
#ifdef HAVE_SHELL_SERVICE
this.updateSetDefaultBrowser();
#ifdef XP_WIN
// In Windows 8 we launch the control panel since it's the only
// way to get all file type association prefs. So we don't know
// when the user will select the default. We refresh here periodically
// in case the default changes. On other Windows OS's defaults can also
// be set while the prefs are open.
window.setInterval(this.updateSetDefaultBrowser, 1000);
#ifdef MOZ_METRO
// Pre Windows 8, we should hide the update related settings
// for the Metro browser
let version = Components.classes["@mozilla.org/system-info;1"].
getService(Components.interfaces.nsIPropertyBag2).
getProperty("version");
let preWin8 = parseFloat(version) < 6.2;
this._showingWin8Prefs = !preWin8;
if (preWin8) {
["autoMetro", "autoMetroIndent"].forEach(
function(id) document.getElementById(id).collapsed = true
);
} else {
let brandShortName =
document.getElementById("bundleBrand").getString("brandShortName");
let bundlePrefs = document.getElementById("bundlePreferences");
let autoDesktop = document.getElementById("autoDesktop");
autoDesktop.label =
bundlePrefs.getFormattedString("updateAutoDesktop.label",
[brandShortName]);
autoDesktop.accessKey =
bundlePrefs.getString("updateAutoDesktop.accessKey");
}
#endif
#endif
#endif
#ifdef MOZ_UPDATER
this.updateReadPrefs();
#endif
@ -854,49 +817,4 @@ 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
*/
/**
* Show button for setting browser as default browser or information that
* browser is already the default browser.
*/
updateSetDefaultBrowser: function()
{
let shellSvc = getShellService();
let setDefaultPane = document.getElementById("setDefaultPane");
if (!shellSvc) {
setDefaultPane.hidden = true;
document.getElementById("alwaysCheckDefault").disabled = true;
return;
}
let selectedIndex =
shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
setDefaultPane.selectedIndex = selectedIndex;
},
/**
* Set browser as the operating system default browser.
*/
setDefaultBrowser: function()
{
let shellSvc = getShellService();
if (!shellSvc)
return;
shellSvc.setDefaultBrowser(true, false);
let selectedIndex =
shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
document.getElementById("setDefaultPane").selectedIndex = selectedIndex;
}
#endif
};

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

@ -40,16 +40,6 @@
#endif
<preference id="layout.spellcheckDefault" name="layout.spellcheckDefault" type="int"/>
#ifdef HAVE_SHELL_SERVICE
<preference id="browser.shell.checkDefaultBrowser"
name="browser.shell.checkDefaultBrowser"
type="bool"/>
<preference id="pref.general.disable_button.default_browser"
name="pref.general.disable_button.default_browser"
type="bool"/>
#endif
<!-- Data Choices tab -->
#ifdef MOZ_TELEMETRY_REPORTING
@ -172,26 +162,6 @@
onsynctopreference="return gAdvancedPane.writeCheckSpelling();"
preference="layout.spellcheckDefault"/>
</groupbox>
#ifdef HAVE_SHELL_SERVICE
<!-- System Defaults -->
<groupbox id="systemDefaultsGroup" orient="vertical">
<caption label="&systemDefaults.label;"/>
<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>
</groupbox>
#endif
</tabpanel>
#ifdef MOZ_DATA_REPORTING

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

@ -22,42 +22,6 @@ var gAdvancedPane = {
if (preference.value !== null)
advancedPrefs.selectedIndex = preference.value;
#ifdef HAVE_SHELL_SERVICE
this.updateSetDefaultBrowser();
#ifdef XP_WIN
// In Windows 8 we launch the control panel since it's the only
// way to get all file type association prefs. So we don't know
// when the user will select the default. We refresh here periodically
// in case the default changes. On other Windows OS's defaults can also
// be set while the prefs are open.
window.setInterval(this.updateSetDefaultBrowser, 1000);
#ifdef MOZ_METRO
// Pre Windows 8, we should hide the update related settings
// for the Metro browser
let version = Components.classes["@mozilla.org/system-info;1"].
getService(Components.interfaces.nsIPropertyBag2).
getProperty("version");
let preWin8 = parseFloat(version) < 6.2;
this._showingWin8Prefs = !preWin8;
if (preWin8) {
["autoMetro", "autoMetroIndent"].forEach(
function(id) document.getElementById(id).collapsed = true
);
} else {
let brandShortName =
document.getElementById("bundleBrand").getString("brandShortName");
let bundlePrefs = document.getElementById("bundlePreferences");
let autoDesktop = document.getElementById("autoDesktop");
autoDesktop.label =
bundlePrefs.getFormattedString("updateAutoDesktop.label",
[brandShortName]);
autoDesktop.accessKey =
bundlePrefs.getString("updateAutoDesktop.accessKey");
}
#endif
#endif
#endif
#ifdef MOZ_UPDATER
this.updateReadPrefs();
#endif
@ -825,49 +789,4 @@ var gAdvancedPane = {
"mozilla:devicemanager",
"modal=yes", 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
*/
/**
* Show button for setting browser as default browser or information that
* browser is already the default browser.
*/
updateSetDefaultBrowser: function()
{
let shellSvc = getShellService();
let setDefaultPane = document.getElementById("setDefaultPane");
if (!shellSvc) {
setDefaultPane.hidden = true;
document.getElementById("alwaysCheckDefault").disabled = true;
return;
}
let selectedIndex =
shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
setDefaultPane.selectedIndex = selectedIndex;
},
/**
* Set browser as the operating system default browser.
*/
setDefaultBrowser: function()
{
let shellSvc = getShellService();
if (!shellSvc)
return;
shellSvc.setDefaultBrowser(true, false);
let selectedIndex =
shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
document.getElementById("setDefaultPane").selectedIndex = selectedIndex;
}
#endif
};

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

@ -44,16 +44,6 @@
name="layout.spellcheckDefault"
type="int"/>
#ifdef HAVE_SHELL_SERVICE
<preference id="browser.shell.checkDefaultBrowser"
name="browser.shell.checkDefaultBrowser"
type="bool"/>
<preference id="pref.general.disable_button.default_browser"
name="pref.general.disable_button.default_browser"
type="bool"/>
#endif
#ifdef MOZ_TELEMETRY_REPORTING
<preference id="toolkit.telemetry.enabled"
name="toolkit.telemetry.enabled"
@ -200,23 +190,6 @@
onsynctopreference="return gAdvancedPane.writeCheckSpelling();"
preference="layout.spellcheckDefault"/>
</groupbox>
#ifdef HAVE_SHELL_SERVICE
<!-- System Defaults -->
<groupbox id="systemDefaultsGroup" orient="vertical" align="start">
<caption><label>&systemDefaults.label;</label></caption>
<checkbox id="alwaysCheckDefault" preference="browser.shell.checkDefaultBrowser"
label="&alwaysCheckDefault.label;" accesskey="&alwaysCheckDefault.accesskey;"/>
<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"/>
<label id="isDefaultLabel">&isDefault.label;</label>
</deck>
</hbox>
</groupbox>
#endif
</tabpanel>
#ifdef MOZ_DATA_REPORTING
<!-- Data Choices -->

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

@ -11,6 +11,43 @@ var gMainPane = {
*/
init: function ()
{
#ifdef HAVE_SHELL_SERVICE
this.updateSetDefaultBrowser();
#ifdef XP_WIN
// In Windows 8 we launch the control panel since it's the only
// way to get all file type association prefs. So we don't know
// when the user will select the default. We refresh here periodically
// in case the default changes. On other Windows OS's defaults can also
// be set while the prefs are open.
window.setInterval(this.updateSetDefaultBrowser, 1000);
#ifdef MOZ_METRO
// Pre Windows 8, we should hide the update related settings
// for the Metro browser
let version = Components.classes["@mozilla.org/system-info;1"].
getService(Components.interfaces.nsIPropertyBag2).
getProperty("version");
let preWin8 = parseFloat(version) < 6.2;
this._showingWin8Prefs = !preWin8;
if (preWin8) {
["autoMetro", "autoMetroIndent"].forEach(
function(id) document.getElementById(id).collapsed = true
);
} else {
let brandShortName =
document.getElementById("bundleBrand").getString("brandShortName");
let bundlePrefs = document.getElementById("bundlePreferences");
let autoDesktop = document.getElementById("autoDesktop");
autoDesktop.label =
bundlePrefs.getFormattedString("updateAutoDesktop.label",
[brandShortName]);
autoDesktop.accessKey =
bundlePrefs.getString("updateAutoDesktop.accessKey");
}
#endif
#endif
#endif
// set up the "use current page" label-changing listener
this._updateUseCurrentButton();
window.addEventListener("focus", this._updateUseCurrentButton.bind(this), false);
@ -495,4 +532,46 @@ var gMainPane = {
var linkTargeting = document.getElementById("linkTargeting");
return linkTargeting.checked ? 3 : 2;
}
#ifdef HAVE_SHELL_SERVICE
,
/*
* Preferences:
*
* browser.shell.checkDefault
* - true if a default-browser check (and prompt to make it so if necessary)
* occurs at startup, false otherwise
*/
/**
* Show button for setting browser as default browser or information that
* browser is already the default browser.
*/
updateSetDefaultBrowser: function()
{
let shellSvc = getShellService();
let defaultBrowserBox = document.getElementById("defaultBrowserBox");
if (!shellSvc) {
defaultBrowserBox.hidden = true;
return;
}
let setDefaultPane = document.getElementById("setDefaultPane");
let selectedIndex = shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
setDefaultPane.selectedIndex = selectedIndex;
},
/**
* Set browser as the operating system default browser.
*/
setDefaultBrowser: function()
{
let shellSvc = getShellService();
if (!shellSvc)
return;
shellSvc.setDefaultBrowser(true, false);
let selectedIndex =
shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
document.getElementById("setDefaultPane").selectedIndex = selectedIndex;
}
#endif
};

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

@ -17,6 +17,16 @@
name="browser.startup.homepage"
type="wstring"/>
#ifdef HAVE_SHELL_SERVICE
<preference id="browser.shell.checkDefaultBrowser"
name="browser.shell.checkDefaultBrowser"
type="bool"/>
<preference id="pref.general.disable_button.default_browser"
name="pref.general.disable_button.default_browser"
type="bool"/>
#endif
<preference id="pref.browser.homepage.disable_button.current_page"
name="pref.browser.homepage.disable_button.current_page"
type="bool"/>
@ -100,6 +110,27 @@
hidden="true">
<caption><label>&startup.label;</label></caption>
#ifdef HAVE_SHELL_SERVICE
<vbox id="defaultBrowserBox">
<hbox align="center">
<checkbox id="alwaysCheckDefault" preference="browser.shell.checkDefaultBrowser"
label="&alwaysCheckDefault.label;" accesskey="&alwaysCheckDefault2.accesskey;"/>
</hbox>
<deck id="setDefaultPane">
<hbox align="center" class="indent">
<label id="isNotDefaultLabel" flex="1">&isNotDefault.label;</label>
<button id="setDefaultButton"
label="&setAsMyDefaultBrowser.label;" accesskey="&setAsMyDefaultBrowser.accesskey;"
oncommand="gMainPane.setDefaultBrowser();"
preference="pref.general.disable_button.default_browser"/>
</hbox>
<hbox align="center" class="indent">
<label id="isDefaultLabel" flex="1">&isDefault.label;</label>
</hbox>
</deck>
<separator class="thin"/>
</vbox>
#endif
<hbox align="center">
<label accesskey="&startupPage.accesskey;"
control="browserStartupPage">&startupPage.label;</label>

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

@ -27,7 +27,7 @@ browser.jar:
* content/browser/preferences/languages.xul
content/browser/preferences/languages.js
* content/browser/preferences/main.xul
content/browser/preferences/main.js
* content/browser/preferences/main.js
* content/browser/preferences/permissions.xul
* content/browser/preferences/permissions.js
* content/browser/preferences/preferences.xul

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

@ -17,6 +17,43 @@ var gMainPane = {
{
this._pane = document.getElementById("paneMain");
#ifdef HAVE_SHELL_SERVICE
this.updateSetDefaultBrowser();
#ifdef XP_WIN
// In Windows 8 we launch the control panel since it's the only
// way to get all file type association prefs. So we don't know
// when the user will select the default. We refresh here periodically
// in case the default changes. On other Windows OS's defaults can also
// be set while the prefs are open.
window.setInterval(this.updateSetDefaultBrowser, 1000);
#ifdef MOZ_METRO
// Pre Windows 8, we should hide the update related settings
// for the Metro browser
let version = Components.classes["@mozilla.org/system-info;1"].
getService(Components.interfaces.nsIPropertyBag2).
getProperty("version");
let preWin8 = parseFloat(version) < 6.2;
this._showingWin8Prefs = !preWin8;
if (preWin8) {
["autoMetro", "autoMetroIndent"].forEach(
function(id) document.getElementById(id).collapsed = true
);
} else {
let brandShortName =
document.getElementById("bundleBrand").getString("brandShortName");
let bundlePrefs = document.getElementById("bundlePreferences");
let autoDesktop = document.getElementById("autoDesktop");
autoDesktop.label =
bundlePrefs.getFormattedString("updateAutoDesktop.label",
[brandShortName]);
autoDesktop.accessKey =
bundlePrefs.getString("updateAutoDesktop.accessKey");
}
#endif
#endif
#endif
// set up the "use current page" label-changing listener
this._updateUseCurrentButton();
window.addEventListener("focus", this._updateUseCurrentButton.bind(this), false);
@ -427,4 +464,46 @@ var gMainPane = {
startupPref.updateElements(); // select the correct index in the startup menulist
}
}
#ifdef HAVE_SHELL_SERVICE
,
/*
* Preferences:
*
* browser.shell.checkDefault
* - true if a default-browser check (and prompt to make it so if necessary)
* occurs at startup, false otherwise
*/
/**
* Show button for setting browser as default browser or information that
* browser is already the default browser.
*/
updateSetDefaultBrowser: function()
{
let shellSvc = getShellService();
let defaultBrowserBox = document.getElementById("defaultBrowserBox");
if (!shellSvc) {
defaultBrowserBox.hidden = true;
return;
}
let setDefaultPane = document.getElementById("setDefaultPane");
let selectedIndex = shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
setDefaultPane.selectedIndex = selectedIndex;
},
/**
* Set browser as the operating system default browser.
*/
setDefaultBrowser: function()
{
let shellSvc = getShellService();
if (!shellSvc)
return;
shellSvc.setDefaultBrowser(true, false);
let selectedIndex =
shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
document.getElementById("setDefaultPane").selectedIndex = selectedIndex;
}
#endif
};

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

@ -34,6 +34,16 @@
name="browser.startup.homepage"
type="wstring"/>
#ifdef HAVE_SHELL_SERVICE
<preference id="browser.shell.checkDefaultBrowser"
name="browser.shell.checkDefaultBrowser"
type="bool"/>
<preference id="pref.general.disable_button.default_browser"
name="pref.general.disable_button.default_browser"
type="bool"/>
#endif
<preference id="pref.browser.homepage.disable_button.current_page"
name="pref.browser.homepage.disable_button.current_page"
type="bool"/>
@ -67,6 +77,27 @@
<groupbox id="startupGroup">
<caption label="&startup.label;"/>
#ifdef HAVE_SHELL_SERVICE
<vbox id="defaultBrowserBox">
<hbox align="center">
<checkbox id="alwaysCheckDefault" preference="browser.shell.checkDefaultBrowser"
label="&alwaysCheckDefault.label;" accesskey="&alwaysCheckDefault2.accesskey;"/>
</hbox>
<deck id="setDefaultPane">
<hbox align="center" class="indent">
<label id="isNotDefaultLabel" flex="1">&isNotDefault.label;</label>
<button id="setDefaultButton"
label="&setAsMyDefaultBrowser.label;" accesskey="&setAsMyDefaultBrowser.accesskey;"
oncommand="gMainPane.setDefaultBrowser();"
preference="pref.general.disable_button.default_browser"/>
</hbox>
<hbox align="center" class="indent">
<label id="isDefaultLabel" flex="1">&isDefault.label;</label>
</hbox>
</deck>
<separator class="thin"/>
</vbox>
#endif
<hbox align="center">
<label value="&startupPage.label;" accesskey="&startupPage.accesskey;"
control="browserStartupPage"/>

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

@ -26,13 +26,6 @@
<!ENTITY checkSpelling.label "Check my spelling as I type">
<!ENTITY checkSpelling.accesskey "t">
<!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 setDefault.label "Make &brandShortName; the default browser">
<!ENTITY setDefault.accesskey "d">
<!ENTITY isDefault.label "&brandShortName; is currently your default browser">
<!ENTITY dataChoicesTab.label "Data Choices">
<!ENTITY healthReportSection.label "&brandShortName; Health Report">

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

@ -30,3 +30,11 @@
<!ENTITY chooseFolderMac.accesskey "e">
<!ENTITY alwaysAsk.label "Always ask me where to save files">
<!ENTITY alwaysAsk.accesskey "A">
<!ENTITY alwaysCheckDefault.label "Always check to see if &brandShortName; is the default browser on startup">
<!ENTITY alwaysCheckDefault2.accesskey "w">
<!ENTITY setAsMyDefaultBrowser.label "Make &brandShortName; My Default Browser">
<!ENTITY setAsMyDefaultBrowser.accesskey "D">
<!ENTITY isDefault.label "&brandShortName; is currently your default browser">
<!ENTITY isNotDefault.label "&brandShortName; is not your default browser">

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

@ -54,6 +54,11 @@ label.small {
margin: 5px;
}
/* General Pane */
#isNotDefaultLabel {
font-weight: bold;
}
/* Content Pane */
#translationAttributionImage {
width: 70px;

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

@ -167,6 +167,12 @@ caption {
font: message-box !important;
}
/* General Pane */
#isNotDefaultLabel {
font-weight: bold;
}
/**
* Privacy Pane
*/

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

@ -100,6 +100,10 @@ prefpane {
/* General Pane */
#isNotDefaultLabel {
font-weight: bold;
}
#downloadFolder {
-moz-margin-start: 0;
}

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

@ -53,6 +53,12 @@ label.small {
margin: 6px;
}
/* General Pane */
#isNotDefaultLabel {
font-weight: bold;
}
/* Content Pane */
#translationAttributionImage {
width: 70px;