I am wondering if there is a way to have the "Save Bug Report" button save in the same format as the "Send Bug Report" button?
I already implemented the SendBugReport to work by sending a Zip file which contains a log file we need.
But when clicking Save Bug Report I only get the txt of the BugReport, apparently it skips the added code in the MadExceptionHandlerException:
the "save" button is designed to just save the bug report itself, no screenshots or other attachments. It would be difficult to manage other configurations. E.g. if you want a ZIP file to be saved, then every saved bug report would overwrite the previously saved report. That doesn't sound very useful. Currently, the way saving is implemented, the user can press the save button for several exceptions, and they're all appended to the same bug report file. If at one point that bug report file reaches you, you'll find all the bug reports collected in there. Such a solution would be much more complicated to realize for zip files. E.g. I could save zip files with different file names, appending some sort of number of date. But then when to save old reports?
If you really want to have this functionality, you can use RegisterExceptActionHandler() and in your handler simply replace the functionality of the "save bug report" button with your own code. Would cost you a bit of time, but then you have full flexibility.
The best approach is probably to use HTTP uploading. You would setup a PHP script on your webserver, and then your application would post the bug report to that script, and the script would turn it into an email. See the bottom of this page:
Well, you can also use SMTP mailing. The key problem with that is that you need to provide an account name and password. One "trick" is to create an extra dummy email account for that, and let it forward the bug reports to your real email address. Or you could setup your own SMTP server, which accepts bug reports without account name and password, as long as some requirements are met (e.g. a bug report attachment or similar).
Well I tried to implement an ExceptActionEvent and all was pretty straight forward until I could not get the full path to BugReport. Btw I would appreciate that answer, BugReportFile points to the Filename without path.
But.. while searching for that answer here in the forum I ran into BugReportSections, which solves my problem in a much cleaner way:
procedure TMainForm.ExceptActionEvent(Action: TExceptAction; const exceptIntf: IMEException; var Handled: Boolean);
begin
if Action = eaSaveBugReport then
try
SetTopmost(GetExceptBoxHandle, false);
SavetoDialog.FileName := AssistDatazip;
if SavetoDialog.Execute([ffZip]) then begin
AddCriticalLogData;
with TZipFile.create do
try
Open(SavetoDialog.FileName, zmWrite);
Add(Log.FileName, 'Info.log');
Add(exceptIntf.BugReportFile, 'Hardware_Stack.mbr');
Close;
finally
Free;
end
end;
Handled := True;
Except
On E:Exception do BreakPoint; // Error is already up we don't need more
end;
end;
exceptIntf.BugReportFile returns the path which is stored in the settings. If there's no path stored there, you won't get a path. However, now that you mention it, it could be useful to get access to the bug report file path, I guess. Although, of course you could also replace the saving and then you'd have everything under full control.
Anyway, adding information to BugReportSections has fully solved your problem?