Avoid setting initialNameFilter when mode is Directory

Task-number: QTBUG-30001

Change-Id: I5e854ce99137bd9d718cb2052f2c8dc1fb92b78f
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Irfan Omair 2013-03-01 14:54:21 -08:00 committed by The Qt Project
parent 342c99ff45
commit d903b2aac4

View File

@ -1223,8 +1223,9 @@ QWindowsNativeDialogBase *QWindowsFileDialogHelper::createNativeDialog()
// Apply settings.
const QSharedPointer<QFileDialogOptions> &opts = options();
const QFileDialogOptions::FileMode mode = opts->fileMode();
result->setWindowTitle(opts->windowTitle());
result->setMode(opts->fileMode(), opts->options());
result->setMode(mode, opts->options());
result->setHideFiltersDetails(opts->testOption(QFileDialogOptions::HideNameFilterDetails));
const QStringList nameFilters = opts->nameFilters();
if (!nameFilters.isEmpty())
@ -1242,9 +1243,12 @@ QWindowsNativeDialogBase *QWindowsFileDialogHelper::createNativeDialog()
if (!info.isDir())
result->selectFile(info.fileName());
}
// No need to select initialNameFilter if mode is Dir
if (mode != QFileDialogOptions::Directory && mode != QFileDialogOptions::DirectoryOnly) {
const QString initialNameFilter = opts->initiallySelectedNameFilter();
if (!initialNameFilter.isEmpty())
result->selectNameFilter(initialNameFilter);
}
const QString defaultSuffix = opts->defaultSuffix();
if (!defaultSuffix.isEmpty())
result->setDefaultSuffix(defaultSuffix);