Commit 3227dcd4 authored by Hans-Christian Ebke's avatar Hans-Christian Ebke

Improved PluginFunctions::getSaveFileName.


git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@18755 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f82a4a18
......@@ -1114,14 +1114,33 @@ QString getOpenFileName(const QString &configProperty,
QString getSaveFileName(const QString &configProperty,
QWidget * parent, const QString & caption,
const QString & defaultDir, const QString & filter,
QString * selectedFilter, QFileDialog::Options options) {
QString * selectedFilter, QFileDialog::Options options,
const QString & defaultSuffix) {
const QString dir = OpenFlipperSettings().value(configProperty, defaultDir).toString();
const QString result = QFileDialog::getSaveFileName(parent, caption, dir,
filter, selectedFilter, options);
if (result.length())
/*
* We don't use this convenience wrapper any more since it
* prevents us from setting the default suffix.
*
* const QString result = QFileDialog::getSaveFileName(
* parent, caption, dir, filter, selectedFilter, options);
*/
QFileDialog dialog(parent, caption, dir, filter);
dialog.setOptions(options);
dialog.setAcceptMode(QFileDialog::AcceptSave);
if (selectedFilter && !selectedFilter->isEmpty())
dialog.selectNameFilter(*selectedFilter);
dialog.setDefaultSuffix(defaultSuffix);
if (dialog.exec() == QDialog::Accepted) {
if (selectedFilter)
*selectedFilter = dialog.selectedFilter();
QString result = dialog.selectedFiles().value(0);
OpenFlipperSettings().setValue(configProperty, result);
return result;
return result;
}
return QString();
}
QStringList collectObjectComments(bool visibleOnly, bool targetedOnly) {
......
......@@ -666,7 +666,8 @@ DLLEXPORT
QString getSaveFileName(const QString &configProperty,
QWidget * parent = 0, const QString & caption = QString(),
const QString & defaultDir = QString(), const QString & filter = QString(),
QString * selectedFilter = 0, QFileDialog::Options options = 0);
QString * selectedFilter = 0, QFileDialog::Options options = 0,
const QString & defaultSuffix = QString());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment