diff options
author | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2016-01-29 15:24:04 +0100 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2016-01-30 18:17:04 +0000 |
commit | 2f115fbe0f2ccc0ad25a77c9612588ace9340228 (patch) | |
tree | 60649cbd278694518455c65c3f056f50286e7222 /src/plugins | |
parent | dce530b64eab0666ad22ae5301c2f51b2ee4633f (diff) |
Cocoa integration - fix outdated path in QCocoaFileDialogHelper
When we set accessory view sometimes (sic!) a delegate's callback
fires: -panel:directoryDidChange: with an outdated path (probably because
panels are shared?) resetting our current directory; later we open
file dialog with a wrong path as result.
Change-Id: Iffb02e801c44c5d9a62c2cca3acdf9278eaadb26
Task-number: QTBUG-50140
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 9dc013ba4d..4c1b190b9c 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -126,7 +126,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate); if ([mSavePanel respondsToSelector:@selector(setLevel:)]) [mSavePanel setLevel:NSModalPanelWindowLevel]; - [mSavePanel setDelegate:self]; + mReturnCode = -1; mHelper = helper; mNameFilterDropDownList = new QStringList(mOptions->nameFilters()); @@ -147,7 +147,10 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate); [self createTextField]; [self createAccessory]; [mSavePanel setAccessoryView:mNameFilterDropDownList->size() > 1 ? mAccessoryView : nil]; - + // -setAccessoryView: can result in -panel:directoryDidChange: + // resetting our mCurrentDir, set the delegate + // here to make sure it gets the correct value. + [mSavePanel setDelegate:self]; if (mOptions->isLabelExplicitlySet(QFileDialogOptions::Accept)) [mSavePanel setPrompt:[self strip:options->labelText(QFileDialogOptions::Accept)]]; |