summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2012-04-30 14:26:47 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-09 13:42:03 +0200
commitab947649eb984b006a856d41476e615dc901bcf7 (patch)
tree9edee6b47b64ae8c89941c0d01db982973af86d3 /src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
parent9f2f7a8f7270411677f2074fdf635f8b4b94d325 (diff)
QPA: Cleanup native dialog modal execution
Remove the _q_platformRunNativeAppModalPanel() function, together with the launchNativeAppModalPanel() signal and emitLaunchNativeAppModalPanel() slot, which were previously used to run the modal loop inside the QDialog::exec() loop. This trick isn't necessary anymore, so remove the mechanism and code related to it. Rename QPlatformDialogHelper::platformNativeDialogModalHelp() to exec_sys(). This function is now responsible for both showing the native dialog and running the modal loop. QDialog:exec() now calls this function if a native dialog is in use (it does not call QEventLoop::exec() anymore). The dialogResultCode_sys() function was unused, so it has also been removed. This commit also removes some unused private slots that were left over from the port to QPA. Note that the comments in the Cocoa plugin are still valid and relevant, but this commit does not fix the scenarios mentioned. This will be done in a future commit. The Windows plugin needs minor changes. The QueuedConnections to accept() and reject() cause the deliver to come too late, resulting in crashes, hence the change to AutoConnection (which ends up being a DirectConnection). Change-Id: Ifc90325c945ca78737e60bf331929f03ecc52e0a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm30
1 files changed, 6 insertions, 24 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index 9bc7df02fb..8c3b5fd5c6 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -672,36 +672,18 @@ bool QCocoaFileDialogHelper::hideCocoaFilePanel()
}
}
-void QCocoaFileDialogHelper::platformNativeDialogModalHelp()
+void QCocoaFileDialogHelper::exec_sys()
{
- // Do a queued meta-call to open the native modal dialog so it opens after the new
- // event loop has started to execute (in QDialog::exec). Using a timer rather than
- // a queued meta call is intentional to ensure that the call is only delivered when
- // [NSApp run] runs (timers are handeled special in cocoa). If NSApp is not
- // running (which is the case if e.g a top-most QEventLoop has been
- // interrupted, and the second-most event loop has not yet been reactivated (regardless
- // if [NSApp run] is still on the stack)), showing a native modal dialog will fail.
- QTimer::singleShot(1, this, SIGNAL(launchNativeAppModalPanel()));
-}
-
-void QCocoaFileDialogHelper::_q_platformRunNativeAppModalPanel()
-{
- // TODO:
-#if 0
- QBoolBlocker nativeDialogOnTop(QApplicationPrivate::native_modal_dialog_active);
-#endif
+ // Note: If NSApp is not running (which is the case if e.g a top-most
+ // QEventLoop has been interrupted, and the second-most event loop has not
+ // yet been reactivated (regardless if [NSApp run] is still on the stack)),
+ // showing a native modal dialog will fail.
QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
- [delegate runApplicationModalPanel];
- if (dialogResultCode_sys() == QPlatformDialogHelper::Accepted)
+ if ([delegate runApplicationModalPanel])
emit accept();
else
emit reject();
-}
-QPlatformDialogHelper::DialogCode QCocoaFileDialogHelper::dialogResultCode_sys()
-{
- QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
- return [delegate dialogResultCode];
}
bool QCocoaFileDialogHelper::defaultNameFilterDisables() const