Ignore:
Timestamp:
Apr 9, 2022, 11:52:13 AM (2 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/Forms/UFormContacts.pas

    r128 r129  
    55uses
    66  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
    7   Menus, ActnList, UContact, UListViewSort, LazUTF8, Clipbrd,
     7  Menus, ActnList, UVCard, UListViewSort, LazUTF8, Clipbrd,
    88  Generics.Collections;
    99
     
    102102
    103103uses
    104   UFormContact, UCore;
     104  UFormContact, UCore, UVCardFile;
    105105
    106106resourcestring
     
    304304      ListView1.Columns.Delete(ListView1.Columns.Count - 1);
    305305    for I := 0 to ListView1.Columns.Count - 1 do begin
    306       if Assigned(Contacts) and Assigned(Contacts.ContactsFile) then begin
     306      if Assigned(Contacts) and Assigned(Contacts.ParentVCard) then begin
    307307        Field := TContact.GetFields.GetByIndex(ListViewColumns[I]);
    308308        if Assigned(Field) then
     
    334334    Contact := TContact.Create;
    335335    try
    336       Contact.ContactsFile := Contacts.ContactsFile;
     336      Contact.ParentVCard := Contacts.ParentVCard;
    337337      FormContact.Contact := Contact;
    338338      FormContact.OnGetPrevious := GetPreviousContact;
     
    364364    Contact := TContact.Create;
    365365    try
    366       Contact.ContactsFile := Contacts.ContactsFile;
     366      Contact.ParentVCard := Contacts.ParentVCard;
    367367      Contact.Assign(TContact(ListView1.Selected.Data));
    368368      FormContact.Contact := Contact;
     
    436436procedure TFormContacts.ALoadFromFileExecute(Sender: TObject);
    437437var
    438   TempFile: TContactsFile;
     438  TempFile: TVCardFile;
    439439begin
    440440  if Assigned(ListView1.Selected) then begin
    441     TempFile := TContactsFile.Create;
     441    TempFile := TVCardFile.Create;
    442442    try
    443443      OpenDialog1.Filter := TempFile.GetFileFilter;
     
    465465    Contact := TContact.Create;
    466466    try
    467       Contact.ContactsFile := Contacts.ContactsFile;
     467      Contact.ParentVCard := Contacts.ParentVCard;
    468468      Contact.Assign(TContact(ListView1.Selected.Data));
    469469      FormContact.Contact := Contact;
     
    486486procedure TFormContacts.APasteExecute(Sender: TObject);
    487487var
    488   PasteContacts: TContactsFile;
     488  PasteContacts: TVCardFile;
    489489  Lines: TStringList;
    490490begin
    491   PasteContacts := TContactsFile.Create;
     491  PasteContacts := TVCardFile.Create;
    492492  Lines := TStringList.Create;
    493493  try
    494494    Lines.Text := Clipboard.AsText;
    495     PasteContacts.LoadFromStrings(Lines);
    496     if PasteContacts.Contacts.Count > 0 then begin
     495    PasteContacts.VCard.LoadFromStrings(Lines);
     496    if PasteContacts.VCard.Contacts.Count > 0 then begin
    497497      if Assigned(ListView1.Selected) then begin
    498498        Contacts.InsertContacts(Contacts.IndexOf(ListView1.Selected.Data),
    499           PasteContacts.Contacts);
    500       end else Contacts.AddContacts(PasteContacts.Contacts);
     499          PasteContacts.VCard.Contacts);
     500      end else Contacts.AddContacts(PasteContacts.VCard.Contacts);
    501501      Core.DataFile.Modified := True;
    502502      ReloadList;
     
    528528procedure TFormContacts.ASaveToFileExecute(Sender: TObject);
    529529var
    530   TempFile: TContactsFile;
     530  TempFile: TVCardFile;
    531531begin
    532532  if Assigned(ListView1.Selected) then begin
    533     TempFile := TContactsFile.Create;
     533    TempFile := TVCardFile.Create;
    534534    try
    535535      SaveDialog1.Filter := TempFile.GetFileFilter;
Note: See TracChangeset for help on using the changeset viewer.