Add file type filters for UDL in Save dialogs

Fix #8083, fix #11096, close #15490
pull/15516/head
PeterCJ 2024-07-27 14:04:18 -07:00 committed by Don Ho
parent e17d77ceab
commit 9fb538d125
1 changed files with 40 additions and 0 deletions

View File

@ -994,6 +994,46 @@ int Notepad_plus::setFileOpenSaveDlgFilters(CustomFileDialog & fDlg, bool showAl
l = (NppParameters::getInstance()).getLangFromIndex(i++);
}
LangType lt = (LangType)langType;
wstring fileUdlString(getLangDesc(lt, true));
for (size_t u=0; u<(size_t)nppParam.getNbUserLang(); u++)
{
UserLangContainer& ulc = nppParam.getULCFromIndex(u);
const wchar_t *extList = ulc.getExtention();
const wchar_t *lName = ulc.getName();
wstring list(L"");
if (extList)
list += extList;
wstring stringFilters = exts2Filters(list, showAllExt ? -1 : 40);
const wchar_t *filters = stringFilters.c_str();
if (filters[0])
{
fDlg.setExtFilter(lName, filters);
if (lt == L_USER)
{
wstring loopUdlString(L"udf - ");
loopUdlString += lName;
if (!ltFound)
{
ltFound = fileUdlString.compare(loopUdlString) == 0;
}
if (!ltFound)
{
++ltIndex;
}
}
}
}
if (!ltFound)
return -1;
return ltIndex;