Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This sample will show you how you can explicitly ask user to confirm sending.
- // This may be required by some data privacy standards.
- uses
- EDialog, // for RegisterDialogClassFirst
- EDialogWinAPIMSClassic, // for TMSClassicDialog
- EDialogWinAPIEurekaLogDetailed, // for TEurekaLogDetailedDialog
- ETypes; // for TResponse
- type
- // Override sending report in all dialog classes which are used in application
- TMSClassicDialog = class(EDialogWinAPIMSClassic.TMSClassicDialog)
- function SendBugReportInternal: TResponse; override;
- end;
- TEurekaLogDetailedDialog = class(EDialogWinAPIEurekaLogDetailed.TEurekaLogDetailedDialog)
- function SendBugReportInternal: TResponse; override;
- end;
- function TMSClassicDialog.SendBugReportInternal: TResponse;
- begin
- // Ask consent first
- if Application.MessageBox('Do you want to send bug report with your private data?',
- 'Send consent', MB_YESNO or MB_DEFBUTTON2) <> mrYes then
- begin
- // If user does not agree to send report - indicate send was cancelled
- Finalize(Result);
- FillChar(Result, SizeOf(Result), 0);
- Result.SendResult := srCancelled;
- Result.ErrorMessage := 'Send consent was not given';
- end
- else
- // ...otherwise (user agrees) - do a real send
- Result := inherited SendBugReportInternal;
- end;
- function TEurekaLogDetailedDialog.SendBugReportInternal: TResponse;
- begin
- if Application.MessageBox('Do you want to send bug report with this data?',
- 'Send consent', MB_YESNO or MB_DEFBUTTON2) <> mrYes then
- begin
- Finalize(Result);
- FillChar(Result, SizeOf(Result), 0);
- Result.SendResult := srCancelled;
- Result.ErrorMessage := 'Send consent was not given';
- end
- else
- Result := inherited SendBugReportInternal;
- end;
- initialization
- // Don't forget to register your dialog classes to override EurekaLog's ones
- RegisterDialogClassFirst(TMSClassicDialog);
- RegisterDialogClassFirst(TEurekaLogDetailedDialog);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement