Changeset 103


Ignore:
Timestamp:
Feb 9, 2022, 3:51:26 PM (2 years ago)
Author:
chronos
Message:
  • Added: Support for profile photo as URL.
  • Added: New UContactImage form to show profile photo in bigger size and with URL.
  • Modified: Profile photo image load/save handling moved to separate unit UContactImage.
  • Fixed: Some dynamically created forms were not translated.
  • Added: Remember last used file name for image open/save dialog.
Location:
trunk
Files:
4 added
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContact.lfm

    r102 r103  
    11object FormContact: TFormContact
    2   Left = 1121
     2  Left = 1063
    33  Height = 773
    4   Top = 472
     4  Top = 449
    55  Width = 1032
    66  Caption = 'Contact'
     
    1818    Top = 8
    1919    Width = 1009
    20     ActivePage = TabSheetWork
     20    ActivePage = TabSheetGeneral
    2121    Anchors = [akTop, akLeft, akRight, akBottom]
    2222    ParentFont = False
    23     TabIndex = 2
     23    TabIndex = 0
    2424    TabOrder = 0
    2525    object TabSheetGeneral: TTabSheet
     
    132132        Width = 216
    133133        Center = True
    134         OnClick = APhotoLoadExecute
     134        OnClick = ImagePhotoClick
    135135        PopupMenu = PopupMenuPhoto
    136136        Proportional = True
     
    150150        Top = 25
    151151        Width = 486
     152        OnChange = EditFullNameChange
    152153        ParentFont = False
    153154        TabOrder = 0
     
    13901391  object ActionList1: TActionList
    13911392    Images = Core.ImageList1
    1392     Left = 617
    1393     Top = 550
     1393    Left = 632
     1394    Top = 608
    13941395    object APhotoLoad: TAction
    13951396      Caption = 'Load from file'
     
    14041405      OnExecute = APhotoClearExecute
    14051406    end
     1407    object APhotoShow: TAction
     1408      Caption = 'Show'
     1409      OnExecute = APhotoShowExecute
     1410    end
     1411    object APhotoSetUrl: TAction
     1412      Caption = 'Set URL'
     1413      OnExecute = APhotoSetUrlExecute
     1414    end
    14061415  end
    14071416  object PopupMenuPhoto: TPopupMenu
    14081417    Images = Core.ImageList1
    1409     Left = 872
    1410     Top = 592
     1418    Left = 864
     1419    Top = 608
     1420    object MenuItem4: TMenuItem
     1421      Action = APhotoShow
     1422    end
    14111423    object MenuItem1: TMenuItem
    14121424      Action = APhotoLoad
     
    14171429    object MenuItem3: TMenuItem
    14181430      Action = APhotoClear
     1431    end
     1432    object MenuItem5: TMenuItem
     1433      Action = APhotoSetUrl
    14191434    end
    14201435  end
  • trunk/Forms/UFormContact.lrj

    r101 r103  
    9797{"hash":9308581,"name":"tformcontact.aphotosave.caption","sourcebytes":[83,97,118,101,32,116,111,32,102,105,108,101],"value":"Save to file"},
    9898{"hash":4860802,"name":"tformcontact.aphotoclear.caption","sourcebytes":[67,108,101,97,114],"value":"Clear"},
     99{"hash":368487,"name":"tformcontact.aphotoshow.caption","sourcebytes":[83,104,111,119],"value":"Show"},
     100{"hash":163994172,"name":"tformcontact.aphotoseturl.caption","sourcebytes":[83,101,116,32,85,82,76],"value":"Set URL"},
    99101{"hash":218146437,"name":"tformcontact.openpicturedialog1.title","sourcebytes":[79,112,101,110,32,101,120,105,115,116,105,110,103,32,102,105,108,101],"value":"Open existing file"},
    100102{"hash":159035875,"name":"tformcontact.savepicturedialog1.title","sourcebytes":[83,97,118,101,32,102,105,108,101,32,97,115],"value":"Save file as"},
  • trunk/Forms/UFormContact.pas

    r102 r103  
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    99  ComCtrls, ActnList, Menus, ExtCtrls, ExtDlgs, Buttons, UContact, LCLIntf,
    10   UFormProperties, DateUtils{$IFDEF LCLGTK2}, Gtk2Globals{$ENDIF};
     10  UFormProperties, DateUtils{$IFDEF LCLGTK2}, Gtk2Globals{$ENDIF}, UContactImage;
    1111
    1212type
     
    1515
    1616  TFormContact = class(TForm)
     17    APhotoSetUrl: TAction;
     18    APhotoShow: TAction;
    1719    APhotoClear: TAction;
    1820    APhotoSave: TAction;
     
    172174    MenuItem2: TMenuItem;
    173175    MenuItem3: TMenuItem;
     176    MenuItem4: TMenuItem;
     177    MenuItem5: TMenuItem;
    174178    OpenPictureDialog1: TOpenPictureDialog;
    175179    PageControlContact: TPageControl;
     
    194198    procedure APhotoLoadExecute(Sender: TObject);
    195199    procedure APhotoSaveExecute(Sender: TObject);
     200    procedure APhotoSetUrlExecute(Sender: TObject);
     201    procedure APhotoShowExecute(Sender: TObject);
    196202    procedure ButtonHomeAddressShowClick(Sender: TObject);
    197203    procedure ButtonNextClick(Sender: TObject);
    198204    procedure ButtonPreviousClick(Sender: TObject);
    199205    procedure ButtonWorkAddressShowClick(Sender: TObject);
     206    procedure EditFullNameChange(Sender: TObject);
    200207    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    201208    procedure FormCreate(Sender: TObject);
    202209    procedure FormDestroy(Sender: TObject);
    203210    procedure FormShow(Sender: TObject);
     211    procedure ImagePhotoClick(Sender: TObject);
    204212    procedure SpeedButtonHomeWebClick(Sender: TObject);
    205213    procedure SpeedButtonAniversaryClick(Sender: TObject);
     
    224232    procedure TabSheetWorkShow(Sender: TObject);
    225233  private
    226     FProfilePhotoActive: Boolean;
    227     FProfilePhotoLoaded: Boolean;
    228     FProfilePhotoModified: Boolean;
    229     procedure SetProfilePhotoActive(AValue: Boolean);
     234    FPhoto: TContactImage;
     235    procedure PhotoChange(Sender: TObject);
    230236  private
    231237    FContact: TContact;
     
    235241    procedure SetContact(AValue: TContact);
    236242    procedure ReloadAllPropertiesTab;
    237     property ProfilePhotoActive: Boolean read FProfilePhotoActive
    238       write SetProfilePhotoActive;
    239243  public
    240244    procedure UpdateInterface;
     
    253257
    254258uses
    255   UCore, UCommon;
     259  UCore, UCommon, UFormImage;
     260
     261resourcestring
     262  SContact = 'Contact';
     263  SPhotoUrl = 'Photo URL';
     264  SPhotoUrlQuery = 'Enter URL for profile photo';
    256265
    257266function DateToISO(Date: TDateTime): string;
     
    274283
    275284{$IF FPC_FULLVERSION<30200}
    276 function TryISOStrToDate(const aString: string; out outDate: TDateTime): Boolean;
     285function TryISOStrToDate(const aString: string; out OutDate: TDateTime): Boolean;
    277286var
    278287  xYear, xMonth, xDay: LongInt;
     
    280289  case Length(aString) of
    281290    8: Result :=
    282           TryStrToInt(Copy(aString, 1, 4), xYear) and
    283           TryStrToInt(Copy(aString, 5, 2), xMonth) and
    284           TryStrToInt(Copy(aString, 7, 2), xDay) and
    285           TryEncodeDate(xYear, xMonth, xDay, outDate);
     291      TryStrToInt(Copy(aString, 1, 4), xYear) and
     292      TryStrToInt(Copy(aString, 5, 2), xMonth) and
     293      TryStrToInt(Copy(aString, 7, 2), xDay) and
     294      TryEncodeDate(xYear, xMonth, xDay, OutDate);
    286295    10: Result :=
    287           TryStrToInt(Copy(aString, 1, 4), xYear) and
    288           TryStrToInt(Copy(aString, 6, 2), xMonth) and
    289           TryStrToInt(Copy(aString, 9, 2), xDay) and
    290           TryEncodeDate(xYear, xMonth, xDay, outDate);
     296      TryStrToInt(Copy(aString, 1, 4), xYear) and
     297      TryStrToInt(Copy(aString, 6, 2), xMonth) and
     298      TryStrToInt(Copy(aString, 9, 2), xDay) and
     299      TryEncodeDate(xYear, xMonth, xDay, OutDate);
    291300  else
    292301    Result := False;
    293302  end;
    294303  if not Result then
    295     outDate := 0;
     304    OutDate := 0;
    296305end;
    297306{$ENDIF}
     
    311320  FormProperties.Show;
    312321
    313   FProfilePhotoLoaded := False;
    314 
    315   // Force to load default profile image
    316   ProfilePhotoActive := True;
    317   ProfilePhotoActive := False;
     322  PhotoChange(nil);
    318323
    319324  PageControlContact.TabIndex := Core.LastContactTabIndex;
    320325  UpdateInterface;
     326end;
     327
     328procedure TFormContact.ImagePhotoClick(Sender: TObject);
     329begin
     330  APhotoShow.Execute;
    321331end;
    322332
     
    417427
    418428procedure TFormContact.TabSheetGeneralHide(Sender: TObject);
    419 var
    420   Photo: string;
    421   PhotoProperty: TContactProperty;
    422   Stream: TMemoryStream;
    423   JpegImage: TJpegImage;
    424   GifImage: TGIFImage;
    425   PngImage: TPortableNetworkGraphic;
    426429begin
    427430  Contact.Fields[cfFullName] := EditFullName.Text;
     
    443446  Contact.Fields[cfCategories] := EditCategories.Text;
    444447
    445   // Photo
    446   if FProfilePhotoModified then begin
    447   if ProfilePhotoActive then begin
    448     PhotoProperty := Contact.GetProperty(cfPhoto);
    449     if not Assigned(PhotoProperty) then begin
    450       PhotoProperty := TContactProperty.Create;
    451       PhotoProperty.Name := 'PHOTO';
    452       PhotoProperty.Attributes.DelimitedText := 'JPEG';
    453       Contact.Properties.Add(PhotoProperty);
    454     end;
    455     PhotoProperty.Encoding := 'BASE64';
    456     Stream := TMemoryStream.Create;
    457     try
    458       if PhotoProperty.Attributes.IndexOf('JPEG') <> -1 then begin
    459         JpegImage := TJPEGImage.Create;
    460         try
    461           try
    462             JpegImage.SetSize(ImagePhoto.Picture.Bitmap.Width, ImagePhoto.Picture.Bitmap.Height);
    463             JpegImage.Canvas.Draw(0, 0, ImagePhoto.Picture.Bitmap);
    464             JpegImage.SaveToStream(Stream);
    465           except
    466           end;
    467         finally
    468           JpegImage.Free;
    469         end;
    470       end else
    471       if PhotoProperty.Attributes.IndexOf('PNG') <> -1 then begin
    472         PngImage := TPortableNetworkGraphic.Create;
    473         try
    474           try
    475             PngImage.SetSize(ImagePhoto.Picture.Bitmap.Width, ImagePhoto.Picture.Bitmap.Height);
    476             PngImage.Canvas.Draw(0, 0, ImagePhoto.Picture.Bitmap);
    477             PngImage.SaveToStream(Stream);
    478           except
    479           end;
    480         finally
    481           PngImage.Free;
    482         end;
    483       end else
    484       if PhotoProperty.Attributes.IndexOf('GIF') <> -1 then begin
    485         GifImage := TGIFImage.Create;
    486         try
    487           try
    488             GifImage.SetSize(ImagePhoto.Picture.Bitmap.Width, ImagePhoto.Picture.Bitmap.Height);
    489             GifImage.Canvas.Draw(0, 0, ImagePhoto.Picture.Bitmap);
    490             GifImage.SaveToStream(Stream);
    491           except
    492           end;
    493         finally
    494           GifImage.Free;
    495         end;
    496       end else begin
    497         try
    498           ImagePhoto.Picture.SaveToStream(Stream);
    499         except
    500         end;
    501       end;
    502 
    503       SetLength(Photo, Stream.Size);
    504       Stream.Position := 0;
    505       Stream.Read(Photo[1], Length(Photo));
    506       Contact.Fields[cfPhoto] := Photo;
    507     finally
    508       Stream.Free;
    509     end;
    510   end else begin
    511     PhotoProperty := Contact.GetProperty(cfPhoto);
    512     if Assigned(PhotoProperty) then
    513        Contact.Properties.Remove(PhotoProperty);
    514   end;
    515     FProfilePhotoModified := False;
    516   end;
     448  FPhoto.Contact := Contact;
     449  FPhoto.Save;
    517450
    518451  ReloadAllPropertiesTab;
     
    520453
    521454procedure TFormContact.TabSheetGeneralShow(Sender: TObject);
    522 var
    523   Photo: string;
    524   JpegImage: TJpegImage;
    525   PngImage: TPortableNetworkGraphic;
    526   GifImage: TGIFImage;
    527   Stream: TMemoryStream;
    528   PhotoProperty: TContactProperty;
    529455begin
    530456  EditFullName.Text := Contact.Fields[cfFullName];
     
    546472  EditCategories.Text := Contact.Fields[cfCategories];
    547473
    548   // Photo
    549   PhotoProperty := Contact.GetProperty(cfPhoto);
    550   if not FProfilePhotoLoaded then begin
    551   if Assigned(PhotoProperty) then begin
    552     FProfilePhotoLoaded := True;
    553     FProfilePhotoModified := True;
    554     Photo := Contact.Fields[cfPhoto];
    555     if (Photo <> '') and (PhotoProperty.Encoding <> '') then begin
    556       Stream := TMemoryStream.Create;
    557       try
    558         Stream.Write(Photo[1], Length(Photo));
    559         Stream.Position := 0;
    560         if (PhotoProperty.Attributes.IndexOf('JPEG') <> -1) or
    561         (PhotoProperty.Attributes.IndexOf('jpeg') <> -1) then begin
    562           JpegImage := TJPEGImage.Create;
    563           try
    564             try
    565               JpegImage.LoadFromStream(Stream);
    566               with ImagePhoto.Picture.Bitmap do begin
    567                 PixelFormat := pf24bit;
    568                 SetSize(JpegImage.Width, JpegImage.Height);
    569                 Canvas.Draw(0, 0, JpegImage);
    570               end;
    571               ProfilePhotoActive := True;
    572             except
    573               ProfilePhotoActive := False;
    574             end;
    575           finally
    576             JpegImage.Free;
    577           end;
    578         end else
    579         if (PhotoProperty.Attributes.IndexOf('PNG') <> -1) or
    580         (PhotoProperty.Attributes.IndexOf('png') <> -1) then begin
    581           PngImage := TPortableNetworkGraphic.Create;
    582           try
    583             try
    584               PngImage.LoadFromStream(Stream);
    585               with ImagePhoto.Picture.Bitmap do begin
    586                 PixelFormat := pf24bit;
    587                 SetSize(PngImage.Width, PngImage.Height);
    588                 Canvas.Draw(0, 0, PngImage);
    589               end;
    590               ProfilePhotoActive := True;
    591             except
    592               ProfilePhotoActive := False;
    593             end;
    594           finally
    595             PngImage.Free;
    596           end;
    597         end else
    598         if (PhotoProperty.Attributes.IndexOf('GIF') <> -1) or
    599         (PhotoProperty.Attributes.IndexOf('gif') <> -1) then begin
    600           GifImage := TGIFImage.Create;
    601           try
    602             try
    603               GifImage.LoadFromStream(Stream);
    604               with ImagePhoto.Picture.Bitmap do begin
    605                 PixelFormat := pf24bit;
    606                 SetSize(GifImage.Width, GifImage.Height);
    607                 Canvas.Draw(0, 0, GifImage);
    608               end;
    609               ProfilePhotoActive := True;
    610             except
    611               ProfilePhotoActive := False;
    612             end;
    613           finally
    614             GifImage.Free;
    615           end;
    616         end else begin
    617           try
    618             ImagePhoto.Picture.LoadFromStream(Stream);
    619             ProfilePhotoActive := True;
    620           except
    621             ProfilePhotoActive := False;
    622           end;
    623         end;
    624       finally
    625         Stream.Free;
    626       end;
    627     end else ProfilePhotoActive := False;
    628   end else ProfilePhotoActive := False;
    629   end;
     474  FPhoto.Contact := Contact;
     475  FPhoto.Load;
    630476end;
    631477
     
    750596end;
    751597
    752 procedure TFormContact.SetProfilePhotoActive(AValue: Boolean);
    753 begin
    754   if FProfilePhotoActive = AValue then Exit;
    755   FProfilePhotoActive := AValue;
    756   if not FProfilePhotoActive then begin
    757     ImagePhoto.Picture.Assign(Core.GetProfileImage.Picture);
    758   end;
     598procedure TFormContact.PhotoChange(Sender: TObject);
     599begin
     600  if FPhoto.Used and (FPhoto.Url = '') then
     601    ImagePhoto.Picture.Bitmap.Assign(FPhoto.Bitmap)
     602    else ImagePhoto.Picture.Assign(Core.GetProfileImage.Picture);
    759603  UpdateInterface;
    760604end;
     
    791635procedure TFormContact.APhotoLoadExecute(Sender: TObject);
    792636begin
     637  OpenPictureDialog1.FileName := Core.LastPhotoFileName;
    793638  if OpenPictureDialog1.Execute then begin
    794     ImagePhoto.Picture.LoadFromFile(OpenPictureDialog1.FileName);
    795     FProfilePhotoModified := True;
    796     FProfilePhotoLoaded := True;
    797     ProfilePhotoActive := True;
     639    FPhoto.LoadFromFile(OpenPictureDialog1.FileName);
     640    Core.LastPhotoFileName := OpenPictureDialog1.FileName;
    798641  end;
    799642end;
     
    801644procedure TFormContact.APhotoClearExecute(Sender: TObject);
    802645begin
    803   FProfilePhotoModified := True;
    804   ProfilePhotoActive := False;
     646  FPhoto.Clear;
    805647end;
    806648
    807649procedure TFormContact.APhotoSaveExecute(Sender: TObject);
    808650begin
     651  SavePictureDialog1.FileName := Core.LastPhotoFileName;
    809652  if SavePictureDialog1.Execute then begin
    810653    ImagePhoto.Picture.SaveToFile(SavePictureDialog1.FileName);
     654    Core.LastPhotoFileName := SavePictureDialog1.FileName;
     655  end;
     656end;
     657
     658procedure TFormContact.APhotoSetUrlExecute(Sender: TObject);
     659begin
     660  FPhoto.Url := InputBox(SPhotoUrl, SPhotoUrlQuery, FPhoto.Url);
     661end;
     662
     663procedure TFormContact.APhotoShowExecute(Sender: TObject);
     664begin
     665  with TFormImage.Create(nil) do
     666  try
     667    Image.Assign(FPhoto);
     668    if ShowModal = mrOK then begin
     669      FPhoto.Assign(Image);
     670      UpdateInterface;
     671    end;
     672  finally
     673    Free;
    811674  end;
    812675end;
     
    844707end;
    845708
     709procedure TFormContact.EditFullNameChange(Sender: TObject);
     710begin
     711  UpdateInterface;
     712end;
     713
    846714procedure TFormContact.FormCreate(Sender: TObject);
    847715begin
     
    850718  FContact := nil;
    851719  FormProperties := TFormProperties.Create(nil);
     720  FPhoto := TContactImage.Create;
     721  FPhoto.FieldIndex := cfPhoto;
     722  FPhoto.OnChange := PhotoChange;
    852723end;
    853724
    854725procedure TFormContact.FormDestroy(Sender: TObject);
    855726begin
     727  FreeAndNil(FPhoto);
    856728  FreeAndNil(FormProperties);
    857729end;
     
    859731procedure TFormContact.UpdateInterface;
    860732begin
    861   APhotoSave.Enabled := ProfilePhotoActive;
    862   APhotoClear.Enabled := ProfilePhotoActive;
     733  Caption := EditFullName.Text + ' - ' + SContact;
     734  APhotoSave.Enabled := FPhoto.Used;
     735  APhotoClear.Enabled := FPhoto.Used;
    863736  //ButtonNext.Enabled := Assigned(FOnGetNext) and Assigned(FOnGetNext(Contact));
    864737  //ButtonPrevious.Enabled := Assigned(FOnGetPrevious) and Assigned(FOnGetPrevious(Contact));
  • trunk/Forms/UFormContacts.pas

    r98 r103  
    300300procedure TFormContacts.FormShow(Sender: TObject);
    301301begin
     302  Core.Translator.TranslateComponentRecursive(Self);
     303  Core.ThemeManager1.UseTheme(Self);
    302304  Core.PersistentForm1.Load(Self);
    303   Core.ThemeManager1.UseTheme(Self);
    304   Core.Translator.TranslateComponentRecursive(Self);
    305305  ReloadList;
    306306  UpdateInterface;
  • trunk/Forms/UFormFind.lfm

    r82 r103  
    11object FormFind: TFormFind
    22  Left = 469
    3   Height = 523
     3  Height = 545
    44  Top = 407
    5   Width = 807
     5  Width = 841
    66  ActiveControl = EditValue
    77  Caption = 'Find'
    8   ClientHeight = 523
    9   ClientWidth = 807
    10   DesignTimePPI = 144
     8  ClientHeight = 545
     9  ClientWidth = 841
     10  DesignTimePPI = 150
    1111  OnClose = FormClose
    1212  OnCreate = FormCreate
    1313  OnDestroy = FormDestroy
    1414  OnShow = FormShow
    15   LCLVersion = '2.0.12.0'
     15  LCLVersion = '2.2.0.4'
    1616  object Panel1: TPanel
    1717    Left = 0
    18     Height = 58
     18    Height = 60
    1919    Top = 0
    20     Width = 807
     20    Width = 841
    2121    Align = alTop
    2222    BevelOuter = bvNone
    23     ClientHeight = 58
    24     ClientWidth = 807
     23    ClientHeight = 60
     24    ClientWidth = 841
    2525    ParentFont = False
    2626    TabOrder = 0
    2727    object ComboBoxField: TComboBox
    28       Left = 184
    29       Height = 41
    30       Top = 16
    31       Width = 240
     28      Left = 192
     29      Height = 42
     30      Top = 17
     31      Width = 250
    3232      ItemHeight = 0
    3333      OnChange = ComboBoxFieldChange
     
    3737    end
    3838    object Label1: TLabel
    39       Left = 13
    40       Height = 24
    41       Top = 19
    42       Width = 135
     39      Left = 14
     40      Height = 27
     41      Top = 20
     42      Width = 142
    4343      Caption = 'By contact field:'
    44       ParentColor = False
    4544      ParentFont = False
    4645    end
    4746    object EditValue: TEdit
    48       Left = 440
    49       Height = 42
    50       Top = 16
    51       Width = 208
     47      Left = 458
     48      Height = 43
     49      Top = 17
     50      Width = 217
    5251      OnKeyPress = EditValueKeyPress
    5352      TabOrder = 1
    5453    end
    5554    object ButtonFind: TButton
    56       Left = 664
    57       Height = 38
    58       Top = 16
    59       Width = 113
     55      Left = 692
     56      Height = 40
     57      Top = 17
     58      Width = 118
    6059      Caption = 'Find'
    6160      OnClick = ButtonFindClick
  • trunk/Forms/UFormFind.pas

    r82 r103  
    100100  Core.Translator.TranslateComponentRecursive(Self);
    101101  Core.ThemeManager1.UseTheme(Self);
     102
    102103  ContactFieldIndex := cfNone;
    103104
  • trunk/Forms/UFormFindDuplicity.lfm

    r82 r103  
    11object FormFindDuplicity: TFormFindDuplicity
    22  Left = 455
    3   Height = 523
     3  Height = 545
    44  Top = 355
    5   Width = 807
     5  Width = 841
    66  Caption = 'Find duplicities'
    7   ClientHeight = 523
    8   ClientWidth = 807
    9   DesignTimePPI = 144
     7  ClientHeight = 545
     8  ClientWidth = 841
     9  DesignTimePPI = 150
    1010  OnClose = FormClose
    1111  OnCreate = FormCreate
    1212  OnDestroy = FormDestroy
    1313  OnShow = FormShow
    14   LCLVersion = '2.0.12.0'
     14  LCLVersion = '2.2.0.4'
    1515  object ListView1: TListView
    1616    Left = 5
    17     Height = 455
    18     Top = 63
    19     Width = 797
     17    Height = 475
     18    Top = 65
     19    Width = 831
    2020    Align = alClient
    2121    BorderSpacing.Around = 5
     
    2323      item
    2424        Caption = 'Field'
    25         Width = 180
     25        Width = 188
    2626      end   
    2727      item
    2828        Caption = 'Contacts'
    29         Width = 360
     29        Width = 375
    3030      end   
    3131      item
    3232        Caption = 'Count'
    33         Width = 242
     33        Width = 253
    3434      end>
    3535    OwnerData = True
     
    4545  object Panel1: TPanel
    4646    Left = 0
    47     Height = 58
     47    Height = 60
    4848    Top = 0
    49     Width = 807
     49    Width = 841
    5050    Align = alTop
    5151    BevelOuter = bvNone
    52     ClientHeight = 58
    53     ClientWidth = 807
     52    ClientHeight = 60
     53    ClientWidth = 841
    5454    ParentFont = False
    5555    TabOrder = 1
    5656    object ComboBoxField: TComboBox
    57       Left = 160
    58       Height = 41
    59       Top = 16
    60       Width = 326
     57      Left = 167
     58      Height = 42
     59      Top = 17
     60      Width = 340
    6161      ItemHeight = 0
    6262      OnChange = ComboBoxFieldChange
     
    6666    end
    6767    object Label1: TLabel
    68       Left = 13
    69       Height = 24
    70       Top = 19
    71       Width = 135
     68      Left = 14
     69      Height = 27
     70      Top = 20
     71      Width = 142
    7272      Caption = 'By contact field:'
    73       ParentColor = False
    7473      ParentFont = False
    7574    end
    7675    object ButtonMerge: TButton
    77       Left = 496
    78       Height = 38
    79       Top = 14
    80       Width = 113
     76      Left = 517
     77      Height = 40
     78      Top = 15
     79      Width = 118
    8180      Caption = 'Merge'
    8281      OnClick = ButtonMergeClick
     
    8584  end
    8685  object ActionList1: TActionList
    87     Left = 262
    88     Top = 154
     86    Left = 273
     87    Top = 160
    8988    object AShowContacts: TAction
    9089      Caption = 'Show contacts'
     
    9392  end
    9493  object PopupMenu1: TPopupMenu
    95     Left = 90
    96     Top = 149
     94    Left = 94
     95    Top = 155
    9796    object MenuItem1: TMenuItem
    9897      Action = AShowContacts
  • trunk/Forms/UFormFindDuplicity.pas

    r82 r103  
    169169procedure TFormFindDuplicity.FormCreate(Sender: TObject);
    170170begin
    171   FoundItems := TFoundItems.Create;
    172171  Core.Translator.TranslateComponentRecursive(Self);
    173172  Core.ThemeManager1.UseTheme(Self);
     173
     174  FoundItems := TFoundItems.Create;
    174175  ContactFieldIndex := cfFullName;
    175176end;
  • trunk/Forms/UFormGenerate.lfm

    r69 r103  
    11object FormGenerate: TFormGenerate
    22  Left = 470
    3   Height = 562
     3  Height = 585
    44  Top = 372
    5   Width = 812
     5  Width = 846
    66  Caption = 'Generate contacts'
    7   ClientHeight = 562
    8   ClientWidth = 812
    9   DesignTimePPI = 144
     7  ClientHeight = 585
     8  ClientWidth = 846
     9  DesignTimePPI = 150
    1010  OnClose = FormClose
    1111  OnCreate = FormCreate
    1212  OnShow = FormShow
    13   LCLVersion = '2.0.12.0'
     13  LCLVersion = '2.2.0.4'
    1414  object Label1: TLabel
    15     Left = 19
    16     Height = 24
    17     Top = 19
    18     Width = 55
     15    Left = 20
     16    Height = 27
     17    Top = 20
     18    Width = 59
    1919    Caption = 'Count:'
    20     ParentColor = False
    2120    ParentFont = False
    2221  end
    2322  object SpinEditCount: TSpinEdit
    24     Left = 155
    25     Height = 42
    26     Top = 18
    27     Width = 152
     23    Left = 161
     24    Height = 43
     25    Top = 19
     26    Width = 158
    2827    MaxValue = 1000000000
    2928    MinValue = 1
     
    3332  end
    3433  object ButtonGenerate: TButton
    35     Left = 19
    36     Height = 37
    37     Top = 173
    38     Width = 113
     34    Left = 20
     35    Height = 39
     36    Top = 180
     37    Width = 118
    3938    Caption = 'Generate'
    4039    OnClick = ButtonGenerateClick
  • trunk/Forms/UFormGenerate.pas

    r69 r103  
    4646  for I := 1 to SpinEditCount.Value do begin
    4747    Contact := Contacts.AddNew;
    48     Contact.Fields[cfVersion] := '2.1';
     48    Contact.Fields[cfVersion] := Core.DefaultVcardVersion;
    4949    Contact.Fields[cfFirstName] := 'First ' + IntToStr(Random(10000));
    5050    Contact.Fields[cfLastName] := 'Last ' + IntToStr(Random(10000));
     
    5454  end;
    5555  Close;
     56  ModalResult := mrOk;
    5657end;
    5758
  • trunk/Forms/UFormProperties.pas

    r98 r103  
    205205begin
    206206  Core.PersistentForm1.Load(Self);
    207   Core.ThemeManager1.UseTheme(Self);
    208   Core.Translator.TranslateComponentRecursive(Self);
    209207  ReloadList;
    210208  UpdateInterface;
     
    352350  I: Integer;
    353351begin
     352  Core.Translator.TranslateComponentRecursive(Self);
     353  Core.ThemeManager1.UseTheme(Self);
     354
    354355  FProperties := nil;
    355356  for I := 0 to ToolBar1.ButtonCount - 1 do begin
  • trunk/Forms/UFormProperty.lfm

    r89 r103  
    11object FormProperty: TFormProperty
    22  Left = 760
    3   Height = 418
     3  Height = 435
    44  Top = 576
    5   Width = 726
     5  Width = 756
    66  Caption = 'Field'
    7   ClientHeight = 418
    8   ClientWidth = 726
    9   DesignTimePPI = 144
     7  ClientHeight = 435
     8  ClientWidth = 756
     9  DesignTimePPI = 150
    1010  OnClose = FormClose
    1111  OnCreate = FormCreate
    1212  OnShow = FormShow
    13   LCLVersion = '2.0.12.0'
     13  LCLVersion = '2.2.0.4'
    1414  object ButtonOk: TButton
    15     Left = 460
    16     Height = 37
    17     Top = 365
    18     Width = 119
     15    Left = 479
     16    Height = 39
     17    Top = 379
     18    Width = 124
    1919    Anchors = [akRight, akBottom]
    2020    Caption = 'OK'
     
    2525  end
    2626  object ButtonCancel: TButton
    27     Left = 596
    28     Height = 37
    29     Top = 365
    30     Width = 115
     27    Left = 620
     28    Height = 39
     29    Top = 379
     30    Width = 120
    3131    Anchors = [akRight, akBottom]
    3232    Caption = 'Cancel'
     
    3636  end
    3737  object Label1: TLabel
    38     Left = 24
    39     Height = 24
    40     Top = 80
    41     Width = 56
     38    Left = 25
     39    Height = 27
     40    Top = 83
     41    Width = 59
    4242    Caption = 'Name:'
    43     ParentColor = False
    4443  end
    4544  object EditName: TEdit
    46     Left = 168
    47     Height = 42
    48     Top = 72
    49     Width = 532
     45    Left = 175
     46    Height = 43
     47    Top = 75
     48    Width = 554
    5049    Anchors = [akTop, akLeft, akRight]
    5150    OnChange = EditNameChange
     
    5352  end
    5453  object Label2: TLabel
    55     Left = 24
    56     Height = 24
    57     Top = 128
    58     Width = 88
     54    Left = 25
     55    Height = 27
     56    Top = 133
     57    Width = 95
    5958    Caption = 'Attributes:'
    60     ParentColor = False
    6159  end
    6260  object EditAttributes: TEdit
    63     Left = 168
    64     Height = 42
    65     Top = 124
    66     Width = 532
     61    Left = 175
     62    Height = 43
     63    Top = 129
     64    Width = 554
    6765    Anchors = [akTop, akLeft, akRight]
    6866    OnChange = EditAttributesChange
     
    7068  end
    7169  object Label3: TLabel
    72     Left = 24
    73     Height = 24
    74     Top = 180
    75     Width = 60
     70    Left = 25
     71    Height = 27
     72    Top = 188
     73    Width = 64
    7674    Caption = 'Values:'
    77     ParentColor = False
    7875  end
    7976  object EditValues: TEdit
    80     Left = 168
    81     Height = 42
    82     Top = 172
    83     Width = 532
     77    Left = 175
     78    Height = 43
     79    Top = 179
     80    Width = 554
    8481    Anchors = [akTop, akLeft, akRight]
    8582    TabOrder = 3
    8683  end
    8784  object Label4: TLabel
    88     Left = 24
    89     Height = 24
    90     Top = 32
    91     Width = 45
     85    Left = 25
     86    Height = 27
     87    Top = 33
     88    Width = 48
    9289    Caption = 'Field:'
    93     ParentColor = False
    9490  end
    9591  object ComboBoxField: TComboBox
    96     Left = 168
    97     Height = 41
    98     Top = 24
    99     Width = 532
     92    Left = 175
     93    Height = 42
     94    Top = 25
     95    Width = 554
    10096    Anchors = [akTop, akLeft, akRight]
    10197    ItemHeight = 0
  • trunk/Forms/UFormProperty.pas

    r82 r103  
    101101  Core.Translator.TranslateComponentRecursive(Self);
    102102  Core.ThemeManager1.UseTheme(Self);
     103
    103104  FContactProperty := nil;
    104105  TContact.GetFields.LoadToStrings(ComboBoxField.Items);
  • trunk/Forms/UFormTest.pas

    r97 r103  
    3535    procedure ReloadList;
    3636    procedure UpdateInterface;
     37    procedure InitTestCases;
    3738  public
    3839    TestCases: TTestCases;
     
    7879  ARun.Enabled := Assigned(ListViewTestCases.Selected);
    7980  AShow.Enabled := Assigned(ListViewTestCases.Selected);
     81end;
     82
     83procedure TFormTest.InitTestCases;
     84const
     85  VCardVersion = 'VERSION:2.1';
     86begin
     87  TestCases := TTestCases.Create;
     88  with TestCases do begin
     89    with TTestCaseLoadSave(AddNew('Load and save', TTestCaseLoadSave)) do begin
     90      Input := VCardBegin + LineEnding +
     91        VCardVersion + LineEnding +
     92        'N:Surname;Name' + LineEnding +
     93        'FN:Name Surname' + LineEnding +
     94        VCardEnd + LineEnding;
     95      Output := Input;
     96    end;
     97    with TTestCaseLoadSave(AddNew('Long text', TTestCaseLoadSave)) do begin
     98      Input := VCardBegin + LineEnding +
     99        VCardVersion + LineEnding +
     100        'NOTE:This is some long test which is really multi-lined each line is on d' + LineEnding +
     101        ' ifferent line so it is on multiple lines.' + LineEnding +
     102        VCardEnd + LineEnding;
     103      Output := Input;
     104    end;
     105    with TTestCaseLoadSave(AddNew('Multi-line', TTestCaseLoadSave)) do begin
     106      Input := VCardBegin + LineEnding +
     107        VCardVersion + LineEnding +
     108        'NOTE:First line\nsecond line\nempty line\n\nlast line' + LineEnding +
     109        VCardEnd + LineEnding;
     110     Output := Input;
     111    end;
     112    with TTestCaseLoadSave(AddNew('Quoted-printable load-save', TTestCaseLoadSave)) do begin
     113      Input := VCardBegin + LineEnding +
     114        VCardVersion + LineEnding +
     115        'FN;ENCODING=QUOTED-PRINTABLE:Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=AD' + LineEnding +
     116        VCardEnd + LineEnding;
     117      Output := Input;
     118    end;
     119    with TTestCaseLoadSave(AddNew('Quoted-printable load-save multi-line', TTestCaseLoadSave)) do begin
     120      Input := VCardBegin + LineEnding +
     121        VCardVersion + LineEnding +
     122        'FN;ENCODING=QUOTED-PRINTABLE:Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=AD=' + LineEnding +
     123        'Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=AD' + LineEnding +
     124        VCardEnd + LineEnding;
     125      Output := Input;
     126    end;
     127    //AddNew('Encoding base64', TTestCaseLoadSave);
     128    //AddNew('Encoding quoted-printable', TTestCaseLoadSave);
     129    //AddNew('Image format', TTestCaseLoadSave);
     130    with TTestCaseLoadSave(AddNew('Empty', TTestCaseLoadSave)) do begin
     131      Input := '';
     132      Output := '';
     133    end;
     134    with TTestCaseLoadSave(AddNew('Begin only', TTestCaseLoadSave)) do begin
     135      Input := VCardBegin;
     136      Output := '';
     137    end;
     138    with TTestCaseLoadSave(AddNew('Missing end', TTestCaseLoadSave)) do begin
     139      Input := VCardBegin + LineEnding +
     140        VCardVersion + LineEnding +
     141        'N:Surname;Name' + LineEnding +
     142        'FN:Name Surname' + LineEnding;
     143      Output := '';
     144    end;
     145    with TTestCaseLoadSave(AddNew('Missing start', TTestCaseLoadSave)) do begin
     146      Input := VCardVersion + LineEnding +
     147        'N:Surname;Name' + LineEnding +
     148        'FN:Name Surname' + LineEnding +
     149        VCardEnd + LineEnding;
     150      Output := '';
     151    end;
     152    with TTestCaseCheckProperty(AddNew('Propery FN', TTestCaseCheckProperty)) do begin
     153      Index := cfFullName;
     154      Value := 'Name Surname';
     155      Input := VCardBegin + LineEnding +
     156        VCardVersion + LineEnding +
     157        'FN:' + Value + LineEnding +
     158        VCardEnd + LineEnding;
     159    end;
     160    with TTestCaseCheckProperty(AddNew('Escaped new lines in text', TTestCaseCheckProperty)) do begin
     161      Index := cfNote;
     162      Value := 'Line' + #13#10 + 'Line';
     163      Input := VCardBegin + LineEnding +
     164        VCardVersion + LineEnding +
     165        'NOTE:Line\nLine' + LineEnding +
     166        VCardEnd + LineEnding;
     167    end;
     168    with TTestCaseCheckProperty(AddNew('Compound value', TTestCaseCheckProperty)) do begin
     169      Index := cfFirstName;
     170      Value := 'FirstName';
     171      Input := VCardBegin + LineEnding +
     172        VCardVersion + LineEnding +
     173        'N:Surname;FirstName;;;' + LineEnding +
     174        VCardEnd + LineEnding;
     175    end;
     176    with TTestCaseCheckProperty(AddNew('Quoted-printable special symbols', TTestCaseCheckProperty)) do begin
     177      Index := cfFullName;
     178      Value := 'Jméno Příjmení';
     179      Input := VCardBegin + LineEnding +
     180        VCardVersion + LineEnding +
     181        'FN;ENCODING=QUOTED-PRINTABLE:Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=AD' + LineEnding +
     182        VCardEnd + LineEnding;
     183    end;
     184  end;
    80185end;
    81186
     
    115220
    116221procedure TFormTest.FormCreate(Sender: TObject);
    117 const
    118   VCardVersion = 'VERSION:2.1';
    119 begin
    120   TestCases := TTestCases.Create;
    121   with TestCases do begin
    122     with TTestCaseLoadSave(AddNew('Load and save', TTestCaseLoadSave)) do begin
    123       Input := VCardBegin + LineEnding +
    124         VCardVersion + LineEnding +
    125         'N:Surname;Name' + LineEnding +
    126         'FN:Name Surname' + LineEnding +
    127         VCardEnd + LineEnding;
    128       Output := Input;
    129     end;
    130     with TTestCaseLoadSave(AddNew('Long text', TTestCaseLoadSave)) do begin
    131       Input := VCardBegin + LineEnding +
    132         VCardVersion + LineEnding +
    133         'NOTE:This is some long test which is really multi-lined each line is on d' + LineEnding +
    134         ' ifferent line so it is on multiple lines.' + LineEnding +
    135         VCardEnd + LineEnding;
    136       Output := Input;
    137     end;
    138     with TTestCaseLoadSave(AddNew('Multi-line', TTestCaseLoadSave)) do begin
    139       Input := VCardBegin + LineEnding +
    140         VCardVersion + LineEnding +
    141         'NOTE:First line\nsecond line\nempty line\n\nlast line' + LineEnding +
    142         VCardEnd + LineEnding;
    143       Output := Input;
    144     end;
    145     with TTestCaseLoadSave(AddNew('Quoted-printable load-save', TTestCaseLoadSave)) do begin
    146       Input := VCardBegin + LineEnding +
    147         VCardVersion + LineEnding +
    148         'FN;ENCODING=QUOTED-PRINTABLE:Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=AD' + LineEnding +
    149         VCardEnd + LineEnding;
    150       Output := Input;
    151     end;
    152     with TTestCaseLoadSave(AddNew('Quoted-printable load-save multi-line', TTestCaseLoadSave)) do begin
    153       Input := VCardBegin + LineEnding +
    154         VCardVersion + LineEnding +
    155         'FN;ENCODING=QUOTED-PRINTABLE:Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=AD=' + LineEnding +
    156         'Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=AD' + LineEnding +
    157         VCardEnd + LineEnding;
    158       Output := Input;
    159     end;
    160     //AddNew('Encoding base64', TTestCaseLoadSave);
    161     //AddNew('Encoding quoted-printable', TTestCaseLoadSave);
    162     //AddNew('Image format', TTestCaseLoadSave);
    163     with TTestCaseLoadSave(AddNew('Empty', TTestCaseLoadSave)) do begin
    164       Input := '';
    165       Output := '';
    166     end;
    167     with TTestCaseLoadSave(AddNew('Begin only', TTestCaseLoadSave)) do begin
    168       Input := VCardBegin;
    169       Output := '';
    170     end;
    171     with TTestCaseLoadSave(AddNew('Missing end', TTestCaseLoadSave)) do begin
    172       Input := VCardBegin + LineEnding +
    173         VCardVersion + LineEnding +
    174         'N:Surname;Name' + LineEnding +
    175         'FN:Name Surname' + LineEnding;
    176       Output := '';
    177     end;
    178     with TTestCaseLoadSave(AddNew('Missing start', TTestCaseLoadSave)) do begin
    179       Input := VCardVersion + LineEnding +
    180         'N:Surname;Name' + LineEnding +
    181         'FN:Name Surname' + LineEnding +
    182         VCardEnd + LineEnding;
    183       Output := '';
    184     end;
    185     with TTestCaseCheckProperty(AddNew('Propery FN', TTestCaseCheckProperty)) do begin
    186       Index := cfFullName;
    187       Value := 'Name Surname';
    188       Input := VCardBegin + LineEnding +
    189         VCardVersion + LineEnding +
    190         'FN:' + Value + LineEnding +
    191         VCardEnd + LineEnding;
    192     end;
    193     with TTestCaseCheckProperty(AddNew('Escaped new lines in text', TTestCaseCheckProperty)) do begin
    194       Index := cfNote;
    195       Value := 'Line' + #13#10 + 'Line';
    196       Input := VCardBegin + LineEnding +
    197         VCardVersion + LineEnding +
    198         'NOTE:Line\nLine' + LineEnding +
    199         VCardEnd + LineEnding;
    200     end;
    201     with TTestCaseCheckProperty(AddNew('Compound value', TTestCaseCheckProperty)) do begin
    202       Index := cfFirstName;
    203       Value := 'FirstName';
    204       Input := VCardBegin + LineEnding +
    205         VCardVersion + LineEnding +
    206         'N:Surname;FirstName;;;' + LineEnding +
    207         VCardEnd + LineEnding;
    208     end;
    209     with TTestCaseCheckProperty(AddNew('Quoted-printable special symbols', TTestCaseCheckProperty)) do begin
    210       Index := cfFullName;
    211       Value := 'Jméno Příjmení';
    212       Input := VCardBegin + LineEnding +
    213         VCardVersion + LineEnding +
    214         'FN;ENCODING=QUOTED-PRINTABLE:Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=AD' + LineEnding +
    215         VCardEnd + LineEnding;
    216     end;
    217   end;
     222begin
     223  Core.Translator.TranslateComponentRecursive(Self);
     224  Core.ThemeManager1.UseTheme(Self);
     225
     226  InitTestCases;
    218227end;
    219228
  • trunk/Forms/UFormTestCase.lfm

    r91 r103  
    99  DesignTimePPI = 150
    1010  OnClose = FormClose
     11  OnCreate = FormCreate
    1112  OnShow = FormShow
    1213  LCLVersion = '2.2.0.4'
  • trunk/Forms/UFormTestCase.pas

    r91 r103  
    1515    MemoLog: TMemo;
    1616    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
     17    procedure FormCreate(Sender: TObject);
    1718    procedure FormShow(Sender: TObject);
    1819  private
     
    4041end;
    4142
     43procedure TFormTestCase.FormCreate(Sender: TObject);
     44begin
     45  Core.Translator.TranslateComponentRecursive(Self);
     46  Core.ThemeManager1.UseTheme(Self);
     47end;
     48
    4249procedure TFormTestCase.FormShow(Sender: TObject);
    4350begin
  • trunk/Languages/vCardStudio.cs.po

    r101 r103  
    100100
    101101#: tformcontact.aphotoclear.caption
     102msgctxt "tformcontact.aphotoclear.caption"
    102103msgid "Clear"
    103104msgstr "Vyčistit"
     
    113114msgstr "Uložit do souboru"
    114115
     116#: tformcontact.aphotoseturl.caption
     117msgid "Set URL"
     118msgstr "Nastavit URL"
     119
     120#: tformcontact.aphotoshow.caption
     121msgctxt "tformcontact.aphotoshow.caption"
     122msgid "Show"
     123msgstr "Ukázat"
     124
    115125#: tformcontact.buttoncancel.caption
    116126msgctxt "tformcontact.buttoncancel.caption"
     
    142152
    143153#: tformcontact.calendardialog1.cancelcaption
    144 #, fuzzy
    145154msgctxt "tformcontact.calendardialog1.cancelcaption"
    146155msgid "Cancel"
     
    157166
    158167#: tformcontact.caption
     168msgctxt "tformcontact.caption"
    159169msgid "Contact"
    160170msgstr "Kontakt"
     
    719729msgstr "Počet:"
    720730
     731#: tformimage.buttoncancel.caption
     732msgctxt "tformimage.buttoncancel.caption"
     733msgid "Cancel"
     734msgstr "Zrušit"
     735
     736#: tformimage.buttonclear.caption
     737msgctxt "tformimage.buttonclear.caption"
     738msgid "Clear"
     739msgstr "Vyčistit"
     740
     741#: tformimage.buttonload.caption
     742msgctxt "tformimage.buttonload.caption"
     743msgid "Load from file"
     744msgstr "Načíst ze souboru"
     745
     746#: tformimage.buttonok.caption
     747msgctxt "tformimage.buttonok.caption"
     748msgid "OK"
     749msgstr "OK"
     750
     751#: tformimage.buttonsave.caption
     752msgctxt "tformimage.buttonsave.caption"
     753msgid "Save to file"
     754msgstr "Uložit do souboru"
     755
     756#: tformimage.caption
     757msgctxt "tformimage.caption"
     758msgid "Photo"
     759msgstr "Fotka"
     760
     761#: tformimage.label1.caption
     762msgctxt "tformimage.label1.caption"
     763msgid "URL:"
     764msgstr "URL:"
     765
    721766#: tformmain.caption
    722767msgid "vCard Studio"
     
    906951
    907952#: tformtest.listviewtestcases.columns[0].caption
    908 #, fuzzy
    909953msgctxt "tformtest.listviewtestcases.columns[0].caption"
    910954msgid "Name"
     
    11311175
    11321176#: ucontact.sphoto
     1177msgctxt "ucontact.sphoto"
    11331178msgid "Photo"
    11341179msgstr "Fotka"
     
    13151360msgstr "Soubor"
    13161361
     1362#: uformcontact.scontact
     1363msgctxt "uformcontact.scontact"
     1364msgid "Contact"
     1365msgstr "Kontakt"
     1366
     1367#: uformcontact.sphotourl
     1368msgid "Photo URL"
     1369msgstr "URL fotky"
     1370
     1371#: uformcontact.sphotourlquery
     1372msgid "Enter URL for profile photo"
     1373msgstr "Zadejte URL pro profilovou fotku"
     1374
    13171375#: uformcontacts.sendupdatetoolow
    13181376msgid "Update counter error"
  • trunk/Languages/vCardStudio.pot

    r101 r103  
    9090
    9191#: tformcontact.aphotoclear.caption
     92msgctxt "tformcontact.aphotoclear.caption"
    9293msgid "Clear"
    9394msgstr ""
    9495
    9596#: tformcontact.aphotoload.caption
     97msgctxt "tformcontact.aphotoload.caption"
    9698msgid "Load from file"
    9799msgstr ""
    98100
    99101#: tformcontact.aphotosave.caption
     102msgctxt "tformcontact.aphotosave.caption"
    100103msgid "Save to file"
     104msgstr ""
     105
     106#: tformcontact.aphotoseturl.caption
     107msgid "Set URL"
     108msgstr ""
     109
     110#: tformcontact.aphotoshow.caption
     111msgctxt "tformcontact.aphotoshow.caption"
     112msgid "Show"
    101113msgstr ""
    102114
     
    144156
    145157#: tformcontact.caption
     158msgctxt "tformcontact.caption"
    146159msgid "Contact"
    147160msgstr ""
     
    697710msgstr ""
    698711
     712#: tformimage.buttoncancel.caption
     713msgctxt "tformimage.buttoncancel.caption"
     714msgid "Cancel"
     715msgstr ""
     716
     717#: tformimage.buttonclear.caption
     718msgctxt "tformimage.buttonclear.caption"
     719msgid "Clear"
     720msgstr ""
     721
     722#: tformimage.buttonload.caption
     723msgctxt "tformimage.buttonload.caption"
     724msgid "Load from file"
     725msgstr ""
     726
     727#: tformimage.buttonok.caption
     728msgctxt "tformimage.buttonok.caption"
     729msgid "OK"
     730msgstr ""
     731
     732#: tformimage.buttonsave.caption
     733msgctxt "tformimage.buttonsave.caption"
     734msgid "Save to file"
     735msgstr ""
     736
     737#: tformimage.caption
     738msgctxt "tformimage.caption"
     739msgid "Photo"
     740msgstr ""
     741
     742#: tformimage.label1.caption
     743msgctxt "tformimage.label1.caption"
     744msgid "URL:"
     745msgstr ""
     746
    699747#: tformmain.caption
    700748msgid "vCard Studio"
     
    11011149
    11021150#: ucontact.sphoto
     1151msgctxt "ucontact.sphoto"
    11031152msgid "Photo"
    11041153msgstr ""
     
    12831332msgstr ""
    12841333
     1334#: uformcontact.scontact
     1335msgctxt "uformcontact.scontact"
     1336msgid "Contact"
     1337msgstr ""
     1338
     1339#: uformcontact.sphotourl
     1340msgid "Photo URL"
     1341msgstr ""
     1342
     1343#: uformcontact.sphotourlquery
     1344msgid "Enter URL for profile photo"
     1345msgstr ""
     1346
    12851347#: uformcontacts.sendupdatetoolow
    12861348msgid "Update counter error"
  • trunk/UContact.pas

    r98 r103  
    66
    77uses
    8   Classes, SysUtils, fgl, Dialogs, UDataFile, LazUTF8, Base64;
     8  Classes, SysUtils, fgl, Dialogs, UDataFile, LazUTF8, Base64, Graphics;
    99
    1010type
     
    195195  VCardBegin = 'BEGIN:VCARD';
    196196  VCardEnd = 'END:VCARD';
     197  VCardBase64 = 'BASE64';
     198  VCardQuotedPrintable = 'QUOTED-PRINTABLE';
    197199
    198200
     
    571573  I: Integer;
    572574begin
    573   if Attributes.IndexOf('BASE64') <> -1 then begin
    574     Encoding := 'BASE64';
     575  if Attributes.IndexOf(VCardBase64) <> -1 then begin
     576    Encoding := VCardBase64;
    575577    Value := GetDecodedValue;
    576578  end else
    577579  if Attributes.IndexOfName('ENCODING') <> -1 then begin
    578580    Encoding := Attributes.Values['ENCODING'];
    579     if (Encoding = 'B') or (Encoding = 'b') then Encoding := 'BASE64';
    580     if (Encoding = 'Q') or (Encoding = 'q') then Encoding := 'QUOTED-PRINTABLE';
    581     if (Encoding = 'QUOTED-PRINTABLE') or (Encoding = 'BASE64') then begin
     581    if (Encoding = 'B') or (Encoding = 'b') then Encoding := VCardBase64;
     582    if (Encoding = 'Q') or (Encoding = 'q') then Encoding := VCardQuotedPrintable;
     583    if (Encoding = VCardQuotedPrintable) or (Encoding = VCardBase64) then begin
    582584      Value := GetDecodedValue;
    583585      Attributes.Delete(Attributes.IndexOfName('ENCODING'));
     
    600602function TContactProperty.GetDecodedValue: string;
    601603begin
    602   if Encoding = 'BASE64' then begin
     604  if Encoding = VCardBase64 then begin
    603605    Result := DecodeStringBase64(Value);
    604606  end else
    605   if Encoding = 'QUOTED-PRINTABLE' then begin
     607  if Encoding = VCardQuotedPrintable then begin
    606608    Result := DecodeQuotedPrintable(Value, True);
    607609  end
     
    611613function TContactProperty.GetEncodedValue: string;
    612614begin
    613   if Encoding = 'BASE64' then begin
     615  if Encoding = VCardBase64 then begin
    614616    Result := EncodeStringBase64(Value);
    615617  end else
    616   if Encoding = 'QUOTED-PRINTABLE' then begin
     618  if Encoding = VCardQuotedPrintable then begin
    617619    Result := EncodeQuotedPrintable(Value, True);
    618620  end
     
    11641166            if UTF8Length(OutText) > ContactsFile.MaxLineLength then begin
    11651167              CutLength := ContactsFile.MaxLineLength;
    1166               if Encoding = 'QUOTED-PRINTABLE' then begin
     1168              if Encoding = VCardQuotedPrintable then begin
    11671169                Dec(CutLength); // There will be softline break at the end
    11681170                // Do not cut encoded items at the end of line
     
    11751177              CutText := UTF8Copy(OutText, 1, CutLength);
    11761178              System.Delete(OutText, 1, Length(CutText));
    1177               if Encoding = 'QUOTED-PRINTABLE' then
     1179              if Encoding = VCardQuotedPrintable then
    11781180                CutText := CutText + QuotedPrintableEscapeCharacter; // Add soft line break
    11791181              Add(LinePrefix + CutText);
    1180               if Encoding <> 'QUOTED-PRINTABLE' then
     1182              if Encoding <> VCardQuotedPrintable then
    11811183                LinePrefix := ' ';
    11821184              Inc(LineIndex);
  • trunk/UCore.pas

    r101 r103  
    8282    LastContactTabIndex: Integer;
    8383    LastContactFileName: string;
     84    LastPhotoFileName: string;
    8485    LastPropertyValueFileName: string;
    8586    MapUrl: string;
     
    237238  try
    238239    Contacts := TContactsFile(DataFile).Contacts;
    239     ShowModal;
    240     FormContacts.ReloadList;
    241     FormContacts.UpdateInterface;
    242     DataFile.Modified := True;
    243     FormMain.UpdateInterface;
     240    if ShowModal = mrOk then begin
     241      FormContacts.ReloadList;
     242      FormContacts.UpdateInterface;
     243      DataFile.Modified := True;
     244      FormMain.UpdateInterface;
     245    end;
    244246  finally
    245247    Free;
     
    469471    DefaultVcardVersion := ReadStringWithDefault('DefaultVcardVersion', '2.1');
    470472    MapUrl := ReadStringWithDefault('MapUrl', 'https://www.openstreetmap.org/search?query=');
     473    LastPhotoFileName := ReadStringWithDefault('LastPhotoFileName', '');
    471474  finally
    472475    Free;
     
    497500    WriteString('DefaultVcardVersion', DefaultVcardVersion);
    498501    WriteString('MapUrl', MapUrl);
     502    WriteString('LastPhotoFileName', LastPhotoFileName);
    499503  finally
    500504    Free;
  • trunk/vCardStudio.lpi

    r92 r103  
    104104      </Item2>
    105105    </RequiredPackages>
    106     <Units Count="18">
     106    <Units Count="20">
    107107      <Unit0>
    108108        <Filename Value="vCardStudio.lpr"/>
     
    216216        <ResourceBaseClass Value="Form"/>
    217217      </Unit17>
     218      <Unit18>
     219        <Filename Value="Forms\UFormImage.pas"/>
     220        <IsPartOfProject Value="True"/>
     221        <ComponentName Value="FormImage"/>
     222        <HasResources Value="True"/>
     223        <ResourceBaseClass Value="Form"/>
     224      </Unit18>
     225      <Unit19>
     226        <Filename Value="UContactImage.pas"/>
     227        <IsPartOfProject Value="True"/>
     228      </Unit19>
    218229    </Units>
    219230  </ProjectOptions>
  • trunk/vCardStudio.lpr

    r98 r103  
    88  {$ENDIF}
    99  Interfaces, // this includes the LCL widgetset
    10   Forms, UFormMain, UCore, Common, SysUtils;
     10  Forms, UFormMain, UCore, Common, SysUtils, UFormImage, UContactImage;
    1111
    1212{$R *.res}
Note: See TracChangeset for help on using the changeset viewer.