Changeset 30


Ignore:
Timestamp:
Nov 24, 2021, 8:42:24 PM (3 years ago)
Author:
chronos
Message:
  • Added: In case of loading errors show a list of found errors with line numbers.
  • Fixed: Check if property block started correctly.
  • Added: More standard properties.
  • Fixed: Improved alignment of fields in contact dialog.
Location:
trunk
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContact.lfm

    r23 r30  
    11object FormContact: TFormContact
    2   Left = 423
     2  Left = 604
    33  Height = 588
    4   Top = 271
     4  Top = 429
    55  Width = 914
    66  Caption = 'Contact'
     
    2929      object Label1: TLabel
    3030        Left = 16
    31         Height = 20
    32         Top = 16
    33         Width = 43
     31        Height = 24
     32        Top = 24
     33        Width = 56
    3434        Caption = 'Name:'
    3535        ParentColor = False
     
    3838      object EditName: TEdit
    3939        Left = 144
    40         Height = 28
    41         Top = 19
     40        Height = 42
     41        Top = 16
    4242        Width = 254
    4343        ParentFont = False
     
    4646      object Label2: TLabel
    4747        Left = 16
    48         Height = 20
    49         Top = 56
    50         Width = 74
     48        Height = 24
     49        Top = 72
     50        Width = 95
    5151        Caption = 'Cell phone:'
    5252        ParentColor = False
     
    5555      object EditCellPhone: TEdit
    5656        Left = 144
    57         Height = 28
    58         Top = 56
     57        Height = 42
     58        Top = 62
    5959        Width = 254
    6060        ParentFont = False
     
    6363      object EditPhone: TEdit
    6464        Left = 144
    65         Height = 28
    66         Top = 100
     65        Height = 42
     66        Top = 108
    6767        Width = 254
    6868        ParentFont = False
     
    7171      object Label3: TLabel
    7272        Left = 16
    73         Height = 20
    74         Top = 97
    75         Width = 44
     73        Height = 24
     74        Top = 112
     75        Width = 59
    7676        Caption = 'Phone:'
    7777        ParentColor = False
     
    8080      object EditEmail: TEdit
    8181        Left = 575
    82         Height = 28
    83         Top = 59
     82        Height = 42
     83        Top = 62
    8484        Width = 254
    8585        ParentFont = False
     
    8888      object Label4: TLabel
    8989        Left = 432
    90         Height = 20
    91         Top = 56
    92         Width = 46
     90        Height = 24
     91        Top = 72
     92        Width = 58
    9393        Caption = 'E-mail:'
    9494        ParentColor = False
     
    9797      object EditSurname: TEdit
    9898        Left = 575
    99         Height = 28
    100         Top = 18
     99        Height = 42
     100        Top = 16
    101101        Width = 254
    102102        ParentFont = False
     
    105105      object Label5: TLabel
    106106        Left = 432
    107         Height = 20
    108         Top = 16
    109         Width = 61
     107        Height = 24
     108        Top = 24
     109        Width = 81
    110110        Caption = 'Surname:'
    111111        ParentColor = False
     
    116116        Height = 146
    117117        Top = 230
    118         Width = 702
     118        Width = 846
    119119        Anchors = [akTop, akLeft, akRight, akBottom]
    120120        ParentFont = False
     
    123123      object Label6: TLabel
    124124        Left = 19
    125         Height = 20
     125        Height = 24
    126126        Top = 202
    127         Width = 42
     127        Width = 55
    128128        Caption = 'Notes:'
    129129        ParentColor = False
     
    132132      object EditEmailHome: TEdit
    133133        Left = 575
    134         Height = 28
    135         Top = 100
     134        Height = 42
     135        Top = 108
    136136        Width = 254
    137137        ParentFont = False
     
    140140      object Label20: TLabel
    141141        Left = 432
    142         Height = 20
    143         Top = 96
    144         Width = 101
     142        Height = 24
     143        Top = 112
     144        Width = 124
    145145        Caption = 'E-mail (Home):'
    146146        ParentColor = False
     
    149149      object EditEmailWork: TEdit
    150150        Left = 575
    151         Height = 28
    152         Top = 146
     151        Height = 42
     152        Top = 152
    153153        Width = 254
    154154        ParentFont = False
     
    157157      object Label21: TLabel
    158158        Left = 432
    159         Height = 20
    160         Top = 144
    161         Width = 95
     159        Height = 24
     160        Top = 160
     161        Width = 117
    162162        Caption = 'E-mail (Work):'
    163163        ParentColor = False
     
    166166      object EditBirthday: TEdit
    167167        Left = 144
    168         Height = 28
    169         Top = 144
     168        Height = 42
     169        Top = 152
    170170        Width = 254
    171171        ParentFont = False
     
    174174      object Label22: TLabel
    175175        Left = 16
    176         Height = 20
    177         Top = 144
    178         Width = 58
     176        Height = 24
     177        Top = 160
     178        Width = 76
    179179        Caption = 'Birthday:'
    180180        ParentColor = False
     
    189189      object Label7: TLabel
    190190        Left = 10
    191         Height = 20
     191        Height = 24
    192192        Top = 18
    193         Width = 99
     193        Width = 125
    194194        Caption = 'Phone (Home):'
    195195        ParentColor = False
     
    198198      object EditPhoneHome: TEdit
    199199        Left = 173
    200         Height = 28
    201         Top = 18
     200        Height = 42
     201        Top = 16
    202202        Width = 254
    203203        ParentFont = False
     
    206206      object Label8: TLabel
    207207        Left = 10
    208         Height = 20
    209         Top = 61
    210         Width = 93
     208        Height = 24
     209        Top = 64
     210        Width = 118
    211211        Caption = 'Phone (Work):'
    212212        ParentColor = False
     
    215215      object EditPhoneWork: TEdit
    216216        Left = 173
    217         Height = 28
    218         Top = 61
     217        Height = 42
     218        Top = 62
    219219        Width = 254
    220220        ParentFont = False
     
    223223      object Label9: TLabel
    224224        Left = 10
    225         Height = 20
    226         Top = 106
    227         Width = 129
     225        Height = 24
     226        Top = 112
     227        Width = 161
    228228        Caption = 'Cell phone (Home):'
    229229        ParentColor = False
     
    232232      object EditCellPhoneHome: TEdit
    233233        Left = 173
    234         Height = 28
     234        Height = 42
    235235        Top = 108
    236236        Width = 254
     
    240240      object Label10: TLabel
    241241        Left = 10
    242         Height = 20
    243         Top = 146
    244         Width = 123
     242        Height = 24
     243        Top = 160
     244        Width = 154
    245245        Caption = 'Cell phone (Work):'
    246246        ParentColor = False
     
    249249      object EditCellPhoneWork: TEdit
    250250        Left = 173
    251         Height = 28
    252         Top = 146
     251        Height = 42
     252        Top = 152
    253253        Width = 254
    254254        ParentFont = False
     
    257257      object Label11: TLabel
    258258        Left = 451
    259         Height = 20
     259        Height = 24
    260260        Top = 16
    261         Width = 25
     261        Width = 34
    262262        Caption = 'Fax:'
    263263        ParentColor = False
     
    266266      object EditFax: TEdit
    267267        Left = 584
    268         Height = 28
     268        Height = 42
    269269        Top = 18
    270270        Width = 254
     
    274274      object Label12: TLabel
    275275        Left = 451
    276         Height = 20
     276        Height = 24
    277277        Top = 58
    278         Width = 80
     278        Width = 100
    279279        Caption = 'Fax (Home):'
    280280        ParentColor = False
     
    283283      object EditFaxHome: TEdit
    284284        Left = 584
    285         Height = 28
    286         Top = 61
     285        Height = 42
     286        Top = 62
    287287        Width = 254
    288288        ParentFont = False
     
    291291      object Label13: TLabel
    292292        Left = 451
    293         Height = 20
     293        Height = 24
    294294        Top = 106
    295         Width = 74
     295        Width = 93
    296296        Caption = 'Fax (Work):'
    297297        ParentColor = False
     
    300300      object EditFaxWork: TEdit
    301301        Left = 584
    302         Height = 28
     302        Height = 42
    303303        Top = 108
    304304        Width = 254
     
    308308      object Label14: TLabel
    309309        Left = 451
    310         Height = 20
     310        Height = 24
    311311        Top = 144
    312         Width = 41
     312        Width = 54
    313313        Caption = 'Pager:'
    314314        ParentColor = False
     
    317317      object EditPager: TEdit
    318318        Left = 584
    319         Height = 28
    320         Top = 146
     319        Height = 42
     320        Top = 152
    321321        Width = 254
    322322        ParentFont = False
     
    325325      object Label15: TLabel
    326326        Left = 10
    327         Height = 20
    328         Top = 221
    329         Width = 72
     327        Height = 24
     328        Top = 224
     329        Width = 89
    330330        Caption = 'Web page:'
    331331        ParentColor = False
     
    334334      object EditWebPage: TEdit
    335335        Left = 173
    336         Height = 28
    337         Top = 221
     336        Height = 42
     337        Top = 220
    338338        Width = 254
    339339        ParentFont = False
     
    342342      object Label16: TLabel
    343343        Left = 10
    344         Height = 20
    345         Top = 259
    346         Width = 127
     344        Height = 24
     345        Top = 272
     346        Width = 155
    347347        Caption = 'Web page (Home):'
    348348        ParentColor = False
     
    351351      object EditWebPageHome: TEdit
    352352        Left = 173
    353         Height = 28
    354         Top = 259
     353        Height = 42
     354        Top = 262
    355355        Width = 254
    356356        ParentFont = False
     
    359359      object Label17: TLabel
    360360        Left = 10
    361         Height = 20
    362         Top = 298
    363         Width = 121
     361        Height = 24
     362        Top = 312
     363        Width = 148
    364364        Caption = 'Web page (Work):'
    365365        ParentColor = False
     
    368368      object EditWebPageWork: TEdit
    369369        Left = 173
    370         Height = 28
    371         Top = 298
     370        Height = 42
     371        Top = 306
    372372        Width = 254
    373373        ParentFont = False
     
    376376      object Label18: TLabel
    377377        Left = 450
    378         Height = 20
    379         Top = 221
    380         Width = 32
     378        Height = 24
     379        Top = 224
     380        Width = 41
    381381        Caption = 'Title:'
    382382        ParentColor = False
     
    385385      object EditTitle: TEdit
    386386        Left = 584
    387         Height = 28
    388         Top = 221
     387        Height = 42
     388        Top = 220
    389389        Width = 254
    390390        ParentFont = False
     
    393393      object Label19: TLabel
    394394        Left = 450
    395         Height = 20
    396         Top = 259
    397         Width = 56
     395        Height = 24
     396        Top = 272
     397        Width = 74
    398398        Caption = 'Address:'
    399399        ParentColor = False
     
    401401      end
    402402      object EditAddress: TEdit
    403         Left = 586
    404         Height = 28
    405         Top = 259
     403        Left = 584
     404        Height = 42
     405        Top = 262
    406406        Width = 254
    407407        ParentFont = False
     
    409409      end
    410410      object LabelOrganization: TLabel
    411         Left = 451
    412         Height = 20
    413         Top = 298
    414         Width = 89
     411        Left = 448
     412        Height = 24
     413        Top = 312
     414        Width = 114
    415415        Caption = 'Organization:'
    416416        ParentColor = False
     
    419419      object EditOrganization: TEdit
    420420        Left = 584
    421         Height = 28
    422         Top = 298
     421        Height = 42
     422        Top = 306
    423423        Width = 254
    424424        ParentFont = False
     
    483483  object ActionList1: TActionList
    484484    Images = Core.ImageList1
    485     Left = 380
    486     Top = 188
     485    Left = 320
     486    Top = 416
    487487    object AEditField: TAction
    488488      Caption = 'Edit'
     
    492492  object PopupMenu1: TPopupMenu
    493493    Images = Core.ImageList1
    494     Left = 206
    495     Top = 191
     494    Left = 184
     495    Top = 416
    496496    object MenuItem1: TMenuItem
    497497      Action = AEditField
  • trunk/Languages/vCardStudio.cs.po

    r22 r30  
    1010"Content-Transfer-Encoding: 8bit\n"
    1111"Language: cs\n"
    12 "X-Generator: Poedit 1.8.8\n"
     12"X-Generator: Poedit 3.0\n"
    1313
    1414#: tcore.aabout.caption
     
    6767#: tcore.applicationinfo1.description
    6868msgid "vCard files management tool"
    69 msgstr ""
     69msgstr "Nástroj pro správu souborů vCard"
    7070
    7171#: tcore.asettings.caption
     
    254254msgstr "Domácí telefon"
    255255
     256#: tformerror.caption
     257msgid "Load errors"
     258msgstr "Chyby načítání"
     259
    256260#: tformfindduplicity.ashowcontacts.caption
    257261msgid "Show contacts"
     
    360364msgstr "DPI:"
    361365
     366#: ucontact.sfoundblockendwithoutblockstart
     367msgid "Found block end without block start"
     368msgstr "Nalezen konec bloku bez začátku bloku"
     369
     370#: ucontact.sfoundpropertiesbeforeblockstart
     371msgid "Found properties before the start of block"
     372msgstr "Nalezena vlastnost před začátkem bloku"
     373
     374#: ucontact.sunknowncommand
     375msgid "Unknown command: %s"
     376msgstr "Neznámý příkaz: %s"
     377
    362378#: ucontact.sunsupportedcontactfieldsindex
    363379msgid "Unsupported contact field index"
     
    381397msgstr "Soubor '%s' nenalezen."
    382398
     399#: ucore.sline
     400msgid "Line %d: %s"
     401msgstr "Řádek %d: %s"
     402
    383403#: ucore.smergedcontacts
    384404msgid "Contacts merged. Loaded: %d, New: %d, Updated: %d"
     
    418438msgid "Modified"
    419439msgstr "Upraveno"
    420 
  • trunk/Languages/vCardStudio.po

    r22 r30  
    240240msgstr ""
    241241
     242#: tformerror.caption
     243msgid "Load errors"
     244msgstr ""
     245
    242246#: tformfindduplicity.ashowcontacts.caption
    243247msgid "Show contacts"
     
    344348msgstr ""
    345349
     350#: ucontact.sfoundblockendwithoutblockstart
     351msgid "Found block end without block start"
     352msgstr ""
     353
     354#: ucontact.sfoundpropertiesbeforeblockstart
     355msgid "Found properties before the start of block"
     356msgstr ""
     357
     358#: ucontact.sunknowncommand
     359msgid "Unknown command: %s"
     360msgstr ""
     361
    346362#: ucontact.sunsupportedcontactfieldsindex
    347363msgid "Unsupported contact field index"
     
    365381msgstr ""
    366382
     383#: ucore.sline
     384msgid "Line %d: %s"
     385msgstr ""
     386
    367387#: ucore.smergedcontacts
    368388msgid "Contacts merged. Loaded: %d, New: %d, Updated: %d"
  • trunk/Release Notes.txt

    r26 r30  
    1 Version 1.0.0 (19-08-2021)
     1Version 1.0.0 (2021-08-19)
    22==========================
    33
  • trunk/UContact.pas

    r29 r30  
    1111  TContactsFile = class;
    1212
    13   TStringEvent = procedure (Text: string) of object;
     13  TErrorEvent = procedure (Text: string; Line: Integer) of object;
    1414
    1515  TDataType = (dtString, dtInteger, dtDate, dtDateTime, dtImage);
     
    1919    cfTelCell, cfTelHome, cfTelHome2, cfTelWork, cfTelVoip,
    2020    cfTelPrefWorkVoice, cfTelPrefHomeVoice, cfTelHomeVoice, cfTelWorkVoice,
     21    cfTelVoice, cfTelMain,
    2122    cfEmailHome, cfEmailInternet, cfNickName, cfNote, cfRole, cfTitle,
    2223    cfCategories, cfOrganization, cfAdrHome, cfHomeAddressStreet,
     
    6364    TelHomeVoice: string;
    6465    TelWorkVoice: string;
     66    TelVoice: string;
     67    TelMain: string;
    6568    EmailHome: string;
    6669    EmailInternet: string;
     
    97100  TContactsFile = class(TDataFile)
    98101  private
    99     FOnError: TStringEvent;
     102    FOnError: TErrorEvent;
    100103    function GetNext(var Text: string; Separator: string): string;
    101104    procedure InitFields;
     105    procedure Error(Text: string; Line: Integer);
    102106  public
    103107    Fields: TContactFields;
     
    110114    constructor Create; override;
    111115    destructor Destroy; override;
    112     property OnError: TStringEvent read FOnError write FOnError;
     116    property OnError: TErrorEvent read FOnError write FOnError;
    113117  end;
    114118
     
    119123  SVCardFile = 'vCard file';
    120124  SUnsupportedContactFieldsIndex = 'Unsupported contact field index';
     125  SUnknownCommand = 'Unknown command: %s';
     126  SFoundPropertiesBeforeBlockStart = 'Found properties before the start of block';
     127  SFoundBlockEndWithoutBlockStart = 'Found block end without block start';
    121128
    122129{ TContacts }
     
    195202    cfTelHomeVoice: Result := TelHomeVoice;
    196203    cfTelWorkVoice: Result := TelWorkVoice;
     204    cfTelVoice: Result := TelVoice;
     205    cfTelMain: Result := TelMain;
    197206    cfEmailHome: Result := EmailHome;
    198207    cfEmailInternet: Result := EmailInternet;
     
    234243    cfTelHomeVoice: TelHomeVoice := AValue;
    235244    cfTelWorkVoice: TelWorkVoice := AValue;
     245    cfTelVoice: TelVoice := AValue;
     246    cfTelMain: TelMain := AValue;
    236247    cfEmailHome: EmailHome := AValue;
    237248    cfEmailInternet: EmailInternet := AValue;
     
    338349    AddNew('Tel Home Voice', cfTelHomeVoice, dtString);
    339350    AddNew('Tel Work Voice', cfTelWorkVoice, dtString);
     351    AddNew('Tel Voice', cfTelVoice, dtString);
     352    AddNew('Tel Main', cfTelMain, dtString);
    340353    AddNew('Email Home', cfEmailHome, dtString);
    341354    AddNew('Email Internet', cfEmailInternet, dtString);
     
    355368    AddNew('Jabber', cfXJabber, dtString);
    356369  end;
     370end;
     371
     372procedure TContactsFile.Error(Text: string; Line: Integer);
     373begin
     374  if Assigned(FOnError) then FOnError(Text, Line);
    357375end;
    358376
     
    423441      if TelHomeVoice <> '' then Add('TEL;HOME;VOICE:' + TelHomeVoice);
    424442      if TelWorkVoice <> '' then Add('TEL;WORK;VOICE:' + TelWorkVoice);
     443      if TelVoice <> '' then Add('TEL;VOICE:' + TelVoice);
     444      if TelMain <> '' then Add('TEL;MAIN:' + TelMain);
    425445      if Note <> '' then Add('NOTE:' + Note);
    426446      if AdrHome <> '' then Add('ADR;HOME:' + AdrHome);
     
    469489begin
    470490  inherited;
     491  NewRecord := nil;
    471492  Contacts.Clear;
    472493  Lines := TStringList.Create;
     
    483504      end else
    484505      if Line = 'END:VCARD' then begin
    485         Contacts.Add(NewRecord);
    486         NewRecord := nil;
     506        if Assigned(NewRecord) then begin
     507          Contacts.Add(NewRecord);
     508          NewRecord := nil;
     509        end else Error(SFoundBlockEndWithoutBlockStart, I + 1);
    487510      end else
    488511      if Pos(':', Line) > 0 then begin
     
    503526        Command := CommandItems.DelimitedText;
    504527
    505         if Command = 'FN' then NewRecord.FullName := Line
    506         else if Command = 'N' then begin
    507           NewRecord.LastName := GetNext(Line, ';');
    508           NewRecord.FirstName := GetNext(Line, ';');
    509           NewRecord.MiddleName := GetNext(Line, ';');
    510           NewRecord.TitleBefore := GetNext(Line, ';');
    511           NewRecord.TitleAfter := GetNext(Line, ';');
    512         end
    513         else if Command = 'VERSION' then NewRecord.Version := Line
    514         else if Command = 'TEL;PREF;CELL' then NewRecord.TelPrefCell := Line
    515         else if Command = 'TEL;CELL' then NewRecord.TelCell := Line
    516         else if Command = 'TEL;HOME' then NewRecord.TelHome := Line
    517         else if Command = 'TEL;HOME2' then NewRecord.TelHome2 := Line
    518         else if Command = 'TEL;WORK' then NewRecord.TelWork := Line
    519         else if Command = 'TEL;VOIP' then NewRecord.TelVoip := Line
    520         else if Command = 'TEL;PREF;WORK;VOICE' then NewRecord.TelPrefWorkVoice := Line
    521         else if Command = 'TEL;PREF;HOME;VOICE' then NewRecord.TelPrefHOMEVoice := Line
    522         else if Command = 'TEL;HOME;VOICE' then NewRecord.TelHomeVoice := Line
    523         else if Command = 'TEL;WORK;VOICE' then NewRecord.TelWorkVoice := Line
    524         else if Command = 'ADR;HOME' then NewRecord.AdrHome := Line
    525         else if Command = 'X-NICKNAME' then NewRecord.NickName := Line
    526         else if Command = 'EMAIL;HOME' then NewRecord.EmailHome := Line
    527         else if Command = 'EMAIL;INTERNET' then NewRecord.EmailInternet := Line
    528         else if Command = 'NOTE' then NewRecord.Note := Line
    529         else if Command = 'ORG' then NewRecord.Organization := Line
    530         else if Command = 'X-JABBER' then NewRecord.XJabber := Line
    531         else if Command = 'TITLE' then NewRecord.Role := Line
    532         else if Command = 'X-TIMES_CONTACTED' then NewRecord.XTimesContacted := Line
    533         else if Command = 'X-LAST_TIME_CONTACTED' then NewRecord.XLastTimeContacted := Line
    534         else if Command = 'PHOTO;JPEG' then begin
    535           NewRecord.Photo := Trim(Line);
    536           repeat
    537             Inc(I);
    538             Line := Trim(Lines[I]);
    539             if Line <> '' then NewRecord.Photo := NewRecord.Photo + Line;
    540           until Line = '';
    541           NewRecord.Photo := DecodeStringBase64(NewRecord.Photo);
    542         end
    543         else if Assigned(FOnError) then FOnError('Unknown command: ' + Command);
     528        if Assigned(NewRecord) then begin
     529          if Command = 'FN' then NewRecord.FullName := Line
     530          else if Command = 'N' then begin
     531            NewRecord.LastName := GetNext(Line, ';');
     532            NewRecord.FirstName := GetNext(Line, ';');
     533            NewRecord.MiddleName := GetNext(Line, ';');
     534            NewRecord.TitleBefore := GetNext(Line, ';');
     535            NewRecord.TitleAfter := GetNext(Line, ';');
     536          end
     537          else if Command = 'VERSION' then NewRecord.Version := Line
     538          else if Command = 'TEL;PREF;CELL' then NewRecord.TelPrefCell := Line
     539          else if Command = 'TEL;CELL' then NewRecord.TelCell := Line
     540          else if Command = 'TEL;HOME' then NewRecord.TelHome := Line
     541          else if Command = 'TEL;HOME2' then NewRecord.TelHome2 := Line
     542          else if Command = 'TEL;WORK' then NewRecord.TelWork := Line
     543          else if Command = 'TEL;VOIP' then NewRecord.TelVoip := Line
     544          else if Command = 'TEL;PREF;WORK;VOICE' then NewRecord.TelPrefWorkVoice := Line
     545          else if Command = 'TEL;PREF;HOME;VOICE' then NewRecord.TelPrefHOMEVoice := Line
     546          else if Command = 'TEL;HOME;VOICE' then NewRecord.TelHomeVoice := Line
     547          else if Command = 'TEL;WORK;VOICE' then NewRecord.TelWorkVoice := Line
     548          else if Command = 'TEL;VOICE' then NewRecord.TelVoice := Line
     549          else if Command = 'TEL;MAIN' then NewRecord.TelMain := Line
     550          else if Command = 'ADR;HOME' then NewRecord.AdrHome := Line
     551          else if Command = 'X-NICKNAME' then NewRecord.NickName := Line
     552          else if Command = 'EMAIL;HOME' then NewRecord.EmailHome := Line
     553          else if Command = 'EMAIL;INTERNET' then NewRecord.EmailInternet := Line
     554          else if Command = 'NOTE' then NewRecord.Note := Line
     555          else if Command = 'ORG' then NewRecord.Organization := Line
     556          else if Command = 'X-JABBER' then NewRecord.XJabber := Line
     557          else if Command = 'TITLE' then NewRecord.Role := Line
     558          else if Command = 'X-TIMES_CONTACTED' then NewRecord.XTimesContacted := Line
     559          else if Command = 'X-LAST_TIME_CONTACTED' then NewRecord.XLastTimeContacted := Line
     560          else if Command = 'PHOTO;JPEG' then begin
     561            NewRecord.Photo := Trim(Line);
     562            repeat
     563              Inc(I);
     564              Line := Trim(Lines[I]);
     565              if Line <> '' then NewRecord.Photo := NewRecord.Photo + Line;
     566            until Line = '';
     567            NewRecord.Photo := DecodeStringBase64(NewRecord.Photo);
     568          end
     569          else Error(Format(SUnknownCommand, [Command]), I + 1);
     570        end else Error(SFoundPropertiesBeforeBlockStart, I + 1);
    544571      end;
    545572      Inc(I);
  • trunk/UCore.pas

    r29 r30  
    6868    InitializeStarted: Boolean;
    6969    InitializeFinished: Boolean;
     70    LoadErrors: string;
    7071    procedure FileModified(Sender: TObject);
    7172    function FindFirstNonOption: string;
     
    7374    procedure LoadConfig;
    7475    procedure SaveConfig;
     76    procedure DoError(Text: string; Line: Integer);
    7577  public
    7678    DefaultDataFileClass: TDataFileClass;
     
    9799uses
    98100  UFormMain, UFormSettings, UContact, UFormContacts, UFormFindDuplicity,
    99   UFormGenerate;
     101  UFormGenerate, UFormError;
    100102
    101103resourcestring
     
    104106  SFileNotFound = 'File ''%s'' not found.';
    105107  SMergedContacts = 'Contacts merged. Loaded: %d, New: %d, Updated: %d';
     108  SLine = 'Line %d: %s';
    106109
    107110{ TMergeResult }
     
    310313    if FileClosed then begin
    311314      FileNew;
     315      LoadErrors := '';
    312316      DataFile.LoadFromFile(FileName);
    313317      LastOpenedList1.AddItem(FileName);
     318      if LoadErrors <> '' then begin
     319        FormError := TFormError.Create(nil);
     320        FormError.MemoErrors.Text := LoadErrors;
     321        FormError.ShowModal;
     322        FreeAndNil(FormError);
     323      end;
    314324    end;
    315325  end else ShowMessage(Format(SFileNotFound, [FileName]));
     
    379389    DataFile := DefaultDataFileClass.Create;
    380390    DataFile.OnModify := FileModified;
     391    TContactsFile(DataFile).OnError := DoError;
    381392  end;
    382393end;
     
    437448end;
    438449
     450procedure TCore.DoError(Text: string; Line: Integer);
     451begin
     452  LoadErrors := LoadErrors + Format(SLine, [Line, Text]) + LineEnding;
     453end;
     454
    439455procedure TCore.UpdateInterface;
    440456begin
  • trunk/vCardStudio.lpi

    r29 r30  
    101101      </Item2>
    102102    </RequiredPackages>
    103     <Units Count="10">
     103    <Units Count="11">
    104104      <Unit0>
    105105        <Filename Value="vCardStudio.lpr"/>
     
    163163        <ResourceBaseClass Value="Form"/>
    164164      </Unit9>
     165      <Unit10>
     166        <Filename Value="Forms\UFormError.pas"/>
     167        <IsPartOfProject Value="True"/>
     168        <ComponentName Value="FormError"/>
     169        <ResourceBaseClass Value="Form"/>
     170      </Unit10>
    165171    </Units>
    166172  </ProjectOptions>
  • trunk/vCardStudio.lpr

    r29 r30  
    88  {$ENDIF}
    99  Interfaces, // this includes the LCL widgetset
    10   Forms, UFormMain, UCore, Common, UDataFile,
    11   SysUtils, UFormContacts, UFormContact, UFormFindDuplicity, UFormGenerate
     10  Forms, UFormMain, UCore, Common, UDataFile, SysUtils, UFormContacts,
     11  UFormContact, UFormFindDuplicity, UFormGenerate, UFormError
    1212  { you can add units after this };
    1313
Note: See TracChangeset for help on using the changeset viewer.