home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2 - Developers' Solutions / Delphi 2 Developers' Solutions.iso / dds / chap10 / howto01 / delphi10 / cciccprf.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-06-12  |  5.2 KB  |  177 lines

  1. unit Cciccprf;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, FileCtrl, TabNotBk, StdCtrls, Buttons, ExtCtrls;
  8.  
  9. type
  10.   TCCICPrefsDlg = class(TForm)
  11.     TabbedNotebook1: TTabbedNotebook;
  12.     OKBtn: TBitBtn;
  13.     CancelBtn: TBitBtn;
  14.     HelpBtn: TBitBtn;
  15.     RadioGroup1: TRadioGroup;
  16.     RadioGroup2: TRadioGroup;
  17.     RadioGroup3: TRadioGroup;
  18.     RadioGroup4: TRadioGroup;
  19.     RadioGroup5: TRadioGroup;
  20.     RadioGroup6: TRadioGroup;
  21.     Edit1: TEdit;
  22.     Label1: TLabel;
  23.     CheckBox1: TCheckBox;
  24.     RadioGroup7: TRadioGroup;
  25.     RadioGroup8: TRadioGroup;
  26.     RadioGroup9: TRadioGroup;
  27.     RadioGroup10: TRadioGroup;
  28.     CheckBox2: TCheckBox;
  29.     OpenDialog1: TOpenDialog;
  30.     Label8: TLabel;
  31.     Edit6: TEdit;
  32.     Button6: TButton;
  33.     Label9: TLabel;
  34.     Edit7: TEdit;
  35.     Button7: TButton;
  36.     Label11: TLabel;
  37.     Edit9: TEdit;
  38.     Button9: TButton;
  39.     CheckBox3: TCheckBox;
  40.     procedure OKBtnClick(Sender: TObject);
  41.     procedure FormShow(Sender: TObject);
  42.     procedure Button6Click(Sender: TObject);
  43.     procedure Button7Click(Sender: TObject);
  44.     procedure Button9Click(Sender: TObject);
  45.   private
  46.     { Private declarations }
  47.   public
  48.     { Public declarations }
  49.   end;
  50.  
  51. var
  52.   CCICPrefsDlg: TCCICPrefsDlg;
  53.  
  54. implementation
  55.  
  56. {$R *.DFM}
  57. uses CCICCFrm;
  58.  
  59. procedure TCCICPrefsDlg.OKBtnClick(Sender: TObject);
  60. begin
  61.   case Tag of
  62.     2 : begin
  63.           if CheckBox1.Checked then
  64.           begin
  65.             PasswordControlVector := 1;
  66.           end
  67.           else
  68.           begin
  69.             PassWordControlVector := 2;
  70.           end;
  71.           case RadioGroup6.ItemIndex of
  72.             0 : DefaultDownloadVector := 3;
  73.             1 : begin
  74.                   case RadioGroup5.ItemIndex of
  75.                     0 : DefaultDownloadVector := 2;
  76.                     1 : DefaultDownloadVector := 1;
  77.                   end;
  78.                 end;
  79.           end;
  80.           try
  81.             TheAnonRedialVector := StrToInt( Edit1.Text );
  82.             if TheAnonRedialVector < 1 then TheAnonRedialVector := 1;
  83.             if TheAnonRedialVector > 50 then TheAnonRedialVector := 50;
  84.           except
  85.             On EConvertError do
  86.             begin
  87.               TheAnonRedialVector := 20;
  88.             end;
  89.           end;
  90.         end;
  91.     3 : begin
  92.           if Edit6.Text[ Length( Edit6.Text ) ] = '\' then
  93.            Edit6.Text := Copy( Edit6.Text , 1 , (Length( Edit6.Text ) - 1 ));
  94.           if DirectoryExists( Edit6.Text ) then
  95.            MailPath := Edit6.Text;
  96.           if Edit7.Text[ Length( Edit7.Text ) ] = '\' then
  97.            Edit7.Text := Copy( Edit7.Text , 1 , (Length( Edit7.Text ) - 1 ));
  98.           if DirectoryExists( Edit6.Text ) then
  99.            NewsPath := Edit7.Text;
  100.           if Edit9.Text[ Length( Edit9.Text ) ] = '\' then
  101.            Edit9.Text := Copy( Edit9.Text , 1 , (Length( Edit9.Text ) - 1 ));
  102.           if DirectoryExists( Edit9.Text ) then
  103.            FTPPath := Edit9.Text;
  104.         end;
  105.     4 : begin
  106.           if CheckBox2.Checked then NewsInitialUpdateVector := 1 else
  107.            NewsInitialUpdateVector := 2;
  108.           NewsReadArticlePurgingVector := RadioGroup7.ItemIndex + 1;
  109.           NewsReadArticleDisplayVector := RadioGroup8.ItemIndex + 1;
  110.           NewsUUMIMEVector := RadioGroup9.ItemIndex + 1;
  111.           NewsPostQueueingVector := RadioGroup10.ItemIndex + 1;
  112.         end;
  113.   end;
  114. end;
  115.  
  116. procedure TCCICPrefsDlg.FormShow(Sender: TObject);
  117. begin
  118.   case Tag of
  119.     2 : begin
  120.           case PasswordControlVector of
  121.             1 : CheckBox1.Checked := true;
  122.             2 : CheckBox1.Checked := false;
  123.           end;
  124.           case DefaultDownloadVector of
  125.             1 : begin
  126.                   RadioGroup5.ItemIndex := 1;
  127.                   RadioGroup6.ItemIndex := 1;
  128.                 end;
  129.             2 : begin
  130.                   RadioGroup5.ItemIndex := 0;
  131.                   RadioGroup6.ItemIndex := 1;
  132.                 end;
  133.             3 : begin
  134.                   RadioGroup5.ItemIndex := 0;
  135.                   RadioGroup6.ItemIndex := 0;
  136.                 end;
  137.           end;
  138.           Edit1.Text := IntToStr( TheAnonRedialVector );
  139.         end;
  140.     3 : begin
  141.           Edit6.Text := Mailpath;
  142.           Edit7.Text := NewsPath;
  143.           Edit9.Text := FTPPath;
  144.         end;
  145.     4 : begin
  146.           case NewsInitialUpdateVector of
  147.             1 : CheckBox2.Checked := true;
  148.             2 : CheckBox2.Checked := false;
  149.           end;
  150.           RadioGroup7.ItemIndex := NewsReadArticlePurgingVector - 1;
  151.           RadioGroup8.ItemIndex := NewsReadArticleDisplayVector - 1;
  152.           RadioGroup9.ItemIndex := NewsUUMIMEVector - 1;
  153.           RadioGroup10.ItemIndex := NewsPostQueueingVector - 1;
  154.         end;
  155.   end;
  156. end;
  157.  
  158. procedure TCCICPrefsDlg.Button6Click(Sender: TObject);
  159. begin
  160.   if OpenDialog1.Execute then
  161.    Edit6.Text := ExtractfilePath( OpenDialog1.FileName );
  162. end;
  163.  
  164. procedure TCCICPrefsDlg.Button7Click(Sender: TObject);
  165. begin
  166.   if OpenDialog1.Execute then
  167.    Edit7.Text := ExtractfilePath( OpenDialog1.FileName );
  168. end;
  169.  
  170. procedure TCCICPrefsDlg.Button9Click(Sender: TObject);
  171. begin
  172.   if OpenDialog1.Execute then
  173.    Edit9.Text := ExtractfilePath( OpenDialog1.FileName );
  174. end;
  175.  
  176. end.
  177.