Changeset 62


Ignore:
Timestamp:
Dec 9, 2021, 10:53:52 PM (3 years ago)
Author:
chronos
Message:
  • Added: New feature to split multiple contacts into separate files. Accessible from File menu.
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormGenerate.lfm

    r23 r62  
    11object FormGenerate: TFormGenerate
    2   Left = 464
     2  Left = 470
    33  Height = 562
    4   Top = 368
     4  Top = 372
    55  Width = 812
    66  Caption = 'Generate contacts'
     
    1414  object Label1: TLabel
    1515    Left = 19
    16     Height = 24
     16    Height = 25
    1717    Top = 19
    18     Width = 55
     18    Width = 52
    1919    Caption = 'Count:'
    2020    ParentColor = False
     
    2323  object SpinEditCount: TSpinEdit
    2424    Left = 155
    25     Height = 42
     25    Height = 33
    2626    Top = 18
    2727    Width = 152
  • trunk/Forms/UFormGenerate.pas

    r31 r62  
    4646  for I := 1 to SpinEditCount.Value do begin
    4747    Contact := Contacts.AddNew;
     48    Contact.Fields[cfVersion] := '2.1';
    4849    Contact.Fields[cfFirstName] := 'First ' + IntToStr(Random(10000));
    4950    Contact.Fields[cfLastName] := 'Last ' + IntToStr(Random(10000));
  • trunk/Forms/UFormMain.lfm

    r44 r62  
    4141      Height = 33
    4242      Top = 5
    43       Width = 135
     43      Width = 159
    4444      Align = alNone
    4545      AutoSize = True
     
    7272      end
    7373      object ToolButton4: TToolButton
    74         Left = 1
    75         Top = 33
     74        Left = 124
     75        Top = 0
    7676        Action = Core.AFileClose
    7777      end
     
    8383      Height = 33
    8484      Top = 5
    85       Width = 35
     85      Width = 71
    8686      Align = alNone
    8787      AutoSize = True
     
    9797      Transparent = True
    9898      object ToolButton5: TToolButton
    99         Left = 1
    100         Top = 33
     99        Left = 36
     100        Top = 0
    101101        Action = Core.ASettings
    102102      end
     
    137137      object MenuItem3: TMenuItem
    138138        Action = Core.AFileMerge
     139      end
     140      object MenuItem6: TMenuItem
     141        Action = Core.AFileSplit
    139142      end
    140143      object MenuItem2: TMenuItem
  • trunk/Forms/UFormMain.pas

    r44 r62  
    2020    MenuItem4: TMenuItem;
    2121    MenuItem5: TMenuItem;
     22    MenuItem6: TMenuItem;
    2223    MenuItemToolbar: TMenuItem;
    2324    MenuItemView: TMenuItem;
  • trunk/Forms/UFormProperties.lfm

    r54 r62  
    1414  object ListView1: TListView
    1515    Left = 0
    16     Height = 810
     16    Height = 801
    1717    Top = 0
    1818    Width = 1210
     
    4646    Left = 0
    4747    Height = 39
    48     Top = 842
     48    Top = 833
    4949    Width = 1210
    5050    Align = alBottom
     
    7878    Left = 0
    7979    Height = 32
    80     Top = 810
     80    Top = 801
    8181    Width = 1210
    8282    OnChange = ListViewFilter1Change
     
    8585  object StatusBar1: TStatusBar
    8686    Left = 0
    87     Height = 27
    88     Top = 881
     87    Height = 36
     88    Top = 872
    8989    Width = 1210
    9090    Panels = <   
  • trunk/Languages/vCardStudio.cs.po

    r61 r62  
    4949msgstr "Uložit jako..."
    5050
     51#: tcore.afilesplit.caption
     52msgid "Split..."
     53msgstr "Rozdělit..."
     54
    5155#: tcore.afindduplicate.caption
    5256msgctxt "tcore.afindduplicate.caption"
     
    10651069msgstr "Soubor '%s' nenalezen."
    10661070
     1071#: ucore.sfilesplit
     1072msgid "Contacts split"
     1073msgstr "Rozdělení kontaktů"
     1074
     1075#: ucore.sfilesplitfinishedopendirectory
     1076msgid "Total %d contact files saved. Do you want to open the directory %s?"
     1077msgstr "Uloženo celkem %d souborů kontaktů. Chcete otevřít adresář %s?"
     1078
    10671079#: ucore.sline
    10681080msgid "Line %d: %s"
  • trunk/Languages/vCardStudio.po

    r61 r62  
    3939msgstr ""
    4040
     41#: tcore.afilesplit.caption
     42msgid "Split..."
     43msgstr ""
     44
    4145#: tcore.afindduplicate.caption
    4246msgctxt "tcore.afindduplicate.caption"
     
    10531057msgstr ""
    10541058
     1059#: ucore.sfilesplit
     1060msgid "Contacts split"
     1061msgstr ""
     1062
     1063#: ucore.sfilesplitfinishedopendirectory
     1064msgid "Total %d contact files saved. Do you want to open the directory %s?"
     1065msgstr ""
     1066
    10551067#: ucore.sline
    10561068msgid "Line %d: %s"
  • trunk/UCore.lfm

    r61 r62  
    475475      OnExecute = AGenerateExecute
    476476    end
     477    object AFileSplit: TAction
     478      Category = 'File'
     479      Caption = 'Split...'
     480      OnExecute = AFileSplitExecute
     481    end
    477482  end
    478483  object LastOpenedList1: TLastOpenedList
     
    501506    AppName = 'vCard Studio'
    502507    Description = 'vCard files management tool'
    503     ReleaseDate = 44539
     508    ReleaseDate = 44524
    504509    RegistryKey = '\Software\Chronosoft\vCard Studio'
    505510    RegistryRoot = rrKeyCurrentUser
     
    87318736    Top = 48
    87328737  end
     8738  object SelectDirectoryDialog1: TSelectDirectoryDialog
     8739    Left = 578
     8740    Top = 376
     8741  end
    87338742end
  • trunk/UCore.pas

    r56 r62  
    2727    AAbout: TAction;
    2828    AboutDialog1: TAboutDialog;
     29    AFileSplit: TAction;
    2930    AGenerate: TAction;
    3031    AFindDuplicate: TAction;
     
    4142    ActionList1: TActionList;
    4243    ApplicationInfo1: TApplicationInfo;
     44    SelectDirectoryDialog1: TSelectDirectoryDialog;
    4345    Translator: TTranslator;
    4446    ImageList1: TImageList;
     
    5860    procedure AFileSaveAsExecute(Sender: TObject);
    5961    procedure AFileCloseExecute(Sender: TObject);
     62    procedure AFileSplitExecute(Sender: TObject);
    6063    procedure AFindDuplicateExecute(Sender: TObject);
    6164    procedure AGenerateExecute(Sender: TObject);
     
    7073    LoadErrors: string;
    7174    ProfileImage: TImage;
     75    LastSplitDir: string;
    7276    procedure FileModified(Sender: TObject);
    7377    function FindFirstNonOption: string;
     
    108112  SAppExit = 'Application exit';
    109113  SAppExitQuery = 'File was modified. Do you want to save it before exit?';
     114  SFileSplit = 'Contacts split';
     115  SFileSplitFinishedOpenDirectory = 'Total %d contact files saved. Do you want to open the directory %s?';
    110116  SFileNotFound = 'File ''%s'' not found.';
    111117  SMergedContacts = 'Contacts merged. Loaded: %d, New: %d, Updated: %d';
     
    175181  FileClose;
    176182  UpdateFile;
     183end;
     184
     185procedure TCore.AFileSplitExecute(Sender: TObject);
     186var
     187  I: Integer;
     188  C: Integer;
     189  FileName: string;
     190  ModalResult: TModalResult;
     191begin
     192  C := 0;
     193  SelectDirectoryDialog1.FileName := LastSplitDir;
     194  if SelectDirectoryDialog1.Execute then begin
     195    LastSplitDir := SelectDirectoryDialog1.FileName;
     196    with TContactsFile(DataFile).Contacts do
     197    for I := 0 to Count - 1 do begin
     198      if Items[I].Fields[cfFullName] <> '' then begin
     199        FileName := SelectDirectoryDialog1.FileName + DirectorySeparator +
     200          Items[I].Fields[cfFullName] + VCardFileExt;
     201        Items[I].SaveToFile(FileName);
     202        Inc(C);
     203      end;
     204    end;
     205    ModalResult := MessageDlg(SFileSplit,
     206     Format(SFileSplitFinishedOpenDirectory, [C,
     207     SelectDirectoryDialog1.FileName]), mtConfirmation, [mbYes, mbNo], 0);
     208    if ModalResult = mrYes then begin
     209      {$IFDEF WINDOWS}
     210      ExecuteProgram('explorer.exe', ['"' + SelectDirectoryDialog1.FileName + '"']);
     211      {$ENDIF}
     212    end;
     213  end;
    177214end;
    178215
     
    434471    LastContactTabIndex := ReadIntegerWithDefault('LastContactTabIndex', 0);
    435472    LastContactFileName := ReadStringWithDefault('LastContactFileName', '');
     473    LastSplitDir := ReadStringWithDefault('LastSplitDir', '');
    436474  finally
    437475    Free;
     
    457495    WriteInteger('LastContactTabIndex', LastContactTabIndex);
    458496    WriteString('LastContactFileName', LastContactFileName);
     497    WriteString('LastSplitDir', LastSplitDir);
    459498  finally
    460499    Free;
     
    484523  AFileSaveAs.Enabled := Assigned(DataFile);
    485524  AFileClose.Enabled := Assigned(DataFile);
     525  AFileSplit.Enabled := Assigned(DataFile);
     526  AFileMerge.Enabled := Assigned(DataFile);
    486527end;
    487528
Note: See TracChangeset for help on using the changeset viewer.