mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Take Vincent's advice: using a pointer for selectedFilter
avoids a useless object creation, as Qt tolerates the pointer to be null as well. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39863 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c5496cbf5d
commit
cb9e09f29e
@ -82,7 +82,7 @@ void FileDialog::setButton2(QString const & label, QString const & dir)
|
|||||||
|
|
||||||
FileDialog::Result FileDialog::save(QString const & path,
|
FileDialog::Result FileDialog::save(QString const & path,
|
||||||
QStringList const & filters, QString const & suggested,
|
QStringList const & filters, QString const & suggested,
|
||||||
QString & selectedFilter)
|
QString * selectedFilter)
|
||||||
{
|
{
|
||||||
LYXERR(Debug::GUI, "Select with path \"" << path
|
LYXERR(Debug::GUI, "Select with path \"" << path
|
||||||
<< "\", mask \"" << filters.join(";;")
|
<< "\", mask \"" << filters.join(";;")
|
||||||
@ -95,8 +95,8 @@ FileDialog::Result FileDialog::save(QString const & path,
|
|||||||
QString const startsWith = makeAbsPath(suggested, path);
|
QString const startsWith = makeAbsPath(suggested, path);
|
||||||
QString const name =
|
QString const name =
|
||||||
QFileDialog::getSaveFileName(qApp->focusWidget(),
|
QFileDialog::getSaveFileName(qApp->focusWidget(),
|
||||||
title_, startsWith, filters.join(";;"),
|
title_, startsWith, filters.join(";;"),
|
||||||
&selectedFilter, QFileDialog::DontConfirmOverwrite);
|
selectedFilter, QFileDialog::DontConfirmOverwrite);
|
||||||
if (name.isNull())
|
if (name.isNull())
|
||||||
result.first = FileDialog::Later;
|
result.first = FileDialog::Later;
|
||||||
else
|
else
|
||||||
@ -119,7 +119,8 @@ FileDialog::Result FileDialog::save(QString const & path,
|
|||||||
result.second = internalPath(dlg.selectedFiles()[0]);
|
result.second = internalPath(dlg.selectedFiles()[0]);
|
||||||
else
|
else
|
||||||
result.first = FileDialog::Later;
|
result.first = FileDialog::Later;
|
||||||
selectedFilter = dlg.selectedNameFilter();
|
if (selectedFilter != 0)
|
||||||
|
*selectedFilter = dlg.selectedNameFilter();
|
||||||
dlg.hide();
|
dlg.hide();
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
@ -129,8 +130,7 @@ FileDialog::Result FileDialog::save(QString const & path,
|
|||||||
FileDialog::Result FileDialog::save(QString const & path,
|
FileDialog::Result FileDialog::save(QString const & path,
|
||||||
QStringList const & filters, QString const & suggested)
|
QStringList const & filters, QString const & suggested)
|
||||||
{
|
{
|
||||||
QString selectedFilter;
|
return save(path, filters, suggested, 0);
|
||||||
return save(path, filters, suggested, selectedFilter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,9 +70,10 @@ public:
|
|||||||
Result save(QString const & path, QStringList const & filters,
|
Result save(QString const & path, QStringList const & filters,
|
||||||
QString const & suggested = QString());
|
QString const & suggested = QString());
|
||||||
|
|
||||||
/// Also retrieve the selected filter.
|
/// Also retrieve the selected filter (selectedFilter can be 0 if
|
||||||
|
/// that output is not needed).
|
||||||
Result save(QString const & path, QStringList const & filters,
|
Result save(QString const & path, QStringList const & filters,
|
||||||
QString const & suggested, QString & selectedFilter);
|
QString const & suggested, QString *selectedFilter);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Private;
|
class Private;
|
||||||
|
Loading…
Reference in New Issue
Block a user