]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FileDialog.C
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / xforms / FileDialog.C
index 8582cd32026aa60729a2b379ad078b93913f6b28..4ee22b27ba9795593df381f9c693f69ffd0ab223 100644 (file)
 #include "debug.h"
 #include "gettext.h"
 
+#include "support/filefilterlist.h"
 #include "support/lstrings.h"
 
 using lyx::support::rsplit;
+using lyx::support::FileFilterList;
 
 using std::endl;
 using std::string;
@@ -40,9 +42,11 @@ FileDialog::~FileDialog()
 }
 
 
-FileDialog::Result const FileDialog::save(string const & path, string const & mask, string const & suggested)
+FileDialog::Result const FileDialog::save(string const & path,
+                                         FileFilterList const & filters,
+                                         string const & suggested)
 {
-       return open(path, mask, suggested);
+       return open(path, filters, suggested);
 }
 
 
@@ -62,27 +66,20 @@ FileDialog::Result const FileDialog::opendir(string const & path, string const &
 }
 
 
-FileDialog::Result const FileDialog::open(string const & path, string const & mask, string const & suggested)
+FileDialog::Result const FileDialog::open(string const & path,
+                                         FileFilterList const & filters,
+                                         string const & suggested)
 {
-       string filter = mask;
-
-       if (mask.empty())
-               filter = _("*");
-       else {
-               rsplit(mask, filter, '|');
-               if (filter.empty())
-                       filter = mask;
-       }
-
-       lyxerr[Debug::GUI] << "filedialog open  with path \"" << path << "\", mask \""
-               << filter << "\", suggested \"" << suggested << '"' << endl;
+       lyxerr[Debug::GUI] << "filedialog open  with path \"" << path
+                          << "\", mask \"" << filters.as_string()
+                          << "\", suggested \"" << suggested << '"' << endl;
 
        // no support for asynchronous selection yet
 
        FileDialog::Result result;
 
        result.first = FileDialog::Chosen;
-       result.second = private_->Select(title_, path, filter, suggested);
+       result.second = private_->Select(title_, path, filters, suggested);
 
        return result;
 }