2 * \file LyXFileDialog.cpp
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.
13 #include "LyXFileDialog.h"
15 #include "qt_helpers.h"
17 #include "support/lstrings.h"
19 #include <QApplication>
20 #include <QToolButton>
21 #include <QHBoxLayout>
24 using namespace lyx::support;
29 LyXFileDialog::LyXFileDialog(QString const & title,
31 QStringList const & filters,
32 FileDialog::Button const & b1,
33 FileDialog::Button const & b2)
34 // FIXME replace that with guiApp->currentView()
35 : QFileDialog(qApp->focusWidget(), title, path)
37 setNameFilters(filters);
38 setWindowTitle(title);
39 setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
40 setOption(QFileDialog::DontUseNativeDialog);
42 QList<QHBoxLayout *> layout = findChildren<QHBoxLayout *>();
44 if (!b1.first.isEmpty()) {
46 QToolButton * tb = new QToolButton(this);
47 connect(tb, SIGNAL(clicked()), this, SLOT(button1Clicked()));
48 tb->setText(b1.first);
49 layout.at(0)->addWidget(tb);
52 if (!b2.first.isEmpty()) {
54 QToolButton * tb = new QToolButton(this);
55 connect(tb, SIGNAL(clicked()), this, SLOT(button2Clicked()));
56 tb->setText(b2.first);
57 layout.at(0)->addWidget(tb);
62 void LyXFileDialog::button1Clicked()
64 setDirectory(b1_dir_);
68 void LyXFileDialog::button2Clicked()
70 setDirectory(b2_dir_);
75 #include "moc_LyXFileDialog.cpp"