Changeset 103 for trunk/UContact.pas


Ignore:
Timestamp:
Feb 9, 2022, 3:51:26 PM (3 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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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);
Note: See TracChangeset for help on using the changeset viewer.