Merge pull request #1227 from ONLYOFFICE/fix/allsupported-filter

Fix 'All supported files' filter
This commit is contained in:
Maxim Kadushkin
2024-05-23 12:40:25 +03:00
committed by GitHub
2 changed files with 4 additions and 2 deletions

View File

@ -251,10 +251,10 @@ QStringList CFileDialogWrapper::modalOpen(const QString& path, const QString& fi
tr("Presentations") + " (*.pptx *.ppt *.odp *.otp *.ppsm *.pptm *.ppsx *.pps *.potx *.pot *.potm *.fodp *.dps *.dpt *.sxi);;" +
tr("Web Page") + " (*.html *.htm *.mht *.mhtml *.epub);;" +
tr("Text files") + " (*.txt *.csv)";
#ifdef __linux__
//#ifdef __linux__
_all_sup_files = tr("All supported files") + " " + joinExtentions(_filter_);
_filter_.prepend(_all_sup_files + ";;");
#endif
//#endif
_filter_.append(";;" + m_mapFilters[AVS_OFFICESTUDIO_FILE_UNKNOWN]);
}
const QString _default_sel_filter = _all_sup_files.isEmpty() ?

View File

@ -72,6 +72,8 @@ auto stringToFilters(const wstring& wstr) -> specvector {
wstring filter_pattern = filter_name.substr(mid, filter_name.find(L")", mid) - mid);
std::replace(begin(filter_pattern), end(filter_pattern), ' ', ';');
if (filter_name.length() > 255 && mid > 2)
filter_name = filter_name.substr(0, mid - 2) + L" (*.*)";
return make_pair(filter_name, filter_pattern);
};