Bladeren bron

Make AskRetryDownloadArchivesToExtract msgbox a nice one, consistent with AbortRetryIgnoreTaskDialogMsgBox. Do same for RenameUninstallExe. Todo: new message commit + make LastBaseNameOrUrl available to [Code].

Martijn Laan 2 maanden geleden
bovenliggende
commit
0970f192da

+ 2 - 0
Files/Default.isl

@@ -278,6 +278,8 @@ AbortRetryIgnoreSelectAction=Select action
 AbortRetryIgnoreRetry=&Try again
 AbortRetryIgnoreIgnore=&Ignore the error and continue
 AbortRetryIgnoreCancel=Cancel installation
+RetryCancelSelectAction=Select action
+RetryCancelRetry=&Try again
 
 ; *** Installation status messages
 StatusClosingApplications=Closing applications...

+ 8 - 6
Projects/Src/Setup.Install.pas

@@ -3243,15 +3243,17 @@ var
           Continue;
         end;
       end;
-      case LoggedMsgBox(UninstallExeFilename + SNewLine2 +
-         SetupMessages[msgErrorReplacingExistingFile] + SNewLine2 +
-         AddPeriod(FmtSetupMessage(msgErrorFunctionFailedWithMessage,
-           ['MoveFileEx', IntToStr(LastError), Win32ErrorString(LastError)])),
-         '', mbError, MB_RETRYCANCEL, True, IDCANCEL) of
+
+      const LastOperation = SetupMessages[msgErrorReplacingExistingFile];
+      const Failed = AddPeriod(FmtSetupMessage(msgErrorFunctionFailedWithMessage,
+        ['MoveFileEx', IntToStr(LastError), Win32ErrorString(LastError)]));
+      const Text = UninstallExeFilename + SNewLine2 + LastOperation + SNewLine + Failed;
+      case LoggedTaskDialogMsgBox('',  SetupMessages[msgRetryCancelSelectAction], Text, '',
+         mbError, MB_RETRYCANCEL, [SetupMessages[msgRetryCancelRetry]], 0, True, IDCANCEL) of
         IDRETRY: ;
         IDCANCEL: Abort;
       else
-        Log('LoggedMsgBox returned an unexpected value. Assuming Cancel.');
+        Log('LoggedTaskDialogMsgBox returned an unexpected value. Assuming Cancel.');
         Abort;
       end;
     end;

+ 3 - 0
Projects/Src/Setup.ScriptDlg.pas

@@ -190,6 +190,7 @@ type
       FShowBaseNameInsteadOfUrl: Boolean;
       FAbortButton: TNewButton;
       FShowProgressControlsOnNextProgress, FAbortedByUser: Boolean;
+      FLastBaseNameOrUrl: String;
       function DoAdd(const Url, BaseName, RequiredSHA256OfFile: String;
         const UserName, Password: String; const ISSigVerify: Boolean;
         const ISSigAllowedKeys: AnsiString; const DotISSigEntry: Boolean; const Data: NativeUInt): Integer;
@@ -216,6 +217,7 @@ type
     published
       property AbortButton: TNewButton read FAbortButton;
       property AbortedByUser: Boolean read FAbortedByUser;
+      property LastBaseNameOrUrl: String read FLastBaseNameOrUrl;
       property ShowBaseNameInsteadOfUrl: Boolean read FShowBaseNameInsteadOfUrl write FShowBaseNameInsteadOfUrl;
   end;
   
@@ -1158,6 +1160,7 @@ begin
     for var I := 0 to FFiles.Count-1 do begin
       { Don't need to set DownloadTemporaryFileOrExtractArchiveProcessMessages before downloading since we already process messages ourselves }
       const F = FFiles[I];
+      FLastBaseNameOrUrl := IfThen(FShowBaseNameInsteadOfUrl, PathExtractName(F.BaseName), F.Url);
       SetDownloadTemporaryFileCredentials(F.UserName, F.Password);
       var DestFile: String;
       Result := Result + DownloadTemporaryFile(F.Url, F.BaseName, F.Verification, InternalOnDownloadProgress, DestFile);

+ 10 - 6
Projects/Src/Setup.WizardForm.pas

@@ -1844,12 +1844,14 @@ function TWizardForm.PrepareToInstall(const WizardComponents, WizardTasks: TStri
     end;
   end;
 
-  function AskRetryDownloadArchivesToExtract(const Failed: String): Integer;
+  function AskRetryDownloadArchivesToExtract(const LastBaseNameOrUrl, Failed: String): Integer;
   begin
-    {!!!} //make this a proper message - also see RenameUninstallExe which has a retrycancel msgbox as well
-    Result := LoggedMsgBox(Failed + SNewLine2 + 'Retry?', '', mbConfirmation, MB_RETRYCANCEL, True, IDCANCEL);
+    const LastOperation = SetupMessages[msgErrorDownloading];
+    const Text = LastBaseNameOrUrl + SNewLine2 + LastOperation + SNewLine + Failed;
+    Result := LoggedTaskDialogMsgBox('',  SetupMessages[msgRetryCancelSelectAction], Text, '',
+      mbError, MB_RETRYCANCEL, [SetupMessages[msgRetryCancelRetry]], 0, True, IDCANCEL);
     if (Result <> IDRETRY) and (Result <> IDCANCEL) then begin
-      Log('LoggedMsgBox returned an unexpected value. Assuming Cancel.');
+      Log('LoggedTaskDialogMsgBox returned an unexpected value. Assuming Cancel.');
       Result := IDCANCEL;
     end;
   end;
@@ -1893,9 +1895,10 @@ function TWizardForm.PrepareToInstall(const WizardComponents, WizardTasks: TStri
     if DownloadPage <> nil then begin
       DownloadPage.Show;
       try
-        var Failed: String;
+        var Failed, LastBaseNameOrUrl: String;
         repeat
           Failed := '';
+          LastBaseNameOrUrl := '';
           try
             DownloadPage.Download(procedure(const DownloadedFile: TDownloadFile; const DestFile: String; var Remove: Boolean)
               begin
@@ -1917,8 +1920,9 @@ function TWizardForm.PrepareToInstall(const WizardComponents, WizardTasks: TStri
             if DownloadPage.AbortedByUser then
               raise;  { This is a regular exception and not EAbort (which is what we want) }
             Failed := GetExceptMessage;
+            LastBaseNameOrUrl := DownloadPage.LastBaseNameOrUrl;
           end;
-        until (Failed = '') or (AskRetryDownloadArchivesToExtract(Failed) = IDCANCEL);
+        until (Failed = '') or (AskRetryDownloadArchivesToExtract(LastBaseNameOrUrl, Failed) = IDCANCEL);
         if Failed <> '' then
           raise Exception.Create(Failed);
       finally

+ 2 - 0
Projects/Src/Shared.SetupMessageIDs.pas

@@ -196,6 +196,8 @@ type
     msgReadyMemoTasks,
     msgReadyMemoType,
     msgReadyMemoUserInfo,
+    msgRetryCancelRetry,
+    msgRetryCancelSelectAction,
     msgRunEntryExec,
     msgRunEntryShellExec,
     msgSelectComponentsDesc,