Ignore:
Timestamp:
Aug 26, 2022, 8:09:41 PM (2 years ago)
Author:
chronos
Message:
  • Fixed: Wrong assignment during openning contact image form.
  • Fixed: QR code generation error if contact text is too big (with photo or logo).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContact.pas

    r133 r139  
    171171    OpenPictureDialog1: TOpenPictureDialog;
    172172    PageControlContact: TPageControl;
     173    PanelNotes: TPanel;
     174    PanelQrCode: TPanel;
    173175    PopupMenuQrCode: TPopupMenu;
    174176    PopupMenuPhoto: TPopupMenu;
     
    182184    SpeedButtonWorkEmail: TSpeedButton;
    183185    SpeedButtonWorkWeb: TSpeedButton;
     186    Splitter1: TSplitter;
    184187    TabSheetAll: TTabSheet;
    185188    TabSheetChat: TTabSheet;
     
    206209    procedure ImagePhotoClick(Sender: TObject);
    207210    procedure MenuItemSaveQrToFileClick(Sender: TObject);
     211    procedure PanelQrCodeResize(Sender: TObject);
    208212    procedure SpeedButtonHomeWebClick(Sender: TObject);
    209213    procedure SpeedButtonAniversaryClick(Sender: TObject);
     
    378382end;
    379383
     384procedure TFormContact.PanelQrCodeResize(Sender: TObject);
     385begin
     386  BarcodeQR1.SetBounds(BarcodeQR1.Left, BarcodeQR1.Top,
     387    PanelQrCode.Width - BarcodeQR1.Left * 2,
     388    PanelQrCode.Width - BarcodeQR1.Left * 2);
     389end;
     390
    380391procedure TFormContact.SpeedButtonHomeWebClick(Sender: TObject);
    381392begin
     
    563574
    564575procedure TFormContact.TabSheetOthersShow(Sender: TObject);
     576var
     577  ContactWithoutImages: TContact;
    565578begin
    566579  MemoNotes.Lines.Text := Contact.Fields[cfNote];
    567580  BarcodeQR1.Text := Contact.AsString;
     581  if BarcodeQR1.ErrorString <> '' then begin
     582    ContactWithoutImages := TContact.Create;
     583    try
     584      ContactWithoutImages.Assign(Contact);
     585      ContactWithoutImages.ParentVCard := Contact.ParentVCard;
     586      while ContactWithoutImages.HasField(cfPhoto) do
     587        ContactWithoutImages.Fields[cfPhoto] := '';
     588      while ContactWithoutImages.HasField(cfLogo) do
     589        ContactWithoutImages.Fields[cfLogo] := '';
     590      BarcodeQR1.Text := ContactWithoutImages.AsString;
     591      if BarcodeQR1.ErrorString <> '' then begin
     592        BarcodeQR1.Text := '';
     593        BarcodeQR1.Visible := False;
     594      end else BarcodeQR1.Visible := True;
     595    finally
     596      ContactWithoutImages.Free;
     597    end;
     598  end else BarcodeQR1.Visible := True;
    568599end;
    569600
     
    819850
    820851  // Set Barcode unpublished properties
    821   BarcodeQR1.Anchors := [akTop, akRight];
     852  BarcodeQR1.Anchors := [akTop, akLeft];
    822853  BarcodeQR1.PopupMenu := PopupMenuQrCode;
    823854end;
Note: See TracChangeset for help on using the changeset viewer.