Changeset 170 for trunk/Packages


Ignore:
Timestamp:
Jul 2, 2023, 11:07:39 PM (18 months ago)
Author:
chronos
Message:
  • Fixed: Show only supported import formats.
Location:
trunk/Packages
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/Table.pas

    r169 r170  
    99  TTableFormat = (tfExcel, tfPlain, tfCsv, tfHtml, tfListView, tfMediaWiki,
    1010    tfXml, tfJson);
     11  TTableFormats = set of TTableFormat;
    1112
    1213  { TRow }
     
    4243    procedure GetOutputListView(ListView: TListView);
    4344    function GetOutput(OutputFormat: TTableFormat): string;
    44     procedure SetInputTabs(Text: string);
    45     procedure SetInputPlain(Text: string);
    4645    procedure SetInputCsv(Text: string);
    47     procedure SetInputXml(Text: string);
    48     procedure SetInputHtml(Text: string);
    4946    procedure SetInputMediaWiki(Text: string);
    5047    procedure SetInputJson(Text: string);
    5148    procedure SetInput(OutputFormat: TTableFormat; Text: string);
     49    function GetInputFormats: TTableFormats;
    5250    constructor Create;
    5351    destructor Destroy; override;
     
    303301    else raise Exception.Create(SUnsupportedFormat);
    304302  end;
    305 end;
    306 
    307 procedure TTable.SetInputTabs(Text: string);
    308 begin
    309 
    310 end;
    311 
    312 procedure TTable.SetInputPlain(Text: string);
    313 begin
    314 
    315303end;
    316304
     
    339327    FreeAndNil(Lines);
    340328  end;
    341 end;
    342 
    343 procedure TTable.SetInputXml(Text: string);
    344 begin
    345 
    346 end;
    347 
    348 procedure TTable.SetInputHtml(Text: string);
    349 begin
    350 
    351329end;
    352330
     
    482460begin
    483461  case OutputFormat of
    484     tfExcel: SetInputTabs(Text);
    485     tfPlain: SetInputPlain(Text);
    486462    tfCsv: SetInputCsv(Text);
    487     tfHtml: SetInputHtml(Text);
    488463    tfMediaWiki: SetInputMediaWiki(Text);
    489     tfXml: SetInputXml(Text);
    490464    tfJson: SetInputJson(Text);
    491465    else raise Exception.Create(SUnsupportedFormat);
    492466  end;
     467end;
     468
     469function TTable.GetInputFormats: TTableFormats;
     470begin
     471  Result := [tfCsv, tfJson, tfMediaWiki];
    493472end;
    494473
  • trunk/Packages/VCard/VCard.pas

    r168 r170  
    698698  Lines := TStringList.Create;
    699699  Lines.LoadFromFile(FileName);
    700   {$IF FPC_FULLVERSION>=30200}
    701   if (Length(Lines.Text) > 0) and (Pos(VCardBegin, Lines.Text) = 0) then begin
    702     Lines.LoadFromFile(FileName, TEncoding.Unicode);
    703     if (Length(Lines.Text) > 0) and (Pos(VCardBegin, Lines.Text) = 0) then begin
    704       Lines.LoadFromFile(FileName, TEncoding.BigEndianUnicode);
    705     end;
    706   end;
    707   {$ENDIF}
    708700  try
    709701    ImportFromStrings(Lines, Format, HumanReadableHeader);
Note: See TracChangeset for help on using the changeset viewer.