Page 1 of 1

"save bug report" behavior

Posted: Tue Jan 07, 2020 9:24 pm
by FredS
The "save bug report" button action is dependent on BugReportFile but I believe the online help is outdated:
If you specify a full path, no "save box" is shown, even if the user presses on the "save bug report" button, instead the bug report file is directly written to the specified path.
I've been supplying a full path with filename (in code) yet "save bug report" still comes up with a File dialog, which BTW has only a text filter and doesn't append TXT to an MBR file when saved.

If I only have a file name and no path it saves to the desktop, which isn't where I want the file. But now when a user clicks "Save" it opens with the default directory using the path, preferably that should be the desktop.

The work around was to set BugReportFile during eaSaveBugReport and reset it on eaSaveBugReport3.
A PITA especially when most logic is in inherited base forms.. seems like a complicated fix just wanted to spell it out.

Re: "save bug report" behavior

Posted: Tue Jan 07, 2020 11:17 pm
by FredS
This doesn't work because CheckAutoSave triggers both eaSaveBugReport and eaSaveBugReport3 even though no Assistant is used.

Re: "save bug report" behavior

Posted: Wed Jan 08, 2020 3:23 pm
by madshi
I'm not completely sure what to do. You're reporting a lot of different things, and I'm not sure which of these you want changed and how you want it changed?

Re: "save bug report" behavior

Posted: Wed Jan 08, 2020 10:19 pm
by FredS
madshi wrote:I'm not completely sure what to do. You're reporting a lot of different things, and I'm not sure which of these you want changed and how you want it changed?
I hate to but altered source, I don't believe 'DoFireHandlers(0, 1, eaSaveBugReport, exceptIntf, b1);' should be there.
First from fast reading your code if handle=0 there is no eaSaveBugReport3 fired, second there are no Assistants for the same reason.

The alternative is ugly, if I can't change the BugReportFile then I need to implement a VCL SaveAs myself by hooking eaSaveBugReport2.
Like you I'd rather not break stuff..

But while we are on the subject, when you send a report without the Full Exception Dialog using 'SendBugReport' the Report is Not Auto-saved on send failure. If I use the only exposed method 'AutoSaveBugReport' then its saved regardless of the status of the send.

For now, since I made source changes, I added an accessible method that can be checked :

Code: Select all

function WasMailSent(const ime: IMEException): Boolean;
begin
  Result := (ime  as IMEExceptionEx).GetMailWasSent;
end;
Same could be used when a Report is Sent via 'ImportBugReport.Show', it doesn't get automatically deleted and I have to use 'WasMailSent' if I want to delete that.

Re: "save bug report" behavior

Posted: Wed Jan 08, 2020 10:31 pm
by madshi
To be honest, your report is so complex that I don't really understand what's going on. Your report feels like it describes 5 different ways madExcept behaves, and it doesn't say very clearly which of these you consider a problem and which not and which you want changed and in which way. Can you try to sum up "the problem" (if there is just one) in a way that I can understand what you mean exactly?

Re: "save bug report" behavior

Posted: Wed Jan 08, 2020 10:50 pm
by FredS
Sure,

1) The "save bug report" button action is dependent on BugReportFile but I believe the online help is outdated:
If you specify a full path, no "save box" is shown, even if the user presses on the "save bug report" button, instead the bug report file is directly written to the specified path.
I've been supplying a full path with filename (in code) yet "save bug report" still comes up with a File dialog, which BTW has only a text filter and doesn't append TXT to an MBR file when saved.

2) I set BugReportFile '%ProgramData%\Company\AppName.mbr' when the App starts. With this if the user clicks 'Save' the default directory is '%ProgramData%\Company' and the file name 'AppName.mbr'. The dialog filter is only 'TXT' but when saved its saved as 'AppName.mbr'.
But this is not a huge issues since I need to change the file name to get it to the correct location.

3) To change the file name and to get a 'Save' to the correct location I use this code:

Code: Select all

  case Action of
    eaShowBugReport: begin // before assistant
      {- Fix for saving Bug Report: see Region for details }
      if (Action=eaSaveBugReport) then
        exceptIntf.BugReportFile := ExtractFileName(madExcept.MESettings.BugReportFile) + '.txt';
    end;
    eaSaveBugReport3: begin  // after saving
      {- Fix for saving Bug Report: see Region for details }
      exceptIntf.BugReportFile := madExcept.MESettings.BugReportFile;
    end;
  end;
This works but since 'CheckAutoSave' sends another eaShowBugReport (without a eaSaveBugReport3 btw) it saves to the wrong location.

4)
The fix is this (repeat):
I hate to but altered source, I don't believe 'DoFireHandlers(0, 1, eaSaveBugReport, exceptIntf, b1);' should be there.
First from fast reading your code if handle=0 there is no eaSaveBugReport3 fired, second there are no Assistants for the same reason.

The alternative is ugly, if I can't change the BugReportFile then I need to implement a VCL SaveAs myself by hooking eaSaveBugReport2.
Like you I'd rather not break stuff..

Will add the rest in a separate post.

Re: "save bug report" behavior

Posted: Thu Jan 09, 2020 5:32 pm
by madshi
Once again you're describing a lot of things, but I'm not sure which of what you're describing is something you consider a bug or not. Let me give you a few examples:

1)
A. Are you saying the help should be updated? Or are you saying the help describes how it should be and madExcept needs to be modified accordingly?
B. Are you saying that the file dialog only having a text filter is a bug and should be fixed? Or are you just describing how it is without saying it's a bug that should be fixed?
C. Are you saying that TXT should be appended to an MBR file when saved? Or are you not saying that? If you're not saying that then what are you saying?

Do you see what I mean? With most of the text you're writing here, you're just throwing some information at me, but you're neither asking a question, nor are you requesting specific changes. So I don't really know what you want from me. Usually, when people post here in the forum, they either ask a question, or ask for a specific bugfix.

The same applies to 2). You're describing something, but you're neither asking a question, nor requesting a specific change. So what am I supposed to do with 2)?

So to sum up: I'd like to know what you want me to do. It's as simple as that... :D

Re: "save bug report" behavior

Posted: Thu Jan 09, 2020 5:47 pm
by FredS
I come back to madExcept every few years to make some adjustments and these are my findings.

1) That would be up to you, as it sits now it doesn't follow the rules described in Help. If it did we would have another discussion :)
2) That is what I found. Consider it a bug or update your help topic. I have no problem making the output of a 'Save' a txt file, else it should at least force the 'txt' extension.
3) I made changes to source but IMO this section could use some work. My job is to get my end working and I did by making source changes.
Personally I would rework this, the if and how is up to you.. that all starts with what rules you want to enforce for #1.
Perhaps all you need is another variable similar to 'BugReportSendAs', 'BugReportSaveAs' would work for me.