From dabc653c47c3fcdbbe9e59b8e55306bc0a4d8006 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 13 May 2011 15:29:53 +0300 Subject: Fix softkey icon positioning in S60 5.3 In S60 5.3, Avkon apparently expects softkey icons to be 32x32 and positions them accordingly into the softkey, instead of needing the application to supply the whole softkey image. Fixed by skipping the softkey image centering when S60 version is 5.3 or larger. Task-number: QTBUG-19104 Reviewed-by: Sami Merila --- src/gui/kernel/qsoftkeymanager_s60.cpp | 35 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index 79ed91a..0d64d8a 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -176,22 +176,27 @@ void QSoftKeyManagerPrivateS60::setNativeSoftkey(CEikButtonGroupContainer &cba, QPoint QSoftKeyManagerPrivateS60::softkeyIconPosition(int position, QSize sourceSize, QSize targetSize) { QPoint iconPosition(0,0); - switch( AknLayoutUtils::CbaLocation() ) - { - case AknLayoutUtils::EAknCbaLocationBottom: - // RSK must be moved to right, LSK in on correct position by default - if (position == RSK_POSITION) - iconPosition.setX(targetSize.width() - sourceSize.width()); - break; - case AknLayoutUtils::EAknCbaLocationRight: - case AknLayoutUtils::EAknCbaLocationLeft: - // Already in correct position - default: - break; - } - // Align horizontally to center - iconPosition.setY((targetSize.height() - sourceSize.height()) >> 1); + // Prior to S60 5.3 icons need to be properly positioned to buttons, but starting with 5.3 + // positioning is done on Avkon side. + if (QSysInfo::s60Version() < QSysInfo::SV_S60_5_3) { + switch (AknLayoutUtils::CbaLocation()) + { + case AknLayoutUtils::EAknCbaLocationBottom: + // RSK must be moved to right, LSK in on correct position by default + if (position == RSK_POSITION) + iconPosition.setX(targetSize.width() - sourceSize.width()); + break; + case AknLayoutUtils::EAknCbaLocationRight: + case AknLayoutUtils::EAknCbaLocationLeft: + // Already in correct position + default: + break; + } + + // Align horizontally to center + iconPosition.setY((targetSize.height() - sourceSize.height()) >> 1); + } return iconPosition; } -- cgit v0.12 From 1f292c52cb09444bad4a888df20971c61a4e72a2 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 13 May 2011 15:36:43 +0300 Subject: Support word selection list with predictive text from splitview When splitview is active and user taps a predicted word, mouse button should be forwarded to m_pointerHandler, which opens a suggested word list. When splitview is not active, but there are HW QWERTY keys in the device, tapping a word, should only move the cursor. Without HW QWERTY and no splitview, native editing state handles the functionality. Task-number: QTBUG-19062 Reviewed-by: Miikka Heikkinen --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 47 +++++++++++++------------ src/gui/kernel/qapplication_s60.cpp | 2 ++ src/gui/kernel/qt_s60_p.h | 2 ++ 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 06dc25c..b74cd5e 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -235,21 +235,6 @@ 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(true); - - int pos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt(); - - QList selectAttributes; - selectAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, pos, 0, QVariant()); - QInputMethodEvent selectEvent(QLatin1String(""), selectAttributes); - sendEvent(selectEvent); - } - break; case QEvent::KeyPress: commitTemporaryPreeditString(); // fall through intended @@ -328,7 +313,10 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) if (sControl) { sControl->setIgnoreFocusChanged(false); } - return true; + //If m_pointerHandler has already been set, it means that fep inline editing is in progress. + //When this is happening, do not filter out pointer events. + if (!m_pointerHandler) + return true; } return false; @@ -380,18 +368,31 @@ void QCoeFepInputContext::commitTemporaryPreeditString() commitCurrentString(false); } -void QCoeFepInputContext::mouseHandler( int x, QMouseEvent *event) +void QCoeFepInputContext::mouseHandler(int x, QMouseEvent *event) { Q_ASSERT(focusWidget()); if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::LeftButton) { - commitCurrentString(true); - int pos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt(); + QWidget *proxy = focusWidget()->focusProxy(); + Qt::InputMethodHints currentHints = proxy ? proxy->inputMethodHints() : focusWidget()->inputMethodHints(); + + //If splitview is open and T9 word is tapped, pass the pointer event to pointer handler. + //This will open the "suggested words" list. Pass pointer position always as zero, to make + //full word replacement in case user makes a selection. + if (S60->partial_keyboard && S60->partialKeyboardOpen + && m_pointerHandler + && !(currentHints & Qt::ImhNoPredictiveText) + && (x > 0 && x < m_preeditString.length())) { + m_pointerHandler->HandlePointerEventInInlineTextL(TPointerEvent::EButton1Up, 0, 0); + } else { + commitCurrentString(true); + int pos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt(); - QList attributes; - attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, pos + x, 0, QVariant()); - QInputMethodEvent event(QLatin1String(""), attributes); - sendEvent(event); + QList attributes; + attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, pos + x, 0, QVariant()); + QInputMethodEvent event(QLatin1String(""), attributes); + sendEvent(event); + } } } diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 6620efd..0b7e85d 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1481,8 +1481,10 @@ void QSymbianControl::HandleResourceChange(int resourceType) } if (ic && isSplitViewWidget(widget)) { if (resourceType == KSplitViewCloseEvent) { + S60->partialKeyboardOpen = false; ic->resetSplitViewWidget(); } else { + S60->partialKeyboardOpen = true; ic->ensureFocusWidgetVisible(widget); } } diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 8aba53a..3a910e4 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -153,6 +153,7 @@ public: int menuBeingConstructed : 1; int orientationSet : 1; int partial_keyboard : 1; + int partialKeyboardOpen : 1; QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type QPointer splitViewLastWidget; @@ -340,6 +341,7 @@ inline QS60Data::QS60Data() menuBeingConstructed(0), orientationSet(0), partial_keyboard(0), + partialKeyboardOpen(0), s60ApplicationFactory(0) #ifdef Q_OS_SYMBIAN ,s60InstalledTrapHandler(0) -- cgit v0.12 From e2320ec17446dc6e851fcf4ea2d998177b0d8049 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Fri, 13 May 2011 16:32:58 +0100 Subject: Fix instability in QNetworkConfigurationManager autotest QThread::isFinished() can return false after the finished() signal is emitted, so test the event loop's timeout() function instead. Don't compare prescan configurations, as these may be cached by the OS. It was causing the test to fail on linux if run before any other network test. Reviewed-by: mread --- .../tst_qnetworkconfigurationmanager.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp index c270eb8..8939ffe 100644 --- a/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp +++ b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp @@ -357,7 +357,7 @@ void tst_QNetworkConfigurationManager::usedInThread() connect(&thread, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); thread.start(); QTestEventLoop::instance().enterLoop(100); //QTRY_VERIFY could take ~90 seconds to time out in the thread - QVERIFY(thread.isFinished()); + QVERIFY(!QTestEventLoop::instance().timeout()); qDebug() << "prescan:" << thread.preScanConfigs.count(); qDebug() << "postscan:" << thread.configs.count(); @@ -368,7 +368,9 @@ void tst_QNetworkConfigurationManager::usedInThread() QTRY_VERIFY(spy.count() == 1); //wait for scan to complete QList configs = manager.allConfigurations(); QCOMPARE(thread.configs, configs); - QCOMPARE(thread.preScanConfigs, preScanConfigs); + //Don't compare pre scan configs, because these may be cached and therefore give different results + //which makes the test unstable. The post scan results should have all configurations every time + //QCOMPARE(thread.preScanConfigs, preScanConfigs); #endif } -- cgit v0.12