2 * \file qt2/FileDialog.C
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"
23 #include <qapplication.h>
29 struct FileDialog::Private {
34 FileDialog::FileDialog(LyXView *lv, string const & t, kb_action s, Button b1, Button b2)
35 : private_(new FileDialog::Private()), lv_(lv), title_(t), success_(s)
42 FileDialog::~FileDialog()
48 FileDialog::Result const FileDialog::Select(string const & path, string const & mask, string const & suggested)
52 filter = _("*|All files");
54 LyXFileDialog dlg(path, filter, title_, private_->b1, private_->b2);
55 lyxerr[Debug::GUI] << "Select with path \"" << path << "\", mask \"" << filter << "\", suggested \"" << suggested << endl;
57 dlg.setMode(QFileDialog::AnyFile);
59 if (!suggested.empty())
60 dlg.setSelection(suggested.c_str());
62 // This code relies on DestructiveClose which is broken
63 // in Qt < 3.0.5. So we just don't allow it for now.
64 //if (success_ == LFUN_SELECT_FILE_SYNC) {
66 FileDialog::Result result;
67 lyxerr[Debug::GUI] << "Synchronous FileDialog : " << endl;
68 result.first = FileDialog::Chosen;
70 lyxerr[Debug::GUI] << "result " << res << endl;
71 if (res == QDialog::Accepted)
72 result.second = string(dlg.selectedFile().data());
77 return make_pair(FileDialog::Later, string());