]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FileDialog.C
remove defaults stuff, let Qt handle no toolbar
[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
14 #include "FormFiledialog.h"
15 #include "frontends/FileDialog.h"
16 #include "frontends/LyXView.h"
17 #include "bufferview_funcs.h"
18 #include "gettext.h"
19 #include "lfuns.h"
20 #include "debug.h"
21 #include "support/lstrings.h"
22 #include <utility>
23
24
25 using std::make_pair;
26 using std::pair;
27 using std::endl;
28
29 FileDialog::FileDialog(string const &t, kb_action s, Button b1, Button b2)
30         : private_(0), title_(t), success_(s)
31 {
32         private_ = new FileDialog::Private();
33
34         private_->SetButton(0, b1.first, b1.second);
35         private_->SetButton(1, b2.first, b2.second);
36 }
37
38
39 FileDialog::~FileDialog()
40 {
41         delete private_;
42 }
43
44
45 FileDialog::Result const FileDialog::save(string const & path, string const & mask, string const & suggested)
46 {
47         return open(path, mask, suggested);
48 }
49
50
51 FileDialog::Result const FileDialog::opendir(string const & path, string const & suggested)
52 {
53         lyxerr[Debug::GUI] << "filedialog open  with path \"" << path << "\", suggested \""
54                 << suggested << '"' << endl;
55
56         // no support for asynchronous selection yet
57
58         FileDialog::Result result;
59
60         result.first = FileDialog::Chosen;
61         result.second = private_->SelectDir(title_, path, suggested);
62
63         return result;
64 }
65
66
67 FileDialog::Result const FileDialog::open(string const & path, string const & mask, string const & suggested)
68 {
69         string filter = mask;
70
71         if (mask.empty())
72                 filter = _("*");
73         else {
74                 rsplit(mask, filter, '|');
75                 if (filter.empty())
76                         filter = mask;
77         }
78
79         lyxerr[Debug::GUI] << "filedialog open  with path \"" << path << "\", mask \""
80                 << filter << "\", suggested \"" << suggested << '"' << endl;
81
82         // no support for asynchronous selection yet
83
84         FileDialog::Result result;
85
86         result.first = FileDialog::Chosen;
87         result.second = private_->Select(title_, path, filter, suggested);
88
89         return result;
90 }