summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-06-23 08:27:37 (GMT)
committerPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-06-23 10:22:18 (GMT)
commitb26765f9f40a0320113cf10cbde88f7864d736ab (patch)
tree7c7bc2369fcf532a6bfd51a9bec27238433f940f
parent5c787e03ef321f4dd2eda8e229978639ccfb70cc (diff)
downloadQt-b26765f9f40a0320113cf10cbde88f7864d736ab.zip
Qt-b26765f9f40a0320113cf10cbde88f7864d736ab.tar.gz
Qt-b26765f9f40a0320113cf10cbde88f7864d736ab.tar.bz2
Newly created folders in QFileDialog are disabled on Cocoa.
For a newly created folder in the current path, we were returning NO for the "shouldShowFilename" callback. This patch moves the check for directories to the begining. Task-number: QTBUG-11532 Reviewed-by: Carlos Duclos
-rw-r--r--src/gui/dialogs/qfiledialog_mac.mm18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm
index b07b1ea..f1afaa9 100644
--- a/src/gui/dialogs/qfiledialog_mac.mm
+++ b/src/gui/dialogs/qfiledialog_mac.mm
@@ -284,6 +284,15 @@ QT_USE_NAMESPACE
if ([filename length] == 0)
return NO;
+ // Always accept directories regardless of their names (unless it is a bundle):
+ BOOL isDir;
+ if ([[NSFileManager defaultManager] fileExistsAtPath:filename isDirectory:&isDir] && isDir) {
+ if ([mSavePanel treatsFilePackagesAsDirectories] == NO) {
+ if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename] == NO)
+ return YES;
+ }
+ }
+
QString qtFileName = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString)(filename);
QFileInfo info(qtFileName.normalized(QT_PREPEND_NAMESPACE(QString::NormalizationForm_C)));
QString path = info.absolutePath();
@@ -295,15 +304,6 @@ QT_USE_NAMESPACE
if (!mQDirFilterEntryList->contains(info.fileName()))
return NO;
- // Always accept directories regardless of their names (unless it is a bundle):
- BOOL isDir;
- if ([[NSFileManager defaultManager] fileExistsAtPath:filename isDirectory:&isDir] && isDir) {
- if ([mSavePanel treatsFilePackagesAsDirectories] == NO) {
- if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename] == NO)
- return YES;
- }
- }
-
// No filter means accept everything
if (mSelectedNameFilter->isEmpty())
return YES;