]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FileDialog.C
Introduce LFUN_PRINT.
[lyx.git] / src / frontends / xforms / FileDialog.C
index 807476c1915099ec5178c62f5cd9d5e1ad8e0bd9..43ef10feb1ff2a7161a5f805ba42f8025c6c6ba9 100644 (file)
@@ -5,31 +5,31 @@
  *
  * \author John Levon
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
-
-#include "FormFiledialog.h"
 #include "frontends/FileDialog.h"
-#include "frontends/LyXView.h"
-#include "bufferview_funcs.h"
-#include "gettext.h"
-#include "commandtags.h"
+#include "FormFiledialog.h"
+
 #include "debug.h"
+#include "gettext.h"
+
+#include "support/globbing.h"
 #include "support/lstrings.h"
-#include <utility>
 
+using lyx::support::rsplit;
+using lyx::support::FileFilterList;
 
-using std::make_pair;
-using std::pair;
 using std::endl;
+using std::string;
+
 
 FileDialog::FileDialog(string const &t, kb_action s, Button b1, Button b2)
        : private_(0), title_(t), success_(s)
 {
-       private_ = new FileDialog::Private();
+       private_ = new FileDialog::Private;
 
        private_->SetButton(0, b1.first, b1.second);
        private_->SetButton(1, b2.first, b2.second);
@@ -42,15 +42,17 @@ 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);
 }
 
 
 FileDialog::Result const FileDialog::opendir(string const & path, string const & suggested)
 {
-       lyxerr[Debug::GUI] << "filedialog open  with path \"" << path << "\", suggested \"" 
+       lyxerr[Debug::GUI] << "filedialog open  with path \"" << path << "\", suggested \""
                << suggested << '"' << endl;
 
        // no support for asynchronous selection yet
@@ -64,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.str(false)
+                          << "\", 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;
 }