Ignore:
Timestamp:
Feb 3, 2022, 10:30:03 PM (3 years ago)
Author:
chronos
Message:
  • Fixed: Non-string properties were incorrectly escaped.
  • Modified: Avoid loading and storing contact image during switching tabs.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContact.pas

    r77 r93  
    203203  private
    204204    FProfilePhotoActive: Boolean;
     205    FProfilePhotoLoaded: Boolean;
     206    FProfilePhotoModified: Boolean;
    205207    procedure SetProfilePhotoActive(AValue: Boolean);
    206208  private
     
    240242  FormProperties.Align := alClient;
    241243  FormProperties.Show;
     244
     245  FProfilePhotoLoaded := False;
    242246
    243247  // Force to load default profile image
     
    320324
    321325  // Photo
     326  if FProfilePhotoModified then begin
    322327  if ProfilePhotoActive then begin
    323328    PhotoProperty := Contact.GetProperty(cfPhoto);
     
    388393       Contact.Properties.Remove(PhotoProperty);
    389394  end;
     395    FProfilePhotoModified := False;
     396  end;
    390397
    391398  ReloadAllPropertiesTab;
     
    421428  // Photo
    422429  PhotoProperty := Contact.GetProperty(cfPhoto);
     430  if not FProfilePhotoLoaded then begin
    423431  if Assigned(PhotoProperty) then begin
     432    FProfilePhotoLoaded := True;
     433    FProfilePhotoModified := True;
    424434    Photo := Contact.Fields[cfPhoto];
    425435    if (Photo <> '') and (PhotoProperty.Encoding <> '') then begin
     
    497507    end else ProfilePhotoActive := False;
    498508  end else ProfilePhotoActive := False;
     509  end;
    499510end;
    500511
     
    662673  if OpenPictureDialog1.Execute then begin
    663674    ImagePhoto.Picture.LoadFromFile(OpenPictureDialog1.FileName);
     675    FProfilePhotoModified := True;
     676    FProfilePhotoLoaded := True;
    664677    ProfilePhotoActive := True;
    665678  end;
     
    668681procedure TFormContact.APhotoClearExecute(Sender: TObject);
    669682begin
     683  FProfilePhotoModified := True;
    670684  ProfilePhotoActive := False;
    671685end;
Note: See TracChangeset for help on using the changeset viewer.