Changeset 30 for trunk/UCore.pas
- Timestamp:
- Nov 24, 2021, 8:42:24 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r29 r30 68 68 InitializeStarted: Boolean; 69 69 InitializeFinished: Boolean; 70 LoadErrors: string; 70 71 procedure FileModified(Sender: TObject); 71 72 function FindFirstNonOption: string; … … 73 74 procedure LoadConfig; 74 75 procedure SaveConfig; 76 procedure DoError(Text: string; Line: Integer); 75 77 public 76 78 DefaultDataFileClass: TDataFileClass; … … 97 99 uses 98 100 UFormMain, UFormSettings, UContact, UFormContacts, UFormFindDuplicity, 99 UFormGenerate ;101 UFormGenerate, UFormError; 100 102 101 103 resourcestring … … 104 106 SFileNotFound = 'File ''%s'' not found.'; 105 107 SMergedContacts = 'Contacts merged. Loaded: %d, New: %d, Updated: %d'; 108 SLine = 'Line %d: %s'; 106 109 107 110 { TMergeResult } … … 310 313 if FileClosed then begin 311 314 FileNew; 315 LoadErrors := ''; 312 316 DataFile.LoadFromFile(FileName); 313 317 LastOpenedList1.AddItem(FileName); 318 if LoadErrors <> '' then begin 319 FormError := TFormError.Create(nil); 320 FormError.MemoErrors.Text := LoadErrors; 321 FormError.ShowModal; 322 FreeAndNil(FormError); 323 end; 314 324 end; 315 325 end else ShowMessage(Format(SFileNotFound, [FileName])); … … 379 389 DataFile := DefaultDataFileClass.Create; 380 390 DataFile.OnModify := FileModified; 391 TContactsFile(DataFile).OnError := DoError; 381 392 end; 382 393 end; … … 437 448 end; 438 449 450 procedure TCore.DoError(Text: string; Line: Integer); 451 begin 452 LoadErrors := LoadErrors + Format(SLine, [Line, Text]) + LineEnding; 453 end; 454 439 455 procedure TCore.UpdateInterface; 440 456 begin
Note:
See TracChangeset
for help on using the changeset viewer.