Changeset 54


Ignore:
Timestamp:
Dec 8, 2021, 2:29:29 PM (2 years ago)
Author:
chronos
Message:
  • Added: Support for PNG encoded contact photos.
  • Added: Clone button on contact fields toolbar.
  • Added: Show open file dialog on photo click.
Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContact.lfm

    r52 r54  
    1818    Top = 8
    1919    Width = 939
    20     ActivePage = TabSheetAll
     20    ActivePage = TabSheetGeneral
    2121    Anchors = [akTop, akLeft, akRight, akBottom]
    2222    ParentFont = False
    23     TabIndex = 4
     23    TabIndex = 0
    2424    TabOrder = 0
    2525    object TabSheetGeneral: TTabSheet
     
    3232      object Label1: TLabel
    3333        Left = 240
    34         Height = 25
     34        Height = 24
    3535        Top = 80
    36         Width = 86
     36        Width = 94
    3737        Caption = 'First name:'
    3838        ParentColor = False
     
    4141      object EditFirstName: TEdit
    4242        Left = 360
    43         Height = 33
     43        Height = 42
    4444        Top = 72
    4545        Width = 155
     
    4949      object Label2: TLabel
    5050        Left = 16
    51         Height = 25
     51        Height = 24
    5252        Top = 250
    53         Width = 59
     53        Width = 63
    5454        Caption = 'Mobile:'
    5555        ParentColor = False
     
    5858      object EditMobile: TEdit
    5959        Left = 144
    60         Height = 33
     60        Height = 42
    6161        Top = 240
    6262        Width = 254
     
    6666      object EditPhone: TEdit
    6767        Left = 144
    68         Height = 33
     68        Height = 42
    6969        Top = 286
    7070        Width = 254
     
    7474      object Label3: TLabel
    7575        Left = 16
    76         Height = 25
     76        Height = 24
    7777        Top = 290
    78         Width = 54
     78        Width = 59
    7979        Caption = 'Phone:'
    8080        ParentColor = False
     
    8383      object EditEmail: TEdit
    8484        Left = 144
    85         Height = 33
     85        Height = 42
    8686        Top = 328
    8787        Width = 254
     
    9191      object Label4: TLabel
    9292        Left = 16
    93         Height = 25
     93        Height = 24
    9494        Top = 336
    95         Width = 53
     95        Width = 58
    9696        Caption = 'E-mail:'
    9797        ParentColor = False
     
    100100      object EditLastName: TEdit
    101101        Left = 671
    102         Height = 33
     102        Height = 42
    103103        Top = 72
    104104        Width = 155
     
    108108      object Label5: TLabel
    109109        Left = 536
    110         Height = 25
     110        Height = 24
    111111        Top = 80
    112         Width = 80
     112        Width = 87
    113113        Caption = 'Last name'
    114114        ParentColor = False
     
    117117      object EditBirthday: TEdit
    118118        Left = 144
    119         Height = 33
     119        Height = 42
    120120        Top = 424
    121121        Width = 254
     
    125125      object Label22: TLabel
    126126        Left = 16
    127         Height = 25
     127        Height = 24
    128128        Top = 432
    129         Width = 69
     129        Width = 76
    130130        Caption = 'Birthday:'
    131131        ParentColor = False
     
    138138        Width = 207
    139139        Center = True
     140        OnClick = APhotoLoadExecute
    140141        PopupMenu = PopupMenuPhoto
    141142        Proportional = True
     
    144145      object Label24: TLabel
    145146        Left = 240
    146         Height = 25
     147        Height = 24
    147148        Top = 32
    148         Width = 80
     149        Width = 88
    149150        Caption = 'Full name:'
    150151        ParentColor = False
     
    153154      object EditFullName: TEdit
    154155        Left = 360
    155         Height = 33
     156        Height = 42
    156157        Top = 24
    157158        Width = 467
     
    161162      object Label25: TLabel
    162163        Left = 536
    163         Height = 25
     164        Height = 24
    164165        Top = 128
    165         Width = 108
     166        Width = 116
    166167        Caption = 'Middle name:'
    167168        ParentColor = False
     
    170171      object EditMiddleName: TEdit
    171172        Left = 671
    172         Height = 33
     173        Height = 42
    173174        Top = 120
    174175        Width = 155
     
    178179      object Label26: TLabel
    179180        Left = 240
    180         Height = 25
     181        Height = 24
    181182        Top = 176
    182         Width = 93
     183        Width = 101
    183184        Caption = 'Title before:'
    184185        ParentColor = False
     
    187188      object EditTitleBefore: TEdit
    188189        Left = 360
    189         Height = 33
     190        Height = 42
    190191        Top = 168
    191192        Width = 155
     
    195196      object Label27: TLabel
    196197        Left = 536
    197         Height = 25
     198        Height = 24
    198199        Top = 176
    199         Width = 77
     200        Width = 85
    200201        Caption = 'Title after:'
    201202        ParentColor = False
     
    204205      object EditTitleAfter: TEdit
    205206        Left = 671
    206         Height = 33
     207        Height = 42
    207208        Top = 168
    208209        Width = 155
     
    212213      object Label44: TLabel
    213214        Left = 240
    214         Height = 25
     215        Height = 24
    215216        Top = 128
    216         Width = 82
     217        Width = 91
    217218        Caption = 'Nickname:'
    218219        ParentColor = False
     
    221222      object EditNickName: TEdit
    222223        Left = 360
    223         Height = 33
     224        Height = 42
    224225        Top = 120
    225226        Width = 155
     
    229230      object Label45: TLabel
    230231        Left = 432
    231         Height = 25
     232        Height = 24
    232233        Top = 432
    233         Width = 96
     234        Width = 105
    234235        Caption = 'Anniversary:'
    235236        ParentColor = False
     
    238239      object EditAniversary: TEdit
    239240        Left = 575
    240         Height = 33
     241        Height = 42
    241242        Top = 424
    242243        Width = 254
     
    246247      object Label9: TLabel
    247248        Left = 432
    248         Height = 25
     249        Height = 24
    249250        Top = 248
    250         Width = 29
     251        Width = 34
    251252        Caption = 'Fax:'
    252253        ParentColor = False
     
    255256      object EditFax: TEdit
    256257        Left = 575
    257         Height = 33
     258        Height = 42
    258259        Top = 240
    259260        Width = 254
     
    263264      object EditPager: TEdit
    264265        Left = 575
    265         Height = 33
     266        Height = 42
    266267        Top = 286
    267268        Width = 254
     
    271272      object Label10: TLabel
    272273        Left = 432
    273         Height = 25
     274        Height = 24
    274275        Top = 290
    275         Width = 48
     276        Width = 54
    276277        Caption = 'Pager:'
    277278        ParentColor = False
     
    280281      object Label46: TLabel
    281282        Left = 16
    282         Height = 25
     283        Height = 24
    283284        Top = 384
    284         Width = 107
     285        Width = 114
    285286        Caption = 'Web address:'
    286287        ParentColor = False
     
    289290      object EditWeb: TEdit
    290291        Left = 144
    291         Height = 33
     292        Height = 42
    292293        Top = 376
    293294        Width = 683
  • trunk/Forms/UFormContact.pas

    r50 r54  
    206206  Stream: TMemoryStream;
    207207  JpegImage: TJpegImage;
     208  PngImage: TPortableNetworkGraphic;
    208209begin
    209210  Contact.Fields[cfFullName] := EditFullName.Text;
     
    247248          JpegImage.Free;
    248249        end;
     250      end else
     251      if PhotoProperty.Attributes.IndexOf('PNG') <> -1 then begin
     252        PngImage := TPortableNetworkGraphic.Create;
     253        try
     254          try
     255            PngImage.SetSize(ImagePhoto.Picture.Bitmap.Width, ImagePhoto.Picture.Bitmap.Height);
     256            PngImage.Canvas.Draw(0, 0, ImagePhoto.Picture.Bitmap);
     257            PngImage.SaveToStream(Stream);
     258          except
     259          end;
     260        finally
     261          PngImage.Free;
     262        end;
    249263      end else begin
    250264        try
     
    274288  Photo: string;
    275289  JpegImage: TJpegImage;
     290  PngImage: TPortableNetworkGraphic;
    276291  Stream: TMemoryStream;
    277292  PhotoProperty: TContactProperty;
     
    319334            JpegImage.Free;
    320335          end;
     336        end else
     337        if PhotoProperty.Attributes.IndexOf('PNG') <> -1 then begin
     338          PngImage := TPortableNetworkGraphic.Create;
     339          try
     340            try
     341              PngImage.LoadFromStream(Stream);
     342              with ImagePhoto.Picture.Bitmap do begin
     343                PixelFormat := pf24bit;
     344                SetSize(PngImage.Width, PngImage.Height);
     345                Canvas.Draw(0, 0, PngImage);
     346              end;
     347              ProfilePhotoActive := True;
     348            except
     349              ProfilePhotoActive := False;
     350            end;
     351          finally
     352            PngImage.Free;
     353          end;
    321354        end else begin
    322355          try
  • trunk/Forms/UFormProperties.lfm

    r52 r54  
    6565    end
    6666    object ToolButton3: TToolButton
     67      Left = 106
     68      Top = 2
     69      Action = ARemove
     70    end
     71    object ToolButton4: TToolButton
    6772      Left = 71
    6873      Top = 2
    69       Action = ARemove
     74      Action = AClone
    7075    end
    7176  end
  • trunk/Forms/UFormProperties.pas

    r51 r54  
    3434    ToolButton2: TToolButton;
    3535    ToolButton3: TToolButton;
     36    ToolButton4: TToolButton;
    3637    procedure AAddExecute(Sender: TObject);
    3738    procedure ACloneExecute(Sender: TObject);
  • trunk/Install/snap/snapcraft.yaml

    r29 r54  
    77 
    88  Features:
    9   * Add, Edit, Remove contacts
     9  * Add, Edit, Clone, Remove contacts
    1010  * Merge files together
    1111  * Find duplicate contacts
  • trunk/UContact.pas

    r53 r54  
    333333  if Attributes.IndexOfName('ENCODING') <> -1 then begin
    334334    Encoding := Attributes.Values['ENCODING'];
     335    if (Encoding = 'B') or (Encoding = 'b') then Encoding := 'BASE64';
     336    if (Encoding = 'Q') or (Encoding = 'q') then Encoding := 'QUOTED-PRINTABLE';
    335337    if (Encoding = 'QUOTED-PRINTABLE') or (Encoding = 'BASE64') then begin
    336338      Value := GetDecodedValue;
    337339      Attributes.Delete(Attributes.IndexOfName('ENCODING'));
    338     end;
     340    end else
    339341  end else Encoding := '';
    340342
     
    347349    if Attributes.Names[I] = 'TYPE' then
    348350      Attributes.Strings[I] := Attributes.Values['TYPE'];
     351    if Attributes.Names[I] = 'type' then
     352      Attributes.Strings[I] := Attributes.Values['type'];
    349353  end;
    350354end;
Note: See TracChangeset for help on using the changeset viewer.