- Timestamp:
- Feb 18, 2022, 10:29:49 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r116 r117 71 71 LastSplitDir: string; 72 72 ProfilePhotoFileName: string; 73 RecentFileRegistryContext: TRegistryContext; 73 74 procedure FileModified(Sender: TObject); 74 75 function FindFirstNonOption: string; … … 77 78 procedure SaveConfig; 78 79 procedure DoError(Text: string; Line: Integer); 80 procedure AddItemToLastOpenedList(FileName: string); 79 81 public 80 82 DefaultDataFileClass: TDataFileClass; … … 202 204 ExecuteProgram('explorer.exe', ['"' + SelectDirectoryDialog1.FileName + '"']); 203 205 {$ENDIF} 204 {$IFDEF LINUX}206 {$IFDEF UNIX} 205 207 ExecuteProgram('/usr/bin/xdg-open', [SelectDirectoryDialog1.FileName]); 206 208 {$ENDIF} … … 337 339 if SaveDialog1.Execute then begin 338 340 DataFile.SaveToFile(SaveDialog1.FileName); 339 LastOpenedList1.AddItem(SaveDialog1.FileName);341 AddItemToLastOpenedList(SaveDialog1.FileName); 340 342 UpdateFile; 341 343 end; … … 346 348 if FileExists(DataFile.FileName) then begin 347 349 DataFile.SaveToFile(DataFile.FileName); 348 LastOpenedList1.AddItem(DataFile.FileName);350 AddItemToLastOpenedList(DataFile.FileName); 349 351 UpdateFile; 350 352 end else AFileSaveAs.Execute; … … 352 354 353 355 procedure TCore.DataModuleCreate(Sender: TObject); 354 {$IFDEF Linux}356 {$IFDEF UNIX} 355 357 const 356 358 LinuxDataFilesDir = '/usr/share/vCardStudio'; … … 360 362 begin 361 363 ProfilePhotoFileName := 'Images/Profile.png'; 362 {$IFDEF Linux}364 {$IFDEF UNIX} 363 365 // If installed in Linux system then use installation directory for po files 364 366 if not DirectoryExists(Translator.POFilesFolder) and DirectoryExists(LinuxLanguagesDir) then begin … … 374 376 DefaultDataFileClass := TContactsFile; 375 377 FileClosed := True; 378 RecentFileRegistryContext := TRegistryContext.Create(ApplicationInfo1.RegistryRoot, 379 ApplicationInfo1.RegistryKey + '\RecentFiles'); 376 380 end; 377 381 … … 403 407 LoadErrors := ''; 404 408 DataFile.LoadFromFile(FileName); 405 LastOpenedList1.AddItem(FileName);409 AddItemToLastOpenedList(FileName); 406 410 if LoadErrors <> '' then begin 407 411 FormError := TFormError.Create(nil); … … 466 470 begin 467 471 PersistentForm1.RegistryContext := ApplicationInfo1.GetRegistryContext; 468 LastOpenedList1.LoadFromRegistry(TRegistryContext.Create(ApplicationInfo1.RegistryRoot, 469 ApplicationInfo1.RegistryKey + '\RecentFiles')); 472 LastOpenedList1.LoadFromRegistry(RecentFileRegistryContext); 470 473 471 474 with TRegistryEx.Create do … … 495 498 procedure TCore.SaveConfig; 496 499 begin 497 LastOpenedList1.SaveToRegistry(TRegistryContext.Create(ApplicationInfo1.RegistryRoot,498 ApplicationInfo1.RegistryKey + '\RecentFiles'));499 500 500 with TRegistryEx.Create do 501 501 try … … 527 527 end; 528 528 529 procedure TCore.AddItemToLastOpenedList(FileName: string); 530 begin 531 with LastOpenedList1 do begin 532 LoadFromRegistry(RecentFileRegistryContext); 533 AddItem(FileName); 534 SaveToRegistry(RecentFileRegistryContext); 535 end; 536 end; 537 529 538 function TCore.GetProfileImage: TImage; 530 539 begin … … 569 578 AFileNew.Execute; 570 579 DataFile.LoadFromFile(FileNameOption); 571 LastOpenedList1.AddItem(FileNameOption);580 AddItemToLastOpenedList(FileNameOption); 572 581 end else 573 582 if ReopenLastFileOnStart and (LastOpenedList1.Items.Count > 0) and FileExists(LastOpenedList1.Items[0]) then begin
Note:
See TracChangeset
for help on using the changeset viewer.