Advertisement
RandomClear

How to send feedback instead of bug report

Feb 12th, 2013
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 2.49 KB | None | 0 0
  1. // See also: http://pastebin.com/MfLi4pbj - "how to send arbitrary e-mail with file attaches"
  2. // See also: http://pastebin.com/jxKB2WDZ - "how to send arbitrary data to bug tracker"
  3. // See also: http://pastebin.com/ytYbgAfc - "how to setup send method from code"
  4.  
  5. // This code requires EurekaLog enabled for your application
  6. // You also must properly configure at least one send method to submit bug reports
  7. // This code will use existing EurekaLog configuration to send feedback message
  8.  
  9. uses
  10.   EConsts, ETypes, EClasses, EHash, ESysInfo, ESend, ExceptionLog7;
  11.  
  12. procedure TForm1.Button1Click(Sender: TObject);
  13. var
  14.   Options: TEurekaModuleOptions;
  15.   Files: TStringList;
  16. begin
  17.   Options := TEurekaModuleOptions.Create('');
  18.   Files := TStringList.Create;
  19.   try
  20.     Options.Assign(CurrentEurekaLogOptions);
  21.  
  22.     // 1: store your feedback message
  23.     Options.CustomField[sifBugText]                := 'Your feedback message';
  24.     Options.CustomField[sifBugType]                := 'Short caption (subject)';
  25.  
  26.     // 2: you have to redefine BugID, so it will unique identify this message
  27.     Options.CustomField[sifBugID]                  := IntToHex(GetCRC32(Options.CustomField[sifBugType] + Options.CustomField[sifBugText]), 8);
  28.  
  29.     // 3: (optional) add additional text, if needed
  30.     Options.CustomField[sifMessage]                := 'usually this holds bug report text, you can replace it with any content or empty string';
  31.     Options.CustomField[sifStepsToReproduce]       := 'steps to reproduce';
  32.  
  33.     // 4: (optional) you may want to change caption/category/project/etc. for feedbacks
  34.     Options.SendMantisCategory                     := 'Feedback'; // this is just example
  35.  
  36.     // 5: (optional) fill other informational fields
  37.     Options.CustomField[sifBugAppVersion]          := ESysInfo.GetVersionNumber;
  38.     Options.CustomField[sifBuild]                  := ESysInfo.GetVersionNumber;
  39.     Options.CustomField[sifMachineID]              := ESysInfo.GetComputerName;
  40.     Options.CustomField[sifOSBuild]                := ESysInfo.GetOSBuild;
  41.     Options.CustomField[sifOSType]                 := ESysInfo.GetOSTypeStr;
  42.     Options.CustomField[sifPlatform]               := ESysInfo.GetPlatform;
  43.     Options.CustomField[sifUserEMail]              := ESysInfo.GetUserEMail;
  44.  
  45.     // 6: attach files (if any)
  46.     Files.Add('C:\FileToSend1.txt');
  47.     Files.Add('C:\FileToSend2.zip');
  48.  
  49.     EurekaLogSend(Options, Files);
  50.   finally
  51.     FreeAndNil(Files);
  52.     FreeAndNil(Options);
  53.   end;
  54. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement