Changeset 62 for trunk/UCore.pas
- Timestamp:
- Dec 9, 2021, 10:53:52 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r56 r62 27 27 AAbout: TAction; 28 28 AboutDialog1: TAboutDialog; 29 AFileSplit: TAction; 29 30 AGenerate: TAction; 30 31 AFindDuplicate: TAction; … … 41 42 ActionList1: TActionList; 42 43 ApplicationInfo1: TApplicationInfo; 44 SelectDirectoryDialog1: TSelectDirectoryDialog; 43 45 Translator: TTranslator; 44 46 ImageList1: TImageList; … … 58 60 procedure AFileSaveAsExecute(Sender: TObject); 59 61 procedure AFileCloseExecute(Sender: TObject); 62 procedure AFileSplitExecute(Sender: TObject); 60 63 procedure AFindDuplicateExecute(Sender: TObject); 61 64 procedure AGenerateExecute(Sender: TObject); … … 70 73 LoadErrors: string; 71 74 ProfileImage: TImage; 75 LastSplitDir: string; 72 76 procedure FileModified(Sender: TObject); 73 77 function FindFirstNonOption: string; … … 108 112 SAppExit = 'Application exit'; 109 113 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?'; 110 116 SFileNotFound = 'File ''%s'' not found.'; 111 117 SMergedContacts = 'Contacts merged. Loaded: %d, New: %d, Updated: %d'; … … 175 181 FileClose; 176 182 UpdateFile; 183 end; 184 185 procedure TCore.AFileSplitExecute(Sender: TObject); 186 var 187 I: Integer; 188 C: Integer; 189 FileName: string; 190 ModalResult: TModalResult; 191 begin 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; 177 214 end; 178 215 … … 434 471 LastContactTabIndex := ReadIntegerWithDefault('LastContactTabIndex', 0); 435 472 LastContactFileName := ReadStringWithDefault('LastContactFileName', ''); 473 LastSplitDir := ReadStringWithDefault('LastSplitDir', ''); 436 474 finally 437 475 Free; … … 457 495 WriteInteger('LastContactTabIndex', LastContactTabIndex); 458 496 WriteString('LastContactFileName', LastContactFileName); 497 WriteString('LastSplitDir', LastSplitDir); 459 498 finally 460 499 Free; … … 484 523 AFileSaveAs.Enabled := Assigned(DataFile); 485 524 AFileClose.Enabled := Assigned(DataFile); 525 AFileSplit.Enabled := Assigned(DataFile); 526 AFileMerge.Enabled := Assigned(DataFile); 486 527 end; 487 528
Note:
See TracChangeset
for help on using the changeset viewer.