Hi Jules,
Can I please make a feature request?
I’d like a new virtual method in FileBasedDocument, that I can use to suppress the Error Alert
being displayed in certain circumstances. I’ve already had to patch Juce to cater for this case.
The code would look like this:
// MPC Begin
// Default is always "true", i.e. show the alert dialog.
// The app can override this behaviour where required.
virtual bool canWeShowTheFileSaveErrorDialog(const Result &result)
{
return true;
}
// MPC End
...
FileBasedDocument::SaveResult FileBasedDocument::saveAs (...
{
if (showMessageOnFailure)
{
// MPC Begin
if (canWeShowTheFileSaveErrorDialog(result) == false)
{
// Do NOT show the standard Juce file save error alert!
}
else
// MPC End
{
AlertWindow::showMessageBox (AlertWindow::WarningIcon,
TRANS("Error writing to file..."),
TRANS("An error occurred while trying to save \"DCNM\" to the file: FLNM")
.replace ("DCNM", getDocumentTitle())
.replace ("FLNM", "\n" + newFile.getFullPathName())
+ "\n\n"
+ result.getErrorMessage());
}
}
}
TIA!
Pete