BlackBerry: implement QWidget::showMinimized()

Add window minimization capability on the plugin.

Change-Id: I4539d29b8ebbef935213edde634f0a85b6a21766
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This commit is contained in:
Rafael Roquetto 2013-03-13 15:55:34 -03:00 committed by The Qt Project
parent 0d866c35d6
commit 67faba073d
3 changed files with 38 additions and 3 deletions

View File

@ -87,7 +87,7 @@ void QQnxBpsEventFilter::installOnEventDispatcher(QAbstractEventDispatcher *disp
{
qBpsEventFilterDebug() << Q_FUNC_INFO << "dispatcher=" << dispatcher;
if (navigator_request_events(0) != BPS_SUCCESS)
if (navigator_request_events(NAVIGATOR_EXTENDED_DATA) != BPS_SUCCESS)
qWarning("QQNX: failed to register for navigator events");
dispatcher->installNativeEventFilter(this);

View File

@ -53,6 +53,11 @@
#include <errno.h>
#ifdef Q_OS_BLACKBERRY
#include <sys/pps.h>
#include <bps/navigator.h>
#endif
#ifdef QQNXWINDOW_DEBUG
#define qWindowDebug qDebug
#else
@ -624,12 +629,20 @@ void QQnxWindow::setWindowState(Qt::WindowState state)
switch (state) {
// WindowMinimized is not supported - navigator does not have an API to minimize a window
// WindowActive is not an accepted parameter according to the docs
case Qt::WindowMinimized:
case Qt::WindowActive:
return;
case Qt::WindowMinimized:
minimize();
if (m_unmaximizedGeometry.isValid())
setGeometry(m_unmaximizedGeometry);
else
setGeometry(m_screen->geometry());
break;
case Qt::WindowMaximized:
case Qt::WindowFullScreen:
m_unmaximizedGeometry = geometry();
@ -689,6 +702,27 @@ void QQnxWindow::blitFrom(QQnxWindow *sourceWindow, const QPoint &sourceOffset,
blitHelper(sourceBuffer, targetBuffer, sourceOffset, QPoint(0, 0), targetRegion, true);
}
void QQnxWindow::minimize()
{
#if defined(Q_OS_BLACKBERRY) && !defined(Q_OS_BLACKBERRY_TABLET)
qWindowDebug() << Q_FUNC_INFO;
pps_encoder_t encoder;
pps_encoder_initialize(&encoder, false);
pps_encoder_add_string(&encoder, "msg", "minimizeWindow");
if (navigator_raw_write(pps_encoder_buffer(&encoder),
pps_encoder_length(&encoder)) != BPS_SUCCESS) {
qWindowDebug() << Q_FUNC_INFO << "navigator_raw_write failed:" << strerror(errno);
}
pps_encoder_cleanup(&encoder);
#else
qWarning("Qt::WindowMinimized is not supported by this OS version");
#endif
}
void QQnxWindow::updateZorder(int &topZorder)
{
errno = 0;

View File

@ -116,6 +116,7 @@ public:
QQnxWindow *findWindow(screen_window_t windowHandle);
void blitFrom(QQnxWindow *sourceWindow, const QPoint &sourceOffset, const QRegion &targetRegion);
void minimize();
private:
QRect setGeometryHelper(const QRect &rect);