Subversion Repositories autosfx

Rev

Blame | Last modification | View Log | RSS feed

  1. unit ExtractorPassword;
  2.  
  3. {$WARN UNIT_PLATFORM OFF}
  4.  
  5. interface
  6.  
  7. uses
  8.   Forms, Controls, StdCtrls, Classes, FileCtrl, SysUtils;
  9.  
  10. type
  11.   TPasswordDlg = class(TForm)
  12.     PwEnterLabel: TLabel;
  13.     Password: TEdit;
  14.     OKBtn: TButton;
  15.     CancelBtn: TButton;
  16.     FileLabel: TLabel;
  17.     CurrentFileLabel: TLabel;
  18.     TryLabel: TLabel;
  19.     procedure OKBtnClick(Sender: TObject);
  20.     procedure FormShow(Sender: TObject);
  21.   public
  22.     function ShowModal(Filename: String; TryNo, MaxTries: Integer): Integer; reintroduce;
  23.   end;
  24.  
  25. var
  26.   PasswordDlg: TPasswordDlg;
  27.  
  28. implementation
  29.  
  30. {$R *.dfm}
  31.  
  32. procedure TPasswordDlg.FormShow(Sender: TObject);
  33. begin
  34.   Password.Text := '';
  35.   Password.SetFocus;
  36. end;
  37.  
  38. procedure TPasswordDlg.OKBtnClick(Sender: TObject);
  39. begin
  40.   ModalResult := mrOk;
  41. end;
  42.  
  43. function TPasswordDlg.ShowModal(Filename: String; TryNo, MaxTries: Integer): Integer;
  44. resourcestring
  45.   Lng_Try = 'Versuch %d / %d';
  46. begin
  47.   CurrentFileLabel.Caption := MinimizeName(Filename, CurrentFileLabel.Canvas, CurrentFileLabel.Width);
  48.   TryLabel.Caption := Format(Lng_Try, [TryNo, MaxTries]);
  49.   result := inherited ShowModal;
  50. end;
  51.  
  52. end.
  53.  
  54.