Final(?) part of Bug 408190 Make automatic updates work with SeaMonkey (AUS) - SeaMonkey UI integration and enabling. r=Neil

git-svn-id: svn://10.0.0.236/trunk@243543 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bugzilla%standard8.plus.com 2008-01-19 16:03:53 +00:00
parent 3ba3990530
commit 38e5bc74b5
8 changed files with 104 additions and 19 deletions

View File

@ -225,8 +225,8 @@ pref("app.vendorURL", "chrome://branding/locale/brand.properties");
// App-specific update preferences
// Whether or not app updates are enabled - false initally for SeaMonkey
pref("app.update.enabled", false);
// Whether or not app updates are enabled
pref("app.update.enabled", true);
// This preference turns on app.update.mode and allows automatic download and
// install to take place. We use a separate boolean toggle for this to make

View File

@ -40,8 +40,7 @@
function Startup()
{
toggleFrequency("extensions");
// disabled until SM updates are available
// toggleFrequency("app");
toggleFrequency("app");
}
function toggleFrequency(aType)
@ -53,9 +52,3 @@ function toggleFrequency(aType)
!document.getElementById(aType + ".update.enabled").value ||
document.getElementById(aType + ".update.interval").locked;
}
function toEM()
{
toOpenWindowByType("Extension:Manager",
"chrome://mozapps/content/extensions/extensions.xul");
}

View File

@ -83,16 +83,14 @@
<rows>
<row>
<!-- disabled until SM updates are available -->
<checkbox id="appUpdatesEnabled" label="&appUpdates.label;"
accesskey="&appUpdates.accesskey;" disabled="true"
accesskey="&appUpdates.accesskey;"
preference="app.update.enabled"/>
<!-- disabled until SM updates are available -->
<radiogroup id="appUpdateFrequency" orient="horizontal"
preference="app.update.interval">
<radio id="appFreqDaily" label="&daily.label;" disabled="true"
<radio id="appFreqDaily" label="&daily.label;"
accesskey="&appDaily.accesskey;" value="86400"/>
<radio id="appFreqWeekly" label="&weekly.label;" disabled="true"
<radio id="appFreqWeekly" label="&weekly.label;"
accesskey="&appWeekly.accesskey;" value="604800"/>
</radiogroup>
</row>
@ -111,7 +109,6 @@
</row>
</rows>
</grid>
<description>&appUpdatesDisabled.desc;</description>
<vbox align="end">
<button id="startAddonManager" oncommand="toEM();"
label="&addonManagerButton.label;"

View File

