瀏覽代碼

The Abort/Retry/Ignore dialog shown if an existing file is marked as read-only now displays a task dialog if supported by the system and the existing regular message box otherwise. The task dialog is more user friendly.

Martijn Laan 6 年之前
父節點
當前提交
02761c2786
共有 5 個文件被更改,包括 47 次插入3 次删除
  1. 5 0
      Files/Default.isl
  2. 6 1
      Files/Languages/Dutch.isl
  3. 29 1
      Projects/Install.pas
  4. 5 0
      Projects/MsgIDs.pas
  5. 2 1
      whatsnew.htm

+ 5 - 0
Files/Default.isl

@@ -249,6 +249,7 @@ SelectDirectoryLabel=Please specify the location of the next disk.
 ; *** Installation phase messages
 SetupAborted=Setup was not completed.%n%nPlease correct the problem and run Setup again.
 EntryAbortRetryIgnore=Click Retry to try again, Ignore to proceed anyway, or Abort to cancel installation.
+ChooseAction=Choose action
 
 ; *** Installation status messages
 StatusClosingApplications=Closing applications...
@@ -281,9 +282,13 @@ ErrorIniEntry=Error creating INI entry in file "%1".
 ; *** File copying errors
 FileAbortRetryIgnore=Click Retry to try again, Ignore to skip this file (not recommended), or Abort to cancel installation.
 FileAbortRetryIgnore2=Click Retry to try again, Ignore to proceed anyway (not recommended), or Abort to cancel installation.
+FileAbortRetryIgnoreSkip=Skip this file
+FileAbortRetryIgnoreCancel=Cancel installation
 SourceIsCorrupted=The source file is corrupted
 SourceDoesntExist=The source file "%1" does not exist
 ExistingFileReadOnly=The existing file is marked as read-only.%n%nClick Retry to remove the read-only attribute and try again, Ignore to skip this file, or Abort to cancel installation.
+ExistingFileReadOnly2=The existing file is marked as read-only.
+ExistingFileReadOnlyRetry=Remove the read-only attribute and try again
 ErrorReadingExistingDest=An error occurred while trying to read the existing file:
 FileExists=The file already exists.%n%nWould you like Setup to overwrite it?
 ExistingFileNewer=The existing file is newer than the one Setup is trying to install. It is recommended that you keep the existing file.%n%nDo you want to keep the existing file?

+ 6 - 1
Files/Languages/Dutch.isl

@@ -229,6 +229,7 @@ SelectDirectoryLabel=Geef de locatie van de volgende diskette.
 ; *** Installation phase messages
 SetupAborted=Setup is niet voltooid.%n%nCorrigeer het probleem en voer Setup opnieuw uit.
 EntryAbortRetryIgnore=Klik op Opnieuw om het opnieuw te proberen, op Negeren om toch door te gaan, of op Afbreken om de installatie af te breken.
+ChooseAction=Kies actie
 
 ; *** Installation status messages
 StatusClosingApplications=Programma's afsluiten...
@@ -259,11 +260,15 @@ ErrorRegWriteKey=Fout bij het schrijven naar registersleutel:%n%1\%2
 ErrorIniEntry=Fout bij het maken van een INI-instelling in bestand "%1".
 
 ; *** File copying errors
-FileAbortRetryIgnore=Klik op Opnieuw om het opnieuw te proberen, op Negeren om toch door te gaan (niet aanbevolen), of op Afbreken om de installatie af te breken.
+FileAbortRetryIgnore=Klik op Opnieuw om het opnieuw te proberen, op Negeren om dit bestand over te slaan (niet aanbevolen), of op Afbreken om de installatie af te breken.
 FileAbortRetryIgnore2=Klik op Opnieuw om het opnieuw te proberen, op Negeren om toch door te gaan (niet aanbevolen), of op Afbreken om de installatie af te breken.
