Ignore:
Timestamp:
Jun 6, 2023, 11:15:57 AM (12 months ago)
Author:
chronos
Message:
  • Added: New file compare dialog with additional normalize options.
  • Modified: Compare action uses external compare tool.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/VCard/VCard.pas

    r148 r151  
    147147    procedure AssignToList(List: TObjects);
    148148    function GetByName(Name: string): TContactProperty;
     149    function GetMultipleByName(Name: string): TContactProperties;
    149150    function GetByNameGroups(Name: string; Groups: TStringArray;
    150151      NoGroups: TStringArray): TContactProperty;
    151152    function GetByNameGroupsMultiple(Name: string; Groups: TStringArray;
    152153      NoGroups: TStringArray): TContactProperties;
     154    function RemoveExactDuplicates: Integer;
    153155  end;
    154156
     
    572574procedure TVCard.Assign(Source: TPersistent);
    573575begin
    574   inherited;
    575   if Source is TVCard then Contacts.Assign((Source as TVCard).Contacts);
     576  if Source is TVCard then
     577    Contacts.Assign((Source as TVCard).Contacts)
     578  else inherited;
    576579end;
    577580
     
    10051008end;
    10061009
     1010function TContactProperties.GetMultipleByName(Name: string): TContactProperties;
     1011var
     1012  I: Integer;
     1013begin
     1014  Result := TContactProperties.Create(False);
     1015  for I  := 0 to Count - 1 do
     1016  if (Items[I].Name = Name) or EndsWith(Items[I].Name, '.' + Name) then
     1017    Result.Add(Items[I]);
     1018end;
     1019
    10071020function TContactProperties.GetByNameGroups(Name: string; Groups: TStringArray;
    10081021  NoGroups: TStringArray): TContactProperty;
     
    10251038  if Items[I].MatchNameGroups(Name, Groups, NoGroups) then
    10261039    Result.Add(Items[I]);
     1040end;
     1041
     1042function TContactProperties.RemoveExactDuplicates: Integer;
     1043var
     1044  I: Integer;
     1045  J: Integer;
     1046begin
     1047  Result := 0;
     1048  for I := 0 to Count - 1 do
     1049    for J := Count - 1 downto I + 1 do
     1050      if Items[I].CompareTo(Items[J]) then begin
     1051        Remove(Items[J]);
     1052        Inc(Result);
     1053      end;
    10271054end;
    10281055
Note: See TracChangeset for help on using the changeset viewer.