Unsafe implementation of TppEmail.DisplayEmailDialog
Hello,
there is a hard re-typing in the procedure TppEmail.DisplayEmailDialog.
This causes problems when I want to use my own e-mail send dialog.
Please, can you change the source code to in the following way?
It will keep existing functionality and allows other users to implement
their own email send dialogs by extending TppCustomEmailDialog class.
Best regards, Igor Gottwald
unit ppEmail.pas
procedure TppEmail.DisplayEmailDialog;
var
{inserted}lEmailDialog: TppCustomEmailDialog;
{removed
lEmailDialog: TppEmailDialog;
}
lFormClass: TFormClass;
begin
lFormClass := ppGetFormClass(TppCustomEmailDialog);
{inserted start}
lEmailDialog := TppCustomEmailDialog(lFormClass.Create(nil));
{inserted end}
{removed
lEmailDialog := TppEmailDialog(lFormClass.Create(nil));
}
try
{inserted start}
if (lEmailDialog is TppEmailDialog) then
TppEmailDialog(lEmailDialog).Menu.ConnectionMenu
.Visible := FSMTP.LoginRequired;
{inserted end}
{removed
lEmailDialog.Menu.ConnectionMenu.Visible := FSMTP.LoginRequired;
}
if FEmailSettings.FileName = '' then
FEmailSettings.FileName := FReport.PrinterSetup.DocumentName;
lEmailDialog.EmailSettings := FEmailSettings;
{ Display the email dialog }
lEmailDialog.ShowModal;
if lEmailDialog.ModalResult = mrOk then
begin
{ Assign the new emailsettings to the email }
FEmailSettings.Assign(lEmailDialog.EmailSettings);
ProcessAndSend;
end;
finally
lEmailDialog.Free;
FEmailSettings.Clear;
FReports.Clear;
end;
end; { procedure, DisplayEmailDialog }
there is a hard re-typing in the procedure TppEmail.DisplayEmailDialog.
This causes problems when I want to use my own e-mail send dialog.
Please, can you change the source code to in the following way?
It will keep existing functionality and allows other users to implement
their own email send dialogs by extending TppCustomEmailDialog class.
Best regards, Igor Gottwald
unit ppEmail.pas
procedure TppEmail.DisplayEmailDialog;
var
{inserted}lEmailDialog: TppCustomEmailDialog;
{removed
lEmailDialog: TppEmailDialog;
}
lFormClass: TFormClass;
begin
lFormClass := ppGetFormClass(TppCustomEmailDialog);
{inserted start}
lEmailDialog := TppCustomEmailDialog(lFormClass.Create(nil));
{inserted end}
{removed
lEmailDialog := TppEmailDialog(lFormClass.Create(nil));
}
try
{inserted start}
if (lEmailDialog is TppEmailDialog) then
TppEmailDialog(lEmailDialog).Menu.ConnectionMenu
.Visible := FSMTP.LoginRequired;
{inserted end}
{removed
lEmailDialog.Menu.ConnectionMenu.Visible := FSMTP.LoginRequired;
}
if FEmailSettings.FileName = '' then
FEmailSettings.FileName := FReport.PrinterSetup.DocumentName;
lEmailDialog.EmailSettings := FEmailSettings;
{ Display the email dialog }
lEmailDialog.ShowModal;
if lEmailDialog.ModalResult = mrOk then
begin
{ Assign the new emailsettings to the email }
FEmailSettings.Assign(lEmailDialog.EmailSettings);
ProcessAndSend;
end;
finally
lEmailDialog.Free;
FEmailSettings.Clear;
FReports.Clear;
end;
end; { procedure, DisplayEmailDialog }
This discussion has been closed.
Comments
The described behaviour is in RB 14.08 for XE3
Best regards, Igor Gottwald
In article ,
gottwald@oksoftware.cz says...
TppCustomEmailDialog. For the next major release will add a public boolean
property, TppEmailSettings.LoginRequired, so that this can be handle without
requiring a typecast to TppEmailDialog. We can just assign the
EmailSettings.LoginRequired property and let the dialog configured its menu
option.
-
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com