Bug 600505: Reorganize app update preference ui to not favor disabling app update. ui-review=faaborg, r=rstrong

This commit is contained in:
Steffen Wilberg 2011-10-13 13:01:58 -07:00
Родитель 800156d876
Коммит eea63f98ea
3 изменённых файлов: 140 добавлений и 139 удалений

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

@ -22,6 +22,7 @@
# Contributor(s):
# Ben Goodger <ben@mozilla.org>
# Jeff Walden <jwalden+code@mit.edu>
# Steffen Wilberg <steffen.wilberg@web.de>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -61,9 +62,7 @@ var gAdvancedPane = {
}
#ifdef MOZ_UPDATER
this.updateAppUpdateItems();
this.updateAutoItems();
this.updateModeItems();
this.updateReadPrefs();
#endif
this.updateOfflineApps();
#ifdef MOZ_CRASHREPORTER
@ -459,82 +458,90 @@ var gAdvancedPane = {
* update is a major update
*/
#ifdef MOZ_UPDATER
/**
* Enables and disables various UI preferences as necessary to reflect locked,
* disabled, and checked/unchecked states.
* Selects the item of the radiogroup, and sets the warnIncompatible checkbox
* based on the pref values and locked states.
*
* UI state matrix for update preference conditions
*
* UI Components: Preferences
* 1 = Firefox checkbox i = app.update.enabled
* 2 = When updates for Firefox are found label ii = app.update.auto
* 3 = Automatic Radiogroup (Ask vs. Automatically) iii = app.update.mode
* 4 = Warn before disabling extensions checkbox
*
* States:
* Element p val locked Disabled
* 1 i t/f f false
* i t/f t true
* ii t/f t/f false
* iii 0/1/2 t/f false
* 2,3 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
* 4 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
*
* UI Components: Preferences
* Radiogroup i = app.update.enabled
* Warn before disabling extensions checkbox ii = app.update.auto
* iii = app.update.mode
*
* Disabled states:
* Element pref value locked disabled
* radiogroup i t/f f false
* i t/f *t* *true*
* ii t/f f false
* ii t/f *t* *true*
* iii 0/1/2 t/f false
* warnIncompatible i t f false
* i t *t* *true*
* i *f* t/f *true*
* ii t f false
* ii t *t* *true*
* ii *f* t/f *true*
* iii 0/1/2 f false
* iii 0/1/2 *t* *true*
*/
#ifdef MOZ_UPDATER
updateAppUpdateItems: function ()
{
var aus =
Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService);
var enabledPref = document.getElementById("app.update.enabled");
var enableAppUpdate = document.getElementById("enableAppUpdate");
enableAppUpdate.disabled = !aus.canCheckForUpdates || enabledPref.locked;
},
/**
* Enables/disables UI for "when updates are found" based on the values,
* and "locked" states of associated preferences.
*/
updateAutoItems: function ()
updateReadPrefs: function ()
{
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var updateModeLabel = document.getElementById("updateModeLabel");
var updateMode = document.getElementById("updateMode");
var disable = enabledPref.locked || !enabledPref.value ||
autoPref.locked;
updateModeLabel.disabled = updateMode.disabled = disable;
},
var radiogroup = document.getElementById("updateRadioGroup");
if (!enabledPref.value) // Don't care for autoPref.value in this case.
radiogroup.value="manual" // 3. Never check for updates.
else if (autoPref.value) // enabledPref.value && autoPref.value
radiogroup.value="auto"; // 1. Automatically install updates
else // enabledPref.value && !autoPref.value
radiogroup.value="checkOnly"; // 2. Check, but let me choose
var canCheck = Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService).
canCheckForUpdates;
// canCheck is false if the enabledPref is false and locked,
// or the binary platform or OS version is not known.
// A locked pref is sufficient to disable the radiogroup.
radiogroup.disabled = !canCheck || enabledPref.locked || autoPref.locked;
/**
* Enables/disables the "warn if incompatible extensions/themes exist" UI
* based on the values and "locked" states of various preferences.
*/
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.locked || !enabledPref.value || autoPref.locked ||
!autoPref.value || modePref.locked;
warnIncompatible.disabled = disable;
// the warnIncompatible checkbox value is set by readAddonWarn
warnIncompatible.disabled = radiogroup.disabled || modePref.locked ||
!enabledPref.value || !autoPref.value;
},
/**
* Sets the pref values based on the selected item of the radiogroup,
* and sets the disabled state of the warnIncompatible checkbox accordingly.
*/
updateWritePrefs: function ()
{
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var radiogroup = document.getElementById("updateRadioGroup");
switch (radiogroup.value) {
case "auto": // 1. Automatically install updates
enabledPref.value = true;
autoPref.value = true;
break;
case "checkOnly": // 2. Check, but let me choose
enabledPref.value = true;
autoPref.value = false;
break;
case "manual": // 3. Never check for updates.
enabledPref.value = false;
autoPref.value = false;
}
var warnIncompatible = document.getElementById("warnIncompatible");
var modePref = document.getElementById("app.update.mode");
warnIncompatible.disabled = enabledPref.locked || !enabledPref.value ||
autoPref.locked || !autoPref.value ||
modePref.locked;
},
/**
@ -553,7 +560,7 @@ var gAdvancedPane = {
* of the preference so that the preference value can be properly restored if
* the user's preferences cannot adequately be expressed by a single checkbox.
*
* app.update.modee Checkbox State Meaning
* app.update.mode Checkbox State Meaning
* 0 Unchecked Do not warn
* 1 Checked Warn if there are incompatibilities
* 2 Checked Warn if there are incompatibilities,
@ -562,9 +569,9 @@ var gAdvancedPane = {
readAddonWarn: function ()
{
var preference = document.getElementById("app.update.mode");
var doNotWarn = preference.value != 0;
gAdvancedPane._modePreference = doNotWarn ? preference.value : 1;
return doNotWarn;
var warn = preference.value != 0;
gAdvancedPane._modePreference = warn ? preference.value : 1;
return warn;
},
/**
@ -591,7 +598,7 @@ var gAdvancedPane = {
/**
* The Extensions checkbox and button are disabled only if the enable Addon
* update preference is locked.
* update preference is locked.
*/
updateAddonUpdateUI: function ()
{
@ -599,8 +606,8 @@ var gAdvancedPane = {
var enableAddonUpdate = document.getElementById("enableAddonUpdate");
enableAddonUpdate.disabled = enabledPref.locked;
},
},
// ENCRYPTION TAB
/*

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

@ -25,6 +25,7 @@
# Ben Goodger <ben@mozilla.org>
# Jeff Walden <jwalden+code@mit.edu>
# Ehsan Akhgari <ehsan.akhgari@gmail.com>
# Steffen Wilberg <steffen.wilberg@web.de>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -100,15 +101,9 @@
<!-- Update tab -->
#ifdef MOZ_UPDATER
<preference id="app.update.enabled" name="app.update.enabled" type="bool"
onchange="gAdvancedPane.updateAppUpdateItems();
gAdvancedPane.updateAutoItems();
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="app.update.enabled" name="app.update.enabled" type="bool"/>
<preference id="app.update.auto" name="app.update.auto" type="bool"/>
<preference id="app.update.mode" name="app.update.mode" type="int"/>
<preference id="app.update.disable_button.showUpdateHistory"
name="app.update.disable_button.showUpdateHistory"
@ -299,55 +294,51 @@
</tabpanel>
<!-- Update -->
<tabpanel id="updatePanel" orient="vertical" align="start">
<label control="autoUpdateGroup">&autoCheck.label;</label>
<vbox class="indent" id="autoUpdateGroup" role="group">
<tabpanel id="updatePanel" orient="vertical">
#ifdef MOZ_UPDATER
<checkbox id="enableAppUpdate"
label="&enableAppUpdate.label;"
accesskey="&enableAppUpdate.accesskey;"
preference="app.update.enabled"/>
<groupbox id="updateApp">
<caption label="&updateApp.label;"/>
<radiogroup id="updateRadioGroup"
oncommand="gAdvancedPane.updateWritePrefs();">
<radio value="auto"
label="&updateAuto.label;"
accesskey="&updateAuto.accesskey;"/>
<hbox class="indent">
<checkbox id="warnIncompatible"
label="&updateAutoAddonWarn.label;"
accesskey="&updateAutoAddonWarn.accesskey;"
preference="app.update.mode"
onsyncfrompreference="return gAdvancedPane.readAddonWarn();"
onsynctopreference="return gAdvancedPane.writeAddonWarn();"/>
</hbox>
<radio value="checkOnly"
label="&updateCheck.label;"
accesskey="&updateCheck.accesskey;"/>
<radio value="manual"
label="&updateManual.label;"
accesskey="&updateManual.accesskey;"/>
</radiogroup>
<hbox>
<button id="showUpdateHistory"
label="&updateHistory.label;"
accesskey="&updateHistory.accesskey;"
preference="app.update.disable_button.showUpdateHistory"
oncommand="gAdvancedPane.showUpdates();"/>
</hbox>
</groupbox>
#endif
<groupbox id="updateOthers">
<caption label="&updateOthers.label;"/>
<checkbox id="enableAddonUpdate"
label="&enableAddonsUpdate2.label;"
accesskey="&enableAddonsUpdate2.accesskey;"
label="&enableAddonsUpdate3.label;"
accesskey="&enableAddonsUpdate3.accesskey;"
preference="extensions.update.enabled"/>
<checkbox id="enableSearchUpdate"
label="&enableSearchUpdate.label;"
accesskey="&enableSearchUpdate.accesskey;"
preference="browser.search.update"/>
</vbox>
#ifdef MOZ_UPDATER
<separator id="updateSeparator1"/>
<label id="updateModeLabel" control="updateMode">&whenUpdatesFound.label;</label>
<radiogroup id="updateMode" class="indent"
preference="app.update.auto">
<radio id="ask" value="false"
label="&askMe.label;"
accesskey="&askMe.accesskey;"/>
<radio id="automatic" value="true"
label="&modeAutomatic.label;"
accesskey="&modeAutomatic.accesskey;"/>
<hbox class="indent">
<checkbox id="warnIncompatible"
label="&modeAutoAddonWarn.label;" accesskey="&modeAutoAddonWarn.accesskey;"
preference="app.update.mode"
onsyncfrompreference="return gAdvancedPane.readAddonWarn();"
onsynctopreference="return gAdvancedPane.writeAddonWarn();"/>
</hbox>
</radiogroup>
<separator id="updateSeparator2"/>
<hbox>
<button id="showUpdateHistory"
label="&updateHistory.label;" accesskey="&updateHistory.accesskey;"
preference="app.update.disable_button.showUpdateHistory"
oncommand="gAdvancedPane.showUpdates();"/>
</hbox>
#endif
</groupbox>
</tabpanel>
<!-- Encryption -->

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

@ -58,23 +58,26 @@
<!ENTITY updateTab.label "Update">
<!ENTITY autoCheck.label "Automatically check for updates to:">
<!ENTITY enableAppUpdate.label "&brandShortName;">
<!ENTITY enableAppUpdate.accesskey "F">
<!ENTITY enableAddonsUpdate2.label "Add-ons">
<!ENTITY enableAddonsUpdate2.accesskey "n">
<!ENTITY enableSearchUpdate.label "Search Engines">
<!ENTITY enableSearchUpdate.accesskey "E">
<!ENTITY whenUpdatesFound.label "When updates to &brandShortName; are found:">
<!ENTITY askMe.label "Ask me what I want to do">
<!ENTITY askMe.accesskey "k">
<!ENTITY modeAutomatic.label "Automatically download and install the update">
<!ENTITY modeAutomatic.accesskey "d">
<!ENTITY modeAutoAddonWarn.label "Warn me if this will disable any of my add-ons">
<!ENTITY modeAutoAddonWarn.accesskey "W">
<!ENTITY updateApp.label "&brandShortName; updates:">
<!ENTITY updateAuto.label "Automatically install updates (recommended: improved security)">
<!ENTITY updateAuto.accesskey "A">
<!ENTITY updateCheck.label "Check for updates, but let me choose whether to install them">
<!ENTITY updateCheck.accesskey "C">
<!ENTITY updateManual.label "Never check for updates (not recommended: security risk)">
<!ENTITY updateManual.accesskey "N">
<!ENTITY updateAutoAddonWarn.label "Warn me if this will disable any of my add-ons">
<!ENTITY updateAutoAddonWarn.accesskey "W">
<!ENTITY updateHistory.label "Show Update History">
<!ENTITY updateHistory.accesskey "p">
<!ENTITY updateOthers.label "Automatically update:">
<!ENTITY enableAddonsUpdate3.label "Add-ons">
<!ENTITY enableAddonsUpdate3.accesskey "o">
<!ENTITY enableSearchUpdate.label "Search Engines">
<!ENTITY enableSearchUpdate.accesskey "E">
<!ENTITY offlineNotify.label "Tell me when a website asks to store data for offline use">
<!ENTITY offlineNotify.accesskey "T">
<!ENTITY offlineNotifyExceptions.label "Exceptions…">