Bug 1356507 - Show version and updater in the preferences update pane. r=jaws

This change includes unmodified aboutDialog-appUpdater.js into
preferences.xul, so we could enable the updater UI there. Also,
copied code on version/distribution strings from aboutDialog.js.

MozReview-Commit-ID: 7o24az7Tn28

--HG--
extra : rebase_source : d3120bfa9d30f0f3fb8a1dad9e5c62427b1e6d62
This commit is contained in:
Timothy Guan-tin Chien 2017-04-27 19:59:14 +08:00
Родитель ae41b0ceb9
Коммит f15440fc4a
7 изменённых файлов: 198 добавлений и 16 удалений

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

@ -2,7 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Note: this file is included in aboutDialog.xul if MOZ_UPDATER is defined.
// Note: this file is included in aboutDialog.xul and preferences/advanced.xul
// if MOZ_UPDATER is defined.
/* import-globals-from aboutDialog.js */

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

@ -20,7 +20,56 @@ var gAdvancedPane = {
this._inited = true;
let version = AppConstants.MOZ_APP_VERSION_DISPLAY;
// Include the build ID if this is an "a#" (nightly) build
if (/a\d+$/.test(version)) {
let buildID = Services.appinfo.appBuildID;
let year = buildID.slice(0, 4);
let month = buildID.slice(4, 6);
let day = buildID.slice(6, 8);
version += ` (${year}-${month}-${day})`;
}
// Append "(32-bit)" or "(64-bit)" build architecture to the version number:
let bundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
let archResource = Services.appinfo.is64Bit
? "aboutDialog.architecture.sixtyFourBit"
: "aboutDialog.architecture.thirtyTwoBit";
let arch = bundle.GetStringFromName(archResource);
version += ` (${arch})`;
document.getElementById("version").textContent = version;
// Show a release notes link if we have a URL.
let relNotesLink = document.getElementById("releasenotes");
let relNotesPrefType = Services.prefs.getPrefType("app.releaseNotesURL");
if (relNotesPrefType != Services.prefs.PREF_INVALID) {
let relNotesURL = Services.urlFormatter.formatURLPref("app.releaseNotesURL");
if (relNotesURL != "about:blank") {
relNotesLink.href = relNotesURL;
relNotesLink.hidden = false;
}
}
let distroId = Services.prefs.getCharPref("distribution.id", "");
if (distroId) {
let distroVersion = Services.prefs.getCharPref("distribution.version");
let distroIdField = document.getElementById("distributionId");
distroIdField.value = distroId + " - " + distroVersion;
distroIdField.hidden = false;
let distroAbout = Services.prefs.getStringPref("distribution.about", "");
if (distroAbout) {
let distroField = document.getElementById("distribution");
distroField.value = distroAbout;
distroField.hidden = false;
}
}
if (AppConstants.MOZ_UPDATER) {
gAppUpdater = new appUpdater();
let onUnload = () => {
window.removeEventListener("unload", onUnload);
Services.prefs.removeObserver("app.update.", this);

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

@ -4,6 +4,10 @@
<!-- Advanced panel -->
#ifdef MOZ_UPDATER
<script type="application/javascript" src="chrome://browser/content/aboutDialog-appUpdater.js"/>
#endif
<script type="application/javascript"
src="chrome://browser/content/preferences/in-content/advanced.js"/>
@ -52,23 +56,16 @@
<!-- Update -->
<groupbox id="updateApp" data-category="paneAdvanced" hidden="true">
<caption><label>&updateApplication.label;</label></caption>
#ifdef MOZ_UPDATER
<description>&updateApplication.description;</description>
<hbox align="start">
<vbox flex="1">
<radiogroup id="updateRadioGroup">
<radio id="autoDesktop"
value="auto"
label="&updateAuto2.label;"
accesskey="&updateAuto2.accesskey;"/>
<radio value="checkOnly"
label="&updateCheckChoose2.label;"
accesskey="&updateCheckChoose2.accesskey;"/>
<radio value="manual"
label="&updateManual2.label;"
accesskey="&updateManual2.accesskey;"/>
</radiogroup>
<description>
&updateApplication.version.pre;<label id="version"/>&updateApplication.version.post;
<label id="releasenotes" class="learnMore text-link" hidden="true">&releaseNotes.link;</label>
</description>
<description id="distribution" class="text-blurb" hidden="true"/>
<description id="distributionId" class="text-blurb" hidden="true"/>
</vbox>
#ifdef MOZ_UPDATER
<spacer flex="1"/>
<vbox>
<button id="showUpdateHistory"
@ -77,7 +74,112 @@
accesskey="&updateHistory2.accesskey;"
preference="app.update.disable_button.showUpdateHistory"/>
</vbox>
#endif
</hbox>
#ifdef MOZ_UPDATER
<vbox id="updateBox">
<deck id="updateDeck" orient="vertical">
<hbox id="checkForUpdates" align="center">
<spacer flex="1"/>
<button id="checkForUpdatesButton"
label="&update.checkForUpdatesButton.label;"
accesskey="&update.checkForUpdatesButton.accesskey;"
oncommand="gAppUpdater.checkForUpdates();"/>
</hbox>
<hbox id="downloadAndInstall" align="center">
<spacer flex="1"/>
<button id="downloadAndInstallButton"
oncommand="gAppUpdater.startDownload();"/>
<!-- label and accesskey will be filled by JS -->
</hbox>
<hbox id="apply" align="center">
<spacer flex="1"/>
<button id="updateButton"
label="&update.updateButton.label3;"
accesskey="&update.updateButton.accesskey;"
oncommand="gAppUpdater.buttonRestartAfterDownload();"/>
</hbox>
<hbox id="checkingForUpdates" align="center">
<image class="update-throbber"/><label>&update.checkingForUpdates;</label>
<spacer flex="1"/>
<button label="&update.checkForUpdatesButton.label;"
accesskey="&update.checkForUpdatesButton.accesskey;"
disabled="true"/>
</hbox>
<hbox id="downloading" align="center">
<image class="update-throbber"/><label>&update.downloading.start;</label><label id="downloadStatus"/><label>&update.downloading.end;</label>
</hbox>
<hbox id="applying" align="center">
<image class="update-throbber"/><label>&update.applying;</label>
</hbox>
<hbox id="downloadFailed" align="center">
<label>&update.failed.start;</label><label id="failedLink" class="text-link">&update.failed.linkText;</label><label>&update.failed.end;</label>
<spacer flex="1"/>
<button label="&update.checkForUpdatesButton.label;"
accesskey="&update.checkForUpdatesButton.accesskey;"
oncommand="gAppUpdater.checkForUpdates();"/>
</hbox>
<hbox id="adminDisabled" align="center">
<label>&update.adminDisabled;</label>
<spacer flex="1"/>
<button label="&update.checkForUpdatesButton.label;"
accesskey="&update.checkForUpdatesButton.accesskey;"
disabled="true"/>
</hbox>
<hbox id="noUpdatesFound" align="center">
<label>&update.noUpdatesFound;</label>
<spacer flex="1"/>
<button label="&update.checkForUpdatesButton.label;"
accesskey="&update.checkForUpdatesButton.accesskey;"
oncommand="gAppUpdater.checkForUpdates();"/>
</hbox>
<hbox id="otherInstanceHandlingUpdates" align="center">
<label>&update.otherInstanceHandlingUpdates;</label>
<spacer flex="1"/>
<button label="&update.checkForUpdatesButton.label;"
accesskey="&update.checkForUpdatesButton.accesskey;"
disabled="true"/>
</hbox>
<hbox id="manualUpdate" align="center">
<label>&update.manual.start;</label><label id="manualLink" class="text-link"/><label>&update.manual.end;</label>
<spacer flex="1"/>
<button label="&update.checkForUpdatesButton.label;"
accesskey="&update.checkForUpdatesButton.accesskey;"
disabled="true"/>
</hbox>
<hbox id="unsupportedSystem" align="center">
<label>&update.unsupported.start;</label><label id="unsupportedLink" class="text-link">&update.unsupported.linkText;</label><label>&update.unsupported.end;</label>
<spacer flex="1"/>
<button label="&update.checkForUpdatesButton.label;"
accesskey="&update.checkForUpdatesButton.accesskey;"
disabled="true"/>
</hbox>
<hbox id="restarting" align="center">
<label>&update.restarting;</label>
<spacer flex="1"/>
<button label="&update.updateButton.label3;"
accesskey="&update.updateButton.accesskey;"
disabled="true"/>
</hbox>
</deck>
</vbox>
#endif
<separator/>
#ifdef MOZ_UPDATER
<description>&updateApplication.description;</description>
<radiogroup id="updateRadioGroup">
<radio id="autoDesktop"
value="auto"
label="&updateAuto2.label;"
accesskey="&updateAuto2.accesskey;"/>
<radio value="checkOnly"
label="&updateCheckChoose2.label;"
accesskey="&updateCheckChoose2.accesskey;"/>
<radio value="manual"
label="&updateManual2.label;"
accesskey="&updateManual2.accesskey;"/>
</radiogroup>
#ifdef MOZ_MAINTENANCE_SERVICE
<checkbox id="useService"
label="&useService.label;"

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

@ -37,6 +37,8 @@
"chrome://browser/locale/preferences/applications.dtd">
<!ENTITY % advancedDTD SYSTEM
"chrome://browser/locale/preferences/advanced.dtd">
<!ENTITY % aboutDialogDTD SYSTEM "chrome://browser/locale/aboutDialog.dtd" >
%aboutDialogDTD;
%brandDTD;
%globalPreferencesDTD;
%preferencesDTD;

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

@ -3,6 +3,10 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!ENTITY aboutDialog.title "About &brandFullName;">
<!-- LOCALIZATION NOTE (update.*):
# These strings are also used in the update pane of preferences.
# See about:preferences#advanced.
-->
<!-- LOCALIZATION NOTE (update.checkForUpdatesButton.*, update.updateButton.*):
# Only one button is present at a time.
# The button when displayed is located directly under the Firefox version in
@ -91,7 +95,7 @@
<!ENTITY update.unsupported.linkText "Learn more">
<!ENTITY update.unsupported.end "">
<!-- LOCALIZATION NOTE (update.downloading.start,update.downloading.end): update.downloading.start and
<!-- LOCALIZATION NOTE (update.downloading.start,update.downloading.end): update.downloading.start and
update.downloading.end all go into one line, with the amount downloaded inserted in between. As this
is all in one line, try to make the localized text short (see bug 596813 for screenshots). The is
the "em dash" (long dash).

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

@ -81,7 +81,14 @@
<!ENTITY updateTab.label "Update">
<!-- LOCALIZATION NOTE (updateApplication.label):
Strings from aboutDialog.dtd are displayed in this section of the preferences.
Please check for possible accesskey conflicts.
-->
<!ENTITY updateApplication.label "&brandShortName; Updates">
<!-- LOCALIZATION NOTE (updateApplication.version.pre): include a trailing space as needed -->
<!ENTITY updateApplication.version.pre "Version ">
<!ENTITY updateApplication.version.post "">
<!ENTITY updateApplication.description "Allow &brandShortName; to">
<!ENTITY updateAuto2.label "Automatically install updates (recommended for improved security)">
<!ENTITY updateAuto2.accesskey "A">

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

@ -568,6 +568,23 @@ description > html|a {
}
}
#updateDeck > hbox > label {
margin-inline-end: 5px ! important;
}
.update-throbber {
width: 16px;
min-height: 16px;
margin-inline-end: 3px;
list-style-image: url("chrome://global/skin/icons/loading.png");
}
@media (min-resolution: 1.1dppx) {
.update-throbber {
list-style-image: url("chrome://global/skin/icons/loading@2x.png");
}
}
.help-button {
position: fixed;
left: 0;