source: trunk/VCardFile.pas

Last change on this file was 151, checked in by chronos, 18 months ago
  • Added: New file compare dialog with additional normalize options.
  • Modified: Compare action uses external compare tool.
File size: 1.6 KB
Line 
1unit VCardFile;
2
3interface
4
5uses
6 Classes, SysUtils, VCard, DataFile;
7
8type
9 { TVCardFile }
10
11 TVCardFile = class(TDataFile)
12 private
13 procedure VCardModify(Sender: TObject);
14 public
15 VCard: TVCard;
16 function GetFileName: string; override;
17 function GetFileExt: string; override;
18 function GetFileFilter: string; override;
19 procedure SaveToFile(FileName: string); override;
20 procedure LoadFromFile(FileName: string); override;
21 procedure Assign(Source: TPersistent); override;
22 constructor Create(AOwner: TComponent); override;
23 destructor Destroy; override;
24 end;
25
26
27implementation
28
29resourcestring
30 SVCardFile = 'vCard file';
31
32{ TVCardFile }
33
34procedure TVCardFile.VCardModify(Sender: TObject);
35begin
36 Modified := True;
37end;
38
39function TVCardFile.GetFileName: string;
40begin
41 Result := SVCardFile;
42end;
43
44function TVCardFile.GetFileExt: string;
45begin
46 Result := VCardFileExt;
47end;
48
49function TVCardFile.GetFileFilter: string;
50begin
51 Result := GetFileName + ' (' + GetFileExt + ')|*' + GetFileExt + '|' + inherited;
52end;
53
54procedure TVCardFile.SaveToFile(FileName: string);
55begin
56 inherited;
57 VCard.SaveToFile(FileName);
58end;
59
60procedure TVCardFile.LoadFromFile(FileName: string);
61begin
62 inherited;
63 VCard.LoadFromFile(FileName);
64end;
65
66procedure TVCardFile.Assign(Source: TPersistent);
67begin
68 inherited;
69 VCard.Assign(TVCardFile(Source).VCard)
70end;
71
72constructor TVCardFile.Create(AOwner: TComponent);
73begin
74 inherited;
75 VCard := TVCard.Create(nil);
76 VCard.OnModify := VCardModify;
77end;
78
79destructor TVCardFile.Destroy;
80begin
81 FreeAndNil(VCard);
82 inherited;
83end;
84
85end.
86
Note: See TracBrowser for help on using the repository browser.