X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FFileDialog.C;h=99ea166af72f790e641f698c2def2c810b99b005;hb=1afb2a6b05b22c681aa21780134d3ed922f9498f;hp=fda0481e5611a9e4f5b60622feeada8d2b550f4c;hpb=5b66bd5d4cb555d6a2bb7069c59c9a6d48b875b1;p=lyx.git diff --git a/src/frontends/qt4/FileDialog.C b/src/frontends/qt4/FileDialog.C index fda0481e56..99ea166af7 100644 --- a/src/frontends/qt4/FileDialog.C +++ b/src/frontends/qt4/FileDialog.C @@ -1,5 +1,5 @@ /** - * \file qt2/FileDialog.C + * \file qt4/FileDialog.C * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * @@ -80,17 +80,16 @@ FileDialog::Result const FileDialog::save(string const & path, #ifdef USE_NATIVE_FILEDIALOG string const startsWith = makeAbsPath(suggested, path); - result.second = fromqstr( - Q3FileDialog::getSaveFileName(toqstr(startsWith), - toqstr(filters.as_string()), - qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget(), - title_.c_str())); + result.second = fromqstr(QFileDialog::getSaveFileName( + qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget(), + title_.c_str(), toqstr(startsWith), toqstr(filters.as_string()) )); #else - LyXFileDialog dlg(path, filters, title_, private_->b1, private_->b2); - dlg.setMode(Q3FileDialog::AnyFile); + LyXFileDialog dlg(title_, path, filters, private_->b1, private_->b2); + dlg.setFileMode(QFileDialog::AnyFile); + dlg.setAcceptMode(QFileDialog::AcceptSave); if (!suggested.empty()) - dlg.setSelection(toqstr(suggested)); + dlg.selectFile(toqstr(suggested)); lyxerr[Debug::GUI] << "Synchronous FileDialog: " << endl; int res = dlg.exec(); @@ -115,16 +114,14 @@ FileDialog::Result const FileDialog::open(string const & path, #ifdef USE_NATIVE_FILEDIALOG string const startsWith = makeAbsPath(suggested, path); - result.second = fromqstr( - Q3FileDialog::getOpenFileName(toqstr(startsWith), - toqstr(filters.as_string()), - qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget(), - title_.c_str())); + result.second = fromqstr(QFileDialog::getOpenFileName( + qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget(), + title_.c_str(), toqstr(startsWith), toqstr(filters.as_string()) )); #else - LyXFileDialog dlg(path, filters, title_, private_->b1, private_->b2); + LyXFileDialog dlg(title_, path, filters, private_->b1, private_->b2); if (!suggested.empty()) - dlg.setSelection(toqstr(suggested)); + dlg.selectFile(toqstr(suggested)); lyxerr[Debug::GUI] << "Synchronous FileDialog: " << endl; int res = dlg.exec(); @@ -147,19 +144,18 @@ FileDialog::Result const FileDialog::opendir(string const & path, #ifdef USE_NATIVE_FILEDIALOG string const startsWith = makeAbsPath(suggested, path); - result.second = fromqstr( - Q3FileDialog::getExistingDirectory(toqstr(startsWith), - qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget(), - title_.c_str())); + result.second = fromqstr(QFileDialog::getExistingDirectory( + qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget(), + title_.c_str(),toqstr(startsWith) )); #else FileFilterList const filter(_("Directories")); - LyXFileDialog dlg(path, filter, title_, private_->b1, private_->b2); + LyXFileDialog dlg(title_, path, filter, private_->b1, private_->b2); - dlg.setMode(Q3FileDialog::DirectoryOnly); + dlg.setFileMode(QFileDialog::DirectoryOnly); if (!suggested.empty()) - dlg.setSelection(toqstr(suggested)); + dlg.selectFile(toqstr(suggested)); lyxerr[Debug::GUI] << "Synchronous FileDialog: " << endl; int res = dlg.exec();