]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/FileDialog_private.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / qt4 / FileDialog_private.C
index 8a31c7a1cca44330875cc6eabdeb26178898a643..7a4a83b4ee975c427f71c76842a3a26b80d11c57 100644 (file)
@@ -11,6 +11,7 @@
 #include <config.h>
 
 #include "FileDialog_private.h"
+
 #include "qt_helpers.h"
 
 #include "support/filefilterlist.h"
@@ -18,6 +19,7 @@
 
 #include <QApplication>
 #include <QToolButton>
+#include <QHBoxLayout>
 
 using lyx::support::split;
 
@@ -42,23 +44,26 @@ string const getLabel(string const & str) {
 } // namespace anon
 
 
-LyXFileDialog::LyXFileDialog(string const & p,
+LyXFileDialog::LyXFileDialog(string const & t,
+                            string const & p,
                             lyx::support::FileFilterList const & filters,
-                            string const & t,
                             FileDialog::Button const & b1,
                             FileDialog::Button const & b2)
-       : Q3FileDialog(toqstr(p), toqstr(filters.as_string()),
-                     qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget(), toqstr(t), true),
-         b1_(0), b2_(0)
+                                // FIXME replace that with theApp->gui()->currentView()
+       : QFileDialog(qApp->focusWidget(),
+                     toqstr(t), toqstr(p), toqstr(filters.as_string())),
+                     b1_(0), b2_(0)
 {
-       setCaption(toqstr(t));
+       setWindowTitle(toqstr(t));
+
+       QList<QHBoxLayout *> layout = findChildren<QHBoxLayout *>();
 
        if (!b1.first.empty()) {
                b1_dir_ = b1.second;
                b1_ = new QToolButton(this);
                connect(b1_, SIGNAL(clicked()), this, SLOT(buttonClicked()));
                b1_->setText(toqstr(getLabel(b1.first)));
-               addToolButton(b1_, true);
+               layout.at(0)->addWidget(b1_);
        }
 
        if (!b2.first.empty()) {
@@ -66,7 +71,7 @@ LyXFileDialog::LyXFileDialog(string const & p,
                b2_ = new QToolButton(this);
                connect(b2_, SIGNAL(clicked()), this, SLOT(buttonClicked()));
                b2_->setText(toqstr(getLabel(b2.first)));
-               addToolButton(b2_);
+               layout.at(0)->addWidget(b2_);
        }
 }
 
@@ -74,7 +79,9 @@ LyXFileDialog::LyXFileDialog(string const & p,
 void LyXFileDialog::buttonClicked()
 {
        if (sender() == b1_)
-               setDir(toqstr(b1_dir_));
+               setDirectory(toqstr(b1_dir_));
        else if (sender() == b2_)
-               setDir(toqstr(b2_dir_));
+               setDirectory(toqstr(b2_dir_));
 }
+
+#include "FileDialog_private_moc.cpp"