Update of /cvsroot/jvcl/dev/JVCL3/examples/JvMail
In directory sc8-pr-cvs1:/tmp/cvs-serv4702/JVCL3/examples/JvMail
Added Files:
MailExample.dof MailExample.dpr MailExample.res
MailExampleMainFormU.dfm MailExampleMainFormU.pas MailMain.bkf
Log Message:
- Copied jvcl/devtools and jvcl/examples dev/JVCL3
- Copied JVCLConvert *.dat files to dev/JVCL3/converter
--- NEW FILE: MailExample.dof ---
[Directories]
OutputDir=..\..\Bin
UnitOutputDir=..\..\Dcu
SearchPath=..\..\Source;..\..\Common
--- NEW FILE: MailExample.dpr ---
program MailExample;
uses
Forms,
MailExampleMainFormU in 'MailExampleMainFormU.pas' {MailExampleMainForm};
{$R *.RES}
begin
Application.Initialize;
Application.CreateForm(TMailExampleMainForm, MailExampleMainForm);
Application.CreateForm(TMailExampleMainForm, MailExampleMainForm);
Application.Run;
end.
--- NEW FILE: MailExample.res ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: MailExampleMainFormU.dfm ---
object MailExampleMainForm: TMailExampleMainForm
Left = 316
Top = 201
Width = 565
Height = 456
Caption = 'JvMail example'
Color = clBtnFace
Constraints.MinHeight = 350
Constraints.MinWidth = 400
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object ClientLabel: TLabel
Left = 464
Top = 8
Width = 73
Height = 33
Anchors = [akTop, akRight]
AutoSize = False
Caption = 'ClientLabel'
WordWrap = True
end
object Label1: TLabel
Left = 8
Top = 12
Width = 16
Height = 13
Caption = '&To:'
FocusControl = ToEdit
end
object Label2: TLabel
Left = 8
Top = 36
Width = 36
Height = 13
Caption = '&Subject'
FocusControl = SubjectEdit
end
object Label3: TLabel
Left = 8
Top = 136
Width = 24
Height = 13
Caption = '&Body'
FocusControl = BodyEdit
end
object Label4: TLabel
Left = 8
Top = 56
Width = 59
Height = 13
Caption = 'Attachments'
end
object Label5: TLabel
Left = 240
Top = 11
Width = 17
Height = 13
Caption = '&CC:'
FocusControl = CcEdit
end
object ClientTypeGroupBox: TGroupBox
Left = 8
Top = 331
Width = 81
Height = 93
Anchors = [akLeft, akBottom]
Caption = '&Client type'
TabOrder = 5
object AutomaticRadioBtn: TRadioButton
Left = 8
Top = 16
Width = 70
Height = 17
Caption = '&Automatic'
Checked = True
TabOrder = 0
TabStop = True
OnClick = AutomaticRadioBtnClick
end
object MapiRadioBtn: TRadioButton
Left = 8
Top = 40
Width = 70
Height = 17
Caption = '&MAPI'
TabOrder = 1
OnClick = AutomaticRadioBtnClick
end
object DirectRadioBtn: TRadioButton
Left = 8
Top = 64
Width = 70
Height = 17
Caption = '&Direct'
TabOrder = 2
OnClick = AutomaticRadioBtnClick
end
end
object ClientsListView: TListView
Left = 104
Top = 335
Width = 450
Height = 89
Anchors = [akLeft, akRight, akBottom]
Columns = <
item
Caption = 'KeyValue'
Width = 80
end
item
Caption = 'Client'
Width = 80
end
item
Caption = 'Path'
Width = 240
end>
ColumnClick = False
HideSelection = False
ReadOnly = True
RowSelect = True
TabOrder = 6
ViewStyle = vsReport
OnCustomDrawItem = ClientsListViewCustomDrawItem
OnSelectItem = ClientsListViewSelectItem
end
object ToEdit: TEdit
Left = 48
Top = 8
Width = 185
Height = 21
TabOrder = 0
end
object SubjectEdit: TEdit
Left = 48
Top = 32
Width = 401
Height = 21
Anchors = [akLeft, akTop, akRight]
TabOrder = 2
end
object BodyEdit: TRichEdit
Left = 8
Top = 152
Width = 545
Height = 169
Anchors = [akLeft, akTop, akRight, akBottom]
HideScrollBars = False
PlainText = True
ScrollBars = ssBoth
TabOrder = 4
end
object SendBtn: TButton
Left = 464
Top = 80
Width = 75
Height = 25
Anchors = [akTop, akRight]
Caption = '&Send'
TabOrder = 7
OnClick = SendBtnClick
end
object AttachmentMemo: TMemo
Left = 8
Top = 72
Width = 441
Height = 65
Anchors = [akLeft, akTop, akRight]
ScrollBars = ssBoth
TabOrder = 3
WordWrap = False
end
object AttachBtn: TButton
Left = 464
Top = 112
Width = 75
Height = 25
Anchors = [akTop, akRight]
Caption = '&Attach'
TabOrder = 8
OnClick = AttachBtnClick
end
object CcEdit: TEdit
Left = 264
Top = 8
Width = 185
Height = 21
Anchors = [akLeft, akTop, akRight]
TabOrder = 1
end
object JvMail1: TJvMail
BlindCopy = <>
CarbonCopy = <>
Recipient = <>
Left = 192
Top = 372
end
object JvOpenDialog1: TJvOpenDialog
Filter = 'All files (*.*)|*.*'
Options = [ofHideReadOnly, ofAllowMultiSelect, ofPathMustExist, ofFileMustExist, ofEnableSizing]
ActiveControl = acListView
ActiveStyle = asReport
DefBtnCaption = 'Add'
Height = 264
Width = 426
Left = 124
Top = 372
end
end
--- NEW FILE: MailExampleMainFormU.pas ---
unit MailExampleMainFormU;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
JvMail, ExtCtrls, ComCtrls, StdCtrls, JvDialogs, JvComponent;
type
TMailExampleMainForm = class(TForm)
JvMail1: TJvMail;
ClientTypeGroupBox: TGroupBox;
AutomaticRadioBtn: TRadioButton;
MapiRadioBtn: TRadioButton;
DirectRadioBtn: TRadioButton;
ClientsListView: TListView;
ClientLabel: TLabel;
ToEdit: TEdit;
Label1: TLabel;
SubjectEdit: TEdit;
Label2: TLabel;
BodyEdit: TRichEdit;
SendBtn: TButton;
Label3: TLabel;
AttachmentMemo: TMemo;
Label4: TLabel;
AttachBtn: TButton;
JvOpenDialog1: TJvOpenDialog;
CcEdit: TEdit;
Label5: TLabel;
procedure FormCreate(Sender: TObject);
procedure ClientsListViewSelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean);
procedure AutomaticRadioBtnClick(Sender: TObject);
procedure ClientsListViewCustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
procedure SendBtnClick(Sender: TObject);
procedure AttachBtnClick(Sender: TObject);
private
procedure BuildClientList;
procedure UpdateClientName;
end;
var
MailExampleMainForm: TMailExampleMainForm;
implementation
{$R *.DFM}
uses
JclMapi;
procedure TMailExampleMainForm.BuildClientList;
var
I: Integer;
begin
ClientsListView.Items.BeginUpdate;
ClientsListView.Items.Clear;
with JvMail1.SimpleMAPI do
begin
for I := 0 to ClientCount - 1 do
with ClientsListView.Items.Add do
begin
Caption := Clients[I].RegKeyName;
Data := Pointer(Clients[I].Valid);
SubItems.Add(Clients[I].ClientName);
SubItems.Add(Clients[I].ClientPath);
end;
ClientsListView.Items[SelectedClientIndex].Selected := True;
AutomaticRadioBtn.Enabled := AnyClientInstalled;
MapiRadioBtn.Enabled := SimpleMapiInstalled;
DirectRadioBtn.Enabled := ClientCount > 0;
end;
ClientsListView.Items.EndUpdate;
end;
procedure TMailExampleMainForm.FormCreate(Sender: TObject);
begin
BuildClientList;
UpdateClientName;
end;
procedure TMailExampleMainForm.ClientsListViewSelectItem(Sender: TObject;
Item: TListItem; Selected: Boolean);
begin
if Selected then
begin
JvMail1.SimpleMAPI.SelectedClientIndex := Item.Index;
UpdateClientName;
end;
end;
procedure TMailExampleMainForm.UpdateClientName;
begin
ClientLabel.Caption := JvMail1.SimpleMAPI.CurrentClientName;
end;
procedure TMailExampleMainForm.AutomaticRadioBtnClick(Sender: TObject);
begin
with JvMail1.SimpleMAPI do
begin
if AutomaticRadioBtn.Checked then ClientConnectKind := ctAutomatic;
if MapiRadioBtn.Checked then ClientConnectKind := ctMapi;
if DirectRadioBtn.Checked then ClientConnectKind := ctDirect;
end;
UpdateClientName;
end;
procedure TMailExampleMainForm.ClientsListViewCustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
if not Boolean(Item.Data) then
Sender.Canvas.Font.Color := clInactiveCaption;
end;
procedure TMailExampleMainForm.SendBtnClick(Sender: TObject);
begin
JvMail1.Clear;
JvMail1.Recipient.AddRecipient(ToEdit.Text);
if CcEdit.Text <> '' then JvMail1.CarbonCopy.AddRecipient(CcEdit.Text);
JvMail1.Subject := SubjectEdit.Text;
JvMail1.Body.Text := BodyEdit.Text;
JvMail1.Attachment.Assign(AttachmentMemo.Lines);
JvMail1.SendMail;
end;
procedure TMailExampleMainForm.AttachBtnClick(Sender: TObject);
begin
JvOpenDialog1.FileName := '';
if JvOpenDialog1.Execute then
AttachmentMemo.Lines.AddStrings(JvOpenDialog1.Files);
end;
end.
--- NEW FILE: MailMain.bkf ---
(This appears to be a binary file; contents omitted.)
|