summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2010-03-09 10:33:58 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2010-03-09 10:35:53 (GMT)
commit382cbd618fe4f5093bb1ca3f4fca3bb35614a18d (patch)
tree32a5e217710b4ab366f0659f4323e2cb561254f0
parentd0794c43f21aab3d1ce926f38c315ba2ac999c41 (diff)
downloadQt-382cbd618fe4f5093bb1ca3f4fca3bb35614a18d.zip
Qt-382cbd618fe4f5093bb1ca3f4fca3bb35614a18d.tar.gz
Qt-382cbd618fe4f5093bb1ca3f4fca3bb35614a18d.tar.bz2
Carbon: Native filedialog does not apply filters on app-bundles
The native file dialog (and finder) handles bundles (like .app) like normal files rather than directories, unless specified otherwise. But since they are directories at the same time, we skip sending them through the name filters. This patch makes sure that we are more consistent on this matter for the carbon port. Task-number: QTBUG-834 Reviewed-by: msorvig
-rw-r--r--src/gui/dialogs/qfiledialog_mac.mm17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm
index da8cab5..14a5f15 100644
--- a/src/gui/dialogs/qfiledialog_mac.mm
+++ b/src/gui/dialogs/qfiledialog_mac.mm
@@ -729,6 +729,7 @@ Boolean QFileDialogPrivate::qt_mac_filedialog_filter_proc(AEDesc *theItem, void
NavFileOrFolderInfo *theInfo = static_cast<NavFileOrFolderInfo *>(info);
QString file;
+ QString path;
const QtMacFilterName &fn
= fileDialogPrivate->filterInfo.filters.at(fileDialogPrivate->filterInfo.currentSelection);
if (theItem->descriptorType == typeFSRef) {
@@ -736,10 +737,12 @@ Boolean QFileDialogPrivate::qt_mac_filedialog_filter_proc(AEDesc *theItem, void
AEGetDescData(theItem, &ref, sizeof(ref));
UInt8 str_buffer[1024];
FSRefMakePath(&ref, str_buffer, 1024);
- file = QString::fromUtf8(reinterpret_cast<const char *>(str_buffer));
- int slsh = file.lastIndexOf(QLatin1Char('/'));
+ path = QString::fromUtf8(reinterpret_cast<const char *>(str_buffer));
+ int slsh = path.lastIndexOf(QLatin1Char('/'));
if (slsh != -1)
- file = file.right(file.length() - slsh - 1);
+ file = path.right(path.length() - slsh - 1);
+ else
+ file = path;
}
QStringList reg = fn.regexp.split(QLatin1String(";"));
for (QStringList::const_iterator it = reg.constBegin(); it != reg.constEnd(); ++it) {
@@ -751,7 +754,13 @@ Boolean QFileDialogPrivate::qt_mac_filedialog_filter_proc(AEDesc *theItem, void
if (rg.exactMatch(file))
return true;
}
- return (theInfo->isFolder && !file.endsWith(QLatin1String(".app")));
+
+ if (theInfo->isFolder) {
+ if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:qt_mac_QStringToNSString(path)])
+ return false;
+ return true;
+ }
+ return false;
}
void QFileDialogPrivate::qt_mac_filedialog_event_proc(const NavEventCallbackMessage msg,