Cocoa: fix regressions in cocoa filedialog helper
authorTeemu Katajisto <teemu.katajisto@digia.com>
Wed, 3 Oct 2012 10:17:12 +0000 (13:17 +0300)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 4 Oct 2012 11:31:55 +0000 (13:31 +0200)
mOpenPanel is set to 0 if save file dialog is used so call
mSavePanel instead.

Fixes regression introduced in
2e902799df6298ad4c75b4c565a0baf9cb7f7ab8

Change-Id: Idb93e44437731cad3c985d51b57b793a3ff2f292
Reviewed-by: Pasi Matilainen <pasi.matilainen@digia.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm

index 48be019..682ef48 100644 (file)
@@ -246,9 +246,9 @@ static QString strippedText(QString s)
     bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
         || [self panel:nil shouldShowFilename:filepath];
 
-    [mOpenPanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath())]
+    [mSavePanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath())]
                                            : [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.path())]];
-    mReturnCode = [mOpenPanel runModal];
+    mReturnCode = [mSavePanel runModal];
 
     QAbstractEventDispatcher::instance()->interrupt();
     return (mReturnCode == NSOKButton);
@@ -266,7 +266,7 @@ static QString strippedText(QString s)
     bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
         || [self panel:nil shouldShowFilename:filepath];
 
-    [mOpenPanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath())]
+    [mSavePanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath())]
                                            : [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.path())]];
     NSWindow *nsparent = static_cast<NSWindow *>(qGuiApp->platformNativeInterface()->nativeResourceForWindow("nswindow", parent));
 
@@ -403,9 +403,9 @@ static QString strippedText(QString s)
         ext.prepend(defaultSuffix);
     [mSavePanel setAllowedFileTypes:ext.isEmpty() ? nil : QT_PREPEND_NAMESPACE(qt_mac_QStringListToNSMutableArray(ext))];
 
-    if ([mOpenPanel respondsToSelector:@selector(isVisible)] && [mSavePanel isVisible]) {
-        if ([mOpenPanel respondsToSelector:@selector(validateVisibleColumns)])
-            [mOpenPanel validateVisibleColumns];
+    if ([mSavePanel respondsToSelector:@selector(isVisible)] && [mSavePanel isVisible]) {
+        if ([mSavePanel respondsToSelector:@selector(validateVisibleColumns)])
+            [mSavePanel validateVisibleColumns];
     }
 }