Changeset 39 for trunk/UContact.pas


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/UContact.pas

    r37 r39  
    1717  TContactFieldIndex = (cfFirstName, cfMiddleName, cfLastName, cfTitleBefore,
    1818    cfTitleAfter, cfFullName, cfTelCell, cfTelHome, cfTelHome2, cfTelWork, cfTelVoip,
    19     cfTelMain, cfEmail, cfTel, cfUid, cfUrl,
     19    cfTelMain, cfEmail, cfTel, cfUid, cfUrlHome, cfUrlWork,
    2020    cfEmailHome, cfEmailInternet, cfNickName, cfNote, cfRole, cfTitle,
    2121    cfCategories, cfOrganization, cfDepartment,
    22     cfHomeAddress, cfHomeAddressStreet, cfHomeAddressCity, cfHomeAddressCountry,
    23     cfWorkAddress, cfWorkAddressStreet, cfWorkAddressCity, cfWorkAddressCountry,
     22    cfHomeAddressStreet, cfHomeAddressStreetExtended, cfHomeAddressCity, cfHomeAddressCountry,
     23    cfHomeAddressPostalCode, cfHomeAddressRegion, cfHomeAddressPostOfficeBox,
     24    cfWorkAddressStreet, cfWorkAddressStreetExtended, cfWorkAddressCity, cfWorkAddressCountry,
     25    cfWorkAddressPostalCode, cfWorkAddressRegion, cfWorkAddressPostOfficeBox,
    2426    cfXTimesContacted, cfXLastTimeContacted, cfPhoto, cfXJabber, cfDayOfBirth, cfRevision,
    2527    cfVersion);
     
    6264
    6365  TContactProperties = class(TFPGObjectList<TContactProperty>)
     66    procedure AssignToList(List: TFPGObjectList<TObject>);
    6467    function GetByName(Name: string): TContactProperty;
    6568    function GetByNameGroups(Name: string; Groups: TStringArray): TContactProperty;
     
    151154  SOrganization = 'Organization';
    152155  SDepartement = 'Departement';
    153   SHomeAddress = 'Home Address';
    154   SHomeAddressStreet = 'Home Address Street';
    155   SHomeAddressCity = 'Home Address City';
    156   SHomeAddressCountry = 'Home Address Country';
    157   SWorkAddress = 'Home Address';
    158   SWorkAddressStreet = 'Work Address Street';
    159   SWorkAddressCity = 'Work Address City';
    160   SWorkAddressCountry = 'Work Address Country';
     156  SHomeAddressPostOfficeBox = 'Home address post office box';
     157  SHomeAddressStreetExtended = 'Home address extended street';
     158  SHomeAddressStreet = 'Home address street';
     159  SHomeAddressCity = 'Home address city';
     160  SHomeAddressRegion = 'Home address region';
     161  SHomeAddressPostalCode = 'Home address postal code';
     162  SHomeAddressCountry = 'Home address country';
     163  SWorkAddressPostOfficeBox = 'Work address post office box';
     164  SWorkAddressStreetExtended = 'Work address extended street';
     165  SWorkAddressStreet = 'Work address street';
     166  SWorkAddressCity = 'Work address city';
     167  SWorkAddressRegion = 'Work address region';
     168  SWorkAddressPostalCode = 'Work address postal code';
     169  SWorkAddressCountry = 'Work address country';
    161170  STimesContacted = 'Times Contacted';
    162171  SLastTimeContacted = 'Last Time Contacted';
     
    166175  SRevision = 'Revision';
    167176  SUniqueIdentifier = 'Unique identifier';
    168   SWebAddress = 'Web address';
     177  SWebAddressHome = 'Web address home';
     178  SWebAddressWork = 'Web address work';
    169179
    170180function GetNext(var Text: string; Separator: string): string;
     
    192202
    193203{ TContactProperties }
     204
     205procedure TContactProperties.AssignToList(List: TFPGObjectList<TObject>);
     206var
     207  I: Integer;
     208begin
     209  while List.Count > Count do List.Delete(List.Count - 1);
     210  while List.Count < Count do List.Add(nil);
     211  for I := 0 to Count - 1 do
     212    List[I] := Items[I];
     213end;
    194214
    195215function TContactProperties.GetByName(Name: string): TContactProperty;
     
    441461  I: Integer;
    442462begin
     463  Parent := Source.Parent;
    443464  while Properties.Count < Source.Properties.Count do
    444465    Properties.Add(TContactProperty.Create);
     
    503524    AddNew('ORG', [], SOrganization, cfOrganization, dtString, 0);
    504525    AddNew('ORG', [], SDepartement, cfDepartment, dtString, 1);
    505     AddNew('ADR', ['HOME'], SHomeAddress, cfHomeAddress, dtString);
    506     AddNew('ADR', ['HOME'], SHomeAddressStreet, cfHomeAddressStreet, dtString, 1);
    507     AddNew('ADR', ['HOME'], SHomeAddressCity, cfHomeAddressCity, dtString, 2);
    508     AddNew('ADR', ['HOME'], SHomeAddressCountry, cfHomeAddressCountry, dtString, 3);
    509     AddNew('ADR', ['WORK'], SWorkAddress, cfWorkAddress, dtString);
    510     AddNew('ADR', ['WORK'], SWorkAddressStreet, cfWorkAddressStreet, dtString, 1);
    511     AddNew('ADR', ['WORK'], SWorkAddressCity, cfWorkAddressCity, dtString, 2);
    512     AddNew('ADR', ['WORK'], SWorkAddressCountry, cfWorkAddressCountry, dtString, 3);
     526    AddNew('ADR', ['HOME'], SHomeAddressPostOfficeBox, cfHomeAddressPostOfficeBox, dtString, 0);
     527    AddNew('ADR', ['HOME'], SHomeAddressStreetExtended, cfHomeAddressStreetExtended, dtString, 1);
     528    AddNew('ADR', ['HOME'], SHomeAddressStreet, cfHomeAddressStreet, dtString, 2);
     529    AddNew('ADR', ['HOME'], SHomeAddressCity, cfHomeAddressCity, dtString, 3);
     530    AddNew('ADR', ['HOME'], SHomeAddressRegion, cfHomeAddressRegion, dtString, 4);
     531    AddNew('ADR', ['HOME'], SHomeAddressPostalCode, cfHomeAddressPostalCode, dtString, 5);
     532    AddNew('ADR', ['HOME'], SHomeAddressCountry, cfHomeAddressCountry, dtString, 6);
     533    AddNew('ADR', ['WORK'], SWorkAddressPostOfficeBox, cfWorkAddressPostOfficeBox, dtString, 0);
     534    AddNew('ADR', ['WORK'], SWorkAddressStreetExtended, cfWorkAddressStreetExtended, dtString, 1);
     535    AddNew('ADR', ['WORK'], SWorkAddressStreet, cfWorkAddressStreet, dtString, 2);
     536    AddNew('ADR', ['WORK'], SWorkAddressCity, cfWorkAddressCity, dtString, 3);
     537    AddNew('ADR', ['WORK'], SWorkAddressRegion, cfWorkAddressRegion, dtString, 4);
     538    AddNew('ADR', ['WORK'], SWorkAddressPostalCode, cfWorkAddressPostalCode, dtString, 5);
     539    AddNew('ADR', ['WORK'], SWorkAddressCountry, cfWorkAddressCountry, dtString, 6);
    513540    AddNew('X-TIMES_CONTACTED', [], STimesContacted, cfXTimesContacted, dtString);
    514541    AddNew('X-LAST_TIME_CONTACTED', [], SLastTimeContacted, cfXLastTimeContacted, dtString);
     
    518545    AddNew('REV', [], SRevision, cfRevision, dtString);
    519546    AddNew('UID', [], SUniqueIdentifier, cfUid, dtString);
    520     AddNew('URL', [], SWebAddress, cfUrl, dtString);
     547    AddNew('URL', ['HOME'], SWebAddressHome, cfUrlHome, dtString);
     548    AddNew('URL', ['WORK'], SWebAddressWork, cfUrlWork, dtString);
    521549  end;
    522550end;
Note: See TracChangeset for help on using the changeset viewer.