282 Q_UNUSED(sender); |
282 Q_UNUSED(sender); |
283 |
283 |
284 if ([filename length] == 0) |
284 if ([filename length] == 0) |
285 return NO; |
285 return NO; |
286 |
286 |
|
287 // Always accept directories regardless of their names (unless it is a bundle): |
|
288 BOOL isDir; |
|
289 if ([[NSFileManager defaultManager] fileExistsAtPath:filename isDirectory:&isDir] && isDir) { |
|
290 if ([mSavePanel treatsFilePackagesAsDirectories] == NO) { |
|
291 if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename] == NO) |
|
292 return YES; |
|
293 } |
|
294 } |
|
295 |
287 QString qtFileName = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString)(filename); |
296 QString qtFileName = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString)(filename); |
288 QFileInfo info(qtFileName.normalized(QT_PREPEND_NAMESPACE(QString::NormalizationForm_C))); |
297 QFileInfo info(qtFileName.normalized(QT_PREPEND_NAMESPACE(QString::NormalizationForm_C))); |
289 QString path = info.absolutePath(); |
298 QString path = info.absolutePath(); |
290 if (path != *mLastFilterCheckPath){ |
299 if (path != *mLastFilterCheckPath){ |
291 *mLastFilterCheckPath = path; |
300 *mLastFilterCheckPath = path; |
292 *mQDirFilterEntryList = info.dir().entryList(*mQDirFilter); |
301 *mQDirFilterEntryList = info.dir().entryList(*mQDirFilter); |
293 } |
302 } |
294 // Check if the QDir filter accepts the file: |
303 // Check if the QDir filter accepts the file: |
295 if (!mQDirFilterEntryList->contains(info.fileName())) |
304 if (!mQDirFilterEntryList->contains(info.fileName())) |
296 return NO; |
305 return NO; |
297 |
|
298 // Always accept directories regardless of their names (unless it is a bundle): |
|
299 BOOL isDir; |
|
300 if ([[NSFileManager defaultManager] fileExistsAtPath:filename isDirectory:&isDir] && isDir) { |
|
301 if ([mSavePanel treatsFilePackagesAsDirectories] == NO) { |
|
302 if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename] == NO) |
|
303 return YES; |
|
304 } |
|
305 } |
|
306 |
306 |
307 // No filter means accept everything |
307 // No filter means accept everything |
308 if (mSelectedNameFilter->isEmpty()) |
308 if (mSelectedNameFilter->isEmpty()) |
309 return YES; |
309 return YES; |
310 // Check if the current file name filter accepts the file: |
310 // Check if the current file name filter accepts the file: |