Fix the display of file filters in the import file dialog.

- Correctly interpret whether a file description is available.
    This description is later displayed in the file filters in the
    import dialog (and other dialogs using this qt helper).

  - Fix the regex so that "LaTeX (plain) (*.tex)" is correctly parsed
    into a description "LaTeX (plain) " and its corresponding filter.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39672 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Julien Rioux 2011-09-13 20:42:55 +00:00
parent d57f66022c
commit 78c80996cd

View File

@ -424,7 +424,7 @@ QString Filter::toString() const
{
QString s;
bool const has_description = desc_.empty();
bool const has_description = !desc_.empty();
if (has_description) {
s += toqstr(desc_);
@ -509,9 +509,9 @@ FileFilterList::FileFilterList(docstring const & qt_style_filter)
void FileFilterList::parse_filter(string const & filter)
{
// Matches "TeX documents (*.tex)",
// storing "TeX documents " as group 1 and "*.tex" as group 2.
static lyx::regex const filter_re("([^(]*)\\(([^)]+)\\) *$");
// Matches "TeX documents (plain) (*.tex)",
// storing "TeX documents (plain) " as group 1 and "*.tex" as group 2.
static lyx::regex const filter_re("(.*)\\(([^()]+)\\) *$");
match_results<string::const_iterator> what;
if (!lyx::regex_search(filter, what, filter_re)) {