Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
- index 22382cd..9f342f6 100644
- --- a/src/corelib/global/qnamespace.qdoc
- +++ b/src/corelib/global/qnamespace.qdoc
- @@ -161,7 +161,7 @@
- like editing on previous versions of Symbian behave. When this attribute
- is true, a virtual keyboard window is shown on top of application and it
- is ensured that the focused text widget is visible. This is only supported in
- - Symbian^3. (internal)
- + Symbian^3. Not supported for QWebView. Not supported for QML applications. (internal)
- \omitvalue AA_AttributeCount
- */
- diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp
- index e44c38c..1ab441e 100644
- --- a/src/gui/dialogs/qdialog.cpp
- +++ b/src/gui/dialogs/qdialog.cpp
- @@ -414,7 +414,7 @@ bool QDialog::event(QEvent *e)
- result = true;
- }
- #elif defined(Q_WS_S60)
- - if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize )) {
- + if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize ) || (e->type() == QEvent::PolishRequest)) {
- if (!testAttribute(Qt::WA_Moved)) {
- Qt::WindowStates state = windowState();
- adjustPosition(parentWidget());
- diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h
- index 8c8ffd4..db2339b 100644
- --- a/src/gui/inputmethod/qcoefepinputcontext_p.h
- +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h
- @@ -93,6 +93,9 @@ public:
- TCoeInputCapabilities inputCapabilities();
- + void resetSplitViewWidget(bool keepInputWidget = false);
- + void ensureFocusWidgetVisible(QWidget *widget, bool forceOperation = false);
- +
- protected:
- void timerEvent(QTimerEvent *timerEvent);
- @@ -104,6 +107,7 @@ private:
- void queueInputCapabilitiesChanged();
- bool needsInputPanel();
- void commitTemporaryPreeditString();
- + bool isWidgetVisible(QWidget *widget, int offset = 0);
- private Q_SLOTS:
- void ensureInputCapabilitiesChanged();
- @@ -155,6 +159,12 @@ private:
- QBasicTimer m_tempPreeditStringTimeout;
- bool m_hasTempPreeditString;
- + int m_splitViewMoveBy;
- + int m_splitViewResizeBy;
- + int m_splitViewScrollBy;
- + int m_splitViewTotalScroll;
- + Qt::WindowStates m_splitViewPreviousWindowStates;
- +
- friend class tst_QInputContext;
- };
- diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
- index 1bef64d..f99eefd 100644
- --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
- +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
- @@ -48,6 +48,7 @@
- #include <qgraphicsscene.h>
- #include <qgraphicswidget.h>
- #include <qsymbianevent.h>
- +#include <qlayout.h>
- #include <private/qcore_symbian_p.h>
- #include <fepitfr.h>
- @@ -67,6 +68,9 @@
- // that support text selection.
- #define QT_EAknEditorFlagSelectionVisible 0x100000
- +// EAknEditorFlagEnablePartialScreen is only valid from Sym^3 onwards.
- +#define QT_EAknEditorFlagEnablePartialScreen 0x200000
- +
- QT_BEGIN_NAMESPACE
- QCoeFepInputContext::QCoeFepInputContext(QObject *parent)
- @@ -80,13 +84,22 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent)
- m_inlinePosition(0),
- m_formatRetriever(0),
- m_pointerHandler(0),
- - m_hasTempPreeditString(false)
- + m_hasTempPreeditString(false),
- + m_splitViewMoveBy(0),
- + m_splitViewResizeBy(0),
- + m_splitViewScrollBy(0),
- + m_splitViewTotalScroll(0),
- + m_splitViewPreviousWindowStates(Qt::WindowNoState)
- {
- m_fepState->SetObjectProvider(this);
- - if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0)
- - m_fepState->SetFlags(EAknEditorFlagDefault | QT_EAknEditorFlagSelectionVisible);
- - else
- - m_fepState->SetFlags(EAknEditorFlagDefault);
- + int defaultFlags = EAknEditorFlagDefault;
- + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) {
- + if (!QApplication::testAttribute(Qt::AA_S60DisablePartialScreenInputMode)) {
- + defaultFlags |= QT_EAknEditorFlagEnablePartialScreen;
- + }
- + defaultFlags |= QT_EAknEditorFlagSelectionVisible;
- + }
- + m_fepState->SetFlags(defaultFlags);
- m_fepState->SetDefaultInputMode( EAknEditorTextInputMode );
- m_fepState->SetPermittedInputModes( EAknEditorAllInputModes );
- m_fepState->SetDefaultCase( EAknEditorTextCase );
- @@ -210,6 +223,21 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event)
- return false;
- switch (event->type()) {
- + case QEvent::MouseButtonPress:
- + // Alphanumeric keypad doesn't like it when we click and text is still getting displayed
- + // It ignores the mouse event, so we need to commit and send a selection event (which will get triggered
- + // after the commit)
- + if (!m_preeditString.isEmpty()) {
- + commitCurrentString(false);
- +
- + int pos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt();
- +
- + QList<QInputMethodEvent::Attribute> selectAttributes;
- + selectAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, pos, 0, QVariant());
- + QInputMethodEvent selectEvent(QLatin1String(""), selectAttributes);
- + sendEvent(selectEvent);
- + }
- + break;
- case QEvent::KeyPress:
- commitTemporaryPreeditString();
- // fall through intended
- @@ -299,13 +327,38 @@ bool QCoeFepInputContext::symbianFilterEvent(QWidget *keyWidget, const QSymbianE
- // This should also happen for commands.
- reset();
- +
- + // We need to scroll the window content when window becomes available. Scrolling window while it is
- + // not yet ready with OpenVg graphicssystem results in scroll()/resize() silently failing.
- +
- + if (event->windowServerEvent() && event->windowServerEvent()->Type() == EEventWindowVisibilityChanged) {
- + if (S60->splitViewLastWidget) {
- + QGraphicsView *gv = qobject_cast<QGraphicsView*>(S60->splitViewLastWidget);
- + const bool alwaysResize = (gv && gv->verticalScrollBarPolicy() != Qt::ScrollBarAlwaysOff);
- + TUint visibleFlags = event->windowServerEvent()->VisibilityChanged()->iFlags;
- +
- + if (!alwaysResize && (visibleFlags & TWsVisibilityChangedEvent::EPartiallyVisible)) {
- +
- + // If visibility is changed and new position for the input widget is not yet
- + // calculated, force calculation and scrolling/resizing to happen immediately.
- + const bool forceMove = (!m_splitViewTotalScroll && !m_splitViewScrollBy && !m_splitViewResizeBy);
- + if (!isWidgetVisible(S60->splitViewLastWidget)) {
- + ensureFocusWidgetVisible(S60->splitViewLastWidget, forceMove);
- + }
- + } else if (visibleFlags & TWsVisibilityChangedEvent::ENotVisible) {
- + resetSplitViewWidget(true);
- + }
- + }
- + }
- +
- return false;
- }
- void QCoeFepInputContext::timerEvent(QTimerEvent *timerEvent)
- {
- - if (timerEvent->timerId() == m_tempPreeditStringTimeout.timerId())
- + if (timerEvent->timerId() == m_tempPreeditStringTimeout.timerId()) {
- commitTemporaryPreeditString();
- + }
- }
- void QCoeFepInputContext::commitTemporaryPreeditString()
- @@ -343,6 +396,308 @@ TCoeInputCapabilities QCoeFepInputContext::inputCapabilities()
- return TCoeInputCapabilities(m_textCapabilities, this, 0);
- }
- +void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget)
- +{
- + if (!S60->splitViewLastWidget) {
- + return;
- + }
- +
- + QSymbianControl *symControl = static_cast<QSymbianControl*>(S60->splitViewLastWidget->effectiveWinId());
- + symControl->CancelLongTapTimer();
- +
- + QGraphicsView *gv = qobject_cast<QGraphicsView*>(S60->splitViewLastWidget);
- + QWidget *windowToMove = gv ? gv : symControl->widget();
- + if (!S60->splitViewLastWidget->isWindow()) {
- + windowToMove = S60->splitViewLastWidget->window();
- + }
- +
- + bool userResize = S60->splitViewLastWidget->testAttribute(Qt::WA_Resized);
- + bool userMove = windowToMove->testAttribute(Qt::WA_Moved);
- +
- + // Resizing might have led to widget losing its original windowstate.
- + // Restore previous window state.
- +
- + if (gv) {
- + windowToMove->setUpdatesEnabled(false);
- + }
- +
- + if (m_splitViewPreviousWindowStates != windowToMove->windowState()) {
- + windowToMove->setWindowState(m_splitViewPreviousWindowStates);
- + }
- +
- + if (m_splitViewResizeBy) {
- + S60->splitViewLastWidget->updateGeometry();
- + }
- +
- + if (m_splitViewTotalScroll) {
- + if (S60->splitViewLastWidget->isTopLevel()) {
- + S60->splitViewLastWidget->scroll(0, -m_splitViewTotalScroll);
- + } else {
- + if (windowToMove->layout()) {
- + windowToMove->layout()->invalidate();
- + } else {
- + windowToMove->update();
- + }
- + }
- + }
- +
- + if (m_splitViewMoveBy) {
- + if (!userMove && (windowToMove->windowType() & Qt::Dialog) && !(windowToMove->isFullScreen() || windowToMove->isMaximized())) {
- + QEvent layoutReq(QEvent::PolishRequest);
- + QApplication::sendEvent(windowToMove, &layoutReq);
- + } else {
- + windowToMove->move(windowToMove->pos().x(), windowToMove->pos().y() - m_splitViewMoveBy);
- + }
- + }
- +
- + if (gv) {
- + windowToMove->setUpdatesEnabled(true);
- + }
- +
- + S60->splitViewLastWidget->setAttribute(Qt::WA_Resized, userResize); //not a user resize
- + windowToMove->setAttribute(Qt::WA_Moved, userMove); //not a user move
- +
- + m_splitViewMoveBy = 0;
- + m_splitViewResizeBy = 0;
- + m_splitViewScrollBy = 0;
- + m_splitViewTotalScroll = 0;
- + if (!keepInputWidget) {
- + m_splitViewPreviousWindowStates = Qt::WindowNoState;
- + S60->splitViewLastWidget = 0;
- + }
- +
- +}
- +
- +// Checks if a given widget is visible in the splitview rect. The offset
- +// parameter can be used to validate if moving widget upwards or downwards
- +// by the offset would make a difference for the visibility.
- +
- +bool QCoeFepInputContext::isWidgetVisible(QWidget *widget, int offset)
- +{
- + bool visible = false;
- + if (widget) {
- + QRect splitViewRect = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect());
- + QWidget *window = QApplication::activeWindow();
- +
- + // If statuspane is visible, it needs to be excluded from allowed visible area for
- + // the widgets, to avoid moving input widgets underneath the statuspane.
- +
- + CEikStatusPane *const s = S60->statusPane();
- + if (s && s->IsVisible()) {
- + TRect statusPaneRect;
- + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane, statusPaneRect);
- + if (!((window->windowType() & Qt::Dialog) && !(window->isMaximized() || window->isFullScreen()))) {
- + splitViewRect.adjust(0, statusPaneRect.Height(), 0, 0);
- + }
- + }
- +
- + QGraphicsView *gv = qobject_cast<QGraphicsView*>(widget);
- + if (gv) {
- + if (QGraphicsScene *scene = gv->scene()) {
- + if (QGraphicsItem *focusItem = scene->focusItem()) {
- + QPoint cursorPos = window->mapToGlobal(focusItem->cursor().pos());
- + cursorPos.setY(cursorPos.y() + offset);
- + if (splitViewRect.contains(cursorPos)) {
- + visible = true;
- + }
- + }
- + }
- +
- + } else {
- + if (splitViewRect.contains(widget->mapToGlobal(QPoint(0, widget->rect().bottom() + offset))) &&
- + splitViewRect.contains(widget->mapToGlobal(QPoint(0, widget->rect().top() + offset)))) {
- + visible = true;
- + }
- + }
- + }
- + return visible;
- +}
- +
- +// Ensure that the input widget is visible in the splitview rect.
- +// When forceOperation is true, input widget operations (resize, scroll) are carried out
- +// immediately. Otherwise only re-positioning values are calculated when splitview opens.
- +// If splitview is already open when ensureFocusWidgetVisible is called, forceOperation
- +// parameter is ignored, as the widget re-positioning can be done immediately.
- +
- +// todo: Note that this currently does not work with QML applications.
- +// todo: Not that with QWebView the input widget re-positioning is not done.
- +
- +void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget, bool forceOperation)
- +{
- + // Native side opening and closing its virtual keyboard when it changes the keyboard layout,
- + // has an adverse impact on long tap timer. Cancel the timer when splitview opens to avoid this.
- + QSymbianControl *symControl = static_cast<QSymbianControl*>(widget->effectiveWinId());
- + symControl->CancelLongTapTimer();
- +
- + // Graphicsviews that have vertical scrollbars and webviews should always be resized to
- + // the splitview area. With widgets, or graphicsviews without scrollbars, splitview move/resize
- + // operations should be avoided if the widget is already visible on-screen.
- +
- + QGraphicsView *gv = qobject_cast<QGraphicsView*>(widget);
- + const bool alwaysResize = (gv && gv->verticalScrollBarPolicy() != Qt::ScrollBarAlwaysOff);
- + const bool moveWithinVisibleArea =
- + (m_splitViewMoveBy != 0 || m_splitViewResizeBy != 0 ||
- + m_splitViewScrollBy != 0 || m_splitViewTotalScroll != 0);
- +
- + QWidget *windowToMove = gv ? gv : symControl->widget();
- + if (!windowToMove->isWindow()) {
- + windowToMove = windowToMove->window();
- + }
- + if (!windowToMove) {
- + return;
- + }
- +
- + // When opening the keyboard (not moving within the splitview area), save the original
- + // window state. In some cases, ensuring input widget visibility might lead to window
- + // states getting changed.
- +
- + if (!moveWithinVisibleArea) {
- + S60->splitViewLastWidget = widget;
- + m_splitViewPreviousWindowStates = windowToMove->windowState();
- + }
- +
- + int windowTop = widget->window()->pos().y();
- +
- + const bool userResize = widget->testAttribute(Qt::WA_Resized);
- + const bool userMove = windowToMove->testAttribute(Qt::WA_Moved);
- +
- + QRect splitViewRect = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect());
- +
- + // Graphicsviews and webviews with scrollbars are just resized to the splitview - content is unaffected.
- + // Microfocus location is set as visible, if possible.
- +
- + if (alwaysResize) {
- + QWidget *w = gv ? gv : widget;
- + if (!moveWithinVisibleArea)
- + m_splitViewResizeBy = w->height();
- +
- + windowToMove->setUpdatesEnabled(false);
- +
- + // When resizing a window widget, it will lose its maximized window state.
- + // Native applications hide statuspane in splitview state, so lets move to
- + // fullscreen mode. This makes available area slightly bigger, which helps usability
- + // and greatly reduces event passing in orientation switch cases,
- + // as the statuspane size is not changing.
- +
- + if (!(windowToMove->windowState() & Qt::WindowFullScreen)) {
- + w->setWindowState(
- + (windowToMove->windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen)) | Qt::WindowFullScreen);
- + }
- +
- + windowTop = w->geometry().top();
- + w->resize(w->width(), splitViewRect.height() - windowTop);
- +
- + if (gv && gv->scene()) {
- + const QRectF microFocusRect = gv->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF();
- + gv->ensureVisible(microFocusRect);
- + }
- + windowToMove->setUpdatesEnabled(true);
- +
- + } else {
- +
- + int resizeBy = 0;
- + int moveBy = 0;
- + int scrollBy = 0;
- + int currentHeight = 0;
- + int currentTop = 0;
- +
- + if (gv) {
- + const QRectF sceneRect = gv->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF();
- + const QPoint p = windowToMove->mapToGlobal(gv->mapFromScene(sceneRect.topLeft()));
- + currentHeight = sceneRect.height();
- + currentTop = p.y() + windowTop;
- + } else {
- + currentHeight = widget->rect().height();
- + currentTop = widget->mapToGlobal(QPoint(0, widget->rect().top())).y();
- + }
- +
- + int availableSpace = splitViewRect.height();
- + const bool canResideOverStatusPane =
- + (windowToMove->windowType() & Qt::Dialog)
- + && !(windowToMove->isMaximized() || windowToMove->isFullScreen());
- +
- + // Native side indicates that statuspane area is included in the splitview rect; even if statuspane is visible.
- + // Reduce the available area, if statuspane is shown.
- +
- + CEikStatusPane *const s = S60->statusPane();
- + TRect statusPaneRect;
- + if (s && s->IsVisible() && !canResideOverStatusPane) {
- + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane, statusPaneRect);
- + availableSpace -= statusPaneRect.Height();
- + }
- +
- + //Widget needs to be resized, if it won't fit into the available area.
- + resizeBy = currentHeight > availableSpace ? availableSpace - currentHeight : 0;
- +
- + bool nowVisible = false;
- +
- + if (!gv && windowToMove->mapToGlobal(QPoint(0,0)).y() >= 0 && canResideOverStatusPane) {
- +
- + // Dialogs with normal geometry are positioned just above the virtual keyboard, if possible.
- + // If the dialog window is taller than splitview area, dialog is placed to screen top.
- +
- + moveBy = (windowToMove->height() < splitViewRect.height()) ?
- + windowToMove->mapToGlobal(windowToMove->rect().bottomLeft()).y() - splitViewRect.bottom() :
- + windowToMove->mapToGlobal(QPoint(0,0)).y();
- + currentTop -= moveBy;
- + nowVisible = isWidgetVisible(widget, -moveBy);
- + }
- +
- + // Widget's new position should preferable be at the center (y-axis) of the splitview rect.
- + int newTopCentered = (availableSpace / 2 - (currentHeight + resizeBy) / 2);
- + if (s && s->IsVisible()) {
- + newTopCentered += statusPaneRect.Height();
- + }
- +
- + // By default, widget should be centered in the available area.
- + // However, window content scrolling should be limited by the top and bottom of the window.
- +
- + const int centerOffset = currentTop - newTopCentered;
- + const int bottomLimit = windowToMove->geometry().bottom() - splitViewRect.bottom() + m_splitViewTotalScroll - moveBy;
- + const int topLimit = moveBy ? (windowToMove->geometry().top() - moveBy + m_splitViewTotalScroll)
- + : (windowToMove->geometry().top() - statusPaneRect.iBr.iY + m_splitViewTotalScroll);
- +
- + if (!nowVisible) {
- + if ((centerOffset < bottomLimit) && (centerOffset > topLimit)) {
- + scrollBy = centerOffset;
- + } else {
- + if (centerOffset < 0) {
- + scrollBy = qMax(centerOffset, topLimit);
- + } else {
- + scrollBy = qMin(centerOffset, bottomLimit);
- + }
- + }
- + }
- +
- + if (moveWithinVisibleArea) {
- + S60->splitViewLastWidget = widget;
- + }
- +
- + if (resizeBy) {
- + m_splitViewResizeBy = resizeBy;
- + if (moveWithinVisibleArea || forceOperation) {
- + widget->resize(widget->width(), widget->height() + resizeBy);
- + }
- + }
- + if (scrollBy) {
- + m_splitViewScrollBy = -scrollBy;
- + if (moveWithinVisibleArea || forceOperation) {
- + windowToMove->scroll(0, m_splitViewScrollBy);
- + m_splitViewTotalScroll += m_splitViewScrollBy;
- + m_splitViewScrollBy = 0;
- + }
- + }
- +
- + if (moveBy) {
- + m_splitViewMoveBy -= moveBy;
- + windowToMove->move(windowToMove->pos().x(), windowTop - moveBy);
- + }
- + }
- +
- + widget->setAttribute(Qt::WA_Resized, userResize); //not a user resize
- + windowToMove->setAttribute(Qt::WA_Moved, userMove); //not a user move
- +}
- +
- static QTextCharFormat qt_TCharFormat2QTextCharFormat(const TCharFormat &cFormat, bool validStyleColor)
- {
- QTextCharFormat qFormat;
- @@ -474,10 +829,12 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints)
- m_fepState->SetPermittedCases(flags);
- ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateCaseModeUpdate);
- - if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0)
- - flags = QT_EAknEditorFlagSelectionVisible;
- - else
- - flags = 0;
- + flags = 0;
- + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) {
- + if (!QApplication::testAttribute(Qt::AA_S60DisablePartialScreenInputMode))
- + flags |= QT_EAknEditorFlagEnablePartialScreen;
- + flags |= QT_EAknEditorFlagSelectionVisible;
- + }
- if (hints & ImhUppercaseOnly && !(hints & ImhLowercaseOnly)
- || hints & ImhLowercaseOnly && !(hints & ImhUppercaseOnly)) {
- flags |= EAknEditorFlagFixedCase;
- diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
- index 59aec91..8033e5f 100644
- --- a/src/gui/kernel/qapplication.cpp
- +++ b/src/gui/kernel/qapplication.cpp
- @@ -1004,6 +1004,10 @@ void QApplicationPrivate::initialize()
- #endif //QT_AUTO_MAXIMIZE_THRESHOLD
- #endif //Q_WS_WINCE
- +#ifdef Q_WS_S60
- + q->setAttribute(Qt::AA_S60DisablePartialScreenInputMode, true);
- +#endif
- +
- // Set up which span functions should be used in raster engine...
- qInitDrawhelperAsm();
- // and QImage conversion functions
- diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
- index fb0c6b8..d573722 100644
- --- a/src/gui/kernel/qapplication_s60.cpp
- +++ b/src/gui/kernel/qapplication_s60.cpp
- @@ -96,6 +96,10 @@ QT_BEGIN_NAMESPACE
- // Goom Events through Window Server
- static const int KGoomMemoryLowEvent = 0x10282DBF;
- static const int KGoomMemoryGoodEvent = 0x20026790;
- +// Split view open/close events from AVKON
- +static const int KSplitViewOpenEvent = 0x2001E2C0;
- +static const int KSplitViewCloseEvent = 0x2001E2C1;
- +
- #if defined(QT_DEBUG)
- static bool appNoGrab = false; // Grabbing enabled
- @@ -1224,6 +1228,11 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */)
- if (m_ignoreFocusChanged || (qwidget->windowType() & Qt::WindowType_Mask) == Qt::Desktop)
- return;
- +#ifdef Q_WS_S60
- + if (S60->splitViewLastWidget)
- + return;
- +#endif
- +
- // Popups never get focused, but still receive the FocusChanged when they are hidden.
- if (QApplicationPrivate::popupWidgets != 0
- || (qwidget->windowType() & Qt::Popup) == Qt::Popup)
- @@ -1288,6 +1297,19 @@ void QSymbianControl::handleClientAreaChange()
- SetExtentToWholeScreen();
- } else if (qwidget->isMaximized() || (qwidget->isFullScreen() && cbaVisibilityHint)) {
- TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
- + if (S60->splitViewLastWidget) {
- + //For some curious reason, native side indicates that splitviewRect starts underneath statuspane.
- + //So, if statuspane is visible, move the mainpane rect in splitview down a little bit.
- + CEikStatusPane *const s = S60->statusPane();
- + if (s && s->IsVisible()) {
- + TRect statusPaneRect;
- + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane, statusPaneRect);
- + r.Move(0, statusPaneRect.Height());
- + }
- + TRect mainRect;
- + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainRect);
- + r.SetHeight(mainRect.Height());
- + }
- SetExtent(r.iTl, r.Size());
- } else if (!qwidget->isMinimized()) { // Normal geometry
- if (!qwidget->testAttribute(Qt::WA_Resized)) {
- @@ -1302,9 +1324,59 @@ void QSymbianControl::handleClientAreaChange()
- }
- }
- +bool QSymbianControl::isSplitViewWidget(QWidget *widget) {
- + bool returnValue = true;
- + //Ignore events sent to non-active windows, not visible widgets and not parents of input widget.
- + if (!qwidget->isActiveWindow()
- + || !qwidget->isVisible()
- + || !qwidget->isAncestorOf(widget)) {
- +
- + returnValue = false;
- + }
- + return returnValue;
- +}
- +
- void QSymbianControl::HandleResourceChange(int resourceType)
- {
- switch (resourceType) {
- + case KSplitViewCloseEvent: //intentional fall-through
- + case KSplitViewOpenEvent: {
- +#if !defined(QT_NO_IM) && defined(Q_WS_S60)
- +
- + //Fetch widget getting the text input
- + QWidget *widget = QWidget::keyboardGrabber();
- + if (!widget) {
- + if (QApplicationPrivate::popupWidgets) {
- + widget = QApplication::activePopupWidget()->focusWidget();
- + if (!widget) {
- + widget = QApplication::activePopupWidget();
- + }
- + } else {
- + widget = QApplicationPrivate::focus_widget;
- + if (!widget) {
- + widget = qwidget;
- + }
- + }
- + }
- + if (widget) {
- + QCoeFepInputContext *ic = qobject_cast<QCoeFepInputContext *>(widget->inputContext());
- + if (!ic) {
- + ic = qobject_cast<QCoeFepInputContext *>(qApp->inputContext());
- + }
- +
- + if (ic && isSplitViewWidget(widget)) {
- + if (resourceType == KSplitViewCloseEvent) {
- + ic->resetSplitViewWidget();
- + handleClientAreaChange();
- + } else {
- + ic->ensureFocusWidgetVisible(widget);
- + }
- + }
- +
- + }
- +#endif // !defined(QT_NO_IM) && defined(Q_WS_S60)
- + }
- + break;
- case KInternalStatusPaneChange:
- handleClientAreaChange();
- if (IsFocused() && IsVisible()) {
- diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
- index 40697bf..18259a8 100644
- --- a/src/gui/kernel/qt_s60_p.h
- +++ b/src/gui/kernel/qt_s60_p.h
- @@ -143,6 +143,8 @@ public:
- int menuBeingConstructed : 1;
- int orientationSet : 1;
- QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type
- + QPointer<QWidget> splitViewLastWidget;
- +
- static CEikButtonGroupContainer *cba;
- enum ScanCodeState {
- @@ -252,6 +254,7 @@ private:
- #ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
- void translateAdvancedPointerEvent(const TAdvancedPointerEvent *event);
- #endif
- + bool isSplitViewWidget(QWidget *widget);
- public:
- void handleClientAreaChange();
- diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
- index 605872e..6afa1f3 100644
- --- a/src/gui/styles/qs60style_s60.cpp
- +++ b/src/gui/styles/qs60style_s60.cpp
- @@ -65,7 +65,6 @@
- #include <aknnavi.h>
- #include <gulicon.h>
- #include <AknBitmapAnimation.h>
- -
- #include <centralrepository.h>
- #if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN)
- @@ -1413,7 +1412,6 @@ void QS60StylePrivate::handleDynamicLayoutVariantSwitch()
- {
- clearCaches(QS60StylePrivate::CC_LayoutChange);
- setActiveLayout();
- - refreshUI();
- foreach (QWidget *widget, QApplication::allWidgets())
- widget->ensurePolished();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement