{/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Original author:
* - Pavel Cvrcek <jasnapaka@jasnapaka.com>
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */}

unit okna;

interface

//******************************************************************************
// Deklarace public procedur a funkci
//******************************************************************************

procedure DefaultL10n;

// dialog c. 1 - uvitani v pruvodci
procedure Okno1;
// dialog c. 2 - volba operace
procedure Okno2;
// dialog c. 3 - volba profilu
procedure Okno3;
// dialog c. 4 - volba soucasti, ktere se budou zalohovat (obnovovat)
procedure Okno4;
// dialog c. 5 - provadeni akci
procedure Okno5;
// dialog c. 6 - zaver
procedure Okno6;


// okno na vyber externiho profilu
//procedure Profil_okno;

implementation

//******************************************************************************
// Deklarace pouzitych unit
//******************************************************************************

uses hlavni, dialogs, forms, funkce, jp_registry, jp_windows, sysutils,
windows, Config, heslo, ZipMstr19, zaloha, JPDialogs, UnknowFilesBL, UnknowFiles,
classes, UnknowItem, Functions, ProgressWindow, Graphics, MozUtils, WinUtils;


var unknowFilesL: TUnknowFilesBL;

//******************************************************************************
// Procedury a funkce
//******************************************************************************

procedure DefaultL10n;
begin
  Form1.Button1.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_BUTTON_1');
  Form1.Button2.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_BUTTON_2');
  Form1.Button3.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_BUTTON_3');
end;


//******************************************************************************
// procedure Okno1
//
// - nastaveni 1. dialogu - uvitani
//******************************************************************************

procedure Okno1;
begin
  // l10n
  DefaultL10n;

  Form1.Caption:= Config.APPLICATION_NAME + Config.l10n.getL10nString ('TForm1', 'LANG_OKNO_1');

  Form1.Label1.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_APLIKACE_WELCOME');
  Form1.StaticText7.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_MEMO1');
  Form1.StaticText8.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_MEMO11');
  Form1.StaticText9.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_MEMO12');

  // set size and bold manually in designer -> need set font 
  Form1.Label1.Font.Name:= Config.l10n.getDefaultFont();
  Form1.Label1.Font.Charset:= Config.l10n.getDefaultCharset();

  // nastaveni vystupniho souboru
  Form1.Vyst_soubor:= '';
  //Form1.Ukoncit:= false;

  // nastaveni prvku na formulari
  Form1.Panel1.Visible:= true;
  Form1.Panel2.Visible:= false;
  Form1.Panel6.Visible:= false;
  Form1.Button1.Enabled:= true;
  Form1.Button1.Visible:= true;
  Form1.Button2.Visible:= true;
  Form1.Button3.Visible:= false;
  
  // nastaveni promennych
  Form1.Okno:= 1;
  Form1.Chyba:= false;          // chyba nenastala
end;

//******************************************************************************
// procedure Okno2
//
// - nastaveni 2. dialogu - volba operace
//******************************************************************************

procedure Okno2;
begin
  // l10n
  Form1.Caption:= Config.APPLICATION_NAME + Config.l10n.getL10nString ('TForm1', 'LANG_APLIKACE_VOLBA');

  Form1.GroupBox1.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_VOLBA'); 
  Form1.RadioButton1.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_ZALOHA');
  Form1.RadioButton2.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_OBNOVA');

  Form1.StaticText1.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CO_PROVEST');
  Form1.StaticText10.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_MEMO2');

  // nastaveni prvku na formulari
  Form1.Panel3.Visible:= false;
  Form1.Panel2.Visible:= true;
  Form1.Panel1.Visible:= false;
  Form1.Button3.Visible:= true;

  
  DetekceKomponent;                                   // detekce nainstalovanych aplikaci
  Over_program;                                       // je detekovan nejaky program? ne - program bude ukoncen

  if Form1.ListBox1.Items.Count > 0 then
    begin
      Form1.ListBox1.Selected[0]:= true;
    end;
  Form1.ListBox1.SetFocus;

  Over_vyber;
end;


//******************************************************************************
// procedure Okno3
//
// - nastaveni 3. dialogu - volba profilu
//******************************************************************************

