Changeset 76 for trunk


Ignore:
Timestamp:
Dec 15, 2021, 8:56:06 PM (3 years ago)
Author:
chronos
Message:
  • Added: Find dialog to search text value by given contact field or by any field.
Location:
trunk
Files:
4 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContacts.lfm

    r74 r76  
    1010  OnClose = FormClose
    1111  OnCreate = FormCreate
     12  OnDestroy = FormDestroy
     13  OnResize = FormResize
    1214  OnShow = FormShow
    1315  LCLVersion = '2.0.12.0'
    1416  object ListView1: TListView
    1517    Left = 0
    16     Height = 810
     18    Height = 801
    1719    Top = 0
    1820    Width = 1210
     
    6668    Left = 0
    6769    Height = 39
    68     Top = 842
     70    Top = 833
    6971    Width = 1210
    7072    Align = alBottom
     
    114116    Left = 0
    115117    Height = 32
    116     Top = 810
     118    Top = 801
    117119    Width = 1210
    118120    OnChange = ListViewFilter1Change
     
    121123  object StatusBar1: TStatusBar
    122124    Left = 0
    123     Height = 27
    124     Top = 881
     125    Height = 36
     126    Top = 872
    125127    Width = 1210
    126128    Panels = <   
  • trunk/Forms/UFormContacts.pas

    r74 r76  
    6464    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    6565    procedure FormCreate(Sender: TObject);
     66    procedure FormDestroy(Sender: TObject);
     67    procedure FormResize(Sender: TObject);
    6668    procedure FormShow(Sender: TObject);
    6769    procedure ListView1Data(Sender: TObject; Item: TListItem);
     
    8183    procedure FormContactNext(Sender: TObject);
    8284    procedure DoUpdateInterface;
     85    procedure UpdateColumns;
    8386  public
     87    ListViewColumns: TContactFieldIndexes;
     88    FilterItems: TContactFilterItems;
    8489    property Contacts: TContacts read FContacts write SetContacts;
    8590    procedure ReloadList;
     
    123128  end;
    124129
     130var
     131  I: Integer;
    125132begin
    126133  if Item.Index < ListViewSort1.List.Count then
    127134  with TContact(ListViewSort1.List[Item.Index]) do begin
    128     AddItem(Fields[cfFullName], True);
    129     AddItem(Fields[cfFirstName]);
    130     AddItem(Fields[cfMiddleName]);
    131     AddItem(Fields[cfLastName]);
    132     AddItem(Fields[cfTel]);
    133     AddItem(Fields[cfTelCell]);
    134     AddItem(Fields[cfTelHome]);
    135     AddItem(Fields[cfTelWork]);
     135    for I := 0 to ListViewColumns.Count - 1 do begin
     136      AddItem(Fields[ListViewColumns[I]], I = 0);
     137    end;
    136138    Item.Data := ListViewSort1.List[Item.Index];
    137139  end;
     
    150152
    151153procedure TFormContacts.ListViewFilter1Change(Sender: TObject);
    152 begin
     154var
     155  I: Integer;
     156begin
     157  // Load filter StringGrid cells into filter
     158  FilterItems.Clear;
     159  for I := 0 to ListViewColumns.Count - 1 do
     160    if I < ListViewFilter1.StringGrid.ColCount then
     161      if ListViewFilter1.StringGrid.Cells[I, 0] <> '' then
     162        FilterItems.AddNew(ListViewColumns[I], ListViewFilter1.StringGrid.Cells[I, 0]);
     163
    153164  ReloadList;
    154165  UpdateInterface;
     
    165176  if Assigned(Item1) and Assigned(Item2) and (ListViewSort1.Order <> soNone) then begin
    166177    with ListViewSort1 do
    167     case Column of
    168       0: Result := CompareString(TContact(Item1).Fields[cfFullName], TContact(Item2).Fields[cfFullName]);
    169       1: Result := CompareString(TContact(Item1).Fields[cfFirstName], TContact(Item2).Fields[cfFirstName]);
    170       2: Result := CompareString(TContact(Item1).Fields[cfMiddleName], TContact(Item2).Fields[cfMiddleName]);
    171       3: Result := CompareString(TContact(Item1).Fields[cfLastName], TContact(Item2).Fields[cfLastName]);
    172       4: Result := CompareString(TContact(Item1).Fields[cfTel], TContact(Item2).Fields[cfTel]);
    173       5: Result := CompareString(TContact(Item1).Fields[cfTelCell], TContact(Item2).Fields[cfTelCell]);
    174       6: Result := CompareString(TContact(Item1).Fields[cfTelHome], TContact(Item2).Fields[cfTelHome]);
    175       7: Result := CompareString(TContact(Item1).Fields[cfTelWork], TContact(Item2).Fields[cfTelWork]);
    176     end;
     178    Result := CompareString(TContact(Item1).Fields[ListViewColumns[Column]], TContact(Item2).Fields[ListViewColumns[Column]]);
    177179    if ListViewSort1.Order = soDown then Result := -Result;
    178180  end else Result := 0;
     
    191193var
    192194  I: Integer;
     195  J: Integer;
     196  K: Integer;
    193197  FoundCount: Integer;
    194   EnteredCount: Integer;
    195 begin
    196   EnteredCount := ListViewFilter1.TextEnteredCount;
     198begin
    197199  for I := List.Count - 1 downto 0 do begin
    198200    if List.Items[I] is TContact then begin
    199201      with TContact(List.Items[I]) do begin
    200          with ListViewFilter1 do
    201          if Visible and (EnteredCount > 0) then begin
    202            FoundCount := 0;
    203            if Pos(UTF8LowerCase(StringGrid.Cells[0, 0]),
    204              UTF8LowerCase(TContact(List.Items[I]).Fields[cfFullName])) > 0 then Inc(FoundCount);
    205            if Pos(UTF8LowerCase(StringGrid.Cells[1, 0]),
    206              UTF8LowerCase(TContact(List.Items[I]).Fields[cfFirstName])) > 0 then Inc(FoundCount);
    207            if Pos(UTF8LowerCase(StringGrid.Cells[2, 0]),
    208              UTF8LowerCase(TContact(List.Items[I]).Fields[cfMiddleName])) > 0 then Inc(FoundCount);
    209            if Pos(UTF8LowerCase(StringGrid.Cells[3, 0]),
    210              UTF8LowerCase(TContact(List.Items[I]).Fields[cfLastName])) > 0 then Inc(FoundCount);
    211            if Pos(UTF8LowerCase(StringGrid.Cells[4, 0]),
    212              UTF8LowerCase(TContact(List.Items[I]).Fields[cfTel])) > 0 then Inc(FoundCount);
    213            if Pos(UTF8LowerCase(StringGrid.Cells[5, 0]),
    214              UTF8LowerCase(TContact(List.Items[I]).Fields[cfTelCell])) > 0 then Inc(FoundCount);
    215            if Pos(UTF8LowerCase(StringGrid.Cells[6, 0]),
    216              UTF8LowerCase(TContact(List.Items[I]).Fields[cfTelHome])) > 0 then Inc(FoundCount);
    217            if Pos(UTF8LowerCase(StringGrid.Cells[7, 0]),
    218              UTF8LowerCase(TContact(List.Items[I]).Fields[cfTelWork])) > 0 then Inc(FoundCount);
    219            if FoundCount <> EnteredCount then List.Delete(I);
    220          end;
     202        FoundCount := 0;
     203        for J := 0 to FilterItems.Count - 1 do begin
     204          if FilterItems[J].FieldIndex = cfNone then begin
     205            for K := 0 to TContact(List.Items[I]).Parent.Fields.Count - 1 do begin
     206              if Pos(UTF8LowerCase(FilterItems[J].Value),
     207                UTF8LowerCase(TContact(List.Items[I]).Fields[TContact(List.Items[I]).Parent.Fields[K].Index])) > 0 then begin
     208                  Inc(FoundCount);
     209                  Break;
     210                end;
     211            end;
     212          end else begin
     213            if Pos(UTF8LowerCase(FilterItems[J].Value),
     214              UTF8LowerCase(TContact(List.Items[I]).Fields[FilterItems[J].FieldIndex])) > 0 then
     215                Inc(FoundCount);
     216          end;
     217        end;
     218        if FoundCount <> FilterItems.Count then List.Delete(I);
    221219      end;
    222220    end else
     
    273271  end;
    274272  StatusBar1.Panels[0].Text := Text;
     273end;
     274
     275procedure TFormContacts.UpdateColumns;
     276var
     277  I: Integer;
     278  Field: TContactField;
     279begin
     280  while ListView1.Columns.Count < ListViewColumns.Count do
     281    ListView1.Columns.Add;
     282  while ListView1.Columns.Count > ListViewColumns.Count do
     283    ListView1.Columns.Delete(ListView1.Columns.Count - 1);
     284  for I := 0 to ListView1.Columns.Count - 1 do begin
     285    if Assigned(Contacts) and Assigned(Contacts.ContactsFile) then begin
     286      Field := Contacts.ContactsFile.Fields.GetByIndex(ListViewColumns[I]);
     287      if Assigned(Field) then
     288        ListView1.Columns[I].Caption := Field.Title;
     289    end;
     290  end;
    275291end;
    276292
     
    512528begin
    513529  BeginUpdate;
    514   ListView1.BeginUpdate;
    515   for I := 0 to ListView1.Items.Count - 1 do
    516     ListView1.Items[I].Selected := True;
    517   //ListView1.SelectAll;
    518   ListView1.EndUpdate;
    519   EndUpdate;
     530  try
     531    ListView1.BeginUpdate;
     532    try
     533      for I := 0 to ListView1.Items.Count - 1 do
     534        ListView1.Items[I].Selected := True;
     535      //ListView1.SelectAll;
     536    finally
     537      ListView1.EndUpdate;
     538    end;
     539  finally
     540    EndUpdate;
     541  end;
    520542end;
    521543
     
    530552  I: Integer;
    531553begin
     554  FilterItems := TContactFilterItems.Create;
     555
     556  ListViewColumns := TContactFieldIndexes.Create;
     557  ListViewColumns.Add(cfFullName);
     558  ListViewColumns.Add(cfFirstName);
     559  ListViewColumns.Add(cfMiddleName);
     560  ListViewColumns.Add(cfLastName);
     561  ListViewColumns.Add(cfTel);
     562  ListViewColumns.Add(cfTelCell);
     563  ListViewColumns.Add(cfTelHome);
     564  ListViewColumns.Add(cfTelWork);
     565  ListViewColumns.Add(cfEmailWork);
     566
    532567  FContacts := nil;
    533568  for I := 0 to ToolBar1.ButtonCount - 1 do begin
     
    535570    ToolBar1.Buttons[I].Hint := ToolBar1.Buttons[I].Caption;
    536571  end;
     572end;
     573
     574procedure TFormContacts.FormDestroy(Sender: TObject);
     575begin
     576  FreeAndNil(ListViewColumns);
     577  FreeAndNil(FilterItems);
     578end;
     579
     580procedure TFormContacts.FormResize(Sender: TObject);
     581begin
     582  ListViewFilter1.UpdateFromListView(ListView1);
    537583end;
    538584
     
    567613  ACut.Enabled := Assigned(Contacts) and Assigned(ListView1.Selected);
    568614  APaste.Enabled := Assigned(Contacts) and (Clipboard.AsText <> '');
     615
     616  UpdateColumns;
    569617end;
    570618
  • trunk/Forms/UFormMain.lfm

    r73 r76  
    148148      end
    149149    end
     150    object MenuItem7: TMenuItem
     151      Caption = 'Find'
     152      object MenuItem8: TMenuItem
     153        Action = Core.AFind
     154      end
     155      object MenuItem9: TMenuItem
     156        Action = Core.AFindDuplicate
     157      end
     158    end
    150159    object MenuItemView: TMenuItem
    151160      Caption = 'View'
     
    161170        Action = Core.ASettings
    162171      end
    163       object MenuItem4: TMenuItem
    164         Action = Core.AFindDuplicate
     172      object MenuItem10: TMenuItem
     173        Caption = '-'
    165174      end
    166175      object MenuItem5: TMenuItem
  • trunk/Forms/UFormMain.lrj

    r62 r76  
    33{"hash":315429,"name":"tformmain.menuitemfile.caption","sourcebytes":[70,105,108,101],"value":"File"},
    44{"hash":131987540,"name":"tformmain.menuitemfileopenrecent.caption","sourcebytes":[79,112,101,110,32,114,101,99,101,110,116],"value":"Open recent"},
     5{"hash":315460,"name":"tformmain.menuitem7.caption","sourcebytes":[70,105,110,100],"value":"Find"},
    56{"hash":380871,"name":"tformmain.menuitemview.caption","sourcebytes":[86,105,101,119],"value":"View"},
    67{"hash":8267778,"name":"tformmain.menuitemtoolbar.caption","sourcebytes":[77,97,105,110,32,116,111,111,108,98,97,114],"value":"Main toolbar"},
  • trunk/Forms/UFormMain.pas

    r62 r76  
    1717    MainMenu1: TMainMenu;
    1818    MenuItem1: TMenuItem;
     19    MenuItem10: TMenuItem;
    1920    MenuItem3: TMenuItem;
    20     MenuItem4: TMenuItem;
    2121    MenuItem5: TMenuItem;
    2222    MenuItem6: TMenuItem;
     23    MenuItem7: TMenuItem;
     24    MenuItem8: TMenuItem;
     25    MenuItem9: TMenuItem;
    2326    MenuItemToolbar: TMenuItem;
    2427    MenuItemView: TMenuItem;
     
    9093procedure TFormMain.FormCreate(Sender: TObject);
    9194begin
     95  FormContacts := TFormContacts.Create(nil);
    9296end;
    9397
    9498procedure TFormMain.FormDestroy(Sender: TObject);
    9599begin
    96   FormContacts.Free;
     100  FreeAndNil(FormContacts);
    97101end;
    98102
     
    111115  CoolBar1.AutosizeBands;
    112116
    113   FormContacts := TFormContacts.Create(nil);
    114117  FormContacts.Contacts := TContactsFile(Core.DataFile).Contacts;
    115118  FormContacts.ManualDock(Self, nil, alClient);
  • trunk/Languages/vCardStudio.cs.po

    r74 r76  
    5353msgstr "Rozdělit..."
    5454
     55#: tcore.afind.caption
     56msgid "Find..."
     57msgstr "Hledat..."
     58
    5559#: tcore.afindduplicate.caption
    5660msgctxt "tcore.afindduplicate.caption"
     
    558562msgstr "Chyby načítání"
    559563
     564#: tformfind.buttonfind.caption
     565msgctxt "tformfind.buttonfind.caption"
     566msgid "Find"
     567msgstr "Hledat"
     568
     569#: tformfind.caption
     570msgctxt "tformfind.caption"
     571msgid "Find"
     572msgstr "Hledat"
     573
     574#: tformfind.label1.caption
     575msgctxt "tformfind.label1.caption"
     576msgid "By contact field:"
     577msgstr "Podle pole kontaktu:"
     578
    560579#: tformfindduplicity.ashowcontacts.caption
     580msgctxt "tformfindduplicity.ashowcontacts.caption"
    561581msgid "Show contacts"
    562582msgstr "Ukázat kontakty"
     
    572592
    573593#: tformfindduplicity.label1.caption
     594msgctxt "tformfindduplicity.label1.caption"
    574595msgid "By contact field:"
    575596msgstr "Podle pole kontaktu:"
     
    586607
    587608#: tformfindduplicity.listview1.columns[2].caption
     609msgctxt "tformfindduplicity.listview1.columns[2].caption"
    588610msgid "Count"
    589611msgstr "Počet"
     
    607629msgstr "vCard Studio"
    608630
     631#: tformmain.menuitem7.caption
     632msgctxt "tformmain.menuitem7.caption"
     633msgid "Find"
     634msgstr "Hledat"
     635
    609636#: tformmain.menuitemfile.caption
    610637msgctxt "tformmain.menuitemfile.caption"
     
    11751202msgstr "Celkem"
    11761203
     1204#: uformfind.sany
     1205msgid "Any"
     1206msgstr "Jakékoliv"
     1207
    11771208#: uformmain.smodified
    11781209msgid "Modified"
  • trunk/Languages/vCardStudio.po

    r74 r76  
    4343msgstr ""
    4444
     45#: tcore.afind.caption
     46msgid "Find..."
     47msgstr ""
     48
    4549#: tcore.afindduplicate.caption
    4650msgctxt "tcore.afindduplicate.caption"
     
    548552msgstr ""
    549553
     554#: tformfind.buttonfind.caption
     555msgctxt "tformfind.buttonfind.caption"
     556msgid "Find"
     557msgstr ""
     558
     559#: tformfind.caption
     560msgctxt "tformfind.caption"
     561msgid "Find"
     562msgstr ""
     563
     564#: tformfind.label1.caption
     565msgctxt "tformfind.label1.caption"
     566msgid "By contact field:"
     567msgstr ""
     568
    550569#: tformfindduplicity.ashowcontacts.caption
     570msgctxt "tformfindduplicity.ashowcontacts.caption"
    551571msgid "Show contacts"
    552572msgstr ""
     
    562582
    563583#: tformfindduplicity.label1.caption
     584msgctxt "tformfindduplicity.label1.caption"
    564585msgid "By contact field:"
    565586msgstr ""
     
    576597
    577598#: tformfindduplicity.listview1.columns[2].caption
     599msgctxt "tformfindduplicity.listview1.columns[2].caption"
    578600msgid "Count"
    579601msgstr ""
     
    597619msgstr ""
    598620
     621#: tformmain.menuitem7.caption
     622msgctxt "tformmain.menuitem7.caption"
     623msgid "Find"
     624msgstr ""
     625
    599626#: tformmain.menuitemfile.caption
    600627msgctxt "tformmain.menuitemfile.caption"
     
    11631190msgstr ""
    11641191
     1192#: uformfind.sany
     1193msgid "Any"
     1194msgstr ""
     1195
    11651196#: uformmain.smodified
    11661197msgid "Modified"
  • trunk/UContact.pas

    r74 r76  
    1515  TDataType = (dtNone, dtString, dtInteger, dtDate, dtDateTime, dtImage, dtStringList);
    1616
    17   TContactFieldIndex = (cfFirstName, cfMiddleName, cfLastName, cfTitleBefore,
     17  TContactFieldIndex = (cfNone, cfFirstName, cfMiddleName, cfLastName, cfTitleBefore,
    1818    cfTitleAfter, cfFullName,
    1919    cfTel, cfTelCell, cfTelFax, cfTelPager, cfTelHome2, cfTelVoip, cfTelMain,
     
    3333    cfTwitter, cfFacebook, cfInstagram, cfSnapchat, cfMatrix, cfYoutube,
    3434    cfPeerTube, cfLinkedIn, cfMastodon, cfMySpace, cfReddit);
     35
     36  TContactFieldIndexes = TFPGList<TContactFieldIndex>;
     37
     38  TContactFilterItem = class
     39    FieldIndex: TContactFieldIndex;
     40    Value: string;
     41  end;
     42
     43  { TContactFilterItems }
     44
     45  TContactFilterItems = class(TFPGObjectList<TContactFilterItem>)
     46    function AddNew(FieldIndex: TContactFieldIndex; Value: string): TContactFilterItem;
     47  end;
    3548
    3649  TContactFields = class;
     
    348361  end;
    349362  SetLength(Result, O - 1);
     363end;
     364
     365{ TContactFilterItems }
     366
     367function TContactFilterItems.AddNew(FieldIndex: TContactFieldIndex;
     368  Value: string): TContactFilterItem;
     369begin
     370  Result := TContactFilterItem.Create;
     371  Result.FieldIndex := FieldIndex;
     372  Result.Value := Value;
     373  Add(Result);
    350374end;
    351375
  • trunk/UCore.lfm

    r73 r76  
    1010  object ImageList1: TImageList
    1111    Left = 115
    12     Top = 202
     12    Top = 200
    1313    Bitmap = {
    14       4C690E0000001000000010000000000000000000000000000000000000000000
     14      4C690F0000001000000010000000000000000000000000000000000000000000
    1515      0000000000000000000000000000000000000000000000000000000000000000
    1616      0000000000000000000000000000000000000000000000000000000000000000
     
    460460      00FF840000FF840000FF840000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00
    461461      FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    462       FF00FF00FF00FF00FF00FF00FF00
     462      FF00FF00FF00FF00FF00FF00FF000000000000000000000000010000001A0000
     463      0074000000C1000000DD000000DE000000BF0000006D0000001E000000020000
     464      0000000000000000000000000000000000000000000100000036000000B20000
     465      00D0000000930000006F0000006D00000098000000CE000000B1000000360000
     466      00000000000000000000000000000000000000000024000000B1000000BE0000
     467      00370000000700000000000000000000000800000042000000BC000000BE0000
     468      000D000000000000000000000000000000050000006B000000D40000003D0000
     469      000000000000000000000000000000000000000000020000003C000000DE0000
     470      006500000000000000000000000000000019000000B2000000850000000A0000
     471      0000000000000000000000000000000000000000000000000000000000910000
     472      00C300000006000000000000000000000023000000C900000061000000000000
     473      00000000000000000000000000000000000000000000000000000000005D0000
     474      00D50000001B000000000000000000000023000000C900000061000000000000
     475      00000000000000000000000000000000000000000000000000000000005D0000
     476      00D60000001C000000000000000000000019000000B2000000850000000A0000
     477      0000000000000000000000000000000000000000000000000000000000910000
     478      00C5000000060000000000000000000000050000006B000000D40000003D0000
     479      000000000000000000000000000000000000000000020000003C000000DF0000
     480      00680000000000000000000000000000000000000024000000AE000000BE0000
     481      00370000000700000000000000000000000800000042000000BC000000F90000
     482      0039000000000000000000000000000000000000000100000032000000AF0000
     483      00D0000000930000006F0000006D00000098000000CE000000ED000000FD0000
     484      00B50000002F00000000000000000000000000000000000000000000001A0000
     485      0074000000C2000000E5000000E8000000C00000006B00000044000000CA0000
     486      00FB000000B40000002900000000000000000000000000000000000000000000
     487      0000000000000000000000000000000000000000000000000000000000130000
     488      00C4000000FC000000C800000034000000000000000000000000000000000000
     489      0000000000000000000000000000000000000000000000000000000000000000
     490      002E000000BA000000FA000000B9000000000000000000000000000000000000
     491      0000000000000000000000000000000000000000000000000000000000000000
     492      000200000033000000A5000000A5000000000000000000000000000000000000
     493      0000000000000000000000000000000000000000000000000000000000000000
     494      0000000000020000001600000016
    463495    }
    464496  end
     
    543575      Caption = 'Split...'
    544576      OnExecute = AFileSplitExecute
     577    end
     578    object AFind: TAction
     579      Caption = 'Find...'
     580      ImageIndex = 14
     581      OnExecute = AFindExecute
     582      ShortCut = 16454
    545583    end
    546584  end
  • trunk/UCore.lrj

    r73 r76  
    1414{"hash":245221587,"name":"tcore.agenerate.caption","sourcebytes":[71,101,110,101,114,97,116,101,32,99,111,110,116,97,99,116,115],"value":"Generate contacts"},
    1515{"hash":120616622,"name":"tcore.afilesplit.caption","sourcebytes":[83,112,108,105,116,46,46,46],"value":"Split..."},
     16{"hash":218394958,"name":"tcore.afind.caption","sourcebytes":[70,105,110,100,46,46,46],"value":"Find..."},
    1617{"hash":190444780,"name":"tcore.applicationinfo1.description","sourcebytes":[118,67,97,114,100,32,102,105,108,101,115,32,109,97,110,97,103,101,109,101,110,116,32,116,111,111,108],"value":"vCard files management tool"}
    1718]}
  • trunk/UCore.pas

    r73 r76  
    1717    AAbout: TAction;
    1818    AboutDialog1: TAboutDialog;
     19    AFind: TAction;
    1920    AFileSplit: TAction;
    2021    AGenerate: TAction;
     
    5253    procedure AFileSplitExecute(Sender: TObject);
    5354    procedure AFindDuplicateExecute(Sender: TObject);
     55    procedure AFindExecute(Sender: TObject);
    5456    procedure AGenerateExecute(Sender: TObject);
    5557    procedure AHomePageExecute(Sender: TObject);
     
    99101uses
    100102  UFormMain, UFormSettings, UContact, UFormContacts, UFormFindDuplicity,
    101   UFormGenerate, UFormError;
     103  UFormGenerate, UFormError, UFormFind;
    102104
    103105resourcestring
     
    202204procedure TCore.AFindDuplicateExecute(Sender: TObject);
    203205begin
    204   FormFindDuplicity := TFormFindDuplicity.Create(nil);
    205   with FormFindDuplicity do begin
     206  with TFormFindDuplicity.Create(nil) do
     207  try
    206208    Contacts := TContactsFile(DataFile).Contacts;
    207209    ShowModal;
    208210    FormContacts.ReloadList;
    209211    FormMain.UpdateInterface;
     212  finally
    210213    Free;
    211214  end;
    212215end;
    213216
     217procedure TCore.AFindExecute(Sender: TObject);
     218begin
     219  with TFormFind.Create(nil) do
     220  try
     221    Contacts := TContactsFile(DataFile).Contacts;
     222    ShowModal;
     223    FormContacts.ReloadList;
     224    FormMain.UpdateInterface;
     225  finally
     226    Free;
     227  end;
     228end;
     229
    214230procedure TCore.AGenerateExecute(Sender: TObject);
    215231begin
    216   FormGenerate := TFormGenerate.Create(nil);
    217   with FormGenerate do begin
     232  with TFormGenerate.Create(nil) do
     233  try
    218234    Contacts := TContactsFile(DataFile).Contacts;
    219235    ShowModal;
     
    222238    DataFile.Modified := True;
    223239    FormMain.UpdateInterface;
     240  finally
    224241    Free;
    225242  end;
     
    233250procedure TCore.ASettingsExecute(Sender: TObject);
    234251begin
    235   FormSettings := TFormSettings.Create(nil);
    236   try
    237     FormSettings.LoadData;
    238     if FormSettings.ShowModal = mrOK then begin
    239       FormSettings.SaveData;
     252  with TFormSettings.Create(nil) do
     253  try
     254    LoadData;
     255    if ShowModal = mrOK then begin
     256      SaveData;
    240257      ThemeManager1.UseTheme(FormMain);
    241258      ThemeManager1.UseTheme(FormContacts);
    242259    end;
    243260  finally
    244     FormSettings.Free;
     261    Free;
    245262  end;
    246263end;
  • trunk/vCardStudio.lpi

    r39 r76  
    101101      </Item2>
    102102    </RequiredPackages>
    103     <Units Count="14">
     103    <Units Count="15">
    104104      <Unit0>
    105105        <Filename Value="vCardStudio.lpr"/>
     
    188188        <ResourceBaseClass Value="Form"/>
    189189      </Unit13>
     190      <Unit14>
     191        <Filename Value="Forms\UFormFind.pas"/>
     192        <IsPartOfProject Value="True"/>
     193        <ComponentName Value="FormFind"/>
     194        <HasResources Value="True"/>
     195        <ResourceBaseClass Value="Form"/>
     196      </Unit14>
    190197    </Units>
    191198  </ProjectOptions>
Note: See TracChangeset for help on using the changeset viewer.