Bug #303957 --> new auto update pref UI
This commit is contained in:
Родитель
08f4cc88b7
Коммит
5a6e3a0e7d
|
@ -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)
|
||||
|
|
|
@ -57,17 +57,25 @@
|
|||
<preference id="mailnews.mark_message_read.delay.interval" name="mailnews.mark_message_read.delay.interval" type="int"/>
|
||||
<preference id="mail.showFolderPaneColumns" name="mail.showFolderPaneColumns" type="bool"/>
|
||||
<preference id="mailnews.reuse_message_window" name="mailnews.reuse_message_window" 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="extensions.update.autoUpdateEnabled"
|
||||
name="extensions.update.autoUpdateEnabled"
|
||||
type="bool"/>
|
||||
<preference id="mailnews.tcptimeout" name="mailnews.tcptimeout" type="int"/>
|
||||
<preference id="offline.startup_state" name="offline.startup_state" type="int"/>
|
||||
<preference id="offline.send.unsent_messages" name="offline.send.unsent_messages" type="int"/>
|
||||
<preference id="offline.download.download_messages" name="offline.download.download_messages" type="int"/>
|
||||
<preference id="mail.prompt_purge_threshhold" name="mail.prompt_purge_threshhold" type="bool"/>
|
||||
<preference id="mail.purge_threshhold" name="mail.purge_threshhold" type="int"/>
|
||||
<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="extensions.update.enabled" name="extensions.update.enabled" type="bool"
|
||||
onchange="gAdvancedPane.updateAddonUpdateUI();"/>
|
||||
<preference id="app.update.disable_button.showUpdateHistory"
|
||||
name="app.update.disable_button.showUpdateHistory"
|
||||
type="bool"/>
|
||||
</preferences>
|
||||
|
||||
<tabbox id="advancedPrefs" flex="1" onselect="gAdvancedPane.tabSelectionChanged();">
|
||||
|
@ -181,51 +189,56 @@
|
|||
</tabpanel>
|
||||
|
||||
<!-- Update -->
|
||||
<tabpanel orient="vertical">
|
||||
<vbox>
|
||||
<label>&softwareupdateinfo.label;</label>
|
||||
<separator class="thin"/>
|
||||
<vbox align="start">
|
||||
|
||||
<tabpanel orient="vertical" align="start">
|
||||
<label>&autoCheck.label;</label>
|
||||
<vbox class="indent">
|
||||
<hbox>
|
||||
<checkbox id="enableAppUpdate"
|
||||
label="&enableAppUpdate.label;"
|
||||
accesskey="&enableAppUpdate.accesskey;"
|
||||
preference="app.update.enabled"
|
||||
onsyncfrompreference="return gAdvancedPane.updateAppUpdateUI();"/>
|
||||
<vbox class="indent" align="start">
|
||||
<hbox>
|
||||
<checkbox id="enableAutoInstall"
|
||||
label="&enableAutoInstall.label;"
|
||||
accesskey="&enableAutoInstall.accesskey;"
|
||||
preference="app.update.auto"
|
||||
onsyncfrompreference="return gAdvancedPane.updateAutoPref();"/>
|
||||
<spacer flex="1"/>
|
||||
<button id="autoInstallOptions"
|
||||
label="&autoInstallOptions.label;" accesskey="&autoInstallOptions.accesskey;"
|
||||
oncommand="gAdvancedPane.showAutoInstallOptions();"/>
|
||||
</hbox>
|
||||
<separator class="thin"/>
|
||||
<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">
|
||||
<checkbox id="enableExtensionUpdate"
|
||||
preference="app.update.enabled"/>
|
||||
<spacer flex="1"/>
|
||||
<button id="appCheckNowButton"
|
||||
label="&checkNow.label;" accesskey="&appCheckNow.accesskey;"
|
||||
oncommand="gAdvancedPane.checkForUpdates();"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<checkbox id="enableAddonUpdate"
|
||||
label="&enableExtensionUpdate.label;"
|
||||
accesskey="&enableExtensionUpdate.accesskey;"
|
||||
preference="extensions.update.autoUpdateEnabled"/>
|
||||
<separator class="thin"/>
|
||||
<hbox class="indent">
|
||||
<button label="&checkNow.label;" accesskey="&extensionsCheckNow.accesskey;"
|
||||
oncommand="gAdvancedPane.checkForAddonUpdates();"
|
||||
preference="extensions.update.autoUpdateEnabled"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
preference="extensions.update.enabled"/>
|
||||
<spacer flex="1"/>
|
||||
<button id="addonCheckNowButton"
|
||||
label="&checkNow.label;" accesskey="&extensionsCheckNow.accesskey;"
|
||||
oncommand="gAdvancedPane.checkForAddonUpdates();"/>
|
||||
</hbox>
|
||||
</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>
|
||||
<separator/>
|
||||
<hbox>
|
||||
<button id="showUpdateHistory"
|
||||
label="&showUpdates.label;" accesskey="&showUpdates.accesskey;"
|
||||
preference="app.update.disable_button.showUpdateHistory"
|
||||
oncommand="gAdvancedPane.showUpdates();"/>
|
||||
</hbox>
|
||||
</tabpanel>
|
||||
</tabpanels>
|
||||
</tabbox>
|
||||
|
|
|
@ -31,18 +31,21 @@
|
|||
<!ENTITY configEdit.accesskey "g">
|
||||
|
||||
<!-- Update -->
|
||||
<!ENTITY softwareupdateinfo.label "Periodically check for updates to:">
|
||||
<!ENTITY autoCheck.label "Automatically check for updates to:">
|
||||
<!ENTITY enableAppUpdate.label "&brandShortName;">
|
||||
<!ENTITY enableAppUpdate.accesskey "T">
|
||||
<!ENTITY enableAutoInstall.label "Automatically Download and Install updates">
|
||||
<!ENTITY enableAutoInstall.accesskey "A">
|
||||
<!ENTITY autoInstallOptions.label "Advanced...">
|
||||
<!ENTITY autoInstallOptions.accesskey "d">
|
||||
<!ENTITY enableExtensionUpdate.label "My Extensions and Themes">
|
||||
<!ENTITY enableExtensionUpdate.accesskey "M">
|
||||
<!ENTITY enableExtensionUpdate.label "Installed Extensions and Themes">
|
||||
<!ENTITY enableExtensionUpdate.accesskey "x">
|
||||
<!ENTITY checkNow.label "Check Now...">
|
||||
<!ENTITY appCheckNow.accesskey "k">
|
||||
<!ENTITY extensionsCheckNow.accesskey "h">
|
||||
<!ENTITY whenUpdatesFound.label "When updates to &brandShortName; are found,">
|
||||
<!ENTITY modeAskMe.label "Ask me what I want to do">
|
||||
<!ENTITY modeAskMe.accesskey "A">
|
||||
<!ENTITY modeAutomatic.label "Automatically download and install the update">
|
||||
<!ENTITY modeAutomatic.accesskey "d">
|
||||
<!ENTITY modeAutoWarn.label "Warn me if this will disable extensions or themes">
|
||||
<!ENTITY modeAutoWarn.accesskey "W">
|
||||
<!ENTITY showUpdates.label "Show Update History">
|
||||
<!ENTITY showUpdates.accesskey "U">
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче