From cee1f6454a7b52a52795590e2f793c0cd4e15ce1 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 30 Jun 2011 11:14:32 +0200 Subject: Cocoa: QFileDialog: fix filename filter not applied correctly From before, the filename filters set on the dialog were matched against the full patch of the filenames shown in the dialog. The correct way is to only match it against the filename. This becomes evident if you set a filter that has no wild cards, e.g "qmake" Rev-By: jbache --- src/gui/dialogs/qfiledialog_mac.mm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/gui/dialogs') diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index fb52274798..f1d3a4abdb 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -305,12 +305,13 @@ QT_USE_NAMESPACE QString qtFileName = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString)(filename); QFileInfo info(qtFileName.normalized(QT_PREPEND_NAMESPACE(QString::NormalizationForm_C))); QString path = info.absolutePath(); + QString name = info.fileName(); if (path != *mLastFilterCheckPath){ *mLastFilterCheckPath = path; *mQDirFilterEntryList = info.dir().entryList(*mQDirFilter); } // Check if the QDir filter accepts the file: - if (!mQDirFilterEntryList->contains(info.fileName())) + if (!mQDirFilterEntryList->contains(name)) return NO; // No filter means accept everything @@ -318,7 +319,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), name)) return YES; } return NO; -- cgit v1.2.3