unit MFMail;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  SRVTabSet, RVScroll, RichView, RVStyle, SRVToolBar, SRVControl, CRVFData,
  SRVListBox, ExtCtrls, SRVPanel, SRVComboBox, ImgList, SRVSkinManager,
  RVTable, ShellAPI;

type
  TFileInfo = record
    FileName : string;
    FileType : string;
    Icon : TIcon;
    FileSize : Integer;
  end;

  TMail = record
    FromEMail : string;
    ToEMail : string;
    Title : string;
    FileBody : string;
    Files : array [0..10] of String;
  end;

  TfrmMail = class(TForm)
    Splitter1: TSplitter;
    RVStyle1: TRVStyle;
    RVStyle2: TRVStyle;
    Panel1: TPanel;
    SRVPanel1: TSRVPanel;
    lstFolders: TSRVListBox;
    cmbUsers: TSRVComboBox;
    Splitter2: TSplitter;
    SRVPanel3: TSRVPanel;
    SRVToolBar1: TSRVToolBar;
    rvEmails: TRichView;
    Panel2: TPanel;
    SRVPanel2: TSRVPanel;
    rvMailInfo: TRichView;
    Panel3: TPanel;
    Splitter3: TSplitter;
    SRVPanel4: TSRVPanel;
    SRVPanel5: TSRVPanel;
    rvMailBody: TRichView;
    rvFiles: TRichView;
    ilGlyphs: TImageList;
    SRVSkinManager1: TSRVSkinManager;
    tsFilter1: TSRVTabSet;
    tsFilter2: TSRVTabSet;
    ilFolders: TImageList;
    ilFileIcons: TImageList;
    ilStatus: TImageList;
    procedure rvEmailsRVMouseUp(Sender: TCustomRichView;
      Button: TMouseButton; Shift: TShiftState; ItemNo, X, Y: Integer);
    procedure rvEmailsMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure FormCreate(Sender: TObject);
    procedure rvFilesJump(Sender: TObject; id: Integer);
    procedure FormDestroy(Sender: TObject);
    procedure rvEmailsKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
    Mails : array of TMail;
    HighlightedRow, SelectedRow: Integer;
    EmailListTable: TRVTableItemInfo;
  public
    { Public declarations }
    function  GetFileInfo(FileName : String) : TFileInfo;
    function  AddTitleRow(Title: TStringList; Lengths : array of Integer) : TRVTableItemInfo;
    procedure AddMailRow(table : TRVTableItemInfo; slMailInfo: TStringList);
    procedure PreviewMail(FromEMail, ToEMail, Title, FileBody : String;
      slFiles: TStringList);
    procedure SetRowColor(Row: Integer; Color: TColor);
    procedure HighlightRow(Row: Integer);
    procedure SelectRow(Row: Integer);
  end;

var
  frmMail: TfrmMail;