- Timestamp:
- Jun 6, 2023, 5:05:18 PM (19 months ago)
- Location:
- trunk
- Files:
-
- 4 added
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Core.lfm
r149 r152 296 296 Caption = 'Remove exact duplicates' 297 297 OnExecute = ARemoveExactDuplicatesExecute 298 end 299 object ANormalize: TAction 300 Caption = 'Normalize' 301 OnExecute = ANormalizeExecute 298 302 end 299 303 end -
trunk/Core.lrj
r149 r152 19 19 {"hash":109897550,"name":"tcore.afilecompare.caption","sourcebytes":[67,111,109,112,97,114,101,46,46,46],"value":"Compare..."}, 20 20 {"hash":78724163,"name":"tcore.aremoveexactduplicates.caption","sourcebytes":[82,101,109,111,118,101,32,101,120,97,99,116,32,100,117,112,108,105,99,97,116,101,115],"value":"Remove exact duplicates"}, 21 {"hash":154699365,"name":"tcore.anormalize.caption","sourcebytes":[78,111,114,109,97,108,105,122,101],"value":"Normalize"}, 21 22 {"hash":218146437,"name":"tcore.opendialog1.title","sourcebytes":[79,112,101,110,32,101,120,105,115,116,105,110,103,32,102,105,108,101],"value":"Open existing file"}, 22 23 {"hash":159035875,"name":"tcore.savedialog1.title","sourcebytes":[83,97,118,101,32,102,105,108,101,32,97,115],"value":"Save file as"}, -
trunk/Core.pas
r151 r152 16 16 AAbout: TAction; 17 17 AboutDialog1: TAboutDialog; 18 ANormalize: TAction; 18 19 ARemoveExactDuplicates: TAction; 19 20 AFileCompare: TAction; … … 60 61 procedure AGenerateExecute(Sender: TObject); 61 62 procedure AHomePageExecute(Sender: TObject); 63 procedure ANormalizeExecute(Sender: TObject); 62 64 procedure ARemoveExactDuplicatesExecute(Sender: TObject); 63 65 procedure ASettingsExecute(Sender: TObject); … … 102 104 ToolbarVisible: Boolean; 103 105 DefaultVcardVersion: string; 104 DefaultPhoneCountryPrefix: string; 106 DefaultPhoneCountryCode: string; 107 DefaultInternationalCallPrefix: string; 105 108 CompareTool: string; 106 109 function GetProfileImage: TImage; … … 126 129 127 130 uses 128 FormMain, FormSettings, FormFindDuplicity, FormCompare, TestCase, 131 FormMain, FormSettings, FormFindDuplicity, FormCompare, TestCase, FormNormalize, 129 132 FormGenerate, FormError, FormFind, FormTest, FormSource, FormCompareSideBySide, 130 133 TestCases; … … 285 288 end; 286 289 290 procedure TCore.ANormalizeExecute(Sender: TObject); 291 var 292 FormNormalize: TFormNormalize; 293 begin 294 FormNormalize := TFormNormalize.Create(nil); 295 try 296 FormNormalize.ShowModal; 297 finally 298 FreeAndNil(FormNormalize); 299 end; 300 end; 301 287 302 procedure TCore.ARemoveExactDuplicatesExecute(Sender: TObject); 288 303 var … … 540 555 LastQrCodeFileName := ReadStringWithDefault('LastQrCodeFileName', ''); 541 556 CompareTool := ReadStringWithDefault('CompareTool', GetDefaultCompareTool); 542 DefaultPhoneCountryPrefix := ReadStringWithDefault('DefaultPhoneCountryPrefix', DefaultPhoneCountryPrefix); 557 DefaultPhoneCountryCode := ReadStringWithDefault('DefaultPhoneCountryPrefix', DefaultPhoneCountryCode); 558 DefaultInternationalCallPrefix := ReadStringWithDefault('DefaultInternationalCallPrefix', DefaultInternationalCallPrefix); 543 559 finally 544 560 Free; … … 568 584 WriteString('LastQrCodeFileName', LastQrCodeFileName); 569 585 WriteString('CompareTool', CompareTool); 570 WriteString('DefaultPhoneCountryPrefix', DefaultPhoneCountryPrefix); 586 WriteString('DefaultPhoneCountryPrefix', DefaultPhoneCountryCode); 587 WriteString('DefaultInternationalCallPrefix', DefaultInternationalCallPrefix); 571 588 finally 572 589 Free; -
trunk/Forms/FormCompare.pas
r151 r152 34 34 procedure CompareExternal; 35 35 procedure LoadConfig; 36 procedure RemoveExactDuplicates(Contacts: TContacts);37 procedure NormalizePhoneNumbers(Contacts: TContacts);38 procedure RemovePhotos(Contacts: TContacts);39 36 procedure SaveConfig; 40 37 end; … … 46 43 47 44 uses 48 Core, FormCompareSideBySide ;45 Core, FormCompareSideBySide, VCardProcessor; 49 46 50 47 { TFormCompare } … … 72 69 73 70 procedure TFormCompare.ButtonCompareClick(Sender: TObject); 71 var 72 VCardProcessor: TVCardProcessor; 74 73 begin 75 74 LeftVCard.Assign(TVCardFile(Core.Core.DataFile)); 76 75 RightVCard.LoadFromFile(EditAnotherFile.Text); 77 76 78 if CheckBoxSortContacts.Checked then begin 79 LeftVCard.VCard.Contacts.Sort; 80 RightVCard.VCard.Contacts.Sort; 77 VCardProcessor := TVCardProcessor.Create(nil); 78 with VCardProcessor do 79 try 80 DefaultPhoneCountryCode := Core.Core.DefaultPhoneCountryCode; 81 RemovePhotos := CheckBoxWithoutPhotos.Checked; 82 RemovePhoneSpaces := CheckBoxNormalizePhoneNumbers.Checked; 83 AddDefaultPhoneCountryPrefix := CheckBoxNormalizePhoneNumbers.Checked; 84 RemoveExactDuplicates := CheckBoxRemoveExactDuplicates.Checked; 85 Order := CheckBoxSortContacts.Checked; 86 finally 87 Free; 81 88 end; 82 89 83 if CheckBoxWithoutPhotos.Checked then begin 84 RemovePhotos(LeftVCard.VCard.Contacts); 85 RemovePhotos(RightVCard.VCard.Contacts); 86 end; 87 88 if CheckBoxNormalizePhoneNumbers.Checked then begin 89 NormalizePhoneNumbers(LeftVCard.VCard.Contacts); 90 NormalizePhoneNumbers(RightVCard.VCard.Contacts); 91 end; 92 93 if CheckBoxRemoveExactDuplicates.Checked then begin 94 RemoveExactDuplicates(LeftVCard.VCard.Contacts); 95 RemoveExactDuplicates(RightVCard.VCard.Contacts); 96 end; 90 LeftVCard.VCard.Contacts.Sort; 91 RightVCard.VCard.Contacts.Sort; 97 92 98 93 CompareExternal; 99 end;100 101 procedure TFormCompare.RemovePhotos(Contacts: TContacts);102 var103 I: Integer;104 J: Integer;105 ContactProperties: TContactProperties;106 begin107 for I := 0 to Contacts.Count - 1 do108 with Contacts[I].Properties do begin109 ContactProperties := GetMultipleByName('PHOTO');110 for J := ContactProperties.Count - 1 downto 0 do111 Remove(ContactProperties[J]);112 ContactProperties.Free;113 end;114 end;115 116 procedure TFormCompare.NormalizePhoneNumbers(Contacts: TContacts);117 var118 I: Integer;119 J: Integer;120 ContactProperties: TContactProperties;121 begin122 for I := 0 to Contacts.Count - 1 do123 with Contacts[I].Properties do begin124 ContactProperties := GetMultipleByName('TEL');125 for J := 0 to ContactProperties.Count - 1 do begin126 ContactProperties[J].Value := StringReplace(ContactProperties[J].Value, ' ', '', [rfReplaceAll]);127 if not ContactProperties[J].Value.StartsWith('+') then128 ContactProperties[J].Value := Core.Core.DefaultPhoneCountryPrefix + ContactProperties[J].Value;129 end;130 ContactProperties.Free;131 end;132 94 end; 133 95 … … 212 174 end; 213 175 214 procedure TFormCompare.RemoveExactDuplicates(Contacts: TContacts);215 var216 I: Integer;217 begin218 Contacts.RemoveExactDuplicates;219 for I := 0 to Contacts.Count - 1 do220 Contacts[I].Properties.RemoveExactDuplicates;221 end;222 223 176 procedure TFormCompare.SaveConfig; 224 177 begin -
trunk/Forms/FormFindDuplicity.lfm
r149 r152 12 12 OnDestroy = FormDestroy 13 13 OnShow = FormShow 14 LCLVersion = '2.2. 0.4'14 LCLVersion = '2.2.6.0' 15 15 object ListView1: TListView 16 16 Left = 5 … … 55 55 TabOrder = 1 56 56 object ComboBoxField: TComboBox 57 Left = 1 6058 Height = 4 159 Top = 1 657 Left = 192 58 Height = 42 59 Top = 14 60 60 Width = 326 61 61 ItemHeight = 0 … … 71 71 Width = 135 72 72 Caption = 'By contact field:' 73 ParentColor = False 73 74 ParentFont = False 74 75 end 75 76 object ButtonMerge: TButton 76 Left = 49677 Left = 528 77 78 Height = 38 78 79 Top = 14 -
trunk/Forms/FormFindDuplicity.pas
r149 r152 5 5 uses 6 6 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls, 7 ExtCtrls, StdCtrls, ActnList, Menus, VCard, Generics.Collections, 7 ExtCtrls, StdCtrls, ActnList, Menus, VCard, Generics.Collections, RegistryEx, 8 8 Generics.Defaults; 9 9 … … 189 189 Form.Contacts := TContacts.Create(False); 190 190 Form.Contacts.ParentVCard := Contacts.ParentVCard; 191 Form.Context := TRegistryContext.Create(Core.Core.ApplicationInfo1.RegistryRoot, 192 Core.Core.ApplicationInfo1.RegistryKey + '\ContactsColumns'); 191 193 with TFoundItem(ListView1.Selected.Data) do 192 194 for I := 0 to Contacts.Count - 1 do -
trunk/Forms/FormMain.lfm
r149 r152 190 190 Caption = '-' 191 191 end 192 object MenuItem14: TMenuItem 193 Action = Core.ANormalize 194 end 192 195 object MenuItem13: TMenuItem 193 196 Action = Core.ARemoveExactDuplicates -
trunk/Forms/FormMain.pas
r150 r152 19 19 MenuItem12: TMenuItem; 20 20 MenuItem13: TMenuItem; 21 MenuItem14: TMenuItem; 21 22 MenuItemColumns: TMenuItem; 22 23 MenuItem3: TMenuItem; -
trunk/Forms/FormSettings.lfm
r151 r152 1 1 object FormSettings: TFormSettings 2 2 Left = 798 3 Height = 5213 Height = 613 4 4 Top = 204 5 5 Width = 857 6 6 Caption = 'Settings' 7 ClientHeight = 5217 ClientHeight = 613 8 8 ClientWidth = 857 9 9 Constraints.MinHeight = 404 … … 18 18 Left = 731 19 19 Height = 37 20 Top = 46820 Top = 560 21 21 Width = 113 22 22 Anchors = [akRight, akBottom] … … 30 30 Left = 587 31 31 Height = 37 32 Top = 46832 Top = 560 33 33 Width = 113 34 34 Anchors = [akRight, akBottom] … … 40 40 object ScrollBox1: TScrollBox 41 41 Left = 8 42 Height = 44842 Height = 540 43 43 Top = 8 44 44 Width = 845 45 45 HorzScrollBar.Page = 504 46 VertScrollBar.Page = 4 2746 VertScrollBar.Page = 475 47 47 Anchors = [akTop, akLeft, akRight, akBottom] 48 ClientHeight = 44648 ClientHeight = 538 49 49 ClientWidth = 843 50 50 TabOrder = 2 … … 195 195 end 196 196 object EditDefaultPhoneCountryPrefix: TEdit 197 Left = 296197 Left = 312 198 198 Height = 43 199 199 Top = 384 … … 201 201 TabOrder = 9 202 202 end 203 object Label7: TLabel 204 Left = 23 205 Height = 26 206 Top = 440 207 Width = 267 208 Caption = 'Default international call prefix:' 209 ParentColor = False 210 end 211 object EditDefaultInternationalCallPrefix: TEdit 212 Left = 312 213 Height = 43 214 Top = 432 215 Width = 144 216 TabOrder = 10 217 end 203 218 end 204 219 object OpenDialog1: TOpenDialog -
trunk/Forms/FormSettings.lrj
r151 r152 12 12 {"hash":220155194,"name":"tformsettings.label5.caption","sourcebytes":[67,111,109,112,97,114,101,32,116,111,111,108,58],"value":"Compare tool:"}, 13 13 {"hash":77164181,"name":"tformsettings.buttonbrowse.caption","sourcebytes":[66,114,111,119,115,101],"value":"Browse"}, 14 {"hash":99356634,"name":"tformsettings.label6.caption","sourcebytes":[68,101,102,97,117,108,116,32,112,104,111,110,101,32,99,111,117,110,116,114,121,32,112,114,101,102,105,120,58],"value":"Default phone country prefix:"} 14 {"hash":99356634,"name":"tformsettings.label6.caption","sourcebytes":[68,101,102,97,117,108,116,32,112,104,111,110,101,32,99,111,117,110,116,114,121,32,112,114,101,102,105,120,58],"value":"Default phone country prefix:"}, 15 {"hash":112394474,"name":"tformsettings.label7.caption","sourcebytes":[68,101,102,97,117,108,116,32,105,110,116,101,114,110,97,116,105,111,110,97,108,32,99,97,108,108,32,112,114,101,102,105,120,58],"value":"Default international call prefix:"} 15 16 ]} -
trunk/Forms/FormSettings.pas
r151 r152 20 20 ComboBoxTheme: TComboBox; 21 21 EditCompareTool: TEdit; 22 EditDefaultInternationalCallPrefix: TEdit; 22 23 EditDefaultVcardVersion: TEdit; 23 24 EditDefaultPhoneCountryPrefix: TEdit; … … 29 30 Label5: TLabel; 30 31 Label6: TLabel; 32 Label7: TLabel; 31 33 LabelDPI: TLabel; 32 34 OpenDialog1: TOpenDialog; … … 119 121 EditMapUrl.Text := MapUrl; 120 122 EditCompareTool.Text := CompareTool; 121 EditDefaultPhoneCountryPrefix.Text := DefaultPhoneCountryPrefix; 123 EditDefaultPhoneCountryPrefix.Text := DefaultPhoneCountryCode; 124 EditDefaultInternationalCallPrefix.Text := DefaultInternationalCallPrefix; 122 125 end; 123 126 UpdateInterface; … … 133 136 MapUrl := EditMapUrl.Text; 134 137 CompareTool := EditCompareTool.Text; 135 DefaultPhoneCountryPrefix := EditDefaultPhoneCountryPrefix.Text; 138 DefaultPhoneCountryCode := EditDefaultPhoneCountryPrefix.Text; 139 DefaultInternationalCallPrefix := EditDefaultInternationalCallPrefix.Text; 136 140 end; 137 141 end; -
trunk/Languages/vCardStudio.cs.po
r151 r152 222 222 msgstr "Domovská stránka" 223 223 224 #: tcore.anormalize.caption 225 msgctxt "tcore.anormalize.caption" 226 msgid "Normalize" 227 msgstr "Normalizovat" 228 224 229 #: tcore.applicationinfo1.description 225 230 msgid "vCard files management tool" … … 329 334 #: tformcompare.checkboxnormalizephonenumbers.caption 330 335 msgid "Normalize phone numbers" 331 msgstr "Normalizovat telefonní čísla :"336 msgstr "Normalizovat telefonní čísla" 332 337 333 338 #: tformcompare.checkboxremoveexactduplicates.caption … … 1118 1123 msgstr "Poslední:" 1119 1124 1125 #: tformnormalize.buttoncancel.caption 1126 msgctxt "tformnormalize.buttoncancel.caption" 1127 msgid "Cancel" 1128 msgstr "Zrušit" 1129 1130 #: tformnormalize.buttonprocess.caption 1131 msgid "Process" 1132 msgstr "Zpracovat" 1133 1134 #: tformnormalize.caption 1135 msgctxt "tformnormalize.caption" 1136 msgid "Normalize" 1137 msgstr "Normalizovat" 1138 1139 #: tformnormalize.checkboxaddphoneprefix.caption 1140 msgid "Add default country phone prefix" 1141 msgstr "Přidat výchozí telefonní předvolba země" 1142 1143 #: tformnormalize.checkboxconvertinternationacallprefixtocountrycode.caption 1144 msgid "Convert international call prefix to country code" 1145 msgstr "Převést mezinárodní volací předvolbu na kód země" 1146 1147 #: tformnormalize.checkboxremoveexactduplicates.caption 1148 msgctxt "tformnormalize.checkboxremoveexactduplicates.caption" 1149 msgid "Remove exact duplicates" 1150 msgstr "Odstranit přesné duplikáty" 1151 1152 #: tformnormalize.checkboxremovephonespaces.caption 1153 msgid "Remove spaces in phone numbers" 1154 msgstr "Odstranit mezery z telefonních čísel" 1155 1156 #: tformnormalize.checkboxremovephotos.caption 1157 msgid "Remove photos" 1158 msgstr "Odstranit fotky" 1159 1120 1160 #: tformproperties.aadd.caption 1121 1161 msgctxt "tformproperties.aadd.caption" … … 1251 1291 msgstr "Výchozí telefonní prefix země:" 1252 1292 1293 #: tformsettings.label7.caption 1294 msgid "Default international call prefix:" 1295 msgstr "Výchozí mezinárodní volací předvolba:" 1296 1253 1297 #: tformsettings.labeldpi.caption 1254 1298 msgid "DPI:" -
trunk/Languages/vCardStudio.pot
r151 r152 212 212 msgstr "" 213 213 214 #: tcore.anormalize.caption 215 msgctxt "tcore.anormalize.caption" 216 msgid "Normalize" 217 msgstr "" 218 214 219 #: tcore.applicationinfo1.description 215 220 msgid "vCard files management tool" … … 1108 1113 msgstr "" 1109 1114 1115 #: tformnormalize.buttoncancel.caption 1116 msgctxt "tformnormalize.buttoncancel.caption" 1117 msgid "Cancel" 1118 msgstr "" 1119 1120 #: tformnormalize.buttonprocess.caption 1121 msgid "Process" 1122 msgstr "" 1123 1124 #: tformnormalize.caption 1125 msgctxt "tformnormalize.caption" 1126 msgid "Normalize" 1127 msgstr "" 1128 1129 #: tformnormalize.checkboxaddphoneprefix.caption 1130 msgid "Add default country phone prefix" 1131 msgstr "" 1132 1133 #: tformnormalize.checkboxconvertinternationacallprefixtocountrycode.caption 1134 msgid "Convert international call prefix to country code" 1135 msgstr "" 1136 1137 #: tformnormalize.checkboxremoveexactduplicates.caption 1138 msgctxt "tformnormalize.checkboxremoveexactduplicates.caption" 1139 msgid "Remove exact duplicates" 1140 msgstr "" 1141 1142 #: tformnormalize.checkboxremovephonespaces.caption 1143 msgid "Remove spaces in phone numbers" 1144 msgstr "" 1145 1146 #: tformnormalize.checkboxremovephotos.caption 1147 msgid "Remove photos" 1148 msgstr "" 1149 1110 1150 #: tformproperties.aadd.caption 1111 1151 msgctxt "tformproperties.aadd.caption" … … 1241 1281 msgstr "" 1242 1282 1283 #: tformsettings.label7.caption 1284 msgid "Default international call prefix:" 1285 msgstr "" 1286 1243 1287 #: tformsettings.labeldpi.caption 1244 1288 msgid "DPI:" -
trunk/Languages/vCardStudio.sv.po
r151 r152 223 223 msgstr "Hemsida" 224 224 225 #: tcore.anormalize.caption 226 msgctxt "tcore.anormalize.caption" 227 msgid "Normalize" 228 msgstr "" 229 225 230 #: tcore.applicationinfo1.description 226 231 msgid "vCard files management tool" … … 1146 1151 msgstr "" 1147 1152 1153 #: tformnormalize.buttoncancel.caption 1154 #, fuzzy 1155 msgctxt "tformnormalize.buttoncancel.caption" 1156 msgid "Cancel" 1157 msgstr "Avbryt" 1158 1159 #: tformnormalize.buttonprocess.caption 1160 msgid "Process" 1161 msgstr "" 1162 1163 #: tformnormalize.caption 1164 msgctxt "tformnormalize.caption" 1165 msgid "Normalize" 1166 msgstr "" 1167 1168 #: tformnormalize.checkboxaddphoneprefix.caption 1169 msgid "Add default country phone prefix" 1170 msgstr "" 1171 1172 #: tformnormalize.checkboxconvertinternationacallprefixtocountrycode.caption 1173 msgid "Convert international call prefix to country code" 1174 msgstr "" 1175 1176 #: tformnormalize.checkboxremoveexactduplicates.caption 1177 msgctxt "tformnormalize.checkboxremoveexactduplicates.caption" 1178 msgid "Remove exact duplicates" 1179 msgstr "" 1180 1181 #: tformnormalize.checkboxremovephonespaces.caption 1182 msgid "Remove spaces in phone numbers" 1183 msgstr "" 1184 1185 #: tformnormalize.checkboxremovephotos.caption 1186 msgid "Remove photos" 1187 msgstr "" 1188 1148 1189 #: tformproperties.aadd.caption 1149 1190 #, fuzzy … … 1288 1329 msgstr "" 1289 1330 1331 #: tformsettings.label7.caption 1332 msgid "Default international call prefix:" 1333 msgstr "" 1334 1290 1335 #: tformsettings.labeldpi.caption 1291 1336 msgid "DPI:" -
trunk/Packages/VCard/VCard.lpk
r148 r152 57 57 <UnitName Value="VCardPackage"/> 58 58 </Item> 59 <Item> 60 <Filename Value="VCardProcessor.pas"/> 61 <UnitName Value="VCardProcessor"/> 62 </Item> 59 63 </Files> 60 64 <i18n> -
trunk/Packages/VCard/VCard.pas
r151 r152 1298 1298 var 1299 1299 I: Integer; 1300 ContactProperty: TContactProperty; 1300 1301 begin 1301 1302 inherited Sort(TComparer<TContact>.Construct(CompareContactFullName)); 1302 for I := 0 to Count - 1 do 1303 for I := 0 to Count - 1 do begin 1303 1304 Items[I].Properties.Sort(TComparer<TContactProperty>.Construct(ComparePropertyName)); 1305 1306 // Make sure VERSION is first property 1307 ContactProperty := Items[I].Properties.GetByName('VERSION'); 1308 if Assigned(ContactProperty) then begin 1309 Items[I].Properties.Move(Items[I].Properties.IndexOf(ContactProperty), 0); 1310 end; 1311 end; 1304 1312 end; 1305 1313 … … 1791 1799 LinePrefix: string; 1792 1800 CutLength: Integer; 1801 Cut: Boolean; 1793 1802 begin 1794 1803 with Output do begin … … 1814 1823 LineIndex := 0; 1815 1824 LinePrefix := ''; 1825 Cut := False; 1816 1826 while True do begin 1817 1827 if UTF8Length(OutText) > ParentVCard.MaxLineLength then begin 1828 Cut := True; 1818 1829 CutLength := ParentVCard.MaxLineLength; 1819 1830 if Encoding = veQuotedPrintable then begin … … 1837 1848 end else begin 1838 1849 Add(LinePrefix + OutText); 1850 if Cut then Add(''); 1839 1851 Break; 1840 1852 end; -
trunk/Packages/VCard/VCardPackage.pas
r148 r152 9 9 10 10 uses 11 VCard, QuotedPrintable, ContactImage, LazarusPackageIntf;11 VCard, QuotedPrintable, ContactImage, VCardProcessor, LazarusPackageIntf; 12 12 13 13 implementation -
trunk/Test.pas
r149 r152 4 4 5 5 uses 6 Classes, SysUtils, VCard, TestCase;6 Classes, SysUtils, VCard, VCardProcessor, TestCase; 7 7 8 8 type … … 29 29 end; 30 30 31 { TTestCaseVCardProcessor } 32 33 TTestCaseVCardProcessor = class(TTestCase) 34 Input: string; 35 Output: string; 36 Processor: TVCardProcessor; 37 procedure Run; override; 38 constructor Create; override; 39 destructor Destroy; override; 40 end; 41 31 42 32 43 implementation … … 38 49 SExpected = 'Expected:'; 39 50 SOutput = 'Output:'; 51 52 { TTestCaseVCardProcessor } 53 54 procedure TTestCaseVCardProcessor.Run; 55 var 56 Lines: TStringList; 57 begin 58 Lines := TStringList.Create; 59 try 60 with TVCardFile.Create(nil) do 61 try 62 Lines.Text := Input; 63 VCard.LoadFromStrings(Lines); 64 65 Processor.Process(VCard); 66 67 Lines.Text := ''; 68 VCard.SaveToStrings(Lines); 69 Evaluate(Lines.Text = Output); 70 Log := SExpected + LineEnding + 71 '"' + Output + '"' + LineEnding + LineEnding + 72 SOutput + LineEnding + 73 '"' + Lines.Text + '"'; 74 finally 75 Free; 76 end; 77 finally 78 Lines.Free; 79 end; 80 end; 81 82 constructor TTestCaseVCardProcessor.Create; 83 begin 84 inherited; 85 Processor := TVCardProcessor.Create(nil); 86 end; 87 88 destructor TTestCaseVCardProcessor.Destroy; 89 begin 90 FreeAndNil(Processor); 91 inherited; 92 end; 40 93 41 94 { TTestCaseCheckProperty } -
trunk/TestCases.pas
r151 r152 39 39 Input := BeginEnd( 40 40 'NOTE:This is some long test which is really multi-lined each line is on dif' + VCardLineEnding + 41 ' ferent line so it is on multiple lines.' + VCardLineEnding); 41 ' ferent line so it is on multiple lines.' + VCardLineEnding + 42 VCardLineEnding); 42 43 Output := Input; 43 44 end; … … 55 56 Input := BeginEnd( 56 57 'FN;ENCODING=QUOTED-PRINTABLE:Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=ADJm=C3=A9n=' + VCardLineEnding + 57 'o=20P=C5=99=C3=ADjmen=C3=AD' + VCardLineEnding); 58 'o=20P=C5=99=C3=ADjmen=C3=AD' + VCardLineEnding + 59 VCardLineEnding); 58 60 Output := Input; 59 61 end; … … 76 78 Input := BeginEnd( 77 79 'FN;ENCODING=BASE64:U29tZSB2ZXJ5IGxvbmcgc3RyaW5nIFNvbWUgdmVyeSBsb25nIHN0cmlu' + VCardLineEnding + 78 ' ZyBTb21lIHZlcnkgbG9uZyBzdHJpbmcgU29tZSB2ZXJ5IGxvbmcgc3RyaW5n' + VCardLineEnding); 80 ' ZyBTb21lIHZlcnkgbG9uZyBzdHJpbmcgU29tZSB2ZXJ5IGxvbmcgc3RyaW5n' + VCardLineEnding + 81 VCardLineEnding); 79 82 Output := Input; 80 83 end; … … 182 185 end; 183 186 187 with TTestCaseVCardProcessor(AddNew('VCardProcessor - Remove exact duplicates', TTestCaseVCardProcessor)) do begin 188 Processor.RemoveExactDuplicates := True; 189 Input := BeginEnd( 190 'N:Surname;Name' + VCardLineEnding + 191 'FN:Name Surname' + VCardLineEnding) + 192 BeginEnd( 193 'N:Surname2;Name2' + VCardLineEnding + 194 'FN:Name2 Surname2' + VCardLineEnding) + 195 BeginEnd( 196 'N:Surname;Name' + VCardLineEnding + 197 'FN:Name Surname' + VCardLineEnding) + 198 BeginEnd( 199 'N:Surname;Name' + VCardLineEnding + 200 'FN:Name Surname' + VCardLineEnding + 201 'NOTE:Note' + VCardLineEnding) + 202 BeginEnd( 203 'N:Surname;Name' + VCardLineEnding + 204 'FN:Name Surname' + VCardLineEnding); 205 Output := BeginEnd( 206 'N:Surname;Name' + VCardLineEnding + 207 'FN:Name Surname' + VCardLineEnding) + 208 BeginEnd( 209 'N:Surname2;Name2' + VCardLineEnding + 210 'FN:Name2 Surname2' + VCardLineEnding) + 211 BeginEnd( 212 'N:Surname;Name' + VCardLineEnding + 213 'FN:Name Surname' + VCardLineEnding + 214 'NOTE:Note' + VCardLineEnding); 215 end; 216 with TTestCaseVCardProcessor(AddNew('VCardProcessor - Remove phone spaces', TTestCaseVCardProcessor)) do begin 217 Processor.RemovePhoneSpaces := True; 218 Input := BeginEnd('TEL: 123 456 789 ' + VCardLineEnding) + 219 BeginEnd('TEL;CELL:919 191 919' + VCardLineEnding); 220 Output := BeginEnd('TEL:123456789' + VCardLineEnding) + 221 BeginEnd('TEL;CELL:919191919' + VCardLineEnding); 222 end; 223 with TTestCaseVCardProcessor(AddNew('VCardProcessor - Remove photos', TTestCaseVCardProcessor)) do begin 224 Processor.RemovePhotos := True; 225 Input := BeginEnd('N:Surname;Name' + VCardLineEnding + 226 'FN:Name Surname' + VCardLineEnding + 227 'PHOTO:dadsa' + VCardLineEnding) + 228 BeginEnd('N:Surname;Name' + VCardLineEnding + 229 'FN:Name Surname' + VCardLineEnding + 230 'PHOTO:dadsa' + VCardLineEnding + 231 'PHOTO:adsadadsa' + VCardLineEnding); 232 Output := BeginEnd('N:Surname;Name' + VCardLineEnding + 233 'FN:Name Surname' + VCardLineEnding) + 234 BeginEnd('N:Surname;Name' + VCardLineEnding + 235 'FN:Name Surname' + VCardLineEnding); 236 end; 237 with TTestCaseVCardProcessor(AddNew('VCardProcessor - Order', TTestCaseVCardProcessor)) do begin 238 Processor.Order := True; 239 Input := BeginEnd('N:Surname2;Name2' + VCardLineEnding + 240 'FN:Name2 Surname2' + VCardLineEnding) + 241 BeginEnd('N:Surname1;Name1' + VCardLineEnding + 242 'FN:Name1 Surname1' + VCardLineEnding) + 243 BeginEnd('N:Surname3;Name3' + VCardLineEnding + 244 'FN:Name3 Surname3' + VCardLineEnding); 245 Output := BeginEnd('FN:Name1 Surname1' + VCardLineEnding + 246 'N:Surname1;Name1' + VCardLineEnding) + 247 BeginEnd('FN:Name2 Surname2' + VCardLineEnding + 248 'N:Surname2;Name2'+ VCardLineEnding) + 249 BeginEnd('FN:Name3 Surname3' + VCardLineEnding + 250 'N:Surname3;Name3' + VCardLineEnding); 251 end; 252 with TTestCaseVCardProcessor(AddNew('VCardProcessor - Add phone country code', TTestCaseVCardProcessor)) do begin 253 Processor.AddDefaultPhoneCountryPrefix := True; 254 Processor.DefaultPhoneCountryCode := '+470'; 255 Processor.NonPrefixedPhoneLength := 9; 256 Input := BeginEnd('TEL: 123 456 789 ' + VCardLineEnding) + 257 BeginEnd('TEL;CELL:919 191 919' + VCardLineEnding) + 258 BeginEnd('TEL;CELL:+421 919 191 919' + VCardLineEnding) + 259 BeginEnd('TEL;CELL:*#1234' + VCardLineEnding); 260 Output := BeginEnd('TEL:+470 123 456 789 ' + VCardLineEnding) + 261 BeginEnd('TEL;CELL:+470919 191 919' + VCardLineEnding) + 262 BeginEnd('TEL;CELL:+421 919 191 919' + VCardLineEnding) + 263 BeginEnd('TEL;CELL:*#1234' + VCardLineEnding); 264 end; 265 with TTestCaseVCardProcessor(AddNew('VCardProcessor - Convert international call prefix to country code', TTestCaseVCardProcessor)) do begin 266 Processor.ConvertInternationalCallPrefixToCountryCode := True; 267 Processor.DefaultInternationalCallPrefix := '00420'; 268 Processor.DefaultPhoneCountryCode := '+470'; 269 Input := BeginEnd('TEL:00420123456789' + VCardLineEnding) + 270 BeginEnd('TEL;CELL:00420 919 191 919 ' + VCardLineEnding) + 271 BeginEnd('TEL;CELL:00421919191919' + VCardLineEnding); 272 Output := BeginEnd('TEL:+470123456789' + VCardLineEnding) + 273 BeginEnd('TEL;CELL:+470 919 191 919 ' + VCardLineEnding) + 274 BeginEnd('TEL;CELL:00421919191919' + VCardLineEnding); 275 end; 276 184 277 with TTestCaseLoadSave(AddNew('Merge same cell phone', TTestCaseLoadSave)) do begin 185 278 Input := VCardBegin + MacLineEnding + -
trunk/vCardStudio.lpi
r151 r152 123 123 </Item7> 124 124 </RequiredPackages> 125 <Units Count="2 5">125 <Units Count="26"> 126 126 <Unit0> 127 127 <Filename Value="vCardStudio.lpr"/> … … 281 281 <ResourceBaseClass Value="Form"/> 282 282 </Unit24> 283 <Unit25> 284 <Filename Value="Forms\FormNormalize.pas"/> 285 <IsPartOfProject Value="True"/> 286 <ComponentName Value="FormNormalize"/> 287 <HasResources Value="True"/> 288 <ResourceBaseClass Value="Form"/> 289 </Unit25> 283 290 </Units> 284 291 </ProjectOptions> -
trunk/vCardStudio.lpr
r151 r152 7 7 Interfaces, // this includes the LCL widgetset 8 8 Forms, FormMain, Core, Diff, SysUtils, FormCompareSideBySide, TestCases, 9 VCardFile, FormColumns, FormCompare ;9 VCardFile, FormColumns, FormCompare, FormNormalize; 10 10 11 11 {$R *.res}
Note:
See TracChangeset
for help on using the changeset viewer.