⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ahmmailreg.pas

📁 AHM控件包 AHM控件包
💻 PAS
字号:
unit AHMMailReg;

interface

uses Classes,DsgnIntf,
     AHMMailClass,
     AHMMails,
     AHMTMapiMail,
     AHMTIEMails,
     AHMTMailAccount,
     AHMTDsgnMailAccount,
     AHMTDsgInetMail,
     AHMTDsgMapiMail;

type
  TAHMMailConfigEditor = class(TDefaultEditor)
  public
    procedure ExecuteVerb(Index : Integer); override;
    function GetVerb(Index : Integer): string; override;
    function GetVerbCount : Integer; override;
    procedure Edit; override;
  end;
  TAHMAccountConfigEditor = class(TDefaultEditor)
  public
    procedure ExecuteVerb(Index : Integer); override;
    function GetVerb(Index : Integer): string; override;
    function GetVerbCount : Integer; override;
    procedure Edit; override;
  end;
  TAHMSendMailProperty = class(TStringProperty)
  public
    Procedure Edit; override;
    function GetValue: string; override;
    Function GetAttributes: TPropertyAttributes; override;
  end;
  TAHMAboutMailComponent = class(TPropertyEditor)
  public
    procedure Edit; override;
    function GetValue: string; override;
    function GetAttributes: TPropertyAttributes; override;
  end;

procedure Register;

implementation
uses Dialogs,SysUtils;
{$R ahmemail.res}

procedure Register;
begin
  RegisterComponents('AHM EMail', [TAHMQuickMail,TAHMMapiMail, TAHMPOPMail, TAHMSMTPMail,TAHMAccountHolder]);
  RegisterPropertyEditor(Typeinfo(TCollection),TAHMAccountHolder,'Accounts',TAHMAccountsProperty);
  RegisterPropertyEditor(Typeinfo(TAHMAttachments),TAHMMessage,'Attachments',TAHMAttachmentProperty);
  RegisterPropertyEditor(Typeinfo(TAHMMessages),TAHMSmtpMail,'Messages',TAHMInetProperty);
  RegisterPropertyEditor(Typeinfo(TAHMMessages),TAHMPopMail,'Messages',TAHMInetProperty);
  RegisterPropertyEditor(Typeinfo(TAHMMapiAttachments),TAHMMapiMessage,'Attachments',TAHMMapiAttachmentProperty);
  RegisterPropertyEditor(Typeinfo(TAHMMapiMessages),TAHMMapiMail,'Messages',TAHMMapiProperty);
  RegisterPropertyEditor(Typeinfo(TAHMAboutMailStr),TAHMMailsComponent,'About',TAHMAboutMailComponent);
  RegisterComponentEditor(TAHMMailHost,TAHMMailConfigEditor);
  RegisterComponentEditor(TAHMMapiMail,TAHMMailConfigEditor);
  RegisterComponentEditor(TAHMAccountHolder,TAHMAccountConfigEditor);
end;

Procedure TAHMSendMailProperty.Edit;
begin
  TAHMMailsComponent(GetComponent(0)).Execute
end;

function TAHMSendMailProperty.GetValue: string;
begin
  FmtStr(Result, '(%s)', ['Execute Test']);
end;


Function TAHMSendMailProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog, paReadonly];
end;


procedure TAHMMailConfigEditor.ExecuteVerb(Index: Integer);
begin
  if (Index< 0) and (Index>1) then Exit;
  if index=0 then Edit;
end;

function TAHMMailConfigEditor.GetVerb(Index: Integer): String;
begin
  if index=0 then  Result := 'Configure Mail ...';
end;

function TAHMMailConfigEditor.GetVerbCount: Integer;
begin
  Result:=1;
end;

procedure TAHMMailConfigEditor.Edit;
begin
  if Component is TAHMSmtpMail then ConfigureInetMail(TAHMMessages(TAHMSmtpMail(Component).Messages),Self.Designer);
  if Component is TAHMPopMail then ConfigureInetMail(TAHMMessages(TAHMPopMail(Component).Messages),Self.Designer);
  if Component is TAHMMapiMail then ConfigureMapiMail(TAHMMapiMessages(TAHMMapiMail(Component).Messages),Self.Designer);
end;

procedure TAHMAccountConfigEditor.ExecuteVerb(Index: Integer);
begin
  if (Index< 0) and (Index>1) then Exit;
  if index=0 then Edit;
end;

function TAHMAccountConfigEditor.GetVerb(Index: Integer): String;
begin
  if index=0 then  Result := 'Configure Accounts ...';
end;

function TAHMAccountConfigEditor.GetVerbCount: Integer;
begin
  Result:=1;
end;

procedure TAHMAccountConfigEditor.Edit;
begin
  EditAccounts(TAHMMailAccounts(TAHMAccountHolder(Component).Accounts),Component,Self.Designer);
end;

procedure TAHMAboutMailComponent.Edit;
begin
  ShowmailsAbout;
end;

function TAHMAboutMailComponent.GetValue: string;
begin
  FmtStr(Result, '(%s)', ['AHM Mail Components']);
end;

function TAHMAboutMailComponent.GetAttributes: TPropertyAttributes;
begin
  Result := [paMultiSelect,paDialog,paReadOnly];
end;



end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -