Here is what I think will get us close to what we have now in the code with a env var override.
It needs to be called to replace QFileDialog::Options options = QFileDialog::Options().
The issue is we may want to invoke this only on some routines and not others so more work will be need to handle special cases:
Code:
//declaration for header
QFileDialog::Options DlgOptions(const QString special_case = QString());
// to be used in place of a call to QFileDialog::Options()
QFileDialog::Options Utility::DlgOptions(const QString special_case)
QFileDialog::Options options = QFileDialog::Options();
if (qEnvironmentVariableIsSet("SIGIL_FORCE_NATIVE_FILE_DIALOG")) {
return options;
}
#ifdefined(Q_OS_MAC)
options = options | QFileDialog::DontUseNativeDialog;
#endif
#ifdefined(Q_OS_WIN32)
if (!special_case.isEmpty()) {
options = options | QFileDialog::DontUseNativeDialog;
}
#endif
return options;
}
We could pass in other options as a parameter but it may be easier to add those other options in as needed back in the original places we use them now (things like QFileDialog::HideNameFilterDetails, and QFileDialog::ReadOnly and any others we use in various places.
There really are a lot of them.
Thoughts?