diff options
author | Lauri Malmi <ext-lauri.malmi@nokia.com> | 2012-05-15 09:54:25 +0300 |
---|---|---|
committer | Pasi Pentikäinen <ext-pasi.a.pentikainen@nokia.com> | 2012-05-22 10:16:55 +0200 |
commit | 23e4b783dc0a42c5a0b3cf825bad534341eafd1b (patch) | |
tree | 9bdc49f3a8499acb5a47adcb5b710634252ce544 | |
parent | ab1c27d2432969dae000bf215ffdaff551fc0a4c (diff) | |
download | qt4-tools-23e4b783dc0a42c5a0b3cf825bad534341eafd1b.tar.gz |
Symbian: inputcontext reports pointer events to FEP during inline edit
QCoeFepInputContext::mouseHandler() must report pointer events to FEP
by calling CAknExtendedInputCapabilities::ReportEventL(
CAknExtendedInputCapabilities::MAknEventObserver::
EPointerEventReceived).
Based on this event FEP commits inline edit properly and sends
notification peninputserver/VKB. Earlier QCoeFepInputContext::
mouseHandler() called CCoeFep::CancelTransaction() direclty
which lead to inconsistent inline edit state between FEP and VKB.
Task-number: ou1cimx1#991638
Change-Id: I90641ffd5aed97b27f2ca2328c0296e14b12f319
Reviewed-by: Pasi Pentikäinen <ext-pasi.a.pentikainen@nokia.com>
(cherry picked from commit 11a1383d54fd479c4fb3d2a96b847732a01dcce8)
Reviewed-by: Lauri Malmi <ext-lauri.malmi@nokia.com>
-rw-r--r-- | src/gui/inputmethod/inputmethod.pri | 2 | ||||
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_p.h | 4 | ||||
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 34 |
3 files changed, 35 insertions, 5 deletions
diff --git a/src/gui/inputmethod/inputmethod.pri b/src/gui/inputmethod/inputmethod.pri index d4394380dc..6667defcd2 100644 --- a/src/gui/inputmethod/inputmethod.pri +++ b/src/gui/inputmethod/inputmethod.pri @@ -26,6 +26,6 @@ mac:!embedded:!qpa { symbian:contains(QT_CONFIG, s60) { HEADERS += inputmethod/qcoefepinputcontext_p.h SOURCES += inputmethod/qcoefepinputcontext_s60.cpp - LIBS += -lfepbase -lakninputlanguage + LIBS += -lfepbase -lakninputlanguage -leikctl } diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 1b62a256f4..f8e6fec0a4 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -65,6 +65,8 @@ #include <aknedsts.h> #include <eikccpu.h> +class CAknExtendedInputCapabilities; + QT_BEGIN_NAMESPACE class QCoeFepInputMaskHandler @@ -221,6 +223,8 @@ private: QPointer<QWidget> m_lastFocusedEditor; QPointer<QObject> m_lastFocusedObject; + CAknExtendedInputCapabilities *m_extendedInputCapabilities; + friend class tst_QInputContext; }; diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 5ced556e51..151d3cc79a 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -63,6 +63,7 @@ #include <coeinput.h> #include <w32std.h> #include <akndiscreetpopup.h> +#include <aknextendedinputcapabilities.h> #include <qtextedit.h> #include <qplaintextedit.h> @@ -432,7 +433,8 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) m_splitViewResizeBy(0), m_splitViewPreviousWindowStates(Qt::WindowNoState), m_splitViewPreviousFocusItem(0), - m_ccpu(0) + m_ccpu(0), + m_extendedInputCapabilities(0) { m_fepState->SetObjectProvider(this); int defaultFlags = EAknEditorFlagDefault; @@ -464,6 +466,8 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) pasteLabel = qt_TDesC2QString(*pasteBuf); CleanupStack::PopAndDestroy(pasteBuf); } + + m_extendedInputCapabilities = CAknExtendedInputCapabilities::NewL(); ) m_copyAction = new QAction(copyLabel, QApplication::desktop()); @@ -486,6 +490,7 @@ QCoeFepInputContext::~QCoeFepInputContext() delete m_fepState; delete m_ccpu; + delete m_extendedInputCapabilities; } void QCoeFepInputContext::reset() @@ -907,7 +912,22 @@ void QCoeFepInputContext::mouseHandler(int x, QMouseEvent *event) && (x > 0 && x < m_preeditString.length())) { m_pointerHandler->HandlePointerEventInInlineTextL(TPointerEvent::EButton1Up, 0, 0); } else { - commitCurrentString(true); + // Notify FEP about pointer event via CAknExtendedInputCapabilities::ReporEventL(). + // FEP will then commit the string and cancel inline edit state properly. + // FEP does not really use the pointer event parameter, so it is ok to pass NULL. + if (m_extendedInputCapabilities) { + TRAP_IGNORE( + m_extendedInputCapabilities->ReportEventL( + CAknExtendedInputCapabilities::MAknEventObserver::EPointerEventReceived, + NULL)); + } else { + // In practice m_extendedInputCapabilities should always exist. + // If it does not, commit current string directly here. + // This will cancel inline edit in FEP but VKB might still think that + // inline edit is ongoing. + commitCurrentString(true); + } + int pos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt(); QList<QInputMethodEvent::Attribute> attributes; @@ -924,7 +944,9 @@ TCoeInputCapabilities QCoeFepInputContext::inputCapabilities() return TCoeInputCapabilities(TCoeInputCapabilities::ENone, 0, 0); } - return TCoeInputCapabilities(m_textCapabilities, this, 0); + TCoeInputCapabilities inputCapabilities(m_textCapabilities, this, 0); + inputCapabilities.SetObjectProvider(this); + return inputCapabilities; } void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget) @@ -2115,8 +2137,12 @@ void QCoeFepInputContext::paste() QT_TRAP_THROWING(CcpuPasteL()); } -TTypeUid::Ptr QCoeFepInputContext::MopSupplyObject(TTypeUid /*id*/) +TTypeUid::Ptr QCoeFepInputContext::MopSupplyObject(TTypeUid id) { + if (m_extendedInputCapabilities + && id.iUid == CAknExtendedInputCapabilities::ETypeId) + return id.MakePtr(m_extendedInputCapabilities); + return TTypeUid::Null(); } |