299507 - automatic update options dialog contains too much text. revised UI designed by mike beltzner.

also fixes preferences binding to use event names that match the onfoo attributes.
This commit is contained in:
ben@bengoodger.com
2005-08-02 05:27:14 +00:00
parent d5ca0bda2e
commit 21051a9d5c
3 changed files with 154 additions and 65 deletions

View File

@@ -44,6 +44,10 @@ var gAdvancedPane = {
if (preference.value === null) if (preference.value === null)
return; return;
advancedPrefs.selectedIndex = preference.value; advancedPrefs.selectedIndex = preference.value;
this.updateAppUpdateItems();
this.updateAutoItems();
this.updateModeItems();
}, },
tabSelectionChanged: function () tabSelectionChanged: function ()
@@ -90,29 +94,109 @@ var gAdvancedPane = {
"chrome://pippki/content/device_manager.xul", "chrome://pippki/content/device_manager.xul",
"width=600,height=400", null); "width=600,height=400", null);
}, },
updateAppUpdateUI: function ()
{
var preference = document.getElementById("app.update.enabled");
document.getElementById("enableAutoInstall").disabled = !preference.value;
/**
* UI state matrix for update preference conditions
*
* UI Components: Preferences
* 1 = Firefox checkbox i = app.update.enabled
* 2 = Check Now button for Firefox ii = app.update.auto
* 3 = When updates for Firefox are found label iii = app.update.mode
* 4 = Automatic Radiogroup (Ask vs. Automatically)
* 5 = Warn before disabling extensions checkbox
*
* States:
* Element p val locked Disabled
* 1,2 i t/f f false
* i t/f t true
* ii t/f t/f false
* iii 0/1/2 t/f false
* 3,4 i t t/f false
* i f t/f true
* ii t/f f false
* ii t/f t true
* iii 0/1/2 t/f false
* 5 i t t/f false
* i f t/f true
* ii t t/f false
* ii f t/f true
* iii 0/1/2 f false
* iii 0/1/2 t true
*
*/
updateAppUpdateItems: function ()
{
var aus = var aus =
Components.classes["@mozilla.org/updates/update-service;1"]. Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService); getService(Components.interfaces.nsIApplicationUpdateService);
var checkNowButton = document.getElementById("checkNowButton");
checkNowButton.disabled = !aus.canUpdate;
this.updateAutoPref(); var enabledPref = document.getElementById("app.update.enabled");
return undefined;
var enableAppUpdate = document.getElementById("enableAppUpdate");
var appCheckNowButton = document.getElementById("appCheckNowButton");
appCheckNowButton.disabled = enableAppUpdate.disabled = !aus.canUpdate;
}, },
updateAutoPref: function () updateAutoItems: function ()
{ {
var preference = document.getElementById("app.update.auto"); var enabledPref = document.getElementById("app.update.enabled");
var updateEnabledPref = document.getElementById("app.update.enabled"); var autoPref = document.getElementById("app.update.auto");
var autoInstallOptions = document.getElementById("autoInstallOptions");
autoInstallOptions.disabled = !preference.value || !updateEnabledPref.value; var updateModeLabel = document.getElementById("updateModeLabel");
return undefined; var updateMode = document.getElementById("updateMode");
var disable = !enabledPref.value || autoPref.locked;
updateModeLabel.disabled = updateMode.disabled = disable;
},
updateModeItems: function ()
{
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var modePref = document.getElementById("app.update.mode");
var warnIncompatible = document.getElementById("warnIncompatible");
var disable = !enabledPref.value || !autoPref.value || modePref.locked;
warnIncompatible.disabled = disable;
},
/**
* The Extensions checkbox and button are disabled only if the enable Addon
* update preference is locked.
*/
updateAddonUpdateUI: function ()
{
var enabledPref = document.getElementById("extensions.update.enabled");
var enableAddonUpdate = document.getElementById("enableAddonUpdate");
var addonCheckNowButton = document.getElementById("addonCheckNowButton");
enableAddonUpdate.disabled = addonCheckNowButton.disabled = enabledPref.locked;
},
/**
* app.update.mode is a three state integer preference, and we have to
* express all three values in a single checkbox:
* "Warn me if this will disable extensions or themes"
* Preference Value Checkbox State Meaning
* 0 Unchecked Do not warn
* 1 Checked Warn if there are incompatibilities
* 2 Checked Warn if there are incompatibilities,
* or the update is major.
*/
_modePreference: -1,
addonWarnSyncFrom: function ()
{
var preference = document.getElementById("app.update.mode");
var doNotWarn = preference.value != 0;
gAdvancedPane._modePreference = doNotWarn ? preference.value : 1;
return doNotWarn;
},
addonWarnSyncTo: function ()
{
var warnIncompatible = document.getElementById("warnIncompatible");
return !warnIncompatible.checked ? 0 : gAdvancedPane._modePreference;
}, },
checkForAddonUpdates: function () checkForAddonUpdates: function ()

