3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
10 #pragma implementation
17 #include "commandtags.h"
21 #include "frontends/FileDialog.h"
23 #include "FileDialog_private.h"
31 FileDialog::FileDialog(LyXView *lv, string const &t, kb_action s, Button b1, Button b2)
32 : private_(0), lv_(lv), title_(t), success_(s)
34 // FIXME - to get the icon menu working sensibly we need MVCise the operations
35 // so we can get told which icons to use ...
39 FileDialog::~FileDialog()
44 FileDialog::Result const FileDialog::Select(string const & path, string const & mask, string const & suggested)
49 filter = _("*|All files");
51 LyXKFileDialog * dlg = new LyXKFileDialog(lv_, success_, path, filter, title_);
53 lyxerr[Debug::GUI] << "Select with path \"" << path << "\", mask \"" << filter << "\", suggested \"" << suggested << endl;
55 if (!suggested.empty())
56 dlg->setSelection(suggested.c_str());
58 if (success_ == LFUN_SELECT_FILE_SYNC) {
59 FileDialog::Result result;
61 lyxerr[Debug::GUI] << "Synchronous FileDialog : " << endl;
63 result.first = FileDialog::Chosen;
65 int res = dlg->exec();
67 lyxerr[Debug::GUI] << "result " << res << endl;
69 if (res == QDialog::Accepted)
70 result.second = string(dlg->selectedFile().data());
79 return make_pair(FileDialog::Later, string());