diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-07-01 09:59:28 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2015-07-01 09:59:28 +0000 |
commit | 0698f876ca02b85c1e584b72cac3444796f6a355 (patch) | |
tree | 022748fb34278fb455d8e029d912dfb0b545f443 /src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | |
parent | cd297f99a2ce9c53c3ac4633bdf2425af364a1bc (diff) | |
parent | 0aa2d318b1524cdab42ab9988270779ddcc1922a (diff) |
Merge "Merge remote-tracking branch 'origin/5.5' into dev" into refs/staging/dev
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index fad3f28053..93ee4e8624 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -253,22 +253,17 @@ static QString strippedText(QString s) || [self panel:nil shouldShowFilename:filepath]; [self updateProperties]; + QCocoaMenuBar::redirectKnownMenuItemsToFirstResponder(); [mSavePanel setDirectoryURL: [NSURL fileURLWithPath:mCurrentDir]]; [mSavePanel setNameFieldStringValue:selectable ? QCFString::toNSString(info.fileName()) : @""]; NSWindow *nsparent = static_cast<NSWindow *>(qGuiApp->platformNativeInterface()->nativeResourceForWindow("nswindow", parent)); - qApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); - QCocoaMenuBar::redirectKnownMenuItemsToFirstResponder(); - [mSavePanel beginSheetModalForWindow:nsparent completionHandler:^(NSInteger result){ - [[NSApplication sharedApplication] stopModalWithCode:result]; + mReturnCode = result; + if (mHelper) + mHelper->QNSOpenSavePanelDelegate_panelClosed(result == NSOKButton); }]; - - mReturnCode = [[NSApplication sharedApplication] runModalForWindow:nsparent]; - QAbstractEventDispatcher::instance()->interrupt(); - if (mHelper) - mHelper->QNSOpenSavePanelDelegate_panelClosed(mReturnCode == NSOKButton); } - (BOOL)isHiddenFile:(NSString *)filename isDir:(BOOL)isDir @@ -710,15 +705,14 @@ void QCocoaFileDialogHelper::createNSOpenSavePanelDelegate() bool QCocoaFileDialogHelper::showCocoaFilePanel(Qt::WindowModality windowModality, QWindow *parent) { - Q_UNUSED(parent) - createNSOpenSavePanelDelegate(); if (!mDelegate) return false; if (windowModality == Qt::NonModal) [mDelegate showModelessPanel]; - // no need to show a Qt::ApplicationModal dialog here, since it will be done in exec; - // Qt::WindowModal will be done in execModalForWindow. + else if (windowModality == Qt::WindowModal && parent) + [mDelegate showWindowModalSheet:parent]; + // no need to show a Qt::ApplicationModal dialog here, since it will be done in _q_platformRunNativeAppModalPanel() return true; } @@ -750,14 +744,6 @@ void QCocoaFileDialogHelper::exec() } -void QCocoaFileDialogHelper::execModalForWindow(QWindow *parent) -{ - if (!parent) - return exec(); - - [mDelegate showWindowModalSheet:parent]; -} - bool QCocoaFileDialogHelper::defaultNameFilterDisables() const { return true; |