summaryrefslogtreecommitdiff
path: root/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
diff options
context:
space:
mode:
authorJouni Hiltunen <jouni.hiltunen@digia.com>2009-11-03 13:50:49 +0200
committeraxis <qt-info@nokia.com>2009-11-10 16:18:12 +0100
commit05eacd9ad40f8adb5aaa12a8b90113a73b43f642 (patch)
tree4e6a14606e80e7caa9a3e337fd81bc8e24ac2b77 /src/gui/inputmethod/qcoefepinputcontext_s60.cpp
parent4a3d5b857f2525cc033bcefafe014302116c3535 (diff)
downloadqt4-tools-05eacd9ad40f8adb5aaa12a8b90113a73b43f642.tar.gz
Long-press shortcuts for symbols on QWERTY keyboard don't work
Qt key event was not handled properly in the case of long key press. With long key press, QCoeFepInputContext::commitCurrentString gets called 3 times("q", "", "1"). (Normal key press is causing one call). This is how aknfep works, so commitCurrentString was modified to replace first character if long key press event detected. E.g. "q" is replaced with "1". qlinecontrol modified to keep cursor position correct. Signed-off-by: axis <qt-info@nokia.com>
Diffstat (limited to 'src/gui/inputmethod/qcoefepinputcontext_s60.cpp')
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index ea5e29b295..ceace4a105 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) {