Changeset 128 for trunk/UContact.pas
- Timestamp:
- Apr 8, 2022, 9:43:55 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UContact.pas
r127 r128 4 4 5 5 uses 6 Classes, SysUtils, fgl, Dialogs, UDataFile, LazUTF8, Base64, Graphics; 6 Classes, SysUtils, Generics.Collections, Generics.Defaults, Dialogs, 7 UDataFile, LazUTF8, Base64, Graphics, UListViewSort; 7 8 8 9 type … … 62 63 cfPeerTube, cfLinkedIn, cfMastodon, cfMySpace, cfReddit); 63 64 64 TContactFieldIndexes = T FPGList<TContactFieldIndex>;65 TContactFieldIndexes = TList<TContactFieldIndex>; 65 66 66 67 TContactFilterItem = class … … 71 72 { TContactFilterItems } 72 73 73 TContactFilterItems = class(T FPGObjectList<TContactFilterItem>)74 TContactFilterItems = class(TObjectList<TContactFilterItem>) 74 75 function AddNew(FieldIndex: TContactFieldIndex; Value: string): TContactFilterItem; 75 76 end; … … 98 99 { TContactFields } 99 100 100 TContactFields = class(T FPGObjectList<TContactField>)101 TContactFields = class(TObjectList<TContactField>) 101 102 private 102 103 Indexes: array[TContactFieldIndex] of TContactField; … … 143 144 { TContactProperties } 144 145 145 TContactProperties = class(T FPGObjectList<TContactProperty>)146 TContactProperties = class(TObjectList<TContactProperty>) 146 147 function AddNew(Name, Value: string): TContactProperty; 147 148 procedure Assign(Source: TContactProperties); 148 procedure AssignToList(List: T FPGObjectList<TObject>);149 procedure AssignToList(List: TObjects); 149 150 function GetByName(Name: string): TContactProperty; 150 151 function GetByNameGroups(Name: string; Groups: TStringArray; … … 197 198 { TContacts } 198 199 199 TContacts = class(T FPGObjectList<TContact>)200 TContacts = class(TObjectList<TContact>) 200 201 ContactsFile: TContactsFile; 201 202 procedure Assign(Source: TContacts); 202 203 procedure AddContacts(Contacts: TContacts); 203 204 procedure InsertContacts(Index: Integer; Contacts: TContacts); 204 procedure AssignToList(List: T FPGObjectList<TObject>);205 procedure AssignToList(List: TObjects); 205 206 function AddNew: TContact; 206 207 function Search(Text: string; FieldIndex: TContactFieldIndex): TContact; … … 854 855 end; 855 856 856 procedure TContactProperties.AssignToList(List: T FPGObjectList<TObject>);857 procedure TContactProperties.AssignToList(List: TObjects); 857 858 var 858 859 I: Integer; … … 1126 1127 end; 1127 1128 1128 procedure TContacts.AssignToList(List: T FPGObjectList<TObject>);1129 var 1130 I: Integer; 1131 begin 1132 while List.Count > Count do List.Delete(List.Count - 1);1133 while List.Count < Count do List.Add(nil);1134 for I := 0 to Count - 1 do1129 procedure TContacts.AssignToList(List: TObjects); 1130 var 1131 I: Integer; 1132 begin 1133 while List.Count > Count do 1134 List.Delete(List.Count - 1); 1135 for I := 0 to List.Count - 1 do 1135 1136 List[I] := Items[I]; 1137 while List.Count < Count do 1138 List.Add(Items[List.Count]); 1136 1139 end; 1137 1140 … … 1906 1909 end; 1907 1910 1908 function CompareContactFullName(const Item1, Item2: TContact): Integer;1911 function CompareContactFullName(constref Item1, Item2: TContact): Integer; 1909 1912 begin 1910 1913 Result := CompareStr(Item1.Fields[cfFullName], Item2.Fields[cfFullName]); 1911 1914 end; 1912 1915 1913 function ComparePropertyName(const Item1, Item2: TContactProperty): Integer;1916 function ComparePropertyName(constref Item1, Item2: TContactProperty): Integer; 1914 1917 begin 1915 1918 Result := CompareStr(Item1.Name + ';' + Item1.Attributes.Text, … … 1921 1924 I: Integer; 1922 1925 begin 1923 Contacts.Sort( CompareContactFullName);1926 Contacts.Sort(TComparer<TContact>.Construct(CompareContactFullName)); 1924 1927 for I := 0 to Contacts.Count - 1 do 1925 Contacts[I].Properties.Sort( ComparePropertyName);1928 Contacts[I].Properties.Sort(TComparer<TContactProperty>.Construct(ComparePropertyName)); 1926 1929 end; 1927 1930
Note:
See TracChangeset
for help on using the changeset viewer.