summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-07-01 11:05:26 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-07-01 11:05:26 +0200
commit0aa2d318b1524cdab42ab9988270779ddcc1922a (patch)
tree695c70702763ba2c66eb398ae9d545fc712a9e2d /src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
parent6251d4dafc86bcbec09d1962050af9924249d419 (diff)
parent49049d90470eb3e94bda77d19ab7f7c57a0bd57f (diff)
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qglobal.h src/corelib/global/qsysinfo.h src/corelib/global/qsystemdetection.h src/corelib/kernel/qobjectdefs.h src/plugins/plugins.pro tests/auto/widgets/itemviews/qlistview/qlistview.pro Change-Id: Ib55aa79d707c4c1453fb9d697f6cf92211ed665c
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm28
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;