]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FileDialog.C
Removed all redundant using directives from the source.
[lyx.git] / src / frontends / xforms / FileDialog.C
1 /**
2  * \file xforms/FileDialog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "frontends/FileDialog.h"
14 #include "FormFiledialog.h"
15
16 #include "debug.h"
17 #include "gettext.h"
18
19 #include "support/lstrings.h"
20
21 using namespace lyx::support;
22
23 using std::endl;
24
25
26 FileDialog::FileDialog(string const &t, kb_action s, Button b1, Button b2)
27         : private_(0), title_(t), success_(s)
28 {
29         private_ = new FileDialog::Private();
30
31         private_->SetButton(0, b1.first, b1.second);
32         private_->SetButton(1, b2.first, b2.second);
33 }
34
35
36 FileDialog::~FileDialog()
37 {
38         delete private_;
39 }
40
41
42 FileDialog::Result const FileDialog::save(string const & path, string const & mask, string const & suggested)
43 {
44         return open(path, mask, suggested);
45 }
46
47
48 FileDialog::Result const FileDialog::opendir(string const & path, string const & suggested)
49 {
50         lyxerr[Debug::GUI] << "filedialog open  with path \"" << path << "\", suggested \""
51                 << suggested << '"' << endl;
52
53         // no support for asynchronous selection yet
54
55         FileDialog::Result result;
56
57         result.first = FileDialog::Chosen;
58         result.second = private_->SelectDir(title_, path, suggested);
59
60         return result;
61 }
62
63
64 FileDialog::Result const FileDialog::open(string const & path, string const & mask, string const & suggested)
65 {
66         string filter = mask;
67
68         if (mask.empty())
69                 filter = _("*");
70         else {
71                 rsplit(mask, filter, '|');
72                 if (filter.empty())
73                         filter = mask;
74         }
75
76         lyxerr[Debug::GUI] << "filedialog open  with path \"" << path << "\", mask \""
77                 << filter << "\", suggested \"" << suggested << '"' << endl;
78
79         // no support for asynchronous selection yet
80
81         FileDialog::Result result;
82
83         result.first = FileDialog::Chosen;
84         result.second = private_->Select(title_, path, filter, suggested);
85
86         return result;
87 }