source: trunk/Forms/FormNormalize.pas

Last change on this file was 162, checked in by chronos, 17 months ago
  • Modified: Updated Common package.
File size: 3.4 KB
Line 
1unit FormNormalize;
2
3{$mode Delphi}
4
5interface
6
7uses
8 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, RegistryEx,
9 FormEx;
10
11type
12
13 { TFormNormalize }
14
15 TFormNormalize = class(TFormEx)
16 ButtonCancel: TButton;
17 ButtonProcess: TButton;
18 CheckBoxAddPhonePrefix: TCheckBox;
19 CheckBoxRemoveExactDuplicates: TCheckBox;
20 CheckBoxRemovePhotos: TCheckBox;
21 CheckBoxRemovePhoneSpaces: TCheckBox;
22 CheckBoxConvertInternationaCallPrefixToCountryCode: TCheckBox;
23 EditPhoneCountryCode: TEdit;
24 EditPhoneInternationalCallPrefix: TEdit;
25 ScrollBox1: TScrollBox;
26 procedure ButtonProcessClick(Sender: TObject);
27 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
28 procedure FormShow(Sender: TObject);
29 private
30 procedure LoadConfig;
31 procedure SaveConfig;
32 end;
33
34implementation
35
36{$R *.lfm}
37
38uses
39 Core, VCardFile, VCardProcessor;
40
41{ TFormNormalize }
42
43procedure TFormNormalize.FormClose(Sender: TObject;
44 var CloseAction: TCloseAction);
45begin
46 SaveConfig;
47end;
48
49procedure TFormNormalize.ButtonProcessClick(Sender: TObject);
50var
51 VCardProcessor: TVCardProcessor;
52begin
53 VCardProcessor := TVCardProcessor.Create(nil);
54 with VCardProcessor do
55 try
56 RemovePhoneSpaces := CheckBoxRemovePhoneSpaces.Checked;
57 AddDefaultPhoneCountryPrefix := CheckBoxAddPhonePrefix.Checked;
58 DefaultPhoneCountryCode := Core.Core.DefaultPhoneCountryCode;
59 ConvertInternationalCallPrefixToCountryCode := CheckBoxConvertInternationaCallPrefixToCountryCode.Checked;
60 DefaultInternationalCallPrefix := Core.Core.DefaultInternationalCallPrefix;
61 RemoveExactDuplicates := CheckBoxRemoveExactDuplicates.Checked;
62 RemovePhotos := CheckBoxRemovePhotos.Checked;
63 Process(TVCardFile(Core.Core.DataFile).VCard);
64 finally
65 Free;
66 end;
67end;
68
69procedure TFormNormalize.FormShow(Sender: TObject);
70begin
71 LoadConfig;
72end;
73
74procedure TFormNormalize.LoadConfig;
75begin
76 EditPhoneCountryCode.Text := Core.Core.DefaultPhoneCountryCode;
77 EditPhoneInternationalCallPrefix.Text := Core.Core.DefaultInternationalCallPrefix;
78 with TRegistryEx.Create do
79 try
80 CurrentContext := Core.Core.ApplicationInfo1.GetRegistryContext;
81 CheckBoxAddPhonePrefix.Checked := ReadBoolWithDefault('AddPhonePrefix', False);
82 CheckBoxRemovePhoneSpaces.Checked := ReadBoolWithDefault('RemovePhoneSpaces', False);
83 CheckBoxRemoveExactDuplicates.Checked := ReadBoolWithDefault('RemoveExactDuplicates', False);
84 CheckBoxRemovePhotos.Checked := ReadBoolWithDefault('RemovePhotos', False);
85 CheckBoxConvertInternationaCallPrefixToCountryCode.Checked := ReadBoolWithDefault('ConvertInternationaCallPrefixToCountryCode', False);
86 finally
87 Free;
88 end;
89end;
90
91procedure TFormNormalize.SaveConfig;
92begin
93 Core.Core.DefaultPhoneCountryCode := EditPhoneCountryCode.Text;
94 Core.Core.DefaultInternationalCallPrefix := EditPhoneInternationalCallPrefix.Text;
95 with TRegistryEx.Create do
96 try
97 CurrentContext := Core.Core.ApplicationInfo1.GetRegistryContext;
98 WriteBool('AddPhonePrefix', CheckBoxAddPhonePrefix.Checked);
99 WriteBool('RemovePhoneSpaces', CheckBoxRemovePhoneSpaces.Checked);
100 WriteBool('RemoveExactDuplicates', CheckBoxRemoveExactDuplicates.Checked);
101 WriteBool('RemovePhotos', CheckBoxRemovePhotos.Checked);
102 WriteBool('ConvertInternationaCallPrefixToCountryCode', CheckBoxConvertInternationaCallPrefixToCountryCode.Checked);
103 finally
104 Free;
105 end;
106end;
107
108
109end.
110
Note: See TracBrowser for help on using the repository browser.