View Single Post
Old 07-29-2025, 01:35 PM   #9
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,893
Karma: 6120478
Join Date: Nov 2009
Device: many
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?

Last edited by KevinH; 07-29-2025 at 01:41 PM.
KevinH is offline   Reply With Quote