procedure Okno3;
begin
  // volba operace
  if (Form1.RadioButton1.Checked) then Form1.Akce:= 1 else Form1.Akce:= 2;

  // nastaveni Caption okna
  Form1.Caption:= Config.APPLICATION_NAME + Config.l10n.getL10nString ('TForm1', 'LANG_VOLBA_PROFILU');

  Form1.Button5.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_NEW_PROFIL');
  Form1.Button6.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_RELOAD');
  Form1.Button7.Caption:= Config.l10n.getL10nString ('MozBackup14', 'LANG_PORTABLE');  

  if (Form1.Akce = 1) then
    begin
      Form1.GroupBox2.Caption:= Config.l10n.getL10nString ('MozBackup14', 'LANG_CHOOSE_FILE_BACKUP');
    end
  else
    begin
      Form1.GroupBox2.Caption:= Config.l10n.getL10nString ('MozBackup14', 'LANG_CHOOSE_FILE_RESTORE');
    end;

  // set size and bold manually in designer -> need set font
  Form1.GroupBox2.Font.Name:= Config.l10n.getDefaultFont();
  Form1.GroupBox2.Font.Charset:= Config.l10n.getDefaultCharset();
  Form1.StaticText3.Font.Name:= Config.l10n.getDefaultFont();
  Form1.StaticText3.Font.Charset:= Config.l10n.getDefaultCharset();
  Form1.Button4.Font.Name:= Config.l10n.getDefaultFont();
  Form1.Button4.Font.Charset:= Config.l10n.getDefaultCharset();


  //Form1.GroupBox2.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHOOSE_FILE');
  Form1.Button4.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHOOSE');

  // nastaveni prvku na formulari
  if (Length (Programy[Form1.Typ_programu].Cesta) <> 0) and (Form1.Akce = 2) then
  Form1.Button5.Enabled:= true else Form1.Button5.Enabled:= false;

  Form1.Panel3.Visible:= true;
  Form1.Panel4.Visible:= false;
  Form1.Panel2.Visible:= false;
  Form1.Panel1.Visible:= false;
  Form1.Button1.Enabled:= false;
  Form1.ListBox2.Sorted:= true;

  // nastaveni jazykovych veci
  if Form1.Akce = 1 then
    begin
      Form1.StaticText2.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_TEXT2_1');
      Form1.StaticText4.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_TEXT4_1');
    end
  else
    begin
      Form1.StaticText2.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_TEXT2_2');
      Form1.StaticText4.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_TEXT4_2');
    end;

  DetekceProfilu;               // provede detekci profilu
  
  if Form1.ListBox2.Items.Count > 0 then
    begin
      Form1.ListBox2.Selected[0]:= true;
    end;
  Form1.ListBox2.SetFocus;

  Over_vyber_profilu;           // je vybran nejaky profil?
  NastavSoubor;                 // Nastavi vystupni soubor
end;


procedure FindUnknowFilesInProfile;
var unknowItem: TUnknowItem;
    unknowFilesList: TList;
    I: integer;
begin
   UnknowFilesFM.CheckListBox1.Clear;
   unknowFilesList:= nil;

   // clean
   if unknowFilesL <> nil then
     begin
       unknowFilesL.Destroy;
     end;
   if unknowFilesList <> nil then
     begin
       unknowFilesList.Destroy;
     end;
   
   unknowFilesL:= TUnknowFilesBL.Create();
   unknowFilesList:= unknowFilesL.getUnknowFiles(Form1.Slozka_data);
   if (unknowFilesList.Count > 0) then
     begin
       Form1.UnknowFilesBT.Visible:= true;
       for I := 0 to unknowFilesList.Count - 1 do
         begin
           unknowItem:= unknowFilesList[i];
           if unknowItem.isDirectory() then
             begin
               UnknowFilesFM.CheckListBox1.Items.Add(unknowItem.getFilename + ' (' + Config.l10n.getL10nString ('MozBackup14', 'LANG_DIRECTORY') + ')');
             end
           else
             begin
               UnknowFilesFM.CheckListBox1.Items.Add(unknowItem.getFilename);
             end;
          end;

        // set all as checked
        UnknowFilesFM.CheckBox1.Checked:= true;
        UnknowFilesFM.ResetItems();
        for I := 0 to UnknowFilesFM.CheckListBox1.Items.Count - 1 do
          begin
            UnknowFilesFM.CheckListBox1.Checked[i]:= true;
          end;
      end
        else
          begin
            Form1.UnknowFilesBT.Visible:= false;
          end;
end;

//******************************************************************************
// procedure Okno4
//
// - nastaveni 4. dialogu - volba soucasti
//******************************************************************************

procedure Okno4;
var Pokracovat: boolean;
    i: integer;
    unknowItem: TUnknowItem;
    App1, App2: String;
    Disc: String;
