Changeset 168 for trunk/Forms


Ignore:
Timestamp:
Jul 1, 2023, 8:17:50 PM (18 months ago)
Author:
chronos
Message:
Location:
trunk/Forms
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormExport.pas

    r167 r168  
    3636    Table: TTable;
    3737    RedrawPending: Boolean;
    38     procedure PrepareTable;
    3938    procedure UpdateFileNameExt;
    4039    procedure LoadConfig;
     
    6261begin
    6362  TableFormat := TTableFormat(ComboBoxOutputFormat.Items.Objects[ComboBoxOutputFormat.ItemIndex]);
    64   SaveStringToFile(Table.GetOutput(TableFormat), EditOutputFile.Text);
     63  TVCardFile(Core.Core.DataFile).VCard.ExportToFile(EditOutputFile.Text, TableFormat,
     64    CheckBoxHumanReadableHeader.Checked);
    6565end;
    6666
     
    118118begin
    119119  if RedrawPending then begin
    120     PrepareTable;
     120    TVCardFile(Core.Core.DataFile).VCard.ExportToTable(Table,
     121      CheckBoxHumanReadableHeader.Checked);
    121122    Table.GetOutputListView(ListView1);
    122123    RedrawPending := False;
    123   end;
    124 end;
    125 
    126 procedure TFormExport.PrepareTable;
    127 var
    128   Row: TRow;
    129   I: Integer;
    130   J: Integer;
    131   Values: TStringList;
    132   Index: Integer;
    133   Fields: TContactFields;
    134   Field: TContactField;
    135   Columns: TStringList;
    136 begin
    137   Fields := TContact.GetFields;
    138   Table.Clear;
    139 
    140   Values := TStringList.Create;
    141   Columns := TStringList.Create;
    142   try
    143     with TVCardFile(Core.Core.DataFile), VCard do begin
    144       Table.Title := ExtractFileNameWithoutExt(FileName);
    145 
    146       // Get all properties types
    147       for I := 0 to Contacts.Count - 1 do begin
    148         for J := 0 to Contacts[I].Properties.Count - 1 do
    149         if not Contacts[I].Properties[J].Name.StartsWith('PHOTO') and
    150           (Table.Columns.IndexOf(Contacts[I].Properties[J].Name) = -1) then begin
    151             Table.Columns.Add(Contacts[I].Properties[J].Name);
    152             Columns.Add(Contacts[I].Properties[J].Name);
    153           end;
    154       end;
    155 
    156       if CheckBoxHumanReadableHeader.Checked then begin
    157         for I := 0 to Table.Columns.Count - 1 do begin
    158           Field := Fields.GetBySysName(Table.Columns[I]);
    159           if Assigned(Field) then Table.Columns[I] := Field.Title;
    160         end;
    161       end;
    162 
    163       for I := 0 to Contacts.Count - 1 do begin
    164         Values.Clear;
    165         for J := 0 to Columns.Count - 1 do
    166           Values.Add('');
    167         for J := 0 to Contacts[I].Properties.Count - 1 do begin
    168           Index := Columns.IndexOf(Contacts[I].Properties[J].Name);
    169           if Index <> -1 then
    170             Values[Index] := Contacts[I].Properties[J].Value;
    171         end;
    172 
    173         Row := Table.AddRow;
    174         for J := 0 to Values.Count - 1 do
    175           Row.Cells.Add(Values[J]);
    176       end;
    177     end;
    178   finally
    179     Values.Free;
    180     Columns.Free;
    181124  end;
    182125end;
  • trunk/Forms/FormImage.lfm

    r165 r168  
    5151    Anchors = [akLeft, akBottom]
    5252    Caption = 'Clear'
    53     OnClick = uttonClearClick
     53    OnClick = ButtonClearClick
    5454    TabOrder = 2
    5555  end
    5656  object EditUrl: TEdit
    5757    Left = 84
    58     Height = 33
    59     Top = 426
     58    Height = 43
     59    Top = 416
    6060    Width = 610
    6161    Anchors = [akLeft, akRight, akBottom]
     
    8585  object Label1: TLabel
    8686    Left = 16
    87     Height = 25
    88     Top = 432
    89     Width = 35
     87    Height = 26
     88    Top = 431
     89    Width = 38
    9090    Anchors = [akLeft, akBottom]
    9191    Caption = 'URL:'
  • trunk/Forms/FormImage.pas

    r162 r168  
    2222    OpenPictureDialog1: TOpenPictureDialog;
    2323    SavePictureDialog1: TSavePictureDialog;
    24     procedure uttonClearClick(Sender: TObject);
     24    procedure ButtonClearClick(Sender: TObject);
    2525    procedure ButtonLoadClick(Sender: TObject);
    2626    procedure ButtonSaveClick(Sender: TObject);
     
    6767end;
    6868
    69 procedure TFormImage.uttonClearClick(Sender: TObject);
     69procedure TFormImage.ButtonClearClick(Sender: TObject);
    7070begin
    7171  Image.Clear;
  • trunk/Forms/FormImport.lfm

    r167 r168  
    8080      Width = 464
    8181      Anchors = [akTop, akLeft, akRight]
     82      OnChange = EditInputFileChange
    8283      TabOrder = 1
    8384    end
  • trunk/Forms/FormImport.pas

    r167 r168  
    2727    procedure ButtonImportClick(Sender: TObject);
    2828    procedure ComboBoxInputFormatChange(Sender: TObject);
     29    procedure EditInputFileChange(Sender: TObject);
    2930    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    3031    procedure FormCreate(Sender: TObject);
     
    4748
    4849uses
    49   Core, Common, RegistryEx, VCardFile;
     50  Core, Common, RegistryEx, VCardFile, VCard;
    5051
    5152{ TFormImport }
     
    6162begin
    6263  TableFormat := TTableFormat(ComboBoxInputFormat.Items.Objects[ComboBoxInputFormat.ItemIndex]);
    63   Table.SetInput(TableFormat, LoadFileToStr(EditInputFile.Text));
    64   Table.Title := ExtractFileNameWithoutExt(EditInputFile.Text);
     64  TVCardFile(Core.Core.DataFile).VCard.ImportFromFile(EditInputFile.Text, TableFormat,
     65    CheckBoxHumanReadableHeader.Checked);
    6566end;
    6667
     
    6869begin
    6970  UpdateTableFormat;
     71end;
     72
     73procedure TFormImport.EditInputFileChange(Sender: TObject);
     74begin
     75  RedrawPending := True;
    7076end;
    7177
Note: See TracChangeset for help on using the changeset viewer.