Bug 689057 - When upgrading Thunderbird, the button in the installer should be "Upgrade" instead of "Install". r=mkmelin
authorRichard Marti <richard.marti@gmail.com>
Sat, 30 May 2020 14:18:21 +0200
changeset 39284 b9537efaabaf9eeb7c2e2ba9c18b15650c527e5a
parent 39283 a637a794de332ef4732caae59627fcb2e6a0a645
child 39285 713f46cfd0fa60ab114719ea68ea3237e5c625df
push id402
push userclokep@gmail.com
push dateMon, 29 Jun 2020 20:48:04 +0000
reviewersmkmelin
bugs689057
Bug 689057 - When upgrading Thunderbird, the button in the installer should be "Upgrade" instead of "Install". r=mkmelin
mail/installer/windows/nsis/installer.nsi
mail/locales/en-US/installer/custom.properties
--- a/mail/installer/windows/nsis/installer.nsi
+++ b/mail/installer/windows/nsis/installer.nsi
@@ -589,17 +589,17 @@ SectionEnd
 ; Cleanup operations to perform at the end of the installation.
 Section "-InstallEndCleanup"
   SetDetailsPrint both
   DetailPrint "$(STATUS_CLEANUP)"
   SetDetailsPrint none
 
   ${Unless} ${Silent}
     ClearErrors
-    ${MUI_INSTALLOPTIONS_READ} $0 "options.ini" "Field 6" "State"
+    ${MUI_INSTALLOPTIONS_READ} $0 "summary.ini" "Field 4" "State"
     ${If} "$0" == "1"
       ${LogHeader} "Setting as the default mail application"
       ClearErrors
       ${GetParameters} $0
       ${GetOptions} "$0" "/UAC:" $0
       ${If} ${Errors}
         Call SetAsDefaultMailAppUserHKCU
       ${Else}
@@ -974,46 +974,69 @@ Function preSummary
   WriteINIStr "$PLUGINSDIR\summary.ini" "Field 2" flags  "READONLY"
 
   WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Type   "label"
   WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Left   "0"
   WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Right  "-1"
   WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Top    "130"
   WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Bottom "150"
 
-  ${If} "$TmpVal" == "true"
-    WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Type   "label"
-    WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Text   "$(SUMMARY_REBOOT_REQUIRED_INSTALL)"
-    WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Left   "0"
-    WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Right  "-1"
-    WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Top    "35"
-    WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Bottom "45"
-
-    WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "4"
+  ${If} ${FileExists} "$INSTDIR\${FileMainEXE}"
+    WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Text "$(SUMMARY_UPGRADE_CLICK)"
+    WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NextButtonText "$(UPGRADE_BUTTON)"
+  ${Else}
+    WriteINIStr "$PLUGINSDIR\summary.ini" "Field 3" Text "$(SUMMARY_INSTALL_CLICK)"
+    DeleteINIStr "$PLUGINSDIR\summary.ini" "Settings" NextButtonText
   ${EndIf}
 
-  ReadINIStr $0 "$PLUGINSDIR\options.ini" "Field 6" "State"
-  ${If} "$0" == "1"
-    ${If} "$TmpVal" == "true"
-      ; To insert this control reset Top / Bottom for controls below this one
-      WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Top    "50"
-      WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Bottom "60"
+  ; Remove the "Field 4" ini section in case the user hits back and changes the
+  ; installation directory which could change whether the make default checkbox
+  ; should be displayed.
+  DeleteINISec "$PLUGINSDIR\summary.ini" "Field 4"
+
+  ; Check if it is possible to write to HKLM
+  ClearErrors
+  WriteRegStr HKLM "Software\Thunderbird" "${BrandShortName}InstallerTest" "Write Test"
+  ${Unless} ${Errors}
+    DeleteRegValue HKLM "Software\Thunderbird" "${BrandShortName}InstallerTest"
+    ; Check if Firefox is already the handler for http. This is set on all
+    ; versions of Windows.
+    ${IsHandlerForInstallDir} "http" $R9
+    ${If} "$R9" != "true"
+      WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "4"
+      WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Type   "checkbox"
+      WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Text   "$(SUMMARY_TAKE_DEFAULTS)"
+      WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Left   "0"
+      WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Right  "-1"
+      WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" State  "1"
+      WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Top    "32"
+      WriteINIStr "$PLUGINSDIR\summary.ini" "Field 4" Bottom "53"
+    ${EndIf}
+  ${EndUnless}
+
+  ${If} "$TmpVal" == "true"
+    ; If there is already a Type entry in the "Field 4" section with a value of
+    ; checkbox then the set as the default mail client checkbox is displayed and
+    ; this text must be moved below it.
+    ReadINIStr $0 "$PLUGINSDIR\summary.ini" "Field 4" "Type"
+    ${If} "$0" == "checkbox"
       StrCpy $0 "5"
+      WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Top    "53"
+      WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Bottom "68"
     ${Else}
       StrCpy $0 "4"
+      WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Top    "35"
+      WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Bottom "50"
     ${EndIf}
+    WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "$0"
 
     WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Type   "label"
-    WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Text   "$(SUMMARY_MAKE_DEFAULT)"
+    WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Text   "$(SUMMARY_REBOOT_REQUIRED_INSTALL)"
     WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Left   "0"
     WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Right  "-1"
-    WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Top    "35"
-    WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Bottom "45"
-
-    WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "$0"
   ${EndIf}
 
   !insertmacro MUI_HEADER_TEXT "$(SUMMARY_PAGE_TITLE)" "$(SUMMARY_PAGE_SUBTITLE)"
 
   ; The Summary custom page has a textbox that will automatically receive
   ; focus. This sets the focus to the Install button instead.
   !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "summary.ini"
   GetDlgItem $0 $HWNDPARENT 1
