home *** CD-ROM | disk | FTP | other *** search
/ Freelog 11 / Freelog011.iso / BestOf / PhoenixMail / Source / phoenix / FMFolder.pas < prev    next >
Pascal/Delphi Source File  |  1999-02-05  |  5KB  |  160 lines

  1. {*****************************************************************************
  2.  *
  3.  *  FMFolder.pas - Folder form  (28-July-1998)
  4.  *
  5.  *  Copyright (c) 1998-99 Michael Haller
  6.  *
  7.  *  Author:     Michael Haller
  8.  *  E-mail:     michael@discountdrive.com
  9.  *  Homepage:   http://www.discountdrive.com/sunrise
  10.  *
  11.  *  This program is free software; you can redistribute it and/or
  12.  *  modify it under the terms of the GNU General Public License
  13.  *  as published by the Free Software Foundation;
  14.  *
  15.  *  This program is distributed in the hope that it will be useful,
  16.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  *  GNU General Public License for more details.
  19.  *
  20.  *  You should have received a copy of the GNU General Public License
  21.  *  along with this program; if not, write to the Free Software
  22.  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
  23.  *
  24.  *----------------------------------------------------------------------------
  25.  *
  26.  *  Revision history:
  27.  *
  28.  *     DATE     REV                 DESCRIPTION
  29.  *  ----------- --- ----------------------------------------------------------
  30.  *
  31.  *****************************************************************************}
  32.  
  33. unit FMFolder;
  34.  
  35. interface
  36.  
  37. uses
  38.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  39.   StdCtrls, ExtCtrls, ComCtrls, PXStuff, FileCtrl, LangSup;
  40.  
  41. type
  42.   TFolderForm = class(TForm)
  43.     Panel1: TPanel;
  44.     PageControl1: TPageControl;
  45.     TabSheet1: TTabSheet;
  46.     Button1: TButton;
  47.     Button2: TButton;
  48.     Label16: TLabel;
  49.     Label1: TLabel;
  50.     Edit1: TEdit;
  51.     Label2: TLabel;
  52.     Bevel1: TBevel;
  53.     Edit2: TEdit;
  54.     Bevel5: TBevel;
  55.     Button3: TButton;
  56.     Panel2: TPanel;
  57.     Image1: TImage;
  58.     Image2: TImage;
  59.     Label4: TLabel;
  60.     Label20: TLabel;
  61.     Label23: TLabel;
  62.     RadioButton1: TRadioButton;
  63.     RadioButton2: TRadioButton;
  64.     RadioButton3: TRadioButton;
  65.     procedure Button1Click(Sender: TObject);
  66.     procedure CheckBox1Click(Sender: TObject);
  67.     procedure FormCreate(Sender: TObject);
  68.     procedure Button3Click(Sender: TObject);
  69.   private
  70.     { Private declarations }
  71.     Folder: String;
  72.   public
  73.     { Public declarations }
  74.     procedure LoadFolderData(Data: PFolderData);
  75.     procedure SaveFolderData(var Data: PFolderData);
  76.   end;
  77.  
  78. var
  79.   FolderForm: TFolderForm;
  80.  
  81. implementation
  82.  
  83. {$R *.DFM}
  84.  
  85. uses
  86.   Main;
  87.  
  88. procedure TFolderForm.LoadFolderData(Data: PFolderData);
  89. begin
  90.   RadioButton1.Checked := True;
  91.   Edit1.Text := Data^.Name;
  92.   Edit2.Text := Data^.Filter;
  93.   RadioButton2.Checked := Data^.Outbox;
  94.   RadioButton3.Checked := Data^.Inbox;
  95.   Folder := Data^.Path;
  96.   CheckBox1Click(Self);
  97. end;
  98.  
  99. procedure TFolderForm.SaveFolderData(var Data: PFolderData);
  100. begin
  101.   Data^.Name := Edit1.Text;
  102.   Data^.Filter := Edit2.Text;
  103.   Data^.OutBox := RadioButton2.Checked;
  104.   Data^.InBox := RadioButton3.Checked;
  105.   Data^.Path := GetParentFolder(Folder)+Edit1.Text+'\';
  106. end;
  107.  
  108. procedure TFolderForm.Button1Click(Sender: TObject);
  109. var
  110.   S: String;
  111.   I: Integer;
  112. begin
  113.   for I := 1 to Length(Edit1.Text) do
  114.     if Edit1.Text[I] in ['\','/','<','>',':','?','*','"','|',#19] then begin
  115.       MessageDlg(MainForm.ListBox1.Items[44], mtWarning, [mbOK], 0);
  116.       Exit;
  117.     end;
  118.   S := GetParentFolder(Folder)+Edit1.Text+'\';
  119.   if LowerCase(Folder) <> LowerCase(S) then
  120.     if DirectoryExists(S) then begin
  121.       MessageDlg(Format(MainForm.ListBox1.Items[50], [Edit1.Text]), mtWarning, [mbOK], 0);
  122.       Exit;
  123.     end;
  124.   ModalResult := mrOK;
  125. end;
  126.  
  127. procedure TFolderForm.CheckBox1Click(Sender: TObject);
  128. var
  129.   S: String;
  130. begin
  131.   S := MainForm.ListBox1.Items[51];
  132.   if RadioButton3.Checked then begin
  133.     if Edit2.Text = S then Edit2.Text := '';
  134.     Edit2.Enabled := True;
  135.     Label20.Enabled := True;
  136.     Label23.Enabled := True;
  137.   end else begin
  138.     Edit2.Text := S;
  139.     Edit2.Enabled := False;
  140.     Label20.Enabled := False;
  141.     Label23.Enabled := False;
  142.   end;
  143. end;
  144.  
  145. procedure TFolderForm.FormCreate(Sender: TObject);
  146. begin
  147.   AttachLanguageToForm(Self);
  148.   if bOfficeFonts then Font.Name := sOfficeFontName;
  149.   Label16.Caption := Label16.Caption+' ';
  150.   Label2.Caption := Label2.Caption+' ';
  151.   Image1.Picture.Bitmap := MainForm.Image5.Picture.Bitmap;
  152. end;
  153.  
  154. procedure TFolderForm.Button3Click(Sender: TObject);
  155. begin
  156.   Application.HelpContext(11);
  157. end;
  158.  
  159. end.
  160.