Comments about preference keys that store localized string values...
... which is wrong in general, but describe why that's pardonable
This commit is contained in:
parent
8655e2e3b9
commit
b53b5e54fe
|
@ -1057,6 +1057,11 @@ wxArrayString ProjectFileManager::ShowOpenDialog(const wxString &extraformat, co
|
||||||
for (int i = 0; i < index; i++) {
|
for (int i = 0; i < index; i++) {
|
||||||
mask = mask.AfterFirst(wxT('|')).AfterFirst(wxT('|'));
|
mask = mask.AfterFirst(wxT('|')).AfterFirst(wxT('|'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PRL: Preference keys /DefaultOpenType and /LastOpenType, unusually,
|
||||||
|
// store localized strings!
|
||||||
|
// The bad consequences of a change of locale are not severe -- only that
|
||||||
|
// a default choice of file type for an open dialog is not remembered
|
||||||
gPrefs->Write(wxT("/DefaultOpenType"), mask.BeforeFirst(wxT('|')));
|
gPrefs->Write(wxT("/DefaultOpenType"), mask.BeforeFirst(wxT('|')));
|
||||||
gPrefs->Write(wxT("/LastOpenType"), mask.BeforeFirst(wxT('|')));
|
gPrefs->Write(wxT("/LastOpenType"), mask.BeforeFirst(wxT('|')));
|
||||||
gPrefs->Flush();
|
gPrefs->Flush();
|
||||||
|
|
|
@ -369,10 +369,6 @@ bool Importer::Import(const FilePath &fName,
|
||||||
// This list is used to remember plugins that should have been compatible with the file.
|
// This list is used to remember plugins that should have been compatible with the file.
|
||||||
ImportPluginPtrs compatiblePlugins;
|
ImportPluginPtrs compatiblePlugins;
|
||||||
|
|
||||||
// If user explicitly selected a filter,
|
|
||||||
// then we should try importing via corresponding plugin first
|
|
||||||
wxString type = gPrefs->Read(wxT("/LastOpenType"),wxT(""));
|
|
||||||
|
|
||||||
// Not implemented (yet?)
|
// Not implemented (yet?)
|
||||||
wxString mime_type = wxT("*");
|
wxString mime_type = wxT("*");
|
||||||
|
|
||||||
|
@ -380,13 +376,21 @@ bool Importer::Import(const FilePath &fName,
|
||||||
bool usersSelectionOverrides;
|
bool usersSelectionOverrides;
|
||||||
gPrefs->Read(wxT("/ExtendedImport/OverrideExtendedImportByOpenFileDialogChoice"), &usersSelectionOverrides, false);
|
gPrefs->Read(wxT("/ExtendedImport/OverrideExtendedImportByOpenFileDialogChoice"), &usersSelectionOverrides, false);
|
||||||
|
|
||||||
wxLogDebug(wxT("LastOpenType is %s"),type);
|
|
||||||
wxLogDebug(wxT("OverrideExtendedImportByOpenFileDialogChoice is %i"),usersSelectionOverrides);
|
|
||||||
|
|
||||||
if (usersSelectionOverrides)
|
if (usersSelectionOverrides)
|
||||||
{
|
{
|
||||||
|
// If user explicitly selected a filter,
|
||||||
|
// then we should try importing via corresponding plugin first
|
||||||
|
wxString type = gPrefs->Read(wxT("/LastOpenType"),wxT(""));
|
||||||
|
|
||||||
|
wxLogDebug(wxT("LastOpenType is %s"),type);
|
||||||
|
wxLogDebug(wxT("OverrideExtendedImportByOpenFileDialogChoice is %i"),usersSelectionOverrides);
|
||||||
|
|
||||||
for (const auto &plugin : sImportPluginList())
|
for (const auto &plugin : sImportPluginList())
|
||||||
{
|
{
|
||||||
|
// PRL: Preference keys /DefaultOpenType and /LastOpenType, unusually,
|
||||||
|
// store localized strings!
|
||||||
|
// The bad consequences of a change of locale are not severe -- only that
|
||||||
|
// a default choice of file type for an open dialog is not remembered
|
||||||
if (plugin->GetPluginFormatDescription().CompareTo(type) == 0)
|
if (plugin->GetPluginFormatDescription().CompareTo(type) == 0)
|
||||||
{
|
{
|
||||||
// This plugin corresponds to user-selected filter, try it first.
|
// This plugin corresponds to user-selected filter, try it first.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user