lazarus/components/lazreport/source/addons/lrEmailExport/lremailappfreesoft.pas
jesus 118cc819c4 LazReport: New big patch from Alexey Lagunov (with small changes)
-------------------------------------------------------
Addfunction / frFuncStr
  - Fixed string functions - accounted for UTF8 strings

DialogControls
  - Fixed reports generation with built-in query mode, MDI (multiple reports open for viewing at the same time)
  - Fixed UNDO in editor
  - Added property HINT for dialog controls
  - A new component - TlrRadioGroup

lrOfficeImport
  - New tool reports designer to import data from a spreadsheet as a report template

source
  - The object TfrMemoView added new handlers
    - OnClick - Event when you click on TfrMemoView in playback mode built reports
    - OnMouseEnter - Event at the Enter of the mouse over TfrMemoView in playback mode built reports
    - OnMouseLeave - Event at the Leave of the mouse TfrMemoView in playback mode built reports

  - The object TfrMemoView added new properties
    - Cursor - the mouse cursor when moving over TfrMemoView in playback mode built reports
    - DetailReport - a reference to the detail-report - called when the user clicks the mouse on TfrMemoView in playback mode built reports

  - A mechanism to detail-report - call a detailed report of the current report
  - In ineterpretatore added new features (for compatibility with FastReport 2.5):
      - FINALPASS
      - CURY
      - PAGEHEIGH
      - PAGEWIDTH
  - In the reports, the editor started saving paramerov editor (the location of the Object Inspector, fonts)
  - In the reports, the editor corrected the addition of new tools (implemented a new tool - Import report template from excel/OpenOffice)
  - Editor of reports finalized Inspector data - now you can also insert variables
  - For export to txt implemented request form export options

images
  - Made in the resources icon tool insert fields in a report from the editor

Demo included (detail_reports)

And new extensions:
- import report template from calc/excel
- send email from report preview (for sending used local mail app, installed on user PC - in windows its TheBat! and Mozilla Thunderbird).
  In future I'm plan make direct send.

git-svn-id: trunk@46079 -
2014-08-28 04:10:20 +00:00

196 lines
5.0 KiB
ObjectPascal

unit lrEmailAppFreeSoft;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, lrEmailExportFilter;
type
{ TEmailAppThunderbird }
TEmailAppThunderbird = class(TEmailApp)
protected
class function AppFileName:string;override;
function MakeParams:string;override;
public
class function AppName:string;override;
end;
{ TEmailAppEvolution }
TEmailAppEvolution = class(TEmailApp)
protected
class function AppFileName:string;override;
function MakeParams:string;override;
public
class function AppName:string;override;
end;
{ TEmailAppKMail }
TEmailAppKMail = class(TEmailApp)
protected
class function AppFileName:string;override;
function MakeParams:string;override;
public
class function AppName:string;override;
end;
implementation
uses
{$IFDEF WINDOWS}
registry,
{$ENDIF}
UTF8Process;
{ TEmailAppKMail }
class function TEmailAppKMail.AppFileName: string;
begin
{$IFDEF LINUX}
Result:=FindFilenameOfCmd('kmail');
{$ELSE}
{$IFDEF WINDOWS}
Result:='';
{$ENDIF}
{$ENDIF}
end;
function TEmailAppKMail.MakeParams: string;
begin
Result:='--composer '+
'--subject '+FFilter.MessageSubject+' '+
'--attach file://'+FFilter.EmailAttachFileName+' ';
if Trim(FFilter.MessageBody.Text)<>'' then
Result:=Result + '--body "'+Trim(FFilter.MessageBody.Text)+'" ';
Result:=Result + FFilter.Email;
{
Usage: kmail [Qt-options] [KDE-options] [options] [address|URL]
KDE Email Client
Generic options:
--help Show help about options
--help-qt Show Qt specific options
--help-kde Show KDE specific options
--help-all Show all options
--author Show author information
-v, --version Show version information
--license Show license information
-- End of options
Options:
-s, --subject <subject> Set subject of message
-c, --cc <address> Send CC: to 'address'
-b, --bcc <address> Send BCC: to 'address'
-h, --replyTo <address> Set replyTo to 'address'
--header <header_name:header_value> Add 'header' to message. This can be repeated
--msg <file> Read message body from 'file'
--body <text> Set body of message
--attach <url> Add an attachment to the mail. This can be repeated
--check Only check for new mail
--composer Only open composer window
--view <url> View the given message file
Arguments:
address|URL Send message to 'address' or attach the file the 'URL' points to
}
end;
class function TEmailAppKMail.AppName: string;
begin
Result:='KDE Mail App (KMail)';
end;
{ TEmailAppEvolution }
class function TEmailAppEvolution.AppFileName: string;
begin
Result:=FindFilenameOfCmd('evolution');
end;
function TEmailAppEvolution.MakeParams: string;
begin
Result:='"mailto:' + FFilter.Email +
'?subject='+FFilter.MessageSubject;
if Trim(FFilter.MessageBody.Text)<>'' then
Result:=Result + '&body='+Trim(FFilter.MessageBody.Text);
Result:=Result + '&attach=file://'+FFilter.EmailAttachFileName+'"';
end;
class function TEmailAppEvolution.AppName: string;
begin
Result:='Gnome Evolution';
end;
{ TEmailAppThunderbird }
class function TEmailAppThunderbird.AppFileName: string;
{$IFDEF WINDOWS}
var
R:TRegistry;
S: String;
{$ENDIF}
begin
{$IFDEF LINUX}
Result:=FindFilenameOfCmd('thunderbird');
{$ELSE}
{$IFDEF WINDOWS}
R:=TRegistry.Create;
R.Access := KEY_READ;
R.RootKey := HKEY_LOCAL_MACHINE;
S:='';
Result:='';
try
if R.OpenKeyReadOnly('SOFTWARE\Mozilla\Mozilla Thunderbird') then
S:=R.ReadString('CurrentVersion');
R.CloseKey;
if S<>'' then
begin
S:='SOFTWARE\Mozilla\Mozilla Thunderbird\'+S+'\Main';
if R.OpenKeyReadOnly(S) then
Result:=R.ReadString('PathToExe');
R.CloseKey;
end;
finally
R.Free;
end;
{$ENDIF}
{$ENDIF}
end;
function TEmailAppThunderbird.MakeParams: string;
begin
Result:='-compose "to='+FFilter.Email+','+
'subject='+FFilter.MessageSubject+','+
'attachment='+FFilter.EmailAttachFileName+','+
'body='''+Trim(FFilter.MessageBody.Text)+'''"';
{
Each message option follows the syntax field=value, for example:
to=foo@nowhere.net
subject=cool page
attachment=www.mozilla.org
attachment='file:///c:/test.txt'
body=check this page
Multiple message options are separated by comma (,), for example: "to=foo@nowhere.net,subject=cool page" . Comma separators must not follow or precede spaces ( ). To assign multiple values to a field, enclose the values in single quotes ('), for example: "to='foo@nowhere.net,foo@foo.de',subject=cool page" .
}
end;
class function TEmailAppThunderbird.AppName: string;
begin
Result:='Mozilla Thunderbird'
end;
initialization
RegisterEmailApp(TEmailAppThunderbird);
RegisterEmailApp(TEmailAppEvolution);
RegisterEmailApp(TEmailAppKMail);
end.