begin
  Pokracovat:= true;

  // Test if profile was selected
  if Form1.ListBox2.ItemIndex = -1 then
    begin
      showErrorDialog(Config.l10n.getL10nString ('TForm1', 'LANG_QUESTION'),
                      Config.l10n.getL10nString ('MozBackup15', 'LANG_NO_PROFILE_SELECTION'));
      Dec (Form1.Okno);
    end
  else
    begin

 // prepsat zalozni soubor? - pri zalohovani
 if (Form1.Akce = 1) and (FileExists (Form1.Vyst_soubor)) then
   begin
     if showQuestionDialog(Config.l10n.getL10nString ('TForm1', 'LANG_QUESTION'),
                           Config.l10n.getL10nString ('TForm1', 'LANG_SOUBOR_EXIST')) = 7 then
     begin
        Pokracovat:= false;
     end;
   end;

 // existuje zalozni soubor? - pri obnoveni profilu
 if (Form1.Akce = 2) then
   begin
     if (not FileExists (Form1.Vyst_soubor)) then
       begin
         showErrorDialog(Config.l10n.getL10nString ('TForm1', 'LANG_ERROR'),
                       Config.l10n.getL10nString ('TForm1', 'LANG_BACKUP_NOT_FOUND'));
         Pokracovat:= false;
       end
     else if (not IsValidFile (Form1.Vyst_soubor)) then
       begin
         showErrorDialog(Config.l10n.getL10nString ('TForm1', 'LANG_ERROR'),
                       Config.l10n.getL10nString ('TForm1', 'LANG_NO_BACKUP_FILE'));
         Pokracovat:= false;
       end
     else if (not IsValidFileForApp(Form1.Vyst_soubor, Form1.Typ_programu)) then
       begin
         App1:= GetApplicationNameOrderById (Form1.Typ_programu);
         App2:= GetApplicationNameOrderById (Form1.BackupAppVersion);
         
         showErrorDialog(Config.l10n.getL10nString ('TForm1', 'LANG_ERROR'),
                       Config.l10n.getL10nString ('MozBackup15', 'LANG_INVALID_BACKUP_VERSION', App1, App2));
         Pokracovat:= false;
       end;

   end;

 // Show warn when user wants to backup on drive with FAT32 system
  Disc:= ExtractFileDrive (Form1.Vyst_soubor);
  ShowMessage (IntToStr (Pos(GetHardDiskPartitionType(Disc[1]), 'FAT')));
  if (Form1.Akce = 1) and (Pos(GetHardDiskPartitionType(Disc[1]), 'FAT') > 0) then
    begin
      ShowMessage ('FAT32');
    end;

  SaveDirectory (Form1.Vyst_soubor, Form1.Typ_programu);   

 if Pokracovat then begin

 // zaheslovat archiv? - pri zalohovani
 if (Form1.Akce=1) and (Form1.AskForPassword) and (showQuestionDialog(Config.l10n.getL10nString ('TForm1', 'LANG_QUESTION'),
                            Config.l10n.getL10nString ('TForm4', 'LANG_ENCRYPT')) = IDYES) then
   begin
     Form4.Edit1.Clear;
     Form4.Edit2.Clear;
     Form1.Password:= '';
     Form4.Potvrzeno:= false;
     Form4.Font.Charset:= Form1.Jazyk;
     Form4.Label1.Caption:= Config.l10n.getL10nString ('TForm4', 'LANG_TEXT');
     Form4.Caption:= Config.l10n.getL10nString ('TForm4', 'LANG_CAPTION');
     Form4.Label2.Caption:= Config.l10n.getL10nString ('TForm4', 'LANG_HESLO');
     Form4.Label3.Caption:= Config.l10n.getL10nString ('TForm4', 'LANG_HESLO2');
     Form4.Button1.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_BUTTON_OK');
     Form4.Button2.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_BUTTON_2');

     Form4.ShowModal;

     if Form4.Potvrzeno = true then
       begin
         Form1.Password:= Form4.Edit1.Text;
       end;
   end;

 if (FileExists (Form1.Vyst_soubor)) or (Form1.RadioButton1.Checked) then
    begin
      // "vynulovani" checkboxu
      NastavCheckboxy;
      // detekce soucasti urcenych k zalohovani (ci obnoveni)
      Form1.Pocet_extern:= 1;
      if Form1.Akce = 1 then DetekceSoucasti else DetekceSoucastiSoubor;

      // nastaveni Caption okna
      Form1.Caption:= Config.APPLICATION_NAME + Config.l10n.getL10nString ('TForm1', 'LANG_SOUCASTI');

      // nastaveni prvku na formulari
      Form1.Panel4.Visible:= true;
      Form1.Panel5.Visible:= false;
      Form1.Panel3.Visible:= false;

      // nastaveni jazykove
      if Form1.Akce = 1 then Form1.StaticText5.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHOOSE_ZALOHA')
      else Form1.StaticText5.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHOOSE_OBNOVA');

      Form1.GroupBox3.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_GROUPBOX3');
      Form1.CheckBox1.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHECKBOX1');
      Form1.CheckBox2.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHECKBOX2');
      Form1.CheckBox3.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHECKBOX3');
      Form1.CheckBox4.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHECKBOX4');
      Form1.CheckBox5.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHECKBOX5');
      Form1.CheckBox6.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHECKBOX6');
      Form1.CheckBox7.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHECKBOX7');
      Form1.CheckBox8.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHECKBOX8');
      Form1.CheckBox9.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHECKBOX9');
      Form1.CheckBox10.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHECKBOX10');
      Form1.CheckBox11.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHECKBOX11');
      Form1.CheckBox12.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHECKBOX12');
      Form1.CheckBox13.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHECKBOX13');
      Form1.CheckBox14.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHECKBOX14');
      Form1.CheckBox14.Hint:= Config.l10n.getL10nString ('TForm1', 'LANG_CHECKBOX14_HINT');
      Form1.CheckBox15.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_CHECKBOX15');
      Form1.UnknowFilesBT.Caption:= Config.l10n.getL10nString ('MozBackup14', 'LANG_UNKNOW_FILES');

      if Form1.Akce = 2 then Form1.CheckBox7.Visible:= false;

      if Form1.Akce = 1 then
        begin
          FindUnknowFilesInProfile;
        end
      else
        // restore action
        begin
          if Form1.UnknowFiles.Count > 0 then
            begin
              Form1.UnknowFilesBT.Visible:= true;
              UnknowFilesFM.CheckListBox1.Clear;

              for I := 0 to Form1.UnknowFiles.Count - 1 do
                begin
                  unknowItem:= TUnknowItem (Form1.UnknowFiles[i]);
                  if (unknowItem.isDirectory()) then
                    begin
                      UnknowFilesFM.CheckListBox1.Items.Add(unknowItem.getFilename() + ' ('+ Config.l10n.getL10nString ('MozBackup14', 'LANG_DIRECTORY') + ')');
                    end
                  else
                    begin
                      UnknowFilesFM.CheckListBox1.Items.Add(unknowItem.getFilename());
                    end;
                end;

              // set all as checked
              for I := 0 to UnknowFilesFM.CheckListBox1.Items.Count - 1 do
                begin
                  UnknowFilesFM.CheckListBox1.Checked[i]:= true;
                end;              
            end
          else
            begin
              Form1.UnknowFilesBT.Visible:= false;
            end;
      end;
    end
  else
    begin
      showWarningDialog(Config.l10n.getL10nString ('TForm1', 'LANG_WARNING'),
                        Config.l10n.getL10nString ('TForm1', 'LANG_BAD_FILE2'));
      Dec (Form1.Okno);
    end;
  end   // "pokracovat"
  else Dec (Form1.Okno);

  end;
