summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-06-20 16:45:12 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-06-20 16:45:12 +0200
commit6213b8145772d3dc584907a544f6c46b8cef74e2 (patch)
tree4c1902793bb78511e63c09cbe92f9eda6b3d7237 /src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
parent75e9c7d6bc662e62e9ce8b641588183992c1e8bf (diff)
parent25739bebba0343a8b35775a073c49f0fba080762 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp tools/configure/configureapp.cpp Change-Id: I3092bd3276af14304b7ab3ae1e1cc05d11cdede0
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index e1f8f8c20a..402e5b9b01 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -170,7 +170,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate);
mSelectedNameFilter = new QStringList([self findStrippedFilterWithVisualFilterName:selectedVisualNameFilter]);
QFileInfo sel(selectFile);
- if (sel.isDir()){
+ if (sel.isDir() && !sel.isBundle()){
mCurrentDir = [QCFString::toNSString(sel.absoluteFilePath()) retain];
mCurrentSelection = new QString;
} else {
@@ -246,15 +246,15 @@ static QString strippedText(QString s)
- (void)showModelessPanel
{
if (mOpenPanel){
- QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QCFString::toQString(mCurrentDir));
+ QFileInfo info(*mCurrentSelection);
NSString *filepath = QCFString::toNSString(info.filePath());
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|| [self panel:nil shouldShowFilename:filepath];
[self updateProperties];
[mOpenPanel setAllowedFileTypes:nil];
- [mOpenPanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QCFString::toNSString(info.filePath())]
- : [NSURL fileURLWithPath:QCFString::toNSString(info.path())]];
+ [mSavePanel setNameFieldStringValue:selectable ? QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName()) : @""];
+
[mOpenPanel beginWithCompletionHandler:^(NSInteger result){
mReturnCode = result;
if (mHelper)
@@ -265,13 +265,12 @@ static QString strippedText(QString s)
- (BOOL)runApplicationModalPanel
{
- QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QCFString::toQString(mCurrentDir));
+ QFileInfo info(*mCurrentSelection);
NSString *filepath = QCFString::toNSString(info.filePath());
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|| [self panel:nil shouldShowFilename:filepath];
- [mSavePanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QCFString::toNSString(info.filePath())]
- : [NSURL fileURLWithPath:QCFString::toNSString(info.path())]];
+ [mSavePanel setDirectoryURL: [NSURL fileURLWithPath:mCurrentDir]];
[mSavePanel setNameFieldStringValue:selectable ? QCFString::toNSString(info.fileName()) : @""];
// Call processEvents in case the event dispatcher has been interrupted, and needs to do
@@ -291,14 +290,14 @@ static QString strippedText(QString s)
- (void)showWindowModalSheet:(QWindow *)parent
{
- QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QCFString::toQString(mCurrentDir));
+ QFileInfo info(*mCurrentSelection);
NSString *filepath = QCFString::toNSString(info.filePath());
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|| [self panel:nil shouldShowFilename:filepath];
[self updateProperties];
- [mSavePanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QCFString::toNSString(info.filePath())]
- : [NSURL fileURLWithPath:QCFString::toNSString(info.path())]];
+ [mSavePanel setDirectoryURL: [NSURL fileURLWithPath:mCurrentDir]];
+
[mSavePanel setNameFieldStringValue:selectable ? QCFString::toNSString(info.fileName()) : @""];
NSWindow *nsparent = static_cast<NSWindow *>(qGuiApp->platformNativeInterface()->nativeResourceForWindow("nswindow", parent));