Ignore:
Timestamp:
Dec 10, 2021, 11:15:41 AM (3 years ago)
Author:
chronos
Message:
  • Fixed: Wrong field selected for duplicates find from field combobox selection in Find duplicates window.
  • Added: Sort list of contact fields in Find duplicates and Field windows.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormFindDuplicity.pas

    r29 r68  
    4949  public
    5050    FoundItems: TFoundItems;
    51     ContactField: TContactFieldIndex;
     51    ContactFieldIndex: TContactFieldIndex;
    5252    procedure Find;
    5353    procedure ReloadList;
     
    107107
    108108procedure TFormFindDuplicity.SetContacts(AValue: TContacts);
     109var
     110  ContactField: TContactField;
    109111begin
    110112  if FContacts = AValue then Exit;
     
    112114  if Assigned(FContacts) then begin
    113115    Contacts.ContactsFile.Fields.LoadToStrings(ComboBoxField.Items);
    114     ComboBoxField.ItemIndex := Integer(ContactField);
     116    ContactField := Contacts.ContactsFile.Fields.GetByIndex(ContactFieldIndex);
     117    ComboBoxField.ItemIndex := ComboBoxField.Items.IndexOfObject(ContactField);
    115118    if (ComboBoxField.Items.Count > 0) and (ComboBoxField.ItemIndex = -1) then
    116119      ComboBoxField.ItemIndex := 0;
     
    133136  FoundItems.Clear;
    134137  for I := 0 to Contacts.Count - 1 do begin
    135     FieldName := TContact(Contacts[I]).Fields[ContactField];
     138    FieldName := Contacts[I].Fields[ContactFieldIndex];
    136139    if FieldName <> '' then begin
    137140      Item := FoundItems.SearchByField(FieldName);
     
    153156  Core.Translator.TranslateComponentRecursive(Self);
    154157  Core.ThemeManager1.UseTheme(Self);
    155   ContactField := cfTelCell;
     158  ContactFieldIndex := cfTelCell;
    156159end;
    157160
    158161procedure TFormFindDuplicity.ComboBoxFieldChange(Sender: TObject);
    159162begin
    160   ContactField := TContactFieldIndex(ComboBoxField.ItemIndex);
     163  if ComboBoxField.ItemIndex <> -1 then
     164    ContactFieldIndex := TContactField(ComboBoxField.Items.Objects[ComboBoxField.ItemIndex]).Index
     165    else ContactFieldIndex := cfTelCell;
    161166  Find;
    162167end;
Note: See TracChangeset for help on using the changeset viewer.