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>
bb10
Timur Pocheptsov 2016-01-29 15:24:04 +01:00
parent dce530b64e
commit 2f115fbe0f
1 changed files with 5 additions and 2 deletions

View File

@ -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)]];