Changeset 73 for trunk/Forms/UFormFindDuplicity.pas
- Timestamp:
- Dec 13, 2021, 11:33:11 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormFindDuplicity.pas
r68 r73 31 31 AShowContacts: TAction; 32 32 ActionList1: TActionList; 33 ButtonMerge: TButton; 33 34 ComboBoxField: TComboBox; 34 35 Label1: TLabel; … … 38 39 PopupMenu1: TPopupMenu; 39 40 procedure AShowContactsExecute(Sender: TObject); 41 procedure ButtonMergeClick(Sender: TObject); 40 42 procedure ComboBoxFieldChange(Sender: TObject); 41 43 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); … … 109 111 var 110 112 ContactField: TContactField; 113 Items: TStringList; 114 I: Integer; 111 115 begin 112 116 if FContacts = AValue then Exit; 113 117 FContacts := AValue; 114 118 if Assigned(FContacts) then begin 115 Contacts.ContactsFile.Fields.LoadToStrings(ComboBoxField.Items); 119 Items := TStringList.Create; 120 try 121 Contacts.ContactsFile.Fields.LoadToStrings(Items); 122 123 // Remove fields which are not used in contacts 124 for I := Items.Count - 1 downto 0 do 125 if Contacts.CountByField(TContactField(Items.Objects[I]).Index) = 0 then 126 Items.Delete(I); 127 128 ComboBoxField.Items.Assign(Items); 129 finally 130 Items.Free; 131 end; 116 132 ContactField := Contacts.ContactsFile.Fields.GetByIndex(ContactFieldIndex); 117 133 ComboBoxField.ItemIndex := ComboBoxField.Items.IndexOfObject(ContactField); … … 156 172 Core.Translator.TranslateComponentRecursive(Self); 157 173 Core.ThemeManager1.UseTheme(Self); 158 ContactFieldIndex := cf TelCell;174 ContactFieldIndex := cfFullName; 159 175 end; 160 176 … … 203 219 end; 204 220 221 procedure TFormFindDuplicity.ButtonMergeClick(Sender: TObject); 222 var 223 TempContacts: TContactsFile; 224 I: Integer; 225 begin 226 TempContacts := TContactsFile.Create; 227 try 228 for I := 0 to Contacts.Count - 1 do 229 TempContacts.Contacts.Merge(Contacts[I], TContactField(ComboBoxField.Items.Objects[ComboBoxField.ItemIndex]).Index); 230 Contacts.Assign(TempContacts.Contacts); 231 Find; 232 finally 233 TempContacts.Free; 234 end; 235 end; 236 205 237 procedure TFormFindDuplicity.FormClose(Sender: TObject; 206 238 var CloseAction: TCloseAction);
Note:
See TracChangeset
for help on using the changeset viewer.