diff --git a/mail/components/preferences/advanced.js b/mail/components/preferences/advanced.js
index 4fc83bb3369..a45576a040e 100644
--- a/mail/components/preferences/advanced.js
+++ b/mail/components/preferences/advanced.js
@@ -51,6 +51,11 @@ var gAdvancedPane = {
if (preference.value)
document.getElementById("advancedPrefs").selectedIndex = preference.value;
}
+
+ this.updateAppUpdateItems();
+ this.updateAutoItems();
+ this.updateModeItems();
+
this.mInitialized = true;
},
@@ -70,73 +75,149 @@ var gAdvancedPane = {
"", null);
},
- updateAppUpdateUI: function ()
+ updateButtons: function (aButtonID, aPreferenceID)
{
- var preference = document.getElementById("app.update.enabled");
- document.getElementById("enableAutoInstall").disabled = !preference.value;
+ var button = document.getElementById(aButtonID);
+ var preference = document.getElementById(aPreferenceID);
+ // This is actually before the value changes, so the value is not as you expect.
+ button.disabled = preference.value == true;
+ return undefined;
+ },
+ /**
+ * UI state matrix for update preference conditions
+ *
+ * UI Components: Preferences
+ * 1 = Thunderbird checkbox i = app.update.enabled
+ * 2 = Check Now button for Firefox ii = app.update.auto
+ * 3 = When updates for Thunderbird 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 =
Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService);
- var checkNowButton = document.getElementById("checkNowButton");
- checkNowButton.disabled = !aus.canUpdate;
+
+ var enabledPref = document.getElementById("app.update.enabled");
- this.updateAutoPref();
- 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 updateEnabledPref = document.getElementById("app.update.enabled");
- var autoInstallOptions = document.getElementById("autoInstallOptions");
- autoInstallOptions.disabled = !preference.value || !updateEnabledPref.value;
- return undefined;
+ 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.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 ()
{
- var updateTypes =
- Components.classes["@mozilla.org/supports-PRUint8;1"].
- createInstance(Components.interfaces.nsISupportsPRUint8);
- updateTypes.data = Components.interfaces.nsIUpdateItem.TYPE_ADDON;
- var showMismatch =
- Components.classes["@mozilla.org/supports-PRBool;1"].
- createInstance(Components.interfaces.nsISupportsPRBool);
- showMismatch.data = false;
- var ary =
- Components.classes["@mozilla.org/supports-array;1"].
- createInstance(Components.interfaces.nsISupportsArray);
- ary.AppendElement(updateTypes);
- ary.AppendElement(showMismatch);
-
- var features = "chrome,centerscreen,dialog,titlebar";
- const URI_EXTENSION_UPDATE_DIALOG =
- "chrome://mozapps/content/extensions/update.xul";
- var ww =
- Components.classes["@mozilla.org/embedcomp/window-watcher;1"].
- getService(Components.interfaces.nsIWindowWatcher);
- ww.openWindow(window, URI_EXTENSION_UPDATE_DIALOG, "", features, ary);
+ var wm =
+ Components.classes["@mozilla.org/appshell/window-mediator;1"].
+ getService(Components.interfaces.nsIWindowMediator);
+ var manager = wm.getMostRecentWindow("Extension:Manager-extensions");
+ if (!manager) {
+ const features = "chrome,centerscreen,dialog,titlebar";
+ const URI_EXTENSIONS_WINDOW =
+ "chrome://mozapps/content/extensions/extensions.xul?type=extensions";
+ openDialog(URI_EXTENSIONS_WINDOW, "", features, "updatecheck");
+ }
+ else {
+ manager.performUpdate();
+ manager.focus();
+ }
},
checkForUpdates: function ()
{
var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
.createInstance(Components.interfaces.nsIUpdatePrompt);
- prompter.checkForUpdates();
+ prompter.checkForUpdates();
},
-
- showAutoInstallOptions: function ()
- {
- document.documentElement.openSubDialog("chrome://mozapps/content/preferences/update.xul",
- "", null);
- },
-
+
showUpdates: function ()
{
var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
.createInstance(Components.interfaces.nsIUpdatePrompt);
- prompter.showUpdateHistory(window);
+ prompter.showUpdateHistory(window);
},
updateMarkAsReadTextbox: function(aFocusTextBox)
diff --git a/mail/components/preferences/advanced.xul b/mail/components/preferences/advanced.xul
index f6b1d888bbb..6f9232e01d8 100644
--- a/mail/components/preferences/advanced.xul
+++ b/mail/components/preferences/advanced.xul
@@ -57,17 +57,25 @@
-
-
-
+
+
+
+
+
@@ -181,51 +189,56 @@
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+ preference="extensions.update.enabled"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mail/locales/en-US/chrome/messenger/preferences/advanced.dtd b/mail/locales/en-US/chrome/messenger/preferences/advanced.dtd
index 5532a04bff3..1d304ff4cfc 100644
--- a/mail/locales/en-US/chrome/messenger/preferences/advanced.dtd
+++ b/mail/locales/en-US/chrome/messenger/preferences/advanced.dtd
@@ -31,18 +31,21 @@
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+