Changeset 152 for trunk/Packages/VCard


Ignore:
Timestamp:
Jun 6, 2023, 5:05:18 PM (16 months ago)
Author:
chronos
Message:
  • Added: VCardProcessor class for processing contacts available from VCard package.
  • Added: Normalize menu action for normalization of contact property values.
Location:
trunk/Packages/VCard
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/VCard/VCard.lpk

    r148 r152  
    5757        <UnitName Value="VCardPackage"/>
    5858      </Item>
     59      <Item>
     60        <Filename Value="VCardProcessor.pas"/>
     61        <UnitName Value="VCardProcessor"/>
     62      </Item>
    5963    </Files>
    6064    <i18n>
  • trunk/Packages/VCard/VCard.pas

    r151 r152  
    12981298var
    12991299  I: Integer;
     1300  ContactProperty: TContactProperty;
    13001301begin
    13011302  inherited Sort(TComparer<TContact>.Construct(CompareContactFullName));
    1302   for I := 0 to Count - 1 do
     1303  for I := 0 to Count - 1 do begin
    13031304    Items[I].Properties.Sort(TComparer<TContactProperty>.Construct(ComparePropertyName));
     1305
     1306    // Make sure VERSION is first property
     1307    ContactProperty := Items[I].Properties.GetByName('VERSION');
     1308    if Assigned(ContactProperty) then begin
     1309      Items[I].Properties.Move(Items[I].Properties.IndexOf(ContactProperty), 0);
     1310    end;
     1311  end;
    13041312end;
    13051313
     
    17911799  LinePrefix: string;
    17921800  CutLength: Integer;
     1801  Cut: Boolean;
    17931802begin
    17941803  with Output do begin
     
    18141823        LineIndex := 0;
    18151824        LinePrefix := '';
     1825        Cut := False;
    18161826        while True do begin
    18171827          if UTF8Length(OutText) > ParentVCard.MaxLineLength then begin
     1828            Cut := True;
    18181829            CutLength := ParentVCard.MaxLineLength;
    18191830            if Encoding = veQuotedPrintable then begin
     
    18371848          end else begin
    18381849            Add(LinePrefix + OutText);
     1850            if Cut then Add('');
    18391851            Break;
    18401852          end;
  • trunk/Packages/VCard/VCardPackage.pas

    r148 r152  
    99
    1010uses
    11   VCard, QuotedPrintable, ContactImage, LazarusPackageIntf;
     11  VCard, QuotedPrintable, ContactImage, VCardProcessor, LazarusPackageIntf;
    1212
    1313implementation
Note: See TracChangeset for help on using the changeset viewer.