Changeset 129 for trunk/UCore.pas


Ignore:
Timestamp:
Apr 9, 2022, 11:52:13 AM (3 years ago)
Author:
chronos
Message:
  • Added: TVCard as TComponent descendant.
  • Modified: TContactsFile renamed to TVCardFile and moved into separate file.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r127 r129  
    114114
    115115uses
    116   UFormMain, UFormSettings, UContact, UFormContacts, UFormFindDuplicity, UTest,
     116  UFormMain, UFormSettings, UVCard, UFormContacts, UFormFindDuplicity, UTest,
    117117  UFormGenerate, UFormError, UFormFind, UFormTest, UFormSource, UFormCompare,
    118   UTestCases;
     118  UTestCases, UVCardFile;
    119119
    120120resourcestring
     
    156156    for I := 0 to OpenDialog1.Files.Count - 1 do begin
    157157      if FileExists(OpenDialog1.Files[I]) then begin
    158         TempFile := TContactsFile.Create;
     158        TempFile := TVCardFile.Create;
    159159        try
    160160          TempFile.LoadFromFile(OpenDialog1.Files[I]);
    161           TContactsFile(DataFile).Contacts.AddContacts(TContactsFile(TempFile).Contacts);
     161          TVCardFile(DataFile).VCard.Contacts.AddContacts(TVCardFile(TempFile).VCard.Contacts);
    162162          Inc(LoadedFiles);
    163163        finally
     
    166166      end;
    167167    end;
    168     if LoadedFiles > 0 then TContactsFile(DataFile).Modified := True;
     168    if LoadedFiles > 0 then TVCardFile(DataFile).Modified := True;
    169169    ShowMessage(Format(SCombinedContacts, [LoadedFiles]));
    170170    UpdateFile;
     
    193193        DirectorySeparator + 'Compare' + VCardFileExt;
    194194      ForceDirectories(ExtractFileDir(TempFileName));
    195       TContactsFile(DataFile).SaveToFile(TempFileName);
     195      TVCardFile(DataFile).SaveToFile(TempFileName);
    196196      LoadFileLeft(TempFileName);
    197197      LoadFileRight(OpenDialog1.FileName);
     
    226226  if SelectDirectoryDialog1.Execute then begin
    227227    LastSplitDir := SelectDirectoryDialog1.FileName;
    228     with TContactsFile(DataFile).Contacts do
     228    with TVCardFile(DataFile).VCard.Contacts do
    229229    for I := 0 to Count - 1 do begin
    230230      if Items[I].Fields[cfFullName] <> '' then begin
     
    253253  with TFormFindDuplicity.Create(nil) do
    254254  try
    255     Contacts := TContactsFile(DataFile).Contacts;
     255    Contacts := TVCardFile(DataFile).VCard.Contacts;
    256256    ShowModal;
    257257    FormContacts.ReloadList;
     
    266266  with TFormFind.Create(nil) do
    267267  try
    268     Contacts := TContactsFile(DataFile).Contacts;
     268    Contacts := TVCardFile(DataFile).VCard.Contacts;
    269269    ShowModal;
    270270    FormContacts.ReloadList;
     
    279279  with TFormGenerate.Create(nil) do
    280280  try
    281     Contacts := TContactsFile(DataFile).Contacts;
     281    Contacts := TVCardFile(DataFile).VCard.Contacts;
    282282    if ShowModal = mrOk then begin
    283283      FormContacts.ReloadList;
     
    298298procedure TCore.ARemoveExactDuplicatesExecute(Sender: TObject);
    299299begin
    300   TContactsFile(DataFile).Contacts.RemoveExactDuplicates;
     300  TVCardFile(DataFile).VCard.Contacts.RemoveExactDuplicates;
    301301  UpdateFile;
    302302end;
     
    336336  with TFormSource.Create(nil) do
    337337  try
    338     Source := TContactsFile(DataFile).AsString;
     338    Source := TVCardFile(DataFile).VCard.AsString;
    339339    if ShowModal = mrOk then begin
    340       TContactsFile(DataFile).AsString := Source;
     340      TVCardFile(DataFile).VCard.AsString := Source;
    341341      UpdateFile;
    342342    end;
     
    423423
    424424  DataFile := nil;
    425   DefaultDataFileClass := TContactsFile;
     425  DefaultDataFileClass := TVCardFile;
    426426  FileClosed := True;
    427427  RecentFileRegistryContext := TRegistryContext.Create(ApplicationInfo1.RegistryRoot,
     
    504504    DataFile := DefaultDataFileClass.Create;
    505505    DataFile.OnModify := FileModified;
    506     TContactsFile(DataFile).OnError := DoError;
     506    TVCardFile(DataFile).VCard.OnError := DoError;
    507507  end;
    508508end;
     
    514514  if Assigned(FormContacts) then begin
    515515    if Assigned(DataFile) then
    516       FormContacts.Contacts := TContactsFile(DataFile).Contacts
     516      FormContacts.Contacts := TVCardFile(DataFile).VCard.Contacts
    517517      else FormContacts.Contacts := nil;
    518518    FormContacts.ReloadList;
Note: See TracChangeset for help on using the changeset viewer.