Ignore:
Timestamp:
Apr 8, 2022, 9:43:55 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Use Generics.Collection instead of fgl for better Delphi compatibility.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContacts.pas

    r127 r128  
    55uses
    66  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
    7   Menus, ActnList, UContact, UListViewSort, fgl, LazUTF8, Clipbrd;
     7  Menus, ActnList, UContact, UListViewSort, LazUTF8, Clipbrd,
     8  Generics.Collections;
    89
    910type
     
    7677    FContacts: TContacts;
    7778    FUpdateCount: Integer;
    78     procedure FilterList(List: TFPGObjectList<TObject>);
     79    procedure FilterList(List: TObjectList<TObject>);
    7980    procedure SetContacts(AValue: TContacts);
    8081    function GetPreviousContact(Contact: TContact): TContact;
     
    188189end;
    189190
    190 procedure TFormContacts.FilterList(List: TFPGObjectList<TObject>);
     191procedure TFormContacts.FilterList(List: TObjectList<TObject>);
    191192var
    192193  I: Integer;
     
    194195  K: Integer;
    195196  FoundCount: Integer;
     197  Item: TContact;
    196198begin
    197199  for I := List.Count - 1 downto 0 do begin
    198200    if List.Items[I] is TContact then begin
    199       with TContact(List.Items[I]) do begin
     201      Item := TContact(List.Items[I]);
     202      with Item do begin
    200203        FoundCount := 0;
    201204        for J := 0 to FilterItems.Count - 1 do
    202205        if FilterItems[J].FieldIndex = cfNone then begin
    203           for K := 0 to TContact(List.Items[I]).GetFields.Count - 1 do begin
     206          for K := 0 to Item.GetFields.Count - 1 do begin
    204207            if Pos(UTF8LowerCase(FilterItems[J].Value),
    205               UTF8LowerCase(TContact(List.Items[I]).Fields[TContact.GetFields[K].Index])) > 0 then begin
     208              UTF8LowerCase(Item.Fields[TContact.GetFields[K].Index])) > 0 then begin
    206209                Inc(FoundCount);
    207210                Break;
     
    210213        end else begin
    211214          if Pos(UTF8LowerCase(FilterItems[J].Value),
    212             UTF8LowerCase(TContact(List.Items[I]).Fields[FilterItems[J].FieldIndex])) > 0 then
     215            UTF8LowerCase(Item.Fields[FilterItems[J].FieldIndex])) > 0 then
    213216              Inc(FoundCount);
    214217        end;
Note: See TracChangeset for help on using the changeset viewer.