unit attention;

interface

uses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
  Forms, Dialogs, ComCtrls, ExtCtrls, StdCtrls, FileCtrl, Spin, Buttons,
  shellApi, iniFiles, Menus, WinHelpViewer, XPMan, LabelLien, Printers,
  Registry, DKLang;

type
  TOKRightDlg = class(TForm)
    OKBtn: TButton;
    CancelBtn: TButton;
    Bevel1: TBevel;
    Label1: TLabel;
    Label2: TLabel;
    XPManifest1: TXPManifest;
    DKLanguageController1: TDKLanguageController;
    procedure FormCreate(Sender: TObject);
    procedure OKBtnClick(Sender: TObject);
    procedure CancelBtnClick(Sender: TObject);
  private
    { Déclarations privées }
  public
    { Déclarations publiques }
  end;

var
  OKRightDlg: TOKRightDlg;
  FIni: TiniFile;
  FIniasso: Tinifile;
implementation

uses Main, Unit2;

{$R *.dfm}
//////////////////////////////////////////////////////////////////////////////
//                            fonction taille de fichier                    //
//////////////////////////////////////////////////////////////////////////////


procedure TOKRightDlg.FormCreate(Sender: TObject);
begin
FIni:=TiniFile.Create(ExtractFilePath(Application.ExeName)+'profils.ini');
FIniasso:=TiniFile.Create(ExtractFilePath(Application.ExeName)+'MultiConfig.ini');
end;

procedure TOKRightDlg.CancelBtnClick(Sender: TObject);
begin
OKRightDlg.hide;
end;

procedure TOKRightDlg.OKBtnClick(Sender: TObject);
var cle: string;
    TempVar:TstringList;
begin
      if fileexists(ExtractFilePath(Application.ExeName)+'fichiers\'+Form1.ComboBox1.Text+'_fichier.1') then DeleteFile(ExtractFilePath(Application.ExeName)+'fichiers\'+Form1.ComboBox1.Text+'_fichier.1');
      if fileexists(ExtractFilePath(Application.ExeName)+'fichiers\'+Form1.ComboBox1.Text+'_fichier.2') then DeleteFile(ExtractFilePath(Application.ExeName)+'fichiers\'+Form1.ComboBox1.Text+'_fichier.2');
      if fileexists(ExtractFilePath(Application.ExeName)+'fichiers\'+Form1.ComboBox1.Text+'_fichier.3') then DeleteFile(ExtractFilePath(Application.ExeName)+'fichiers\'+Form1.ComboBox1.Text+'_fichier.3');
      if fileexists(ExtractFilePath(Application.ExeName)+'fichiers\'+Form1.ComboBox1.Text+'_fichier.4') then DeleteFile(ExtractFilePath(Application.ExeName)+'fichiers\'+Form1.ComboBox1.Text+'_fichier.4');
      if fileexists(ExtractFilePath(Application.ExeName)+'fichiers\'+Form1.ComboBox1.Text+'_fichier.5') then DeleteFile(ExtractFilePath(Application.ExeName)+'fichiers\'+Form1.ComboBox1.Text+'_fichier.5');
      cle:=FIni.ReadString(Form1.ComboBox1.Text, 'Application', 'loupé');
      FIniAsso.DeleteKey(cle,Form1.ComboBox1.Text);
      FIniAsso.DeleteKey('PAGEKEY',Form1.ComboBox1.Text);
      FIni.EraseSection(Form1.ComboBox1.Text);

      {test si il n'y a plus d'autre profil}
      TempVar:=Tstringlist.Create;
      FIni.ReadSections(TempVar);
      if TempVar.count=0 then
      begin
      Deletefile(ExtractFilePath(Application.ExeName)+'profils.ini');
      Deletefile(ExtractFilePath(Application.ExeName)+'MultiConfig.ini');
      Form1.Hide;
      OKRightDlg.Hide;
      Form2.Label3.Caption:='OK';
      Form2.Show;
      end
      {fin test si il n'y a plus d'autre profil}
      else
      {traitement des pages visibles, et des cadres}
      begin
      Form1.PageControl1.Pages[0].TabVisible := True;
      Form1.PageControl1.Pages[3].TabVisible := True;
      Form1.PageControl1.Pages[4].TabVisible := True;
      Form1.PageControl1.ActivePageIndex := 4;
      Form1.ComboBox2.Clear;
      Form1.ComboBox2.Text:='Choisissez un profil';
      FIni.ReadSections(Form1.ComboBox2.Items);
      Form1.ComboBox1.Clear;
      Form1.ComboBox1.Text:='Choisissez un profil';
      FIni.ReadSections(Form1.ComboBox1.Items);
     Form1.GroupBox15.Visible:=False;
     Form1.CheckBox3.Visible:=False;
     Form1.Edit15.Text:='';
     Form1.Edit16.Text:='';
     Form1.Edit17.Text:='';
     Form1.Edit18.Text:='';
     Form1.Edit19.Text:='';
     Form1.Edit8.Text:='';
     Form1.Edit9.Text:='';
     Form1.Edit10.Text:='';
     Form1.Edit11.Text:='';
     Form1.Edit12.Text:='';
     Form1.Edit13.Text:='';
     Form1.Edit14.Text:='';
  Form1.Label12.Visible:=false;
  Form1.Label24.Visible:=false;
  Form1.Label13.Caption:='';
  Form1.Label29.Caption:='';
  Form1.Label14.Visible:=false;
  Form1.Label25.Visible:=false;
  Form1.Label18.Caption:='';
  Form1.Label30.Caption:='';
  Form1.Label15.Visible:=false;
  Form1.Label26.Visible:=false;
  Form1.Label19.Caption:='';
  Form1.Label31.Caption:='';
  Form1.Label16.Visible:=false;
  Form1.Label27.Visible:=false;
  Form1.Label20.Caption:='';
  Form1.Label32.Caption:='';
  Form1.Label17.Visible:=false;
  Form1.Label28.Visible:=false;
  Form1.Label21.Caption:='';
  Form1.Label33.Caption:='';
      OKRightDlg.hide;
      end;
end;
end.