@ -58,6 +58,7 @@ const kProxyManual = ["network.proxy.ftp",
"network.proxy.socks",
"network.proxy.ssl"];
var gShowBiDi = false;
var gUtilityBundle = null;
function toggleOfflineStatus()
{
@ -419,6 +420,74 @@ function goReleaseNotes()
catch (ex) { dump(ex); }
}
function checkForUpdates()
{
var um = Components.classes["@mozilla.org/updates/update-manager;1"]
.getService(Components.interfaces.nsIUpdateManager);
var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
.createInstance(Components.interfaces.nsIUpdatePrompt);
// If there's an update ready to be applied, show the "Update Downloaded"
// UI instead and let the user know they have to restart the browser for
// the changes to be applied.
if (um.activeUpdate && um.activeUpdate.state == "pending")
prompter.showUpdateDownloaded(um.activeUpdate);
else
prompter.checkForUpdates();
}
function updateCheckUpdatesItem()
{
var updates = Components.classes["@mozilla.org/updates/update-service;1"]
.getService(Components.interfaces.nsIApplicationUpdateService);
var um = Components.classes["@mozilla.org/updates/update-manager;1"]
.getService(Components.interfaces.nsIUpdateManager);
// Disable the UI if the update enabled pref has been locked by the
// administrator or if we cannot update for some other reason.
var checkForUpdates = document.getElementById("checkForUpdates");
var canUpdate = updates.canUpdate;
checkForUpdates.setAttribute("disabled", !canUpdate);
if (!canUpdate)
return;
if (!gUtilityBundle)
gUtilityBundle = document.getElementById("bundle_utilityOverlay");
// By default, show "Check for Updates..."
var key = "default";
if (um.activeUpdate) {
switch (um.activeUpdate.state) {
case "downloading":
// If we're downloading an update at present, show the text:
// "Downloading Firefox x.x..." otherwise we're paused, and show
// "Resume Downloading Firefox x.x..."
key = updates.isDownloading ? "downloading" : "resume";
break;
case "pending":
// If we're waiting for the user to restart, show: "Apply Downloaded
// Updates Now..."
key = "pending";
break;
}
}
// If there's an active update, substitute its name into the label
// we show for this item, otherwise display a generic label.
if (um.activeUpdate && um.activeUpdate.name)
checkForUpdates.label = gUtilityBundle.getFormattedString("updatesItem_" + key,
[activeUpdate.name]);
else
checkForUpdates.label = gUtilityBundle.getString("updatesItem_" + key + "Fallback");
checkForUpdates.accesskey = gUtilityBundle.getString("updatesItem_" + key + "AccessKey");
if (um.activeUpdate && updates.isDownloading)
checkForUpdates.setAttribute("loading", "true");
else
checkForUpdates.removeAttribute("loading");
}
// update menu items that rely on focus
function goUpdateGlobalEditMenuItems()
{

View File

@ -23,6 +23,11 @@
<script type="application/x-javascript"
src="chrome://help/content/contextHelp.js"/>
<stringbundleset id="stringbundleset">
<stringbundle id="bundle_utilityOverlay"
src="chrome://communicator/locale/utilityOverlay.properties"/>
</stringbundleset>
<!-- online/offline status indicators -->
<broadcaster id="Communicator:WorkMode"
label="&offlineGoOfflineCmd.label;"
@ -290,7 +295,7 @@
<menu id="menu_Help"
label="&helpMenu.label;"
accesskey="&helpMenu.accesskey;">
<menupopup id="helpPopup">
<menupopup id="helpPopup" onpopupshowing="updateCheckUpdatesItem();">
<menuitem label="&openHelpCmd.label;"
accesskey="&openHelpCmd.accesskey;"
id="help"
@ -302,6 +307,11 @@
id="releaseUrl"
oncommand="goReleaseNotes();"/>
<menuseparator id="menu_HelpUpdatesSeparator"/>
<menuitem accesskey="&updateCmd.accesskey;" label="&updateCmd.label;"
id="checkForUpdates" oncommand="checkForUpdates();"/>
<menuseparator id="menu_HelpAboutSeparator"/>
<menuitem class="about"

View File

@ -18,6 +18,5 @@
<!ENTITY extensionsUpdates.accesskey "n">
<!ENTITY extensionsDaily.accesskey "i">
<!ENTITY extensionsWeekly.accesskey "k">
<!ENTITY appUpdatesDisabled.desc "Automatic updates to &brandShortName; are not currently available. This feature is intended for implementation before the next release.">
<!ENTITY addonManagerButton.label "Add-on Manager">
<!ENTITY addonManagerButton.accesskey "M">

View File

@ -62,6 +62,8 @@
<!ENTITY releaseCmd.label "Release Notes">
<!ENTITY releaseCmd.accesskey "N">
<!ENTITY updateCmd.label "Check for Updates...">
<!ENTITY updateCmd.accesskey "C">
<!ENTITY aboutCmd.label "About &brandShortName;">
<!ENTITY aboutCmd.accesskey "A">
<!ENTITY aboutCommPluginsCmd.label "About Plugins">

View File

@ -1,9 +1,24 @@
# Online/offline tooltips
onlineTooltip0=You are online (proxy: none). Click the icon to go offline.
onlineTooltip1=You are online (proxy: manual). Click the icon to go offline.
onlineTooltip2=You are online (proxy: auto URL). Click the icon to go offline.
onlineTooltip4=You are online (proxy: auto discover). Click the icon to go offline.
offlineTooltip=You are offline. Click the icon to go online.
# Popup menus
popupMenuShow=Show %S
popupAllow=Allow popups from %S
# Check for Updates
updatesItem_default=Check for Updates...
updatesItem_defaultFallback=Check for Updates...
updatesItem_defaultAccessKey=C
updatesItem_downloading=Downloading %S...
updatesItem_downloadingFallback=Downloading Update...
updatesItem_downloadingAccessKey=D
updatesItem_resume=Resume Downloading %S...
updatesItem_resumeFallback=Resume Downloading Update...
updatesItem_resumeAccessKey=D
updatesItem_pending=Apply Downloaded Update Now...
updatesItem_pendingFallback=Apply Downloaded Update Now...
updatesItem_pendingAccessKey=U