end;


//******************************************************************************
// procedure Okno5
//
// - nastaveni 5. dialogu - akce
//******************************************************************************

procedure Okno5;
begin
  if IsRunCommandLineVersion then 
    begin
      FindUnknowFilesInProfile;
    end;

  Form1.Caption:= Config.APPLICATION_NAME + Config.l10n.getL10nString ('TForm1', 'LANG_PROV_AKCE');

  // add parts which are backuped
  if (Form1.Akce = 1) then
    begin
      ProgressWindowAddListMessage(Config.l10n.getL10nString('MozBackup14', 'LANG_BACKUP_PARTS'));
      if (Form1.CheckBox1.Checked) then ProgressWindowAddListMessage ('- ' + Config.l10n.getL10nString('TForm1', 'LANG_CHECKBOX1'));
      if (Form1.CheckBox2.Checked) then ProgressWindowAddListMessage ('- ' + Config.l10n.getL10nString('TForm1', 'LANG_CHECKBOX2'));
      if (Form1.CheckBox3.Checked) then ProgressWindowAddListMessage ('- ' + Config.l10n.getL10nString('TForm1', 'LANG_CHECKBOX3'));
      if (Form1.CheckBox4.Checked) then ProgressWindowAddListMessage ('- ' + Config.l10n.getL10nString('TForm1', 'LANG_CHECKBOX4'));
      if (Form1.CheckBox5.Checked) then ProgressWindowAddListMessage ('- ' + Config.l10n.getL10nString('TForm1', 'LANG_CHECKBOX5'));
      if (Form1.CheckBox6.Checked) then ProgressWindowAddListMessage ('- ' + Config.l10n.getL10nString('TForm1', 'LANG_CHECKBOX6'));
      if (Form1.CheckBox7.Checked) then ProgressWindowAddListMessage ('- ' + Config.l10n.getL10nString('TForm1', 'LANG_CHECKBOX7'));
      if (Form1.CheckBox8.Checked) then ProgressWindowAddListMessage ('- ' + Config.l10n.getL10nString('TForm1', 'LANG_CHECKBOX8'));
      if (Form1.CheckBox9.Checked) then ProgressWindowAddListMessage ('- ' + Config.l10n.getL10nString('TForm1', 'LANG_CHECKBOX9'));
      if (Form1.CheckBox10.Checked) then ProgressWindowAddListMessage ('- ' + Config.l10n.getL10nString('TForm1', 'LANG_CHECKBOX10'));
      if (Form1.CheckBox11.Checked) then ProgressWindowAddListMessage ('- ' + Config.l10n.getL10nString('TForm1', 'LANG_CHECKBOX11'));
      if (Form1.CheckBox12.Checked) then ProgressWindowAddListMessage ('- ' + Config.l10n.getL10nString('TForm1', 'LANG_CHECKBOX12'));
      if (Form1.CheckBox13.Checked) then ProgressWindowAddListMessage ('- ' + Config.l10n.getL10nString('TForm1', 'LANG_CHECKBOX13'));
      if (Form1.CheckBox14.Checked) then ProgressWindowAddListMessage ('- ' + Config.l10n.getL10nString('TForm1', 'LANG_CHECKBOX14'));
      if (Form1.CheckBox15.Checked) then ProgressWindowAddListMessage ('- ' + Config.l10n.getL10nString('TForm1', 'LANG_CHECKBOX15'));
      Form1.StaticText6.Caption:= Config.l10n.getL10nString('MozBackup14', 'LANG_DISK_SPACE_CALCULATE');
    end;

  Form1.Panel5.Visible:= true;
  Form1.Panel4.Visible:= false;
  Form1.Button1.Visible:= false;
  Form1.Button3.Visible:= false;