+FileAbortRetryIgnoreSkip=Sla dit bestand over
+FileAbortRetryIgnoreCancel=Breek de installatie af
 SourceIsCorrupted=Het bronbestand is beschadigd
 SourceDoesntExist=Het bronbestand "%1" bestaat niet
 ExistingFileReadOnly=Het bestaande bestand is gemarkeerd als alleen-lezen.%n%nKlik op Opnieuw om het kenmerk alleen-lezen te verwijderen en opnieuw te proberen, op Negeren om dit bestand over te slaan, of op Afbreken om de installatie af te breken.
+ExistingFileReadOnly2=Het bestaande bestand is gemarkeerd als alleen-lezen.
+ExistingFileReadOnlyRetry=Verwijder het kenmerk alleen-lezen en probeer opnieuw
 ErrorReadingExistingDest=Er is een fout opgetreden bij het lezen van het bestaande bestand:
 FileExists=Het bestand bestaat al.%n%nWilt u dat Setup het overschrijft?
 ExistingFileNewer=Het bestaande bestand is nieuwer dan het bestand dat Setup probeert te installeren. U wordt aanbevolen het bestaande bestand te behouden.%n%nWilt u het bestaande bestand behouden?

+ 29 - 1
Projects/Install.pas

@@ -211,6 +211,31 @@ begin
   end;
 end;
 
+function AbortRetryIgnoreTaskDialogMsgBox(const TaskDialogText1, TaskDialogText2, MsgBoxText1, MsgBoxText2: String;
+  const RetryIgnoreAbortButtonLabels: array of String): Boolean;
+{ Returns True if Ignore was selected, False if Retry was selected, or
+  calls Abort if Abort was selected. }
+var
+  TaskDialogText: String;
+begin
+  if TaskDialogText2 <> '' then
+    TaskDialogText := TaskDialogText1 + SNewLine2 + TaskDialogText2
+  else
+    TaskDialogText := TaskDialogText1;
+  Result := False;
+  case LoggedTaskDialogMsgBox('', SetupMessages[msgChooseAction], TaskDialogText,
+         MsgBoxText1 + SNewLine2 + MsgBoxText2, '', mbError, MB_ABORTRETRYIGNORE,
+         RetryIgnoreAbortButtonLabels,
+         0, False, True, IDABORT) of
+    IDABORT: Abort;
+    IDRETRY: ;
+    IDIGNORE: Result := True;
+  else
+    Log('LoggedTaskDialogMsgBox returned an unexpected value. Assuming Abort.');
+    Abort;
+  end;
+end;
+
 function FileTimeToStr(const AFileTime: TFileTime): String;
 { Converts a TFileTime into a string for log purposes. }
 var
@@ -1310,7 +1335,10 @@ var
             if (ExistingFileAttr <> -1) and
                (ExistingFileAttr and FILE_ATTRIBUTE_READONLY <> 0) then begin
               if not(foOverwriteReadOnly in CurFile^.Options) and
-                 AbortRetryIgnoreMsgBox(DestFile, SetupMessages[msgExistingFileReadOnly]) then begin
+                 AbortRetryIgnoreTaskDialogMsgBox(
+                   DestFile, SetupMessages[msgExistingFileReadOnly2],
+                   DestFile, SetupMessages[msgExistingFileReadOnly],
+                   [SetupMessages[msgExistingFileReadOnlyRetry], SetupMessages[msgFileAbortRetryIgnoreSkip], SetupMessages[msgFileAbortRetryIgnoreCancel]]) then begin
                 Log('User opted not to strip the existing file''s read-only attribute. Skipping.');
                 goto Skip;
               end;

+ 5 - 0
Projects/MsgIDs.pas

@@ -45,6 +45,7 @@ type
     msgCannotInstallToNetworkDrive,
     msgCannotInstallToUNCPath,
     msgChangeDiskTitle,
+    msgChooseAction,
     msgClickFinish,
     msgClickNext,
     msgCloseApplications,
@@ -95,10 +96,14 @@ type
     msgErrorTooManyFilesInDir,
     msgExistingFileNewer,
     msgExistingFileReadOnly,
