]> git.lyx.org Git - features.git/commitdiff
Fix the display of file filters in the import file dialog.
authorJulien Rioux <jrioux@lyx.org>
Tue, 13 Sep 2011 20:42:55 +0000 (20:42 +0000)
committerJulien Rioux <jrioux@lyx.org>
Tue, 13 Sep 2011 20:42:55 +0000 (20:42 +0000)
  - 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

src/frontends/qt4/qt_helpers.cpp

index 103e024b20410fa56c16a3f9cb31b4e5731e757b..a89406ca2dc7d0a3c6be83e57f5bd0301c8df8bb 100644 (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)) {