summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp
diff options
context:
space:
mode:
authorSergio Martins <sergio.martins.qnx@kdab.com>2012-12-07 10:49:19 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-12-10 13:23:51 +0100
commit1eabbc0908160de7879a9ee7fa43916f0f9f8d49 (patch)
tree04b6ae7fde5dec8a013352f35dac250c825ab5bd /src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp
parentaa3a75ce145b6402578fc5b527d8a7c6a57cf765 (diff)
Blackberry: Fix crash when opening file dialog without parent.
If parent is null, we now use qqnxintegration->primaryScreen() This simplifies ctors of QQnxTheme and QQnxFileDialogHelper which now receive a QQnxIntegration pointer instead of receiving a font database and a bps event filter. Change-Id: I3b1ed4d99f738b980a4f19a98618341a14e0c222 Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Diffstat (limited to 'src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp')
-rw-r--r--src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp b/src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp
index 262bdb16f4..79d7c7d9ca 100644
--- a/src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp
+++ b/src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp
@@ -43,6 +43,7 @@
#include "qqnxbpseventfilter.h"
#include "qqnxscreen.h"
+#include "qqnxintegration.h"
#include <QDebug>
#include <QEventLoop>
@@ -58,9 +59,9 @@
QT_BEGIN_NAMESPACE
-QQnxFileDialogHelper::QQnxFileDialogHelper(QQnxBpsEventFilter *eventFilter)
+QQnxFileDialogHelper::QQnxFileDialogHelper(const QQnxIntegration *integration)
: QPlatformFileDialogHelper(),
- m_eventFilter(eventFilter),
+ m_integration(integration),
m_dialog(0),
m_acceptMode(QFileDialogOptions::AcceptOpen),
m_selectedFilter(),
@@ -144,8 +145,9 @@ bool QQnxFileDialogHelper::show(Qt::WindowFlags flags, Qt::WindowModality modali
Q_UNUSED(flags);
qFileDialogHelperDebug() << Q_FUNC_INFO;
+ QQnxBpsEventFilter *eventFilter = m_integration->bpsEventFilter();
// We *really* need the bps event filter ;)
- if (!m_eventFilter)
+ if (!eventFilter)
return false;
// Native dialogs can only handle application modal use cases so far
@@ -208,12 +210,15 @@ bool QQnxFileDialogHelper::show(Qt::WindowFlags flags, Qt::WindowModality modali
m_acceptMode = opts->acceptMode();
// Set the libscreen window group and common properties
- QQnxScreen *nativeScreen = static_cast<QQnxScreen *>(parent->screen()->handle());
+
+ QQnxScreen *nativeScreen = parent ? static_cast<QQnxScreen *>(parent->screen()->handle()) :
+ m_integration->primaryDisplay();
+ Q_ASSERT(nativeScreen);
dialog_set_group_id(m_dialog, nativeScreen->windowGroupName());
dialog_set_title_text(m_dialog, opts->windowTitle().toLocal8Bit().constData());
// Register ourselves for dialog domain events from bps
- m_eventFilter->registerForDialogEvents(this);
+ eventFilter->registerForDialogEvents(this);
// Show the dialog
dialog_show(m_dialog);