summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/qcocoacolordialoghelper.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm33
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm30
-rw-r--r--src/plugins/platforms/cocoa/qcocoafontdialoghelper.h6
-rw-r--r--src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm33
6 files changed, 22 insertions, 88 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h
index 8845d7fdcd..6e83da9614 100644
--- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h
+++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h
@@ -53,13 +53,11 @@ public:
QCocoaColorDialogHelper();
virtual ~QCocoaColorDialogHelper();
- void platformNativeDialogModalHelp();
- void _q_platformRunNativeAppModalPanel();
+ void exec_sys();
void deleteNativeDialog_sys();
bool show_sys(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent);
void hide_sys();
- DialogCode dialogResultCode_sys();
void setCurrentColor_sys(const QColor&);
QColor currentColor_sys() const;
diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
index 45c36b4e1e..99dc3cb94e 100644
--- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
@@ -345,27 +345,14 @@ QCocoaColorDialogHelper::QCocoaColorDialogHelper() :
QCocoaColorDialogHelper::~QCocoaColorDialogHelper()
{ }
-void QCocoaColorDialogHelper::platformNativeDialogModalHelp()
+void QCocoaColorDialogHelper::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 QCocoaColorDialogHelper::_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(QNSColorPanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *>(mDelegate);
- [delegate runApplicationModalPanel];
- if (dialogResultCode_sys() == QPlatformDialogHelper::Accepted)
+ if ([delegate runApplicationModalPanel])
emit accept();
else
emit reject();
@@ -395,14 +382,6 @@ void QCocoaColorDialogHelper::hide_sys()
[reinterpret_cast<QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *>(mDelegate)->mColorPanel close];
}
-QCocoaColorDialogHelper::DialogCode QCocoaColorDialogHelper::dialogResultCode_sys()
-{
- if (!mDelegate)
- return QPlatformDialogHelper::Rejected;
- QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *>(mDelegate);
- return [delegate dialogResultCode];
-}
-
void QCocoaColorDialogHelper::setCurrentColor_sys(const QColor &color)
{
if (!mDelegate)
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
index 5b7af09fb8..7d7a0eeea2 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
@@ -56,15 +56,13 @@ public:
QCocoaFileDialogHelper();
virtual ~QCocoaFileDialogHelper();
- void platformNativeDialogModalHelp();
- void _q_platformRunNativeAppModalPanel();
+ void exec_sys();
bool defaultNameFilterDisables() const;
void deleteNativeDialog_sys();
bool show_sys(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent);
void hide_sys();
- QPlatformFileDialogHelper::DialogCode dialogResultCode_sys();
void setDirectory_sys(const QString &directory);
QString directory_sys() const;
void selectFile_sys(const QString &filename);
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
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.h b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.h
index 501e67deb3..d135a958df 100644
--- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.h
+++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.h
@@ -56,15 +56,13 @@ public:
QCocoaFontDialogHelper();
virtual ~QCocoaFontDialogHelper();
- void platformNativeDialogModalHelp();
- void _q_platformRunNativeAppModalPanel();
+ void exec_sys();
+
void deleteNativeDialog_sys();
bool show_sys(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent);
void hide_sys();
- QPlatformDialogHelper::DialogCode dialogResultCode_sys();
-
void setCurrentFont_sys(const QFont &);
QFont currentFont_sys() const;
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
index 5f39531503..89501f7c9d 100644
--- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
@@ -364,27 +364,14 @@ QCocoaFontDialogHelper::QCocoaFontDialogHelper() :
QCocoaFontDialogHelper::~QCocoaFontDialogHelper()
{ }
-void QCocoaFontDialogHelper::platformNativeDialogModalHelp()
+void QCocoaFontDialogHelper::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 QCocoaFontDialogHelper::_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(QNSFontPanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) *>(mDelegate);
- [delegate runApplicationModalPanel];
- if (dialogResultCode_sys() == QPlatformDialogHelper::Accepted)
+ if ([delegate runApplicationModalPanel])
emit accept();
else
emit reject();
@@ -414,14 +401,6 @@ void QCocoaFontDialogHelper::hide_sys()
[reinterpret_cast<QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) *>(mDelegate)->mFontPanel close];
}
-QCocoaFontDialogHelper::DialogCode QCocoaFontDialogHelper::dialogResultCode_sys()
-{
- if (!mDelegate)
- return QPlatformDialogHelper::Rejected;
- QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) *>(mDelegate);
- return [delegate dialogResultCode];
-}
-
void QCocoaFontDialogHelper::setCurrentFont_sys(const QFont &font)
{
NSFontManager *mgr = [NSFontManager sharedFontManager];