+    msgExistingFileReadOnly2,
+    msgExistingFileReadOnlyRetry,
     msgExitSetupMessage,
     msgExitSetupTitle,
     msgFileAbortRetryIgnore,
     msgFileAbortRetryIgnore2,
+    msgFileAbortRetryIgnoreSkip,
+    msgFileAbortRetryIgnoreCancel,
     msgFileExists,
     msgFileNotInDir2,
     msgFinishedHeadingLabel,

+ 2 - 1
whatsnew.htm

@@ -113,6 +113,7 @@ For conditions of distribution and use, see <a href="http://www.jrsoftware.org/f
   <li>Added support for 64-bit mode on Windows 10 on ARM which can be used to install ARM64 binaries. See the <i>64BitThreeArch.iss</i> example script for an example which demonstrates how to install a program built for three different architectures (x86, x64, ARM64) using a single installer.</li>
 </ul>
 <ul>
+  <li>The Abort/Retry/Ignore dialog shown if an existing file is marked as read-only now displays a task dialog if supported by the system and the existing regular message box otherwise. The task dialog is more user friendly (<a href="https://i.imgur.com/IwOfoQo.png">task dialog example</a>, <a href="https://i.imgur.com/n7wh2UC.png">message box example</a>).</li>
   <li>Added new [Setup] section directive: <tt>VersionInfoOriginalFileName</tt>, which sets the original filename version value.</li>
   <li>The <tt>Permissions</tt> parameter supported by [Files], [Dirs] and [Registry] entries now also allows you to grant permission to the Guests group, the Local Service account, the Network Service account, and to the Creator Owner.</li>
   <li>Added new special-purpose <i>HelpTextNote</i> message that can be used to specify one or more lines of text that are added to the list of parameters in the summary shown when passing /HELP on the command line. This message defaults to an empty string so make sure to provide a non-empty default for all languages from your main script if you want to use it.</li>
@@ -154,7 +155,7 @@ For conditions of distribution and use, see <a href="http://www.jrsoftware.org/f
 
 <p>Some messages have been added in this version:<!-- (<a href="https://github.com/jrsoftware/issrc/commit/b0cd1a0177b818e36734026c67dc24f01ad6a0d0">View differences in Default.isl</a>).--></p>
 <ul>
-  <li><b>New messages:</b> PrivilegesRequiredOverrideInstruction, PrivilegesRequiredOverrideTaskDialogText1, PrivilegesRequiredOverrideMsgBoxText1, PrivilegesRequiredOverrideTaskDialogText2, PrivilegesRequiredOverrideMsgBoxText2, PrivilegesRequiredOverrideAllUsers, PrivilegesRequiredOverrideCurrentUser, PrivilegesRequiredOverrideRecommended, UninstallDisplayNameMark, UninstallDisplayNameMarks, UninstallDisplayNameMark32Bit, UninstallDisplayNameMark64Bit, UninstallDisplayNameMarkAllUsers, UninstallDisplayNameCurrentUser.</li>
+  <li><b>New messages:</b> ChooseAction, ExistingFileReadOnly2, ExistingFileReadOnlyRetry, FileAbortRetryIgnoreSkip, FileAbortRetryIgnoreCancel, PrivilegesRequiredOverrideInstruction, PrivilegesRequiredOverrideTaskDialogText1, PrivilegesRequiredOverrideMsgBoxText1, PrivilegesRequiredOverrideTaskDialogText2, PrivilegesRequiredOverrideMsgBoxText2, PrivilegesRequiredOverrideAllUsers, PrivilegesRequiredOverrideCurrentUser, PrivilegesRequiredOverrideRecommended, UninstallDisplayNameMark, UninstallDisplayNameMarks, UninstallDisplayNameMark32Bit, UninstallDisplayNameMark64Bit, UninstallDisplayNameMarkAllUsers, UninstallDisplayNameCurrentUser.</li>
 </ul>
 
 <p>Note: Only the official English and Dutch (Netherlands) translations have been updated for these changes at this moment. See the <a href="http://www.jrsoftware.org/files/istrans/">Inno Setup Translations</a> page for more information.</p>