2 * \file qt2/FileDialog.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS
12 #pragma implementation
19 #include "commandtags.h"
21 #include "frontends/FileDialog.h"
22 #include "FileDialog_private.h"
25 #include <qapplication.h>
31 struct FileDialog::Private {
36 FileDialog::FileDialog(LyXView *lv, string const & t, kb_action s, Button b1, Button b2)
37 : private_(new FileDialog::Private()), lv_(lv), title_(t), success_(s)
44 FileDialog::~FileDialog()
50 FileDialog::Result const FileDialog::Select(string const & path, string const & mask, string const & suggested)
54 filter = _("*|All files");
56 LyXFileDialog dlg(path, filter, title_, private_->b1, private_->b2);
57 lyxerr[Debug::GUI] << "Select with path \"" << path << "\", mask \"" << filter << "\", suggested \"" << suggested << endl;
59 dlg.setMode(QFileDialog::AnyFile);
61 if (!suggested.empty())
62 dlg.setSelection(suggested.c_str());
64 // This code relies on DestructiveClose which is broken
65 // in Qt < 3.0.5. So we just don't allow it for now.
66 //if (success_ == LFUN_SELECT_FILE_SYNC) {
68 FileDialog::Result result;
69 lyxerr[Debug::GUI] << "Synchronous FileDialog : " << endl;
70 result.first = FileDialog::Chosen;
72 lyxerr[Debug::GUI] << "result " << res << endl;
73 if (res == QDialog::Accepted)
74 result.second = string(dlg.selectedFile().data());
79 return make_pair(FileDialog::Later, string());