program SMAIL;

{%ToDo 'SMAIL.todo'}

uses
  Forms,
  Graphics,
  Controls,
  SysUtils,
  IniFiles,
  PMLanguage in 'PMLanguage.pas',
  Main in 'Main.pas' {MainForm},
  BASE64Sup in 'BASE64Sup.pas',
  MailParser in 'MailParser.pas',
  PXStuff in 'PXStuff.pas',
  FMMailOptions in 'FMMailOptions.pas' {MailOptionsForm},
  ParserSup in 'ParserSup.pas',
  DateSup in 'DateSup.pas',
  FMAccount in 'FMAccount.pas' {AccountForm},
  FMFolder in 'FMFolder.pas' {FolderForm},
  FMOnline in 'FMOnline.pas' {OnlineForm},
  FMEnviro in 'FMEnviro.pas' {EnviroForm},
  FMInfo in 'FMInfo.pas' {InfoForm},
  FMSplash in 'FMSplash.pas' {SplashForm},
  FMTips in 'FMTips.pas' {TipsForm},
  FMSelectMail in 'FMSelectMail.pas' {SelectMailForm},
  FMAddress in 'FMAddress.pas' {AddressForm},
  FMEditAdr in 'FMEditAdr.pas' {EditAdrForm},
  FMDirectory in 'FMDirectory.pas' {DirectoryForm},
  FMSelBook in 'FMSelBook.pas' {SelBookForm},
  FMSearch in 'FMSearch.pas' {menSearchForm},
  FMStdMail in 'FMStdMail.pas' {StdMailForm},
  TDOnline in 'TDOnline.pas',
  UUCode in 'UUCode.pas',
  DropSource in 'DropSource.pas',
  FMMoveMessage in 'FMMoveMessage.pas' {frmMoveMessage},
  FMSelDate in 'FMSelDate.pas' {FormSelDate},
  FMTemplate in 'FMTemplate.pas' {TemplateForm},
  FMSearchX in 'FMSearchX.pas' {SearchAdvanced},
  pmclasses in 'pmclasses.pas',
  pmmatcher in 'pmmatcher.pas',
  FMToDoProp in 'FMToDoProp.pas' {ToDoProperties},
  FMCats in 'FMCats.pas' {CatEditor},
  pmToDo in 'pmToDo.pas',
  FMToDOEx in 'FMToDOEx.pas' {ToDoEx},
  FMCustomizer in 'FMCustomizer.pas' {CustomizeTB},
  hedform in 'hedform.pas' {DHEDForm},
  IEConst in 'ieconst.pas',
  AccountStep in 'AccountStep.pas' {stepform},
  ViewMail in 'ViewMail.pas' {ViewMailFrm},
  SaveAttach in 'SaveAttach.pas' {frmSaveAttach},
  ShowError in 'ShowError.pas' {FrmShowError},
  NewFold in 'NewFold.pas' {FrmNewFold},
  WabApi in 'WabApi.pas',
  WabDefs in 'WabDefs.pas',
  WabIab in 'WabIab.pas',
  WabTags in 'WabTags.pas',
  WabCode in 'WabCode.pas',
  uoexpress in 'uoexpress.pas',
  SearchMail in 'SearchMail.pas' {FrmSearchMail},
  Rename in 'Rename.pas' {FrmRename};

// MSHTML_TLB0 in 'MSHTML_TLB0.pas';

{$R *.RES}

var
  i: integer;
begin
  Application.Initialize;
  if CheckForPrevInstance = False then Exit;
  if CheckCDROMStart = False then begin
    ClearUpCheckForPrevInstance;
    Exit;
  end;
  CheckColorDepth;
  if (ParamCount = 0) then begin
    SplashForm := TSplashForm.Create(Application);
    //SplashForm.Show;
    SplashForm.ShowNextStep;
    Application.ProcessMessages;
  end;
  if (ParamCount = 0) then SplashForm.ShowNextStep;
  InitializePX;

  if (ParamCount = 0) then SplashForm.ShowNextStep;
  CheckForStandardEMailProgram;

  if (ParamCount = 0) then SplashForm.ShowNextStep;

  for i := 1 to ParamCount do begin
    if CompareText(ParamStr(i), '-min') = 0 then
      bStartMin := true;
    if pos('@',ParamStr(i))>0 then
    begin
      sLinkMail:=ParamStr(i);
      sLinkMail:=copy(sLinkMail,pos(':',sLinkMail)+1,length(sLinkMail));
      continue;
    end;

    sParamStr:=copy(ParamStr(i),2,length(ParamStr(i)));

  end;

  if (ParamCount = 0) then SplashForm.ShowNextStep;
  Application.Title := 'SMAIL';
  Application.CreateForm(TMainForm, MainForm);
  if (ParamCount = 0) then SplashForm.ShowNextStep;
  Application.CreateForm(TMailOptionsForm, MailOptionsForm);
  if (ParamCount = 0) then SplashForm.ShowNextStep;
  Application.CreateForm(TAddressForm, AddressForm);

  if (ParamCount = 0) then SplashForm.ShowNextStep;

  if Assigned(LangHolder) then
  begin
    if LangHolder.Language <> '' then
    begin
      LangHolder.Translate([MainForm, MailOptionsForm, AddressForm]);
    end;
  end;

  if (ParamCount = 0) then  SplashForm.ShowNextStep;
  Application.ProcessMessages;

  if (ParamCount = 0) then
    SplashForm.Free;

  if bStartMin then begin
    Application.ShowMainForm := False;
    MainForm.AppMinimize(Application);
  end
  else
  begin
    MainForm.Show;
    if ParamCount = 0 then
    begin
      if bShowTips then begin
        TipsForm := TTipsForm.Create(Application);
        if Assigned(LangHolder) then
        begin
          if LangHolder.Language <> '' then
            LangHolder.Translate([TipsForm]);
        end;
        TipsForm.ShowModal;
        TipsForm.Free;
      end;
    end;
  end;
  if MainForm.GetActualAccount = nil then
    MainForm.actAccountNewExecute(Application);
  if bGoOnlineAtStart then MainForm.OnlineSession(otGoOnline);
  Application.Run;
  ClearUpPX;
end.

