OSX: FileDialogHelper uses options to remember the selected filter

Task-number: QTBUG-35958
Change-Id: I998cf93232e79f70837cfa8f63592b69ea0dc563
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
Shawn Rutledge 2014-01-24 09:14:33 +01:00 committed by The Qt Project
parent 61e1bcb4dd
commit 64d95e3df2

View File

@ -665,8 +665,10 @@ void QCocoaFileDialogHelper::selectNameFilter(const QString &filter)
const int index = options()->nameFilters().indexOf(filter);
if (index != -1) {
QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
if (!delegate)
if (!delegate) {
options()->setInitiallySelectedNameFilter(filter);
return;
}
[delegate->mPopUpButton selectItemAtIndex:index];
[delegate filterChanged:nil];
}
@ -676,7 +678,7 @@ QString QCocoaFileDialogHelper::selectedNameFilter() const
{
QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
if (!delegate)
return QString();
return options()->initiallySelectedNameFilter();
int index = [delegate->mPopUpButton indexOfSelectedItem];
if (index >= options()->nameFilters().count())
return QString();