diff options
Diffstat (limited to 'src/plugins')
8 files changed, 31 insertions, 122 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]; diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index 7cd857e3a4..e2c3b6a059 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -519,29 +519,12 @@ void QWindowsDialogHelperBase<BaseClass>::hide_sys() } template <class BaseClass> -void QWindowsDialogHelperBase<BaseClass>::platformNativeDialogModalHelp() +void QWindowsDialogHelperBase<BaseClass>::exec_sys() { if (QWindowsContext::verboseDialogs) qDebug("%s" , __FUNCTION__); - if (QWindowsNativeDialogBase *nd =nativeDialog()) - nd->metaObject()->invokeMethod(this, - "emitLaunchNativeAppModalPanel", - Qt::QueuedConnection); -} - -template <class BaseClass> -void QWindowsDialogHelperBase<BaseClass>::_q_platformRunNativeAppModalPanel() -{ - if (QWindowsNativeDialogBase *nd =nativeDialog()) - nd->exec(m_ownerWindow); -} - -template <class BaseClass> -QPlatformDialogHelper::DialogCode QWindowsDialogHelperBase<BaseClass>::dialogResultCode_sys() -{ - if (QWindowsNativeDialogBase *nd =nativeDialog()) - return nd->result(); - return QPlatformDialogHelper::Rejected; + if (QWindowsNativeDialogBase *nd = nativeDialog()) + nd->exec(m_ownerWindow); } static inline bool snapToDefaultButtonHint() @@ -1135,19 +1118,14 @@ QWindowsNativeDialogBase *QWindowsFileDialogHelper::createNativeDialog() QWindowsNativeFileDialogBase *result = QWindowsNativeFileDialogBase::create(options()->acceptMode()); if (!result) return 0; - QObject::connect(result, SIGNAL(accepted()), this, SIGNAL(accept()), - Qt::QueuedConnection); - QObject::connect(result, SIGNAL(rejected()), this, SIGNAL(reject()), - Qt::QueuedConnection); + QObject::connect(result, SIGNAL(accepted()), this, SIGNAL(accept())); + QObject::connect(result, SIGNAL(rejected()), this, SIGNAL(reject())); QObject::connect(result, SIGNAL(directoryEntered(QString)), - this, SIGNAL(directoryEntered(QString)), - Qt::QueuedConnection); + this, SIGNAL(directoryEntered(QString))); QObject::connect(result, SIGNAL(currentChanged(QString)), - this, SIGNAL(currentChanged(QString)), - Qt::QueuedConnection); + this, SIGNAL(currentChanged(QString))); QObject::connect(result, SIGNAL(filterSelected(QString)), - this, SIGNAL(filterSelected(QString)), - Qt::QueuedConnection); + this, SIGNAL(filterSelected(QString))); // Apply settings. const QSharedPointer<QFileDialogOptions> &opts = options(); diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.h b/src/plugins/platforms/windows/qwindowsdialoghelpers.h index 285c58dc5f..8a06c35167 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.h +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.h @@ -66,8 +66,7 @@ class QWindowsDialogHelperBase : public BaseClass { public: - virtual void platformNativeDialogModalHelp(); - virtual void _q_platformRunNativeAppModalPanel(); + virtual void exec_sys(); virtual void deleteNativeDialog_sys(); virtual bool show_sys(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, @@ -75,8 +74,6 @@ public: virtual void hide_sys(); virtual QVariant styleHint(QPlatformDialogHelper::StyleHint) const; - virtual QPlatformDialogHelper::DialogCode dialogResultCode_sys(); - virtual bool supportsNonModalDialog() const { return true; } protected: |