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>
33 struct FileDialog::Private {
39 FileDialog::FileDialog(LyXView * lv, string const & t,
40 kb_action s, Button b1, Button b2)
41 : private_(new FileDialog::Private), lv_(lv), title_(t), success_(s)
48 FileDialog::~FileDialog()
54 FileDialog::Result const FileDialog::Select(string const & path,
56 string const & suggested)
60 filter = _("*|All files");
62 LyXFileDialog dlg(path, filter, title_, private_->b1, private_->b2);
63 lyxerr[Debug::GUI] << "Select with path \"" << path
64 << "\", mask \"" << filter
65 << "\", suggested \"" << suggested << endl;
67 dlg.setMode(QFileDialog::AnyFile);
69 if (!suggested.empty())
70 dlg.setSelection(suggested.c_str());
72 // This code relies on DestructiveClose which is broken
73 // in Qt < 3.0.5. So we just don't allow it for now.
74 //if (success_ == LFUN_SELECT_FILE_SYNC) {
76 FileDialog::Result result;
77 lyxerr[Debug::GUI] << "Synchronous FileDialog : " << endl;
78 result.first = FileDialog::Chosen;
80 lyxerr[Debug::GUI] << "result " << res << endl;
81 if (res == QDialog::Accepted)
82 result.second = string(dlg.selectedFile().data());
87 return make_pair(FileDialog::Later, string());