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
17 #include "commandtags.h"
19 #include "frontends/FileDialog.h"
20 #include "FileDialog_private.h"
24 #include <qapplication.h>
32 struct FileDialog::Private {
37 FileDialog::FileDialog(LyXView *lv, string const & t, kb_action s, Button b1, Button b2)
38 : private_(new FileDialog::Private), lv_(lv), title_(t), success_(s)
45 FileDialog::~FileDialog()
51 FileDialog::Result const FileDialog::Select(string const & path, string const & mask, string const & suggested)
55 filter = _("*|All files");
57 LyXFileDialog dlg(path, filter, title_, private_->b1, private_->b2);
58 lyxerr[Debug::GUI] << "Select with path \"" << path << "\", mask \"" << filter << "\", suggested \"" << suggested << endl;
60 dlg.setMode(QFileDialog::AnyFile);
62 if (!suggested.empty())
63 dlg.setSelection(suggested.c_str());
65 // This code relies on DestructiveClose which is broken
66 // in Qt < 3.0.5. So we just don't allow it for now.
67 //if (success_ == LFUN_SELECT_FILE_SYNC) {
69 FileDialog::Result result;
70 lyxerr[Debug::GUI] << "Synchronous FileDialog : " << endl;
71 result.first = FileDialog::Chosen;
73 lyxerr[Debug::GUI] << "result " << res << endl;
74 if (res == QDialog::Accepted)
75 result.second = string(dlg.selectedFile().data());
80 return make_pair(FileDialog::Later, string());