Changeset 73


Ignore:
Timestamp:
Dec 13, 2021, 11:33:11 PM (2 years ago)
Author:
chronos
Message:
  • Added: Copy, cut and paste context menu action in contacts list.
  • Modified: Merge multiple files action replaced by Combine action. During Combine action files are simply added into final contacts list even with duplicate contacts.
  • Modified: Added Merge button into Find duplicate window to merge contacts by selected contact field.
  • Modified: Show only used contact fields in Find duplicates window.
  • Fixed: Wrong items were removed if contacts and properties lists were in filtered state.
Location:
trunk
Files:
2 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContact.lfm

    r71 r73  
    429429        Anchors = [akTop, akLeft, akRight]
    430430        Caption = 'Address'
    431         ClientHeight = 215
    432         ClientWidth = 920
     431        ClientHeight = 212
     432        ClientWidth = 918
    433433        TabOrder = 6
    434434        object Label36: TLabel
     
    573573    object TabSheetWork: TTabSheet
    574574      Caption = 'Work'
    575       ClientHeight = 628
    576       ClientWidth = 959
     575      ClientHeight = 630
     576      ClientWidth = 961
    577577      OnHide = TabSheetWorkHide
    578578      OnShow = TabSheetWorkShow
    579579      object EditOrganization: TEdit
    580580        Left = 173
    581         Height = 42
     581        Height = 33
    582582        Top = 64
    583583        Width = 254
     
    587587      object LabelOrganization: TLabel
    588588        Left = 10
    589         Height = 24
     589        Height = 25
    590590        Top = 70
    591         Width = 114
     591        Width = 106
    592592        Caption = 'Organization:'
    593593        ParentColor = False
     
    596596      object LabelOrganization1: TLabel
    597597        Left = 451
    598         Height = 24
     598        Height = 25
    599599        Top = 24
    600         Width = 106
     600        Width = 99
    601601        Caption = 'Department:'
    602602        ParentColor = False
     
    605605      object EditDepartment: TEdit
    606606        Left = 608
    607         Height = 42
     607        Height = 33
    608608        Top = 20
    609609        Width = 254
     
    613613      object Label18: TLabel
    614614        Left = 10
    615         Height = 24
     615        Height = 25
    616616        Top = 20
    617         Width = 41
     617        Width = 36
    618618        Caption = 'Title:'
    619619        ParentColor = False
     
    622622      object EditTitle: TEdit
    623623        Left = 173
    624         Height = 42
     624        Height = 33
    625625        Top = 16
    626626        Width = 254
     
    630630      object EditWorkWeb: TEdit
    631631        Left = 173
    632         Height = 42
     632        Height = 33
    633633        Top = 256
    634634        Width = 683
     
    638638      object Label32: TLabel
    639639        Left = 10
    640         Height = 24
     640        Height = 25
    641641        Top = 264
    642         Width = 114
     642        Width = 107
    643643        Caption = 'Web address:'
    644644        ParentColor = False
     
    651651        Width = 911
    652652        Caption = 'Address'
    653         ClientHeight = 220
    654         ClientWidth = 909
     653        ClientHeight = 217
     654        ClientWidth = 907
    655655        TabOrder = 4
    656656        object Label31: TLabel
    657657          Left = 10
    658           Height = 24
     658          Height = 25
    659659          Top = 160
    660           Width = 71
     660          Width = 67
    661661          Caption = 'Country:'
    662662          ParentColor = False
     
    665665        object EditAddressWorkCountry: TEdit
    666666          Left = 173
    667           Height = 42
     667          Height = 33
    668668          Top = 160
    669669          Width = 254
     
    673673        object EditAddressWorkRegion: TEdit
    674674          Left = 173
    675           Height = 42
     675          Height = 33
    676676          Top = 112
    677677          Width = 254
     
    681681        object Label30: TLabel
    682682          Left = 10
    683           Height = 24
     683          Height = 25
    684684          Top = 112
    685           Width = 64
     685          Width = 59
    686686          Caption = 'Region:'
    687687          ParentColor = False
     
    690690        object Label35: TLabel
    691691          Left = 10
    692           Height = 24
     692          Height = 25
    693693          Top = 66
    694           Width = 137
     694          Width = 126
    695695          Caption = 'Extended street:'
    696696          ParentColor = False
     
    699699        object EditAddressWorkStreetExtended: TEdit
    700700          Left = 173
    701           Height = 42
     701          Height = 33
    702702          Top = 64
    703703          Width = 254
     
    707707        object Label28: TLabel
    708708          Left = 10
    709           Height = 24
     709          Height = 25
    710710          Top = 18
    711           Width = 54
     711          Width = 49
    712712          Caption = 'Street:'
    713713          ParentColor = False
     
    716716        object EditAddressWorkStreet: TEdit
    717717          Left = 173
    718           Height = 42
     718          Height = 33
    719719          Top = 8
    720720          Width = 254
     
    724724        object Label34: TLabel
    725725          Left = 451
    726           Height = 24
     726          Height = 25
    727727          Top = 18
    728           Width = 131
     728          Width = 122
    729729          Caption = 'Post office box:'
    730730          ParentColor = False
     
    733733        object EditAddressWorkPostOfficeBox: TEdit
    734734          Left = 608
    735           Height = 42
     735          Height = 33
    736736          Top = 8
    737737          Width = 254
     
    741741        object EditAddressWorkCity: TEdit
    742742          Left = 608
    743           Height = 42
     743          Height = 33
    744744          Top = 56
    745745          Width = 254
     
    749749        object Label29: TLabel
    750750          Left = 451
    751           Height = 24
     751          Height = 25
    752752          Top = 64
    753           Width = 36
     753          Width = 34
    754754          Caption = 'City:'
    755755          ParentColor = False
     
    758758        object EditAddressWorkPostalCode: TEdit
    759759          Left = 608
    760           Height = 42
     760          Height = 33
    761761          Top = 142
    762762          Width = 254
     
    766766        object Label33: TLabel
    767767          Left = 451
    768           Height = 24
     768          Height = 25
    769769          Top = 150
    770           Width = 103
     770          Width = 95
    771771          Caption = 'Postal code:'
    772772          ParentColor = False
     
    776776      object Label15: TLabel
    777777        Left = 10
    778         Height = 24
     778        Height = 25
    779779        Top = 116
    780         Width = 59
     780        Width = 54
    781781        Caption = 'Phone:'
    782782        ParentColor = False
     
    785785      object EditWorkPhone: TEdit
    786786        Left = 173
    787         Height = 42
     787        Height = 33
    788788        Top = 112
    789789        Width = 254
     
    793793      object Label16: TLabel
    794794        Left = 451
    795         Height = 24
     795        Height = 25
    796796        Top = 112
    797         Width = 34
     797        Width = 29
    798798        Caption = 'Fax:'
    799799        ParentColor = False
     
    802802      object EditWorkFax: TEdit
    803803        Left = 608
    804         Height = 42
     804        Height = 33
    805805        Top = 112
    806806        Width = 254
     
    810810      object EditWorkPager: TEdit
    811811        Left = 608
    812         Height = 42
     812        Height = 33
    813813        Top = 156
    814814        Width = 254
     
    818818      object Label17: TLabel
    819819        Left = 448
    820         Height = 24
     820        Height = 25
    821821        Top = 160
    822         Width = 54
     822        Width = 48
    823823        Caption = 'Pager:'
    824824        ParentColor = False
     
    827827      object EditWorkMobile: TEdit
    828828        Left = 173
    829         Height = 42
     829        Height = 33
    830830        Top = 160
    831831        Width = 254
     
    835835      object Label19: TLabel
    836836        Left = 10
    837         Height = 24
     837        Height = 25
    838838        Top = 160
    839         Width = 63
     839        Width = 59
    840840        Caption = 'Mobile:'
    841841        ParentColor = False
     
    844844      object Label8: TLabel
    845845        Left = 10
    846         Height = 24
     846        Height = 25
    847847        Top = 210
    848         Width = 58
     848        Width = 53
    849849        Caption = 'E-mail:'
    850850        ParentColor = False
     
    853853      object EditWorkEmail: TEdit
    854854        Left = 173
    855         Height = 42
     855        Height = 33
    856856        Top = 210
    857857        Width = 254
  • trunk/Forms/UFormContacts.lfm

    r72 r73  
    149149      Action = ASelectAll
    150150    end
     151    object MenuItem12: TMenuItem
     152      Caption = '-'
     153    end
     154    object MenuItem9: TMenuItem
     155      Action = ACut
     156    end
     157    object MenuItem10: TMenuItem
     158      Action = ACopy
     159    end
     160    object MenuItem11: TMenuItem
     161      Action = APaste
     162    end
    151163    object MenuItem6: TMenuItem
    152164      Caption = '-'
     
    201213      OnExecute = ASaveToFileExecute
    202214    end
     215    object ACopy: TAction
     216      Caption = 'Copy'
     217      ImageIndex = 11
     218      OnExecute = ACopyExecute
     219      ShortCut = 16451
     220    end
     221    object ACut: TAction
     222      Caption = 'Cut'
     223      ImageIndex = 12
     224      OnExecute = ACutExecute
     225      ShortCut = 16472
     226    end
     227    object APaste: TAction
     228      Caption = 'Paste'
     229      ImageIndex = 13
     230      OnExecute = APasteExecute
     231      ShortCut = 16470
     232    end
    203233  end
    204234  object ListViewSort1: TListViewSort
  • trunk/Forms/UFormContacts.lrj

    r72 r73  
    1515{"hash":4863557,"name":"tformcontacts.aclone.caption","sourcebytes":[67,108,111,110,101],"value":"Clone"},
    1616{"hash":177113358,"name":"tformcontacts.aloadfromfile.caption","sourcebytes":[76,111,97,100,32,102,114,111,109,32,102,105,108,101,46,46,46],"value":"Load from file..."},
    17 {"hash":10127854,"name":"tformcontacts.asavetofile.caption","sourcebytes":[83,97,118,101,32,116,111,32,102,105,108,101,46,46,46],"value":"Save to file..."}
     17{"hash":10127854,"name":"tformcontacts.asavetofile.caption","sourcebytes":[83,97,118,101,32,116,111,32,102,105,108,101,46,46,46],"value":"Save to file..."},
     18{"hash":304761,"name":"tformcontacts.acopy.caption","sourcebytes":[67,111,112,121],"value":"Copy"},
     19{"hash":19140,"name":"tformcontacts.acut.caption","sourcebytes":[67,117,116],"value":"Cut"},
     20{"hash":5671589,"name":"tformcontacts.apaste.caption","sourcebytes":[80,97,115,116,101],"value":"Paste"}
    1821]}
  • trunk/Forms/UFormContacts.pas

    r72 r73  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   ComCtrls, Menus, ActnList, UContact, UListViewSort, fgl, LazUTF8;
     9  ComCtrls, Menus, ActnList, UContact, UListViewSort, fgl, LazUTF8, Clipbrd;
    1010
    1111type
     
    1616    AAdd: TAction;
    1717    AClone: TAction;
     18    ACopy: TAction;
     19    ACut: TAction;
     20    APaste: TAction;
    1821    ALoadFromFile: TAction;
    1922    ASaveToFile: TAction;
     
    2629    ListViewSort1: TListViewSort;
    2730    MenuItem1: TMenuItem;
     31    MenuItem10: TMenuItem;
     32    MenuItem11: TMenuItem;
     33    MenuItem12: TMenuItem;
    2834    MenuItem2: TMenuItem;
    2935    MenuItem3: TMenuItem;
     
    3339    MenuItem7: TMenuItem;
    3440    MenuItem8: TMenuItem;
     41    MenuItem9: TMenuItem;
    3542    OpenDialog1: TOpenDialog;
    3643    PopupMenuContact: TPopupMenu;
     
    4754    procedure AAddExecute(Sender: TObject);
    4855    procedure ACloneExecute(Sender: TObject);
     56    procedure ACopyExecute(Sender: TObject);
     57    procedure ACutExecute(Sender: TObject);
    4958    procedure ALoadFromFileExecute(Sender: TObject);
    5059    procedure AModifyExecute(Sender: TObject);
     60    procedure APasteExecute(Sender: TObject);
    5161    procedure ARemoveExecute(Sender: TObject);
    5262    procedure ASaveToFileExecute(Sender: TObject);
     
    334344end;
    335345
     346procedure TFormContacts.ACopyExecute(Sender: TObject);
     347var
     348  Text: string;
     349  Strings: TStringList;
     350  I: Integer;
     351begin
     352  Strings := TStringList.Create;
     353  try
     354  Text := '';
     355  for I := 0 to ListView1.Items.Count - 1 do
     356    if ListView1.Items[I].Selected then begin
     357      TContact(ListView1.Items[I].Data).SaveToStrings(Strings);
     358      Text := Text + Strings.Text;
     359    end;
     360    Clipboard.AsText := Text;
     361  finally
     362    Strings.Free;
     363  end;
     364end;
     365
     366procedure TFormContacts.ACutExecute(Sender: TObject);
     367var
     368  Text: string;
     369  Strings: TStringList;
     370  I: Integer;
     371begin
     372  Strings := TStringList.Create;
     373  try
     374    Text := '';
     375    for I := 0 to ListView1.Items.Count - 1 do
     376      if ListView1.Items[I].Selected then begin
     377        TContact(ListView1.Items[I].Data).SaveToStrings(Strings);
     378        Text := Text + Strings.Text;
     379      end;
     380    Clipboard.AsText := Text;
     381    for I := 0 to ListView1.Items.Count - 1 do
     382      if ListView1.Items[I].Selected then begin
     383        Contacts.Delete(Contacts.IndexOf(ListView1.Items[I].Data));
     384      end;
     385    ReloadList;
     386    ListView1.ClearSelection;
     387    UpdateInterface;
     388  finally
     389    Strings.Free;
     390  end;
     391end;
     392
    336393procedure TFormContacts.ALoadFromFileExecute(Sender: TObject);
    337394var
     
    384441end;
    385442
     443procedure TFormContacts.APasteExecute(Sender: TObject);
     444var
     445  PasteContacts: TContactsFile;
     446  Lines: TStringList;
     447begin
     448  PasteContacts := TContactsFile.Create;
     449  Lines := TStringList.Create;
     450  try
     451    Lines.Text := Clipboard.AsText;
     452    PasteContacts.LoadFromStrings(Lines);
     453    if PasteContacts.Contacts.Count > 0 then begin
     454      if Assigned(ListView1.Selected) then begin
     455        Contacts.InsertContacts(Contacts.IndexOf(ListView1.Selected.Data),
     456          PasteContacts.Contacts);
     457      end else Contacts.AddContacts(PasteContacts.Contacts);
     458      Core.DataFile.Modified := True;
     459      ReloadList;
     460      UpdateInterface;
     461    end;
     462  finally
     463    Lines.Free;
     464    PasteContacts.Free;
     465  end;
     466end;
     467
    386468procedure TFormContacts.ARemoveExecute(Sender: TObject);
    387469var
     
    393475    for I := ListView1.Items.Count - 1 downto 0 do
    394476      if ListView1.Items[I].Selected then begin
    395         Contacts.Delete(I);
     477        Contacts.Delete(Contacts.IndexOf(ListView1.Items[I].Data));
    396478      end;
    397479    Core.DataFile.Modified := True;
  • trunk/Forms/UFormFindDuplicity.lfm

    r23 r73  
    11object FormFindDuplicity: TFormFindDuplicity
    22  Left = 455
    3   Height = 481
    4   Top = 397
    5   Width = 701
     3  Height = 523
     4  Top = 355
     5  Width = 807
    66  Caption = 'Find duplicities'
    7   ClientHeight = 481
    8   ClientWidth = 701
     7  ClientHeight = 523
     8  ClientWidth = 807
    99  DesignTimePPI = 144
    1010  OnClose = FormClose
     
    1515  object ListView1: TListView
    1616    Left = 5
    17     Height = 413
     17    Height = 455
    1818    Top = 63
    19     Width = 691
     19    Width = 797
    2020    Align = alClient
    2121    BorderSpacing.Around = 5
     
    4747    Height = 58
    4848    Top = 0
    49     Width = 701
     49    Width = 807
    5050    Align = alTop
    5151    BevelOuter = bvNone
    5252    ClientHeight = 58
    53     ClientWidth = 701
     53    ClientWidth = 807
    5454    ParentFont = False
    5555    TabOrder = 1
    5656    object ComboBoxField: TComboBox
    57       Left = 173
    58       Height = 41
    59       Top = 14
     57      Left = 160
     58      Height = 33
     59      Top = 16
    6060      Width = 326
    61       ItemHeight = 0
     61      ItemHeight = 25
    6262      OnChange = ComboBoxFieldChange
    6363      ParentFont = False
     
    6767    object Label1: TLabel
    6868      Left = 13
    69       Height = 24
     69      Height = 25
    7070      Top = 19
    71       Width = 111
    72       Caption = 'Contact field:'
     71      Width = 125
     72      Caption = 'By contact field:'
    7373      ParentColor = False
    7474      ParentFont = False
     75    end
     76    object ButtonMerge: TButton
     77      Left = 496
     78      Height = 38
     79      Top = 14
     80      Width = 113
     81      Caption = 'Merge'
     82      OnClick = ButtonMergeClick
     83      TabOrder = 1
    7584    end
    7685  end
  • trunk/Forms/UFormFindDuplicity.lrj

    r21 r73  
    44{"hash":106593811,"name":"tformfindduplicity.listview1.columns[1].caption","sourcebytes":[67,111,110,116,97,99,116,115],"value":"Contacts"},
    55{"hash":4877396,"name":"tformfindduplicity.listview1.columns[2].caption","sourcebytes":[67,111,117,110,116],"value":"Count"},
    6 {"hash":9821370,"name":"tformfindduplicity.label1.caption","sourcebytes":[67,111,110,116,97,99,116,32,102,105,101,108,100,58],"value":"Contact field:"},
     6{"hash":14454458,"name":"tformfindduplicity.label1.caption","sourcebytes":[66,121,32,99,111,110,116,97,99,116,32,102,105,101,108,100,58],"value":"By contact field:"},
     7{"hash":5490901,"name":"tformfindduplicity.buttonmerge.caption","sourcebytes":[77,101,114,103,101],"value":"Merge"},
    78{"hash":229436515,"name":"tformfindduplicity.ashowcontacts.caption","sourcebytes":[83,104,111,119,32,99,111,110,116,97,99,116,115],"value":"Show contacts"}
    89]}
  • trunk/Forms/UFormFindDuplicity.pas

    r68 r73  
    3131    AShowContacts: TAction;
    3232    ActionList1: TActionList;
     33    ButtonMerge: TButton;
    3334    ComboBoxField: TComboBox;
    3435    Label1: TLabel;
     
    3839    PopupMenu1: TPopupMenu;
    3940    procedure AShowContactsExecute(Sender: TObject);
     41    procedure ButtonMergeClick(Sender: TObject);
    4042    procedure ComboBoxFieldChange(Sender: TObject);
    4143    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
     
    109111var
    110112  ContactField: TContactField;
     113  Items: TStringList;
     114  I: Integer;
    111115begin
    112116  if FContacts = AValue then Exit;
    113117  FContacts := AValue;
    114118  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;
    116132    ContactField := Contacts.ContactsFile.Fields.GetByIndex(ContactFieldIndex);
    117133    ComboBoxField.ItemIndex := ComboBoxField.Items.IndexOfObject(ContactField);
     
    156172  Core.Translator.TranslateComponentRecursive(Self);
    157173  Core.ThemeManager1.UseTheme(Self);
    158   ContactFieldIndex := cfTelCell;
     174  ContactFieldIndex := cfFullName;
    159175end;
    160176
     
    203219end;
    204220
     221procedure TFormFindDuplicity.ButtonMergeClick(Sender: TObject);
     222var
     223  TempContacts: TContactsFile;
     224  I: Integer;
     225begin
     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;
     235end;
     236
    205237procedure TFormFindDuplicity.FormClose(Sender: TObject;
    206238  var CloseAction: TCloseAction);
  • trunk/Forms/UFormMain.lfm

    r62 r73  
    136136      end
    137137      object MenuItem3: TMenuItem
    138         Action = Core.AFileMerge
     138        Action = Core.AFileCombine
    139139      end
    140140      object MenuItem6: TMenuItem
  • trunk/Forms/UFormProperties.pas

    r72 r73  
    314314    for I := ListView1.Items.Count - 1 downto 0 do
    315315      if ListView1.Items[I].Selected then begin
    316         Properties.Delete(I);
     316        Properties.Delete(Properties.IndexOf(ListView1.Items[I].Data));
    317317      end;
    318318    Core.DataFile.Modified := True;
  • trunk/Languages/vCardStudio.cs.po

    r72 r73  
    2424msgstr "Zavřít"
    2525
    26 #: tcore.afilemerge.caption
    27 msgid "Merge..."
     26#: tcore.afilecombine.caption
     27msgid "Combine..."
    2828msgstr "Sloučit..."
    2929
     
    472472msgstr "Klonovat"
    473473
     474#: tformcontacts.acopy.caption
     475msgid "Copy"
     476msgstr "Kopírovat"
     477
     478#: tformcontacts.acut.caption
     479msgid "Cut"
     480msgstr "Vyříznout"
     481
    474482#: tformcontacts.aloadfromfile.caption
    475483msgctxt "tformcontacts.aloadfromfile.caption"
     
    482490msgstr "Upravit"
    483491
     492#: tformcontacts.apaste.caption
     493msgid "Paste"
     494msgstr "Vložit"
     495
    484496#: tformcontacts.aremove.caption
    485497msgctxt "tformcontacts.aremove.caption"
     
    550562msgstr "Ukázat kontakty"
    551563
     564#: tformfindduplicity.buttonmerge.caption
     565msgid "Merge"
     566msgstr "Sloučit"
     567
    552568#: tformfindduplicity.caption
    553569msgctxt "tformfindduplicity.caption"
     
    556572
    557573#: tformfindduplicity.label1.caption
    558 msgid "Contact field:"
    559 msgstr "Pole kontaktu:"
     574msgid "By contact field:"
     575msgstr "Podle pole kontaktu:"
    560576
    561577#: tformfindduplicity.listview1.columns[0].caption
     
    10971113msgstr "Soubor byl upraven. Chcete jej uložit před ukončením?"
    10981114
     1115#: ucore.scombinedcontacts
     1116msgctxt "ucore.scombinedcontacts"
     1117msgid "Combined %d contact files."
     1118msgstr "Sloučeno %d souborů kontaktů."
     1119
    10991120#: ucore.sfilenotfound
    11001121msgid "File '%s' not found."
     
    11121133msgid "Line %d: %s"
    11131134msgstr "Řádek %d: %s"
    1114 
    1115 #: ucore.smergedcontacts
    1116 msgid "Contacts merged. Loaded: %d, New: %d, Updated: %d"
    1117 msgstr "Kontakty sloučeny. Načteno: %d, Nových: %d, Aktualizovaných: %d"
    11181135
    11191136#: udatafile.sallfiles
     
    11971214msgid "Invalid line length for encoded text"
    11981215msgstr "Neplatná délka řádky kódovaného textu"
    1199 
  • trunk/Languages/vCardStudio.po

    r72 r73  
    1414msgstr ""
    1515
    16 #: tcore.afilemerge.caption
    17 msgid "Merge..."
     16#: tcore.afilecombine.caption
     17msgid "Combine..."
    1818msgstr ""
    1919
     
    462462msgstr ""
    463463
     464#: tformcontacts.acopy.caption
     465msgid "Copy"
     466msgstr ""
     467
     468#: tformcontacts.acut.caption
     469msgid "Cut"
     470msgstr ""
     471
    464472#: tformcontacts.aloadfromfile.caption
    465473msgctxt "tformcontacts.aloadfromfile.caption"
     
    472480msgstr ""
    473481
     482#: tformcontacts.apaste.caption
     483msgid "Paste"
     484msgstr ""
     485
    474486#: tformcontacts.aremove.caption
    475487msgctxt "tformcontacts.aremove.caption"
     
    540552msgstr ""
    541553
     554#: tformfindduplicity.buttonmerge.caption
     555msgid "Merge"
     556msgstr ""
     557
    542558#: tformfindduplicity.caption
    543559msgctxt "tformfindduplicity.caption"
     
    546562
    547563#: tformfindduplicity.label1.caption
    548 msgid "Contact field:"
     564msgid "By contact field:"
    549565msgstr ""
    550566
     
    10851101msgstr ""
    10861102
     1103#: ucore.scombinedcontacts
     1104msgctxt "ucore.scombinedcontacts"
     1105msgid "Combined %d contact files."
     1106msgstr ""
     1107
    10871108#: ucore.sfilenotfound
    10881109msgid "File '%s' not found."
     
    10991120#: ucore.sline
    11001121msgid "Line %d: %s"
    1101 msgstr ""
    1102 
    1103 #: ucore.smergedcontacts
    1104 msgid "Contacts merged. Loaded: %d, New: %d, Updated: %d"
    11051122msgstr ""
    11061123
  • trunk/UContact.pas

    r72 r73  
    9393
    9494  TContactProperties = class(TFPGObjectList<TContactProperty>)
     95    procedure Assign(Source: TContactProperties);
    9596    procedure AssignToList(List: TFPGObjectList<TObject>);
    9697    function GetByName(Name: string): TContactProperty;
     
    110111    Properties: TContactProperties;
    111112    Parent: TContactsFile;
     113    function HasField(FieldIndex: TContactFieldIndex): Boolean;
    112114    function FullNameToFileName: string;
    113115    function GetProperty(Field: TContactField): TContactProperty; overload;
     
    128130  TContacts = class(TFPGObjectList<TContact>)
    129131    ContactsFile: TContactsFile;
     132    procedure Assign(Source: TContacts);
     133    procedure AddContacts(Contacts: TContacts);
     134    procedure InsertContacts(Index: Integer; Contacts: TContacts);
    130135    procedure AssignToList(List: TFPGObjectList<TObject>);
    131136    function AddNew: TContact;
    132     function Search(FullName: string): TContact;
     137    function Search(Text: string; FieldIndex: TContactFieldIndex): TContact;
     138    function CountByField(FieldIndex: TContactFieldIndex): Integer;
     139    procedure Merge(Contact: TContact; FieldIndex: TContactFieldIndex);
    133140    function ToString: ansistring; override;
    134141  end;
     
    148155    function GetFileExt: string; override;
    149156    function GetFileFilter: string; override;
     157    procedure SaveToStrings(Output: TStrings);
     158    procedure LoadFromStrings(Lines: TStrings);
    150159    procedure SaveToFile(FileName: string); override;
    151160    procedure LoadFromFile(FileName: string); override;
     
    388397{ TContactProperties }
    389398
     399procedure TContactProperties.Assign(Source: TContactProperties);
     400var
     401  I: Integer;
     402begin
     403  while Count < Source.Count do
     404    Add(TContactProperty.Create);
     405  while Count > Source.Count do
     406    Delete(Count - 1);
     407  for I := 0 to Count - 1 do
     408    Items[I].Assign(Source.Items[I]);
     409end;
     410
    390411procedure TContactProperties.AssignToList(List: TFPGObjectList<TObject>);
    391412var
     
    579600{ TContacts }
    580601
     602procedure TContacts.Assign(Source: TContacts);
     603var
     604  I: Integer;
     605begin
     606  while Count < Source.Count do
     607    Add(TContact.Create);
     608  while Count > Source.Count do
     609    Delete(Count - 1);
     610  for I := 0 to Count - 1 do begin
     611    Items[I].Assign(Source.Items[I]);
     612    Items[I].Parent := ContactsFile;
     613  end;
     614end;
     615
     616procedure TContacts.AddContacts(Contacts: TContacts);
     617var
     618  I: Integer;
     619  NewContact: TContact;
     620begin
     621  for I := 0 to Contacts.Count - 1 do begin
     622    NewContact := TContact.Create;
     623    NewContact.Assign(Contacts[I]);
     624    NewContact.Parent := ContactsFile;
     625    Add(NewContact);
     626  end;
     627end;
     628
     629procedure TContacts.InsertContacts(Index: Integer; Contacts: TContacts);
     630var
     631  I: Integer;
     632  NewContact: TContact;
     633begin
     634  for I := 0 to Contacts.Count - 1 do begin
     635    NewContact := TContact.Create;
     636    NewContact.Assign(Contacts[I]);
     637    NewContact.Parent := ContactsFile;
     638    Insert(Index, NewContact);
     639    Inc(Index);
     640  end;
     641end;
     642
    581643procedure TContacts.AssignToList(List: TFPGObjectList<TObject>);
    582644var
     
    596658end;
    597659
    598 function TContacts.Search(FullName: string): TContact;
    599 var
    600   Contact: TContact;
     660function TContacts.Search(Text: string; FieldIndex: TContactFieldIndex): TContact;
     661var
     662  I: Integer;
    601663begin
    602664  Result := nil;
    603   for Contact in Self do
    604     if Contact.Fields[cfFullName] = FullName then begin
    605       Result := Contact;
     665  for I := 0 to Count - 1 do
     666    if Items[I].Fields[FieldIndex] = Text then begin
     667      Result := Items[I];
    606668      Break;
    607669    end;
     670end;
     671
     672function TContacts.CountByField(FieldIndex: TContactFieldIndex): Integer;
     673var
     674  I: Integer;
     675begin
     676  Result := 0;
     677  for I := 0 to Count - 1 do
     678    if Items[I].HasField(FieldIndex) then
     679      Inc(Result);
     680end;
     681
     682procedure TContacts.Merge(Contact: TContact; FieldIndex: TContactFieldIndex);
     683var
     684  NewContact: TContact;
     685begin
     686  NewContact := Search(Contact.Fields[FieldIndex], FieldIndex);
     687  if Assigned(NewContact) then begin
     688    NewContact.UpdateFrom(Contact);
     689  end else begin
     690    NewContact := TContact.Create;
     691    NewContact.Assign(Contact);
     692    NewContact.Parent := ContactsFile;
     693    Add(NewContact);
     694  end;
    608695end;
    609696
     
    741828end;
    742829
     830function TContact.HasField(FieldIndex: TContactFieldIndex): Boolean;
     831var
     832  Field: TContactField;
     833begin
     834  if not Assigned(Parent) then raise Exception.Create(SContactHasNoParent);
     835  Field := Parent.Fields.GetByIndex(FieldIndex);
     836  if Assigned(Field) then begin
     837    Result := Assigned(GetProperty(Field));
     838  end else raise Exception.Create(SFieldIndexNotDefined);
     839end;
     840
    743841function TContact.FullNameToFileName: string;
    744842var
     
    778876
    779877procedure TContact.Assign(Source: TContact);
    780 var
    781   I: Integer;
    782 begin
    783   while Properties.Count < Source.Properties.Count do
    784     Properties.Add(TContactProperty.Create);
    785   while Properties.Count > Source.Properties.Count do
    786     Properties.Delete(Properties.Count - 1);
    787   for I := 0 to Properties.Count - 1 do
    788     Properties[I].Assign(Source.Properties[I]);
     878begin
     879  Properties.Assign(Source.Properties);
    789880end;
    790881
     
    11141205end;
    11151206
     1207procedure TContactsFile.SaveToStrings(Output: TStrings);
     1208var
     1209  I: Integer;
     1210begin
     1211  for I := 0 to Contacts.Count - 1 do
     1212    Contacts[I].SaveToStrings(Output);
     1213end;
     1214
     1215procedure TContactsFile.LoadFromStrings(Lines: TStrings);
     1216var
     1217  Contact: TContact;
     1218  I: Integer;
     1219  NewI: Integer;
     1220begin
     1221  Contacts.Clear;
     1222
     1223  I := 0;
     1224  while I < Lines.Count do begin
     1225    Contact := TContact.Create;
     1226    Contact.Parent := Self;
     1227    NewI := Contact.LoadFromStrings(Lines, I);
     1228    if NewI <= Lines.Count then begin
     1229      if NewI <> -1 then begin
     1230        Contacts.Add(Contact);
     1231        I := NewI;
     1232      end else begin
     1233        FreeAndNil(Contact);
     1234        Inc(I);
     1235      end;
     1236    end else begin
     1237      FreeAndNil(Contact);
     1238      Break;
     1239    end;
     1240  end;
     1241end;
     1242
    11161243function TContactsFile.NewItem(Key, Value: string): string;
    11171244var
     
    11251252procedure TContactsFile.SaveToFile(FileName: string);
    11261253var
    1127   Output: TStringList;
    1128   I: Integer;
     1254  Lines: TStringList;
    11291255begin
    11301256  inherited;
    1131   Output := TStringList.Create;
     1257  Lines := TStringList.Create;
    11321258  try
    1133     for I := 0 to Contacts.Count - 1 do
    1134       Contacts[I].SaveToStrings(Output);
    1135     Output.SaveToFile(FileName);
     1259    SaveToStrings(Lines);
     1260    Lines.SaveToFile(FileName);
    11361261  finally
    1137     Output.Free;
     1262    Lines.Free;
    11381263  end
    11391264end;
     
    11421267var
    11431268  Lines: TStringList;
    1144   Contact: TContact;
    1145   I: Integer;
    1146   NewI: Integer;
    11471269begin
    11481270  inherited;
    1149   Contacts.Clear;
    11501271  Lines := TStringList.Create;
    11511272  Lines.LoadFromFile(FileName);
     
    11591280  {$ENDIF}
    11601281  try
    1161     I := 0;
    1162     while I < Lines.Count do begin
    1163       Contact := TContact.Create;
    1164       Contact.Parent := Self;
    1165       NewI := Contact.LoadFromStrings(Lines, I);
    1166       if NewI <= Lines.Count then begin
    1167         if NewI <> -1 then begin
    1168           Contacts.Add(Contact);
    1169           I := NewI;
    1170         end else begin
    1171           FreeAndNil(Contact);
    1172           Inc(I);
    1173         end;
    1174       end else begin
    1175         FreeAndNil(Contact);
    1176         Break;
    1177       end;
    1178     end;
     1282    LoadFromStrings(Lines);
    11791283  finally
    11801284    Lines.Free;
  • trunk/UCore.lfm

    r66 r73  
    1212    Top = 202
    1313    Bitmap = {
    14       4C690C0000001000000010000000000000000000000000000000000000000000
     14      4C690E0000001000000010000000000000000000000000000000000000000000
    1515      0000000000000000000000000000000000000000000000000000000000000000
    1616      0000000000000000000000000000000000000000000000000000000000000000
     
    396396      00FF840000FF840000FF840000FF000000000000000000000000000000000000
    397397      0000000000000000000000000000000000000000000000000000000000000000
    398       0000000000000000000000000000
     398      0000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     399      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     400      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     401      FF00000000FFFFFFFF00FFFFFF00FFFFFF00000000FFFFFFFF00FFFFFF00FFFF
     402      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     403      FF00000000FFFFFFFF00FFFFFF00FFFFFF00000000FFFFFFFF00FFFFFF00FFFF
     404      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     405      FF00000000FFFFFFFF00FFFFFF00FFFFFF00000000FFFFFFFF00FFFFFF00FFFF
     406      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     407      FF00000000FF000000FFFFFFFF00000000FF000000FFFFFFFF00FFFFFF00FFFF
     408      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     409      FF00FFFFFF00000000FFFFFFFF00000000FFFFFFFF00FFFFFF00FFFFFF00FFFF
     410      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     411      FF00FFFFFF00000000FF000000FF000000FFFFFFFF00FFFFFF00FFFFFF00FFFF
     412      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     413      FF00FFFFFF00FFFFFF00000000FFFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     414      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     415      FF00FFFFFF00800000FF000000FF800000FFFFFFFF00FFFFFF00FFFFFF00FFFF
     416      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     417      FF00FFFFFF00800000FFFFFFFF00800000FF800000FF800000FFFFFFFF00FFFF
     418      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF008000
     419      00FF800000FF800000FFFFFFFF00800000FFFFFFFF00FFFFFF00800000FFFFFF
     420      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00800000FFFFFF
     421      FF00FFFFFF00800000FFFFFFFF00800000FFFFFFFF00FFFFFF00800000FFFFFF
     422      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00800000FFFFFF
     423      FF00FFFFFF00800000FFFFFFFF00800000FFFFFFFF00FFFFFF00800000FFFFFF
     424      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00800000FFFFFF
     425      FF00FFFFFF00800000FFFFFFFF00FFFFFF00800000FF800000FFFFFFFF00FFFF
     426      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF008000
     427      00FF800000FFFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     428      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     429      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
     430      FF00FFFFFF00FFFFFF00FFFFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
     431      FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
     432      FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
     433      FF00000000FF000000FF000000FF000000FFFF00FF00FF00FF00FF00FF00FF00
     434      FF00FF00FF00FF00FF00FF00FF00FF00FF00000000FF000000FF000000FF0000
     435      00FF000000FF00FFFFFF00FFFFFF000000FF000000FF000000FF000000FF0000
     436      00FFFF00FF00FF00FF00FF00FF00000000FF008484FF848484FF008484FF0000
     437      00FF00FFFFFF000000FF000000FF00FFFFFF000000FF848484FF008484FF8484
     438      84FF000000FFFF00FF00FF00FF00000000FF848484FF848484FF000000FFFF00
     439      FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00000000FF848484FF0084
     440      84FF000000FFFF00FF00FF00FF00000000FF008484FF848484FF000000FF0000
     441      00FF000000FF000000FF000000FF000000FF000000FF000000FF848484FF8484
     442      84FF000000FFFF00FF00FF00FF00000000FF848484FF008484FF848484FF0084
     443      84FF848484FF008484FF848484FF008484FF848484FF008484FF848484FF0084
     444      84FF000000FFFF00FF00FF00FF00000000FF008484FF848484FF008484FF8484
     445      84FF008484FF840000FF840000FF840000FF840000FF840000FF840000FF8400
     446      00FF000000FFFF00FF00FF00FF00000000FF848484FF008484FF848484FF0084
     447      84FF848484FF840000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8400
     448      00FF840000FFFF00FF00FF00FF00000000FF008484FF848484FF008484FF8484
     449      84FF008484FF840000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8400
     450      00FFFFFFFFFF840000FFFF00FF00000000FF848484FF008484FF848484FF0084
     451      84FF848484FF840000FFFFFFFFFF000000FF000000FF000000FFFFFFFFFF8400
     452      00FF840000FF840000FF840000FF000000FF008484FF848484FF008484FF8484
     453      84FF008484FF840000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
     454      FFFFFFFFFFFFFFFFFFFF840000FF000000FF848484FF008484FF848484FF0084
     455      84FF848484FF840000FFFFFFFFFF000000FF000000FF000000FF000000FF0000
     456      00FF000000FFFFFFFFFF840000FFFF00FF00000000FF000000FF000000FF0000
     457      00FF000000FF840000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
     458      FFFFFFFFFFFFFFFFFFFF840000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00
     459      FF00FF00FF00840000FF840000FF840000FF840000FF840000FF840000FF8400
     460      00FF840000FF840000FF840000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00
     461      FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
     462      FF00FF00FF00FF00FF00FF00FF00
    399463    }
    400464  end
     
    461525      OnExecute = ASettingsExecute
    462526    end
    463     object AFileMerge: TAction
     527    object AFileCombine: TAction
    464528      Category = 'File'
    465       Caption = 'Merge...'
    466       OnExecute = AFileMergeExecute
     529      Caption = 'Combine...'
     530      OnExecute = AFileCombineExecute
    467531    end
    468532    object AFindDuplicate: TAction
  • trunk/UCore.lrj

    r72 r73  
    1010{"hash":58140853,"name":"tcore.ahomepage.caption","sourcebytes":[72,111,109,101,32,112,97,103,101],"value":"Home page"},
    1111{"hash":213582195,"name":"tcore.asettings.caption","sourcebytes":[83,101,116,116,105,110,103,115],"value":"Settings"},
    12 {"hash":210601534,"name":"tcore.afilemerge.caption","sourcebytes":[77,101,114,103,101,46,46,46],"value":"Merge..."},
     12{"hash":151054142,"name":"tcore.afilecombine.caption","sourcebytes":[67,111,109,98,105,110,101,46,46,46],"value":"Combine..."},
    1313{"hash":168802467,"name":"tcore.afindduplicate.caption","sourcebytes":[70,105,110,100,32,100,117,112,108,105,99,105,116,105,101,115],"value":"Find duplicities"},
    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"},
  • trunk/UCore.pas

    r72 r73  
    1111
    1212type
    13 
    14   { TMergeResult }
    15 
    16   TMergeResult = record
    17     Loaded: Integer;
    18     New: Integer;
    19     Updated: Integer;
    20     procedure Clear;
    21     class operator Add(const A, B: TMergeResult): TMergeResult;
    22   end;
    2313
    2414  { TCore }
     
    3020    AGenerate: TAction;
    3121    AFindDuplicate: TAction;
    32     AFileMerge: TAction;
     22    AFileCombine: TAction;
    3323    ASettings: TAction;
    3424    AFileOpenRecent: TAction;
     
    5343    procedure AAboutExecute(Sender: TObject);
    5444    procedure AExitExecute(Sender: TObject);
    55     procedure AFileMergeExecute(Sender: TObject);
     45    procedure AFileCombineExecute(Sender: TObject);
    5646    procedure AFileNewExecute(Sender: TObject);
    5747    procedure AFileOpenExecute(Sender: TObject);
     
    9585    procedure FileOpen(FileName: string);
    9686    procedure FileClose;
    97     function FileMerge(FileName: string): TMergeResult;
    9887    procedure Initialize;
    9988    procedure UpdateInterface;
     
    118107  SFileSplitFinishedOpenDirectory = 'Total %d contact files saved. Do you want to open the directory %s?';
    119108  SFileNotFound = 'File ''%s'' not found.';
    120   SMergedContacts = 'Contacts merged. Loaded: %d, New: %d, Updated: %d';
     109  SCombinedContacts = 'Combined %d contact files.';
    121110  SLine = 'Line %d: %s';
    122111
    123 { TMergeResult }
    124 
    125 procedure TMergeResult.Clear;
    126 begin
    127   Loaded := 0;
    128   New := 0;
    129   Updated := 0;
    130 end;
    131 
    132 class operator TMergeResult.Add(const A, B: TMergeResult): TMergeResult;
    133 begin
    134   Result.Loaded := A.Loaded + B.Loaded;
    135   Result.New := A.New + B.New;
    136   Result.Updated := A.Updated + B.Updated;
    137 end;
    138 
    139112{ TCore }
    140113
     
    144117end;
    145118
    146 procedure TCore.AFileMergeExecute(Sender: TObject);
     119procedure TCore.AFileCombineExecute(Sender: TObject);
    147120var
    148121  TempFile: TDataFile;
    149122  I: Integer;
    150   MergeResult: TMergeResult;
    151   TotalMergeResult: TMergeResult;
     123  LoadedFiles: Integer;
    152124begin
    153125  TempFile := DefaultDataFileClass.Create;
     
    164136  OpenDialog1.Options := OpenDialog1.Options + [ofAllowMultiSelect];
    165137  if OpenDialog1.Execute then begin
    166     TotalMergeResult.Clear;
     138    LoadedFiles := 0;
    167139    for I := 0 to OpenDialog1.Files.Count - 1 do begin
    168       MergeResult := FileMerge(OpenDialog1.Files[I]);
    169       TotalMergeResult := TotalMergeResult + MergeResult;
     140      if FileExists(OpenDialog1.Files[I]) then begin
     141        TempFile := TContactsFile.Create;
     142        try
     143          TempFile.LoadFromFile(OpenDialog1.Files[I]);
     144          TContactsFile(DataFile).Contacts.AddContacts(TContactsFile(TempFile).Contacts);
     145          Inc(LoadedFiles);
     146        finally
     147          TempFile.Free;
     148        end;
     149      end;
    170150    end;
    171     ShowMessage(Format(SMergedContacts, [TotalMergeResult.Loaded,
    172       TotalMergeResult.New, TotalMergeResult.Updated]));
     151    if LoadedFiles > 0 then TContactsFile(DataFile).Modified := True;
     152    ShowMessage(Format(SCombinedContacts, [LoadedFiles]));
    173153    UpdateFile;
    174154  end;
     
    411391end;
    412392
    413 function TCore.FileMerge(FileName: string): TMergeResult;
    414 var
    415   TempFile: TContactsFile;
    416   NewContact: TContact;
    417   I: Integer;
    418 begin
    419   Result.Clear;
    420   if FileExists(FileName) then begin
    421     TempFile := TContactsFile.Create;
    422     try
    423       TempFile.LoadFromFile(FileName);
    424       Result.Loaded := TempFile.Contacts.Count;
    425       for I := 0 to TempFile.Contacts.Count - 1 do begin
    426         NewContact := TContactsFile(DataFile).Contacts.Search(TempFile.Contacts[I].Fields[cfFullName]);
    427         if not Assigned(NewContact) then begin
    428           NewContact := TContact.Create;
    429           NewContact.Assign(TempFile.Contacts[I]);
    430           NewContact.Parent := TContactsFile(DataFile);
    431           TContactsFile(DataFile).Contacts.Add(NewContact);
    432           Inc(Result.New);
    433         end else begin
    434           if NewContact.UpdateFrom(TempFile.Contacts[I]) then
    435             Inc(Result.Updated);
    436         end;
    437       end;
    438       TContactsFile(DataFile).Modified := True;
    439     finally
    440       TempFile.Free;
    441     end;
    442   end else ShowMessage(Format(SFileNotFound, [FileName]));
    443 end;
    444 
    445393procedure TCore.FileNew;
    446394begin
     
    540488  AFileClose.Enabled := Assigned(DataFile);
    541489  AFileSplit.Enabled := Assigned(DataFile);
    542   AFileMerge.Enabled := Assigned(DataFile);
     490  AFileCombine.Enabled := Assigned(DataFile);
    543491  AFindDuplicate.Enabled := Assigned(DataFile);
    544492  AGenerate.Enabled := Assigned(DataFile);
Note: See TracChangeset for help on using the changeset viewer.