@@ -1091,36 +1114,17 @@ Function .onInit
 
   ${InstallOnInitCommon} "$(WARN_MIN_SUPPORTED_OSVER_CPU_MSG)"
 
   !insertmacro InitInstallOptionsFile "options.ini"
   !insertmacro InitInstallOptionsFile "shortcuts.ini"
   !insertmacro InitInstallOptionsFile "components.ini"
   !insertmacro InitInstallOptionsFile "summary.ini"
 
-  ClearErrors
-  WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
-  ${If} ${Errors}
-    ; Setup the options.ini file for the Custom Options Page without the option
-    ; to set as default since the installer is unable to write to HKLM.
-    WriteINIStr "$PLUGINSDIR\options.ini" "Settings" NumFields "5"
-  ${Else}
-    DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
-    ; Setup the options.ini file for the Custom Options Page with the option
-    ; to set as default
-    WriteINIStr "$PLUGINSDIR\options.ini" "Settings" NumFields "6"
-
-    WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Type   "checkbox"
-    WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Text   "$(OPTIONS_MAKE_DEFAULT)"
-    WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Left   "0"
-    WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Right  "-1"
-    WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Top    "124"
-    WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Bottom "145"
-    WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" State  "1"
-  ${EndIf}
+  WriteINIStr "$PLUGINSDIR\options.ini" "Settings" NumFields "5"
 
   WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Type   "label"
   WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Text   "$(OPTIONS_SUMMARY)"
   WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Left   "0"
   WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Right  "-1"
   WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Top    "0"
   WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Bottom "10"
 
--- a/mail/locales/en-US/installer/custom.properties
+++ b/mail/locales/en-US/installer/custom.properties
@@ -18,30 +18,30 @@
 # You can use \n to create a newline in the string but only when the string
 # from en-US contains a \n.
 
 REG_APP_DESC=$BrandShortName is a full-featured email application. $BrandShortName supports IMAP and POP mail protocols, as well as HTML mail formatting. Built-in junk mail controls, RSS capabilities, powerful quick search, spell check as you type, global inbox, and advanced message filtering round out $BrandShortName's modern feature set.
 CONTEXT_OPTIONS=$BrandShortName &Options
 CONTEXT_SAFE_MODE=$BrandShortName &Safe Mode
 OPTIONS_PAGE_TITLE=Setup Type
 OPTIONS_PAGE_SUBTITLE=Choose setup options
-OPTIONS_MAKE_DEFAULT=&Use $BrandShortName as my default mail application
 SHORTCUTS_PAGE_TITLE=Set Up Shortcuts
 SHORTCUTS_PAGE_SUBTITLE=Create Program Icons
 COMPONENTS_PAGE_TITLE=Set Up Optional Components
 COMPONENTS_PAGE_SUBTITLE=Optional Recommended Components
 OPTIONAL_COMPONENTS_DESC=The Maintenance Service will allow you to update $BrandShortName silently in the background.
 MAINTENANCE_SERVICE_CHECKBOX_DESC=Install &Maintenance Service
 SUMMARY_PAGE_TITLE=Summary
 SUMMARY_PAGE_SUBTITLE=Ready to start installing $BrandShortName
 SUMMARY_INSTALLED_TO=$BrandShortName will be installed to the following location:
 SUMMARY_REBOOT_REQUIRED_INSTALL=A restart of your computer may be required to complete the installation.
 SUMMARY_REBOOT_REQUIRED_UNINSTALL=A restart of your computer may be required to complete the uninstall.
-SUMMARY_MAKE_DEFAULT=$BrandShortName will be set as your default mail application.
-SUMMARY_CLICK=Click Install to continue.
+SUMMARY_TAKE_DEFAULTS=U&se $BrandShortName as my default mail application
+SUMMARY_INSTALL_CLICK=Click Install to continue.
+SUMMARY_UPGRADE_CLICK=Click Upgrade to continue.
 SURVEY_TEXT=&Tell us what you thought of $BrandShortName
 LAUNCH_TEXT=&Launch $BrandFullName now
 CREATE_ICONS_DESC=Create icons for $BrandShortName:
 ICONS_DESKTOP=On my &Desktop
 ICONS_STARTMENU=In my &Start Menu Programs folder
 ICONS_QUICKLAUNCH=In my &Quick Launch bar
 WARN_MANUALLY_CLOSE_APP_INSTALL=$BrandShortName must be closed to proceed with the installation.\n\nPlease close $BrandShortName to continue.
 WARN_MANUALLY_CLOSE_APP_UNINSTALL=$BrandShortName must be closed to proceed with the uninstall.\n\nPlease close $BrandShortName to continue.
@@ -72,8 +72,14 @@ STATUS_CLEANUP=Cleaning up the birdcage…
 # One line
 OPTIONS_SUMMARY=Choose the type of setup you prefer, then click Next.
 # One line
 OPTION_STANDARD_DESC=$BrandShortName will be installed with the most common options.
 OPTION_STANDARD_RADIO=&Standard
 # Two lines
 OPTION_CUSTOM_DESC=You may choose individual options to be installed. Recommended for experienced users.
 OPTION_CUSTOM_RADIO=&Custom
+
+# LOCALIZATION NOTE:
+# The following text replaces the Install button text on the summary page.
+# Verify that the access key for InstallBtn (in override.properties) and
+# UPGRADE_BUTTON is not already used by SUMMARY_TAKE_DEFAULTS.
+UPGRADE_BUTTON=&Upgrade