Changeset 151 for trunk/Core.pas
- Timestamp:
- Jun 6, 2023, 11:15:57 AM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Core.pas
r149 r151 7 7 LastOpenedList, ApplicationInfo, PersistentForm, ScaleDPI, Common, 8 8 Translator, DataFile, VCard, Menus, RegistryEx, Theme, AboutDialog, 9 Registry ;9 Registry, VCardFile; 10 10 11 11 type … … 87 87 procedure AddItemToLastOpenedList(FileName: string); 88 88 procedure DoDataFileChange; 89 function GetDefaultCompareTool: string; 89 90 public 90 91 DefaultDataFileClass: TDataFileClass; … … 94 95 LastContactTabIndex: Integer; 95 96 LastContactFileName: string; 96 LastCompareFileName: string;97 97 LastPhotoFileName: string; 98 98 LastQrCodeFileName: string; … … 102 102 ToolbarVisible: Boolean; 103 103 DefaultVcardVersion: string; 104 DefaultPhoneCountryPrefix: string; 105 CompareTool: string; 104 106 function GetProfileImage: TImage; 107 function GetTempDir: string; 105 108 procedure FileNew; 106 109 procedure FileOpen(FileName: string); … … 123 126 124 127 uses 125 FormMain, FormSettings, FormFindDuplicity, TestCase,126 FormGenerate, FormError, FormFind, FormTest, FormSource, FormCompare ,127 TestCases , VCardFile;128 FormMain, FormSettings, FormFindDuplicity, FormCompare, TestCase, 129 FormGenerate, FormError, FormFind, FormTest, FormSource, FormCompareSideBySide, 130 TestCases; 128 131 129 132 resourcestring … … 184 187 procedure TCore.AFileCompareExecute(Sender: TObject); 185 188 var 186 TempFile: TDataFile; 187 TempFileName: string; 188 begin 189 TempFile := DefaultDataFileClass.Create(nil); 190 try 191 OpenDialog1.Filter := TempFile.GetFileFilter; 192 finally 193 TempFile.Free; 194 end; 195 OpenDialog1.DefaultExt := ''; 196 OpenDialog1.InitialDir := ExtractFileDir(Core.LastCompareFileName); 197 OpenDialog1.FileName := ExtractFileName(Core.LastCompareFileName); 198 OpenDialog1.Options := OpenDialog1.Options - [ofAllowMultiSelect]; 199 if OpenDialog1.Execute then begin 200 with TFormCompare.Create(nil) do 201 try 202 TempFileName := GetTempDir + DirectorySeparator + Application.Title + 203 DirectorySeparator + 'Compare' + VCardFileExt; 204 ForceDirectories(ExtractFileDir(TempFileName)); 205 TVCardFile(DataFile).SaveToFile(TempFileName); 206 LoadFileLeft(TempFileName); 207 LoadFileRight(OpenDialog1.FileName); 208 ShowModal; 209 finally 210 Free; 211 end; 212 Core.LastCompareFileName := OpenDialog1.FileName; 189 FormCompare: TFormCompare; 190 begin 191 FormCompare := TFormCompare.Create(nil); 192 try 193 FormCompare.ShowModal; 194 finally 195 FreeAndNil(FormCompare); 213 196 end; 214 197 end; … … 556 539 LastPhotoFileName := ReadStringWithDefault('LastPhotoFileName', ''); 557 540 LastQrCodeFileName := ReadStringWithDefault('LastQrCodeFileName', ''); 558 LastCompareFileName := ReadStringWithDefault('LastCompareFileName', ''); 541 CompareTool := ReadStringWithDefault('CompareTool', GetDefaultCompareTool); 542 DefaultPhoneCountryPrefix := ReadStringWithDefault('DefaultPhoneCountryPrefix', DefaultPhoneCountryPrefix); 559 543 finally 560 544 Free; … … 583 567 WriteString('LastPhotoFileName', LastPhotoFileName); 584 568 WriteString('LastQrCodeFileName', LastQrCodeFileName); 585 WriteString('LastCompareFileName', LastCompareFileName); 569 WriteString('CompareTool', CompareTool); 570 WriteString('DefaultPhoneCountryPrefix', DefaultPhoneCountryPrefix); 586 571 finally 587 572 Free; … … 609 594 end; 610 595 596 function TCore.GetDefaultCompareTool: string; 597 const 598 KDiff3 = '/usr/bin/kdiff3'; 599 Kompare = '/usr/bin/kompare'; 600 Meld = '/usr/bin/meld'; 601 Diffuse = '/usr/bin/diffuse'; 602 BeyondCompare = '/usr/bin/bcompare'; 603 begin 604 if FileExists(KDiff3) then Result := KDiff3 605 else if FileExists(Meld) then Result := Meld 606 else if FileExists(Kompare) then Result := Kompare 607 else if FileExists(Diffuse) then Result := Diffuse 608 else if FileExists(BeyondCompare) then Result := BeyondCompare 609 else Result := ''; 610 end; 611 611 612 function TCore.GetProfileImage: TImage; 612 613 begin … … 617 618 end; 618 619 Result := ProfileImage; 620 end; 621 622 function TCore.GetTempDir: string; 623 begin 624 Result := SysUtils.GetTempDir + Application.Title; 619 625 end; 620 626
Note:
See TracChangeset
for help on using the changeset viewer.