Ignore:
Timestamp:
Nov 29, 2021, 2:17:26 PM (3 years ago)
Author:
chronos
Message:
  • Added: New more general contact properties list and item form.
  • Modified: Show Private and Work addresses in separate tab.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContacts.pas

    r36 r39  
    197197  FormContact := TFormContact.Create(nil);
    198198  try
    199   if FormContact.ShowModal = mrOK then begin
    200199    Contact := TContact.Create;
    201     Contact.Parent := Contacts.ContactsFile;
    202     FormContact.SaveData(Contact);
    203     Contacts.Add(Contact);
    204     Core.DataFile.Modified := True;
    205     ReloadList;
    206     UpdateInterface;
    207   end;
     200    try
     201      Contact.Parent := Contacts.ContactsFile;
     202      FormContact.Contact := Contact;
     203      if FormContact.ShowModal = mrOK then begin
     204        Contacts.Add(Contact);
     205        Contact := nil;
     206        Core.DataFile.Modified := True;
     207        ReloadList;
     208        UpdateInterface;
     209      end;
     210    finally
     211      if Assigned(Contact) then
     212        Contact.Free;
     213    end;
    208214  finally
    209215    FormContact.Free;
     
    214220var
    215221  FormContact: TFormContact;
     222  Contact: TContact;
    216223begin
    217224  FormContact := TFormContact.Create(nil);
    218225  try
    219     FormContact.LoadData(TContact(ListView1.Selected.Data));
    220     if FormContact.ShowModal = mrOK then begin
    221       FormContact.SaveData(TContact(ListView1.Selected.Data));
    222       Core.DataFile.Modified := True;
    223       ReloadList;
    224       UpdateInterface;
     226    Contact := TContact.Create;
     227    Contact.Assign(TContact(ListView1.Selected.Data));
     228    FormContact.Contact := Contact;
     229    try
     230      if FormContact.ShowModal = mrOK then begin
     231        TContact(ListView1.Selected.Data).Assign(Contact);
     232        Core.DataFile.Modified := True;
     233        ReloadList;
     234        UpdateInterface;
     235      end;
     236    finally
     237      Contact.Free;
    225238    end;
    226239  finally
Note: See TracChangeset for help on using the changeset viewer.