diff options
author | axis <qt-info@nokia.com> | 2009-11-10 15:47:47 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-11-10 15:47:47 (GMT) |
commit | 05b878f71c08346af9e3afa10900bf0e41a5e84d (patch) | |
tree | 543a2e7bf5019139b578f142ddfa8ad8bd1693ee /src | |
parent | d4089399a3ab7548a864d5a399e08df85c444783 (diff) | |
parent | b59349a06aeb0933085f76b7401085e63d4d4088 (diff) | |
download | Qt-05b878f71c08346af9e3afa10900bf0e41a5e84d.zip Qt-05b878f71c08346af9e3afa10900bf0e41a5e84d.tar.gz Qt-05b878f71c08346af9e3afa10900bf0e41a5e84d.tar.bz2 |
Merge branch 'cask-merge-request' into 4.6
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_p.h | 2 | ||||
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 15 | ||||
-rw-r--r-- | src/gui/widgets/qlinecontrol.cpp | 2 |
3 files changed, 16 insertions, 3 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 452aa75..28c1c67 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -146,6 +146,8 @@ private: int m_inlinePosition; MFepInlineTextFormatRetriever *m_formatRetriever; MFepPointerEventHandlerDuringInlineEdit *m_pointerHandler; + int m_longPress; + int m_cursorPos; }; QT_END_NAMESPACE diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index ea5e29b..5db6f0d 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -71,7 +71,9 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) m_cursorVisibility(1), m_inlinePosition(0), m_formatRetriever(0), - m_pointerHandler(0) + m_pointerHandler(0), + m_longPress(0), + m_cursorPos(0) { m_fepState->SetObjectProvider(this); m_fepState->SetFlags(EAknEditorFlagDefault); @@ -488,6 +490,8 @@ void QCoeFepInputContext::StartFepInlineEditL(const TDesC& aInitialInlineText, m_isEditing = true; + m_cursorPos = w->inputMethodQuery(Qt::ImCursorPosition).toInt(); + QList<QInputMethodEvent::Attribute> attributes; m_cursorVisibility = aCursorVisibility ? 1 : 0; @@ -691,15 +695,22 @@ void QCoeFepInputContext::DoCommitFepInlineEditL() void QCoeFepInputContext::commitCurrentString(bool triggeredBySymbian) { if (m_preeditString.size() == 0) { + QWidget *w = focusWidget(); + if (triggeredBySymbian && w) { + // We must replace the last character only if the input box has already accepted one + if (w->inputMethodQuery(Qt::ImCursorPosition).toInt() != m_cursorPos) + m_longPress = 1; + } return; } QList<QInputMethodEvent::Attribute> attributes; QInputMethodEvent event(QLatin1String(""), attributes); - event.setCommitString(m_preeditString, 0, 0);//m_preeditString.size()); + event.setCommitString(m_preeditString, 0-m_longPress, m_longPress); m_preeditString.clear(); sendEvent(event); + m_longPress = 0; m_isEditing = false; if (!triggeredBySymbian) { diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 2914164..300a2ea 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -414,7 +414,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) int c = m_cursor; // cursor position after insertion of commit string - if (event->replacementStart() <= 0) + if (event->replacementStart() == 0) c += event->commitString().length() + qMin(-event->replacementStart(), event->replacementLength()); m_cursor += event->replacementStart(); |