Make the update menu item change depending on update state

This commit is contained in:
ben%bengoodger.com 2005-06-20 21:25:45 +00:00
Родитель fce96ba877
Коммит 858992c7b4
5 изменённых файлов: 58 добавлений и 3 удалений

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

@ -68,7 +68,7 @@
label="&helpMenu.label;" label="&helpMenu.label;"
accesskey="&helpMenu.accesskey;"> accesskey="&helpMenu.accesskey;">
#endif #endif
<menupopup id="menu_HelpPopup"> <menupopup id="menu_HelpPopup" onpopupshowing="buildHelpMenu();">
<menuitem oncommand="openHelp('firefox-help', 'chrome://browser/locale/help/help.rdf');" <menuitem oncommand="openHelp('firefox-help', 'chrome://browser/locale/help/help.rdf');"
#ifdef XP_MACOSX #ifdef XP_MACOSX
label="&helpContentsMac.label;" label="&helpContentsMac.label;"
@ -94,6 +94,7 @@
<menuitem id="checkForUpdates" <menuitem id="checkForUpdates"
accesskey="&updateCmd.accesskey;" accesskey="&updateCmd.accesskey;"
label="&updateCmd.label;" label="&updateCmd.label;"
class="menuitem-iconic"
oncommand="checkForUpdates();"/> oncommand="checkForUpdates();"/>
<menuitem id="aboutName" <menuitem id="aboutName"
accesskey="&aboutCmd.accesskey;" accesskey="&aboutCmd.accesskey;"

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

@ -450,3 +450,44 @@ function checkForUpdates()
.createInstance(Components.interfaces.nsIUpdatePrompt); .createInstance(Components.interfaces.nsIUpdatePrompt);
prompter.checkForUpdates(); prompter.checkForUpdates();
} }
function buildHelpMenu()
{
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);
var activeUpdate = um.activeUpdate;
var strings = document.getElementById("bundle_browser");
var label = strings.getString("updates_checkForUpdates");
if (activeUpdate) {
if (updates.isDownloading) {
if (activeUpdate.name) {
label = strings.getFormattedString("updates_downloadingUpdates",
[activeUpdate.name]);
}
else
label = strings.getString("updates_downloadingUpdatesFallback");
}
else {
if (activeUpdate.name) {
label = strings.getFormattedString("updates_resumeDownloading",
[activeUpdate.name]);
}
else
label = strings.getString("updates_resumeDownloadingFallback");
}
}
var checkForUpdates = document.getElementById("checkForUpdates");
checkForUpdates.label = label;
if (um.activeUpdate && updates.isDownloading)
checkForUpdates.setAttribute("loading", "true");
else
checkForUpdates.removeAttribute("loading");
}

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

@ -27,8 +27,8 @@
<!ENTITY openHelpMac2.frontendCommandkey "?"> <!ENTITY openHelpMac2.frontendCommandkey "?">
<!ENTITY openHelpMac2.frontendModifiers "accel"> <!ENTITY openHelpMac2.frontendModifiers "accel">
<!ENTITY helpReleaseNotes.accesskey "R"> <!ENTITY helpReleaseNotes.accesskey "N">
<!ENTITY helpReleaseNotes.label "Release Notes"> <!ENTITY helpReleaseNotes.label "Release Notes">
<!ENTITY updateCmd.accesskey "U"> <!ENTITY updateCmd.accesskey "o">
<!ENTITY updateCmd.label "Check for Updates..."> <!ENTITY updateCmd.label "Check for Updates...">

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

@ -97,3 +97,11 @@ missingpluginsMessage.button.label=Install Missing Plugins...
# Sanitize # Sanitize
sanitizeWithPromptLabel=Sanitize %S... sanitizeWithPromptLabel=Sanitize %S...
sanitizeButton=Sanitize Now sanitizeButton=Sanitize Now
# Check for Updates
updates_checkForUpdates=Check for Updates...
updates_downloadingUpdates=Downloading %S...
updates_downloadingUpdatesFallback=Downloading Update...
updates_resumeDownloading=Resume Downloading %S...
updates_resumeDownloadingFallback=Resume Downloading Update...

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

@ -926,3 +926,8 @@ toolbar[mode="text"] > #window-controls > toolbarbutton > .toolbarbutton-text {
#pageReportFirstTime statusbarpanel.statusbar-resizerpanel { #pageReportFirstTime statusbarpanel.statusbar-resizerpanel {
visibility: collapse; visibility: collapse;
} }
#checkForUpdates[loading="true"] {
list-style-image: url("chrome://global/skin/throbber/Throbber-small.gif");
}