summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2015-06-16 15:09:09 +0200
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2015-06-17 16:55:52 +0000
commitaec2b28eea3354ec80350e25f4305c74ca9bc184 (patch)
treec2955629a2baf2b684f171699321acfe301ee13c /src/plugins
parent997f52b83d41d2ed31a3b36384d1dd3bc78a697c (diff)
OSX: show file dialog in showCocoaFilePanel, don't wait for exec()
This reverts commit 21e6c7ae4745a76b676dfaa9fe17a2dd40fc0c5c because in QtQuick.Controls, we do not call exec(): we just set the dialog visible. If it is a sheet, then it is already acting as a modal dialog, basically. Task-number: QTBUG-46691 Change-Id: I7fe89f2a2ade0d4ddcf540c9bfc4f5963a077471 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm28
2 files changed, 7 insertions, 22 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
index 36943a563e..48d7efe174 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
@@ -51,7 +51,6 @@ public:
virtual ~QCocoaFileDialogHelper();
void exec();
- void execModalForWindow(QWindow *parent);
bool defaultNameFilterDisables() const;
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index 19f81c72a1..4ece1b5a22 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -254,22 +254,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
@@ -711,15 +706,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;
}
@@ -751,14 +745,6 @@ void QCocoaFileDialogHelper::exec()
}
-void QCocoaFileDialogHelper::execModalForWindow(QWindow *parent)
-{
- if (!parent)
- return exec();
-
- [mDelegate showWindowModalSheet:parent];
-}
-
bool QCocoaFileDialogHelper::defaultNameFilterDisables() const
{
return true;