From 6367ee4f6f0f540e1ad6522766ff3a4edab8c281 Mon Sep 17 00:00:00 2001 From: con Date: Wed, 9 Feb 2011 11:52:43 +0100 Subject: [PATCH] Mac: Fix file name filters that don't start with '*'. Cocoa gives us the full path for checking but we want to only check the file name. Task-number: QTBUG-17326 Reviewed-by: pending --- src/gui/dialogs/qfiledialog_mac.mm | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index cc53858..d2039aa 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -302,8 +302,9 @@ QT_USE_NAMESPACE *mLastFilterCheckPath = path; *mQDirFilterEntryList = info.dir().entryList(*mQDirFilter); } + const QString &fileNameWithoutPath = info.fileName(); // Check if the QDir filter accepts the file: - if (!mQDirFilterEntryList->contains(info.fileName())) + if (!mQDirFilterEntryList->contains(fileNameWithoutPath)) return NO; // No filter means accept everything @@ -311,7 +312,7 @@ QT_USE_NAMESPACE return YES; // Check if the current file name filter accepts the file: for (int i=0; isize(); ++i) { - if (QDir::match(mSelectedNameFilter->at(i), qtFileName)) + if (QDir::match(mSelectedNameFilter->at(i), fileNameWithoutPath)) return YES; } return NO; -- 1.7.1