From 768142010cb981666e33dd465fb266fb41dd63de Mon Sep 17 00:00:00 2001 From: Richard Marti Date: Sun, 21 May 2017 15:20:25 +0200 Subject: [PATCH] Bug 1364653 - Port bug 1356507 to TB [Show version and updater in the preferences update pane]. r=jorgk --- mail/base/content/aboutDialog-appUpdater.js | 11 +- mail/components/preferences/advanced.js | 42 ++++++ mail/components/preferences/advanced.xul | 138 +++++++++++++++--- .../en-US/chrome/messenger/aboutDialog.dtd | 5 +- .../chrome/messenger/preferences/advanced.dtd | 14 +- .../linux/mail/preferences/preferences.css | 13 ++ .../osx/mail/preferences/preferences.css | 13 ++ .../mail/incontentprefs/aboutPreferences.css | 9 ++ .../windows/mail/preferences/preferences.css | 13 ++ 9 files changed, 233 insertions(+), 25 deletions(-) diff --git a/mail/base/content/aboutDialog-appUpdater.js b/mail/base/content/aboutDialog-appUpdater.js index b4eb6a28e2..9162d6aba1 100644 --- a/mail/base/content/aboutDialog-appUpdater.js +++ b/mail/base/content/aboutDialog-appUpdater.js @@ -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. Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); Components.utils.import("resource://gre/modules/DownloadUtils.jsm"); @@ -164,6 +165,14 @@ appUpdater.prototype = if (button) { if (aChildID == "downloadAndInstall") { let updateVersion = gAppUpdater.update.displayVersion; + // Include the build ID if this is an "a#" (nightly) build + if (/a\d+$/.test(updateVersion)) { + let buildID = gAppUpdater.update.buildID; + let year = buildID.slice(0, 4); + let month = buildID.slice(4, 6); + let day = buildID.slice(6, 8); + updateVersion += ` (${year}-${month}-${day})`; + } button.label = this.bundle.formatStringFromName("update.downloadAndInstallButton.label", [updateVersion], 1); button.accessKey = this.bundle.GetStringFromName("update.downloadAndInstallButton.accesskey"); } diff --git a/mail/components/preferences/advanced.js b/mail/components/preferences/advanced.js index cffad65cb0..6a3a4836e5 100644 --- a/mail/components/preferences/advanced.js +++ b/mail/components/preferences/advanced.js @@ -6,6 +6,7 @@ // Load DownloadUtils module for convertByteUnits Components.utils.import("resource://gre/modules/DownloadUtils.jsm"); Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); +Components.utils.import("resource://gre/modules/AppConstants.jsm"); var gAdvancedPane = { mPane: null, @@ -85,6 +86,47 @@ var gAdvancedPane = { this.mShellServiceWorking = 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.style.display = "block"; + + let distroAbout = Services.prefs.getStringPref("distribution.about", ""); + if (distroAbout) { + let distroField = document.getElementById("distribution"); + distroField.value = distroAbout; + distroField.style.display = "block"; + } + } + + let version = AppConstants.MOZ_APP_VERSION_DISPLAY; + + // Include the build ID and display warning 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://messenger/locale/messenger.properties"); + let archResource = Services.appinfo.is64Bit + ? "aboutDialog.architecture.sixtyFourBit" + : "aboutDialog.architecture.thirtyTwoBit"; + let arch = bundle.GetStringFromName(archResource); + version += ` (${arch})`; + + document.getElementById("version").textContent = version; + + if (AppConstants.MOZ_UPDATER) { + gAppUpdater = new appUpdater(); + } + if (this._loadInContent) { gSubDialog.init(); } diff --git a/mail/components/preferences/advanced.xul b/mail/components/preferences/advanced.xul index 012aab6902..33edf6a744 100644 --- a/mail/components/preferences/advanced.xul +++ b/mail/components/preferences/advanced.xul @@ -21,11 +21,18 @@ %searchIntegrationDefaultDTD; #endif #endif +#ifdef MOZ_UPDATER + +%aboutDialogDTD; +#endif ]> +#ifdef MOZ_UPDATER +