3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
10 #pragma implementation
17 #include "commandtags.h"
19 #include "frontends/FileDialog.h"
20 #include "FileDialog_private.h"
27 FileDialog::FileDialog(LyXView *lv, string const &t, kb_action s, Button b1, Button b2)
28 : private_(0), lv_(lv), title_(t), success_(s)
34 FileDialog::~FileDialog()
39 FileDialog::Result const FileDialog::Select(string const & path, string const & mask, string const & suggested)
43 filter = _("*|All files");
45 LyXFileDialog * dlg = new LyXFileDialog(lv_, success_, path, filter, title_);
46 lyxerr[Debug::GUI] << "Select with path \"" << path << "\", mask \"" << filter << "\", suggested \"" << suggested << endl;
48 if (!suggested.empty())
49 dlg->setSelection(suggested.c_str());
51 if (success_ == LFUN_SELECT_FILE_SYNC) {
52 FileDialog::Result result;
53 lyxerr[Debug::GUI] << "Synchronous FileDialog : " << endl;
54 result.first = FileDialog::Chosen;
55 int res = dlg->exec();
56 lyxerr[Debug::GUI] << "result " << res << endl;
57 if (res == QDialog::Accepted)
58 result.second = string(dlg->selectedFile().data());
63 return make_pair(FileDialog::Later, string());