Browse Source

Improving formatting of errors displayed after an operation completed in Continue on error mode.

(cherry picked from commit 08e3b5ab6c3b2264c7c335a8461f91f9a0b5f335)

Source commit: b957184f01e91db0ef56227be6b5819ccbdc371b
Martin Prikryl 4 years ago
parent
commit
276ca9ff6a
1 changed files with 16 additions and 4 deletions
  1. 16 4
      source/forms/CustomScpExplorer.cpp

+ 16 - 4
source/forms/CustomScpExplorer.cpp

@@ -2959,6 +2959,7 @@ void __fastcall TCustomScpExplorerForm::ExecuteCopyOperationCommand(
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::HandleErrorList(TStringList *& ErrorList)
 {
+  int Count = ErrorList->Count;
   try
   {
     if (ErrorList->Count)
@@ -2971,7 +2972,7 @@ void __fastcall TCustomScpExplorerForm::HandleErrorList(TStringList *& ErrorList
         int Index = 0;
         do
         {
-          DebugAssert(Index >= 0 && Index < ErrorList->Count);
+          DebugAssert(Index >= 0 && Index < Count);
           TQueryButtonAlias Aliases[2];
           Aliases[0].Button = qaYes;
           Aliases[0].Alias = LoadStr(PREV_BUTTON);
@@ -2981,10 +2982,21 @@ void __fastcall TCustomScpExplorerForm::HandleErrorList(TStringList *& ErrorList
           Params.Aliases = Aliases;
           Params.AliasesCount = LENOF(Aliases);
 
+          int No = Index + 1;
+
+          UnicodeString Message = ErrorList->Strings[Index];
+          UnicodeString AMainInstructions;
+          UnicodeString Details;
+          if (ExtractMainInstructions(Message, AMainInstructions))
+          {
+            Details = Message;
+            Message = AMainInstructions;
+          }
+          Message = MainInstructions(FMTLOAD(ERROR_LIST_NUMBER, (No, Count, Message))) + Details;
           Answer = MoreMessageDialog(
-            FMTLOAD(ERROR_LIST_NUMBER, (Index+1, ErrorList->Count, ErrorList->Strings[Index])),
+            Message,
             dynamic_cast<TStrings *>(ErrorList->Objects[Index]), qtError,
-            (Index ? qaYes : 0) | (Index < ErrorList->Count - 1 ? qaNo : 0) |
+            (Index ? qaYes : 0) | (Index < Count - 1 ? qaNo : 0) |
             qaOK, HELP_NONE, &Params);
 
           if (Answer == qaNo)
@@ -3004,7 +3016,7 @@ void __fastcall TCustomScpExplorerForm::HandleErrorList(TStringList *& ErrorList
   {
     TStrings * List = ErrorList;
     ErrorList = NULL;
-    for (int i = 0; i < List->Count; i++)
+    for (int i = 0; i < Count; i++)
     {
       delete List->Objects[i];
     }