end;


//******************************************************************************
// procedure Okno6
//
// - nastaveni 6. dialogu - zaver
//******************************************************************************

procedure Okno6;
var I: integer;
begin
  if IsRunCommandLineVersion() then
    begin
      Application.Terminate;
    end;

  Form1.Caption:= Config.APPLICATION_NAME + Config.l10n.getL10nString ('TForm1', 'LANG_ZAVER');
  Form1.Button2.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_BUTTON_KONEC');
  Form1.CheckBox16.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_NEW_BR');

  if Form1.Akce = 1 then
    begin
      if not (Form1.BackupFailed) then
        begin
          Form1.StaticText11.Font.Style:= Form1.StaticText11.Font.Style - [fsBold];
          Form1.StaticText11.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_MEMO3');
        end
      else
        begin
          Form1.StaticText11.Font.Style:= Form1.StaticText11.Font.Style + [fsBold];
          Form1.StaticText11.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_BACKUP_FAILED');
        end;
    end
  else
    begin
      Form1.StaticText11.Caption:= Config.l10n.getL10nString ('TForm1', 'LANG_BACKUP_RESTOR');
    end;


  // set info about result of backup/restore
  if (((Form1.Akce = 1) and (Form1.BackupFailed = false)) or (Form1.Akce = 2)) then
    begin
      for I:= 0 to Form1.ListBox3.Count - 1 do
        Form1.ListBox4.Items.Add(Form1.ListBox3.Items.Strings[i]);
    end
  else
    begin
      Form1.ListBox4.Clear;
    end;

  Form1.Panel6.Visible:= true;
  Form1.Panel5.Visible:= false;
  Form1.Button2.SetFocus;

  if Form1.Akce = 2 then
    begin
      Form1.StaticText11.Caption:= (Config.l10n.getL10nString ('TForm1', 'LANG_BACKUP_RESTOR'));
    end;

  // smazani souboru s informaci o obsahu zalozniho souboru
  if (Form1.Akce = 2) and (fileexists (GetSpecialDir (11) + 'indexfile.txt')) then SysUtils.DeleteFile (GetSpecialDir (11) + 'indexfile.txt');
end;

end.
