get rid of QT3_SUPPORT and some cleanup

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14723 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-08-17 08:45:48 +00:00
parent e30a1e10a7
commit 64317e45cd
3 changed files with 13 additions and 11 deletions

View File

@ -81,7 +81,7 @@ FileDialog::Result const FileDialog::save(string const & path,
#ifdef USE_NATIVE_FILEDIALOG #ifdef USE_NATIVE_FILEDIALOG
string const startsWith = makeAbsPath(suggested, path); string const startsWith = makeAbsPath(suggested, path);
result.second = fromqstr(QFileDialog::getSaveFileName( result.second = fromqstr(QFileDialog::getSaveFileName(
qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget(), qApp->focusWidget(),
title_.c_str(), toqstr(startsWith), toqstr(filters.as_string()) )); title_.c_str(), toqstr(startsWith), toqstr(filters.as_string()) ));
#else #else
LyXFileDialog dlg(title_, path, filters, private_->b1, private_->b2); LyXFileDialog dlg(title_, path, filters, private_->b1, private_->b2);
@ -95,7 +95,7 @@ FileDialog::Result const FileDialog::save(string const & path,
int res = dlg.exec(); int res = dlg.exec();
lyxerr[Debug::GUI] << "result " << res << endl; lyxerr[Debug::GUI] << "result " << res << endl;
if (res == QDialog::Accepted) if (res == QDialog::Accepted)
result.second = fromqstr(dlg.selectedFile()); result.second = fromqstr(dlg.selectedFiles()[0]);
dlg.hide(); dlg.hide();
#endif #endif
return result; return result;
@ -115,7 +115,7 @@ FileDialog::Result const FileDialog::open(string const & path,
#ifdef USE_NATIVE_FILEDIALOG #ifdef USE_NATIVE_FILEDIALOG
string const startsWith = makeAbsPath(suggested, path); string const startsWith = makeAbsPath(suggested, path);
result.second = fromqstr(QFileDialog::getOpenFileName( result.second = fromqstr(QFileDialog::getOpenFileName(
qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget(), qApp->focusWidget(),
title_.c_str(), toqstr(startsWith), toqstr(filters.as_string()) )); title_.c_str(), toqstr(startsWith), toqstr(filters.as_string()) ));
#else #else
LyXFileDialog dlg(title_, path, filters, private_->b1, private_->b2); LyXFileDialog dlg(title_, path, filters, private_->b1, private_->b2);
@ -127,7 +127,7 @@ FileDialog::Result const FileDialog::open(string const & path,
int res = dlg.exec(); int res = dlg.exec();
lyxerr[Debug::GUI] << "result " << res << endl; lyxerr[Debug::GUI] << "result " << res << endl;
if (res == QDialog::Accepted) if (res == QDialog::Accepted)
result.second = fromqstr(dlg.selectedFile()); result.second = fromqstr(dlg.selectedFiles()[0]);
dlg.hide(); dlg.hide();
#endif #endif
return result; return result;
@ -145,7 +145,7 @@ FileDialog::Result const FileDialog::opendir(string const & path,
#ifdef USE_NATIVE_FILEDIALOG #ifdef USE_NATIVE_FILEDIALOG
string const startsWith = makeAbsPath(suggested, path); string const startsWith = makeAbsPath(suggested, path);
result.second = fromqstr(QFileDialog::getExistingDirectory( result.second = fromqstr(QFileDialog::getExistingDirectory(
qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget(), qApp->focusWidget(),
title_.c_str(),toqstr(startsWith) )); title_.c_str(),toqstr(startsWith) ));
#else #else
FileFilterList const filter(_("Directories")); FileFilterList const filter(_("Directories"));
@ -161,7 +161,7 @@ FileDialog::Result const FileDialog::opendir(string const & path,
int res = dlg.exec(); int res = dlg.exec();
lyxerr[Debug::GUI] << "result " << res << endl; lyxerr[Debug::GUI] << "result " << res << endl;
if (res == QDialog::Accepted) if (res == QDialog::Accepted)
result.second = fromqstr(dlg.selectedFile()); result.second = fromqstr(dlg.selectedFiles()[0]);
dlg.hide(); dlg.hide();
#endif #endif
return result; return result;

View File

@ -11,6 +11,7 @@
#include <config.h> #include <config.h>
#include "FileDialog_private.h" #include "FileDialog_private.h"
#include "qt_helpers.h" #include "qt_helpers.h"
#include "support/filefilterlist.h" #include "support/filefilterlist.h"
@ -48,11 +49,12 @@ LyXFileDialog::LyXFileDialog(string const & t,
lyx::support::FileFilterList const & filters, lyx::support::FileFilterList const & filters,
FileDialog::Button const & b1, FileDialog::Button const & b1,
FileDialog::Button const & b2) FileDialog::Button const & b2)
: QFileDialog(qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget(), // FIXME replace that with theApp->gui()->currentView()
: QFileDialog(qApp->focusWidget(),
toqstr(t), toqstr(p), toqstr(filters.as_string())), toqstr(t), toqstr(p), toqstr(filters.as_string())),
b1_(0), b2_(0) b1_(0), b2_(0)
{ {
setCaption(toqstr(t)); setWindowTitle(toqstr(t));
QList<QHBoxLayout *> layout = findChildren<QHBoxLayout *>(); QList<QHBoxLayout *> layout = findChildren<QHBoxLayout *>();
@ -77,9 +79,9 @@ LyXFileDialog::LyXFileDialog(string const & t,
void LyXFileDialog::buttonClicked() void LyXFileDialog::buttonClicked()
{ {
if (sender() == b1_) if (sender() == b1_)
setDir(toqstr(b1_dir_)); setDirectory(toqstr(b1_dir_));
else if (sender() == b2_) else if (sender() == b2_)
setDir(toqstr(b2_dir_)); setDirectory(toqstr(b2_dir_));
} }
#include "FileDialog_private_moc.cpp" #include "FileDialog_private_moc.cpp"

View File

@ -12,8 +12,8 @@
#ifndef FILEDIALOG_PRIVATE_H #ifndef FILEDIALOG_PRIVATE_H
#define FILEDIALOG_PRIVATE_H #define FILEDIALOG_PRIVATE_H
#include "frontends/FileDialog.h" #include "frontends/FileDialog.h"
#include <QFileDialog> #include <QFileDialog>
namespace lyx { namespace lyx {