View File

@@ -50,6 +50,10 @@
helpURI="chrome://browser/locale/help/help.rdf"> helpURI="chrome://browser/locale/help/help.rdf">
<preferences> <preferences>
<preference id="browser.preferences.advanced.selectedTabIndex"
name="browser.preferences.advanced.selectedTabIndex"
type="int"/>
<preference id="accessibility.browsewithcaret" name="accessibility.browsewithcaret" type="bool"/> <preference id="accessibility.browsewithcaret" name="accessibility.browsewithcaret" type="bool"/>
<preference id="accessibility.typeaheadfind" name="accessibility.typeaheadfind" type="bool"/> <preference id="accessibility.typeaheadfind" name="accessibility.typeaheadfind" type="bool"/>
<preference id="browser.enable_automatic_image_resizing" <preference id="browser.enable_automatic_image_resizing"
@@ -57,20 +61,23 @@
type="bool"/> type="bool"/>
<preference id="general.autoScroll" name="general.autoScroll" type="bool"/> <preference id="general.autoScroll" name="general.autoScroll" type="bool"/>
<preference id="general.smoothScroll" name="general.smoothScroll" type="bool"/> <preference id="general.smoothScroll" name="general.smoothScroll" type="bool"/>
<preference id="app.update.enabled" name="app.update.enabled" type="bool"/>
<preference id="app.update.auto" name="app.update.auto" type="bool"/> <preference id="app.update.enabled" name="app.update.enabled" type="bool"
<preference id="extensions.update.autoUpdateEnabled" onchange="gAdvancedPane.updateAppUpdateItems();
name="extensions.update.autoUpdateEnabled" gAdvancedPane.updateAutoItems();
type="bool"/> gAdvancedPane.updateModeItems();"/>
<preference id="app.update.auto" name="app.update.auto" type="bool"
onchange="gAdvancedPane.updateAutoItems();
gAdvancedPane.updateModeItems();"/>
<preference id="app.update.mode" name="app.update.mode" type="int"
onchange="gAdvancedPane.updateModeItems();"/>
<preference id="extensions.update.enabled" name="extensions.update.enabled" type="bool"
onchange="gAdvancedPane.updateAddonUpdateUI();"/>
<preference id="security.enable_ssl2" name="security.enable_ssl2" type="bool"/> <preference id="security.enable_ssl2" name="security.enable_ssl2" type="bool"/>
<preference id="security.enable_ssl3" name="security.enable_ssl3" type="bool"/> <preference id="security.enable_ssl3" name="security.enable_ssl3" type="bool"/>
<preference id="security.enable_tls" name="security.enable_tls" type="bool"/> <preference id="security.enable_tls" name="security.enable_tls" type="bool"/>
<preference id="security.default_personal_cert" name="security.default_personal_cert" type="string"/> <preference id="security.default_personal_cert" name="security.default_personal_cert" type="string"/>
<preference id="browser.preferences.advanced.selectedTabIndex"
name="browser.preferences.advanced.selectedTabIndex"
type="int"/>
<preference id="security.disable_button.openCertManager" <preference id="security.disable_button.openCertManager"
name="security.disable_button.openCertManager" name="security.disable_button.openCertManager"
type="bool"/> type="bool"/>
@@ -125,50 +132,48 @@
</hbox> </hbox>
</groupbox> </groupbox>
</tabpanel> </tabpanel>
<tabpanel orient="vertical"> <tabpanel orient="vertical" align="start">
<vbox> <label>&autoCheck.label;</label>
<label>&softwareupdateinfo.label;</label> <vbox class="indent">
<separator class="thin"/> <hbox>
<vbox align="start" class="updateControls">
<checkbox id="enableAppUpdate" <checkbox id="enableAppUpdate"
label="&enableAppUpdate.label;" label="&enableAppUpdate.label;"
accesskey="&enableAppUpdate.accesskey;" accesskey="&enableAppUpdate.accesskey;"
preference="app.update.enabled" preference="app.update.enabled"/>
onsyncfrompreference="return gAdvancedPane.updateAppUpdateUI();"/> <spacer flex="1"/>
<vbox class="indent"> <button id="appCheckNowButton"
<hbox align="center"> label="&checkNow.label;" accesskey="&appCheckNow.accesskey;"
<checkbox id="enableAutoInstall" oncommand="gAdvancedPane.checkForUpdates();"/>
label="&enableAutoInstall.label;" </hbox>
accesskey="&enableAutoInstall.accesskey;" <hbox>
preference="app.update.auto" <checkbox id="enableAddonUpdate"
onsyncfrompreference="return gAdvancedPane.updateAutoPref();"/>
<spacer flex="1"/>
<button id="autoInstallOptions"
label="&autoInstallOptions.label;" accesskey="&autoInstallOptions.accesskey;"
oncommand="gAdvancedPane.showAutoInstallOptions();"/>
</hbox>
<hbox>
<button id="checkNowButton"
label="&checkNow.label;" accesskey="&appCheckNow.accesskey;"
oncommand="gAdvancedPane.checkForUpdates();"/>
<button label="&showUpdates.label;" accesskey="&showUpdates.accesskey;"
oncommand="gAdvancedPane.showUpdates();"/>
</hbox>
</vbox>
</vbox>
<separator/>
<vbox align="start" class="updateControls">
<checkbox id="enableExtensionUpdate"
label="&enableExtensionUpdate.label;" label="&enableExtensionUpdate.label;"
accesskey="&enableExtensionUpdate.accesskey;" accesskey="&enableExtensionUpdate.accesskey;"
preference="extensions.update.autoUpdateEnabled"/> preference="extensions.update.enabled"/>
<hbox class="indent"> <spacer flex="1"/>
<button label="&checkNow.label;" accesskey="&extensionsCheckNow.accesskey;" <button id="addonCheckNowButton"
oncommand="gAdvancedPane.checkForAddonUpdates();" label="&checkNow.label;" accesskey="&extensionsCheckNow.accesskey;"
preference="extensions.update.autoUpdateEnabled"/> oncommand="gAdvancedPane.checkForAddonUpdates();"/>
</hbox> </hbox>
</vbox>
</vbox> </vbox>
<separator/>
<label id="updateModeLabel">&whenUpdatesFound.label;</label>
<radiogroup id="updateMode" class="indent"
preference="app.update.auto">
<radio id="ask" value="false"
label="&modeAskMe.label;"
accesskey="&modeAskMe.accesskey;"/>
<radio id="automatic" value="true"
label="&modeAutomatic.label;"
accesskey="&modeAutomatic.accesskey;"/>
<hbox class="indent">
<checkbox id="warnIncompatible"
label="&modeAutoWarn.label;" accesskey="&modeAutoWarn.accesskey;"
preference="app.update.mode"
onsyncfrompreference="return gAdvancedPane.addonWarnSyncFrom();"
onsynctopreference="return gAdvancedPane.addonWarnSyncTo();"/>
</hbox>
</radiogroup>
</tabpanel> </tabpanel>
<tabpanel orient="vertical"> <tabpanel orient="vertical">
<groupbox> <groupbox>

View File

@@ -326,7 +326,7 @@
// Value changed, synthesize an event // Value changed, synthesize an event
try { try {
var event = document.createEvent("Events"); var event = document.createEvent("Events");
event.initEvent("preferenceread", false, true); event.initEvent("syncfrompreference", false, true);
var f = new Function ("event", var f = new Function ("event",
aElement.getAttribute("onsyncfrompreference")); aElement.getAttribute("onsyncfrompreference"));
rv = f(event); rv = f(event);
@@ -352,7 +352,7 @@
// Value changed, synthesize an event // Value changed, synthesize an event
try { try {
var event = document.createEvent("Events"); var event = document.createEvent("Events");
event.initEvent("preferencewrite", false, true); event.initEvent("synctopreference", false, true);
var f = new Function ("event", var f = new Function ("event",
aElement.getAttribute("onsynctopreference")); aElement.getAttribute("onsynctopreference"));
var rv = f(event); var rv = f(event);