From 64d95e3df27c4e859b2b7e88aac0640bc5c2ddd9 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 24 Jan 2014 09:14:33 +0100 Subject: [PATCH] OSX: FileDialogHelper uses options to remember the selected filter Task-number: QTBUG-35958 Change-Id: I998cf93232e79f70837cfa8f63592b69ea0dc563 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 08505d91a2..f401459cc3 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -665,8 +665,10 @@ void QCocoaFileDialogHelper::selectNameFilter(const QString &filter) const int index = options()->nameFilters().indexOf(filter); if (index != -1) { QNSOpenSavePanelDelegate *delegate = static_cast(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(mDelegate); if (!delegate) - return QString(); + return options()->initiallySelectedNameFilter(); int index = [delegate->mPopUpButton indexOfSelectedItem]; if (index >= options()->nameFilters().count()) return QString();