diff options
author | axis <qt-info@nokia.com> | 2010-09-09 11:48:58 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2010-09-10 09:51:44 (GMT) |
commit | 1ecd2d460896959cf3c5654f4cef7e4d3c8f5cf6 (patch) | |
tree | 5f3f263d6080e2000562b9b405820b8f08935870 | |
parent | 2735bc6759f881c786a1097580a8682e3d28f365 (diff) | |
download | Qt-1ecd2d460896959cf3c5654f4cef7e4d3c8f5cf6.zip Qt-1ecd2d460896959cf3c5654f4cef7e4d3c8f5cf6.tar.gz Qt-1ecd2d460896959cf3c5654f4cef7e4d3c8f5cf6.tar.bz2 |
Fixed crash in input methods when using symbols menu and numbers only
When inputting only numbers, the symbol menu should not do anything.
However in the old code the resource id of the symbol table was still
being set, so the symbol key on N97 would look up a table that was
not valid for the current input mode and crash.
Fixed by setting the symbol table id to zero under those conditions.
RevBy: Sami Merila
Task: QTBUG-13472
AutoTest: Included
(cherry picked from commit 5cef786a651c675d3428060a19bfd9d9ecee6083)
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 11 | ||||
-rw-r--r-- | tests/auto/qinputcontext/tst_qinputcontext.cpp | 21 |
2 files changed, 28 insertions, 4 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index ce0c9ff..02e0abb 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -364,6 +364,9 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) const bool anytextmodes = hints & (ImhUppercaseOnly | ImhLowercaseOnly | ImhEmailCharactersOnly | ImhUrlCharactersOnly); const bool numbersOnly = anynumbermodes && !anytextmodes; const bool noOnlys = !(hints & ImhExclusiveInputMask); + // if alphanumeric input, or if multiple incompatible number modes are selected; + // then make all symbols available in numeric mode too. + const bool needsCharMap= !numbersOnly || ((hints & ImhFormattedNumbersOnly) && (hints & ImhDialableCharactersOnly)); TInt flags; Qt::InputMethodHints oldHints = hints; @@ -463,9 +466,7 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) if (hints & ImhNoPredictiveText || hints & ImhHiddenText) { flags |= EAknEditorFlagNoT9; } - // if alphanumeric input, or if multiple incompatible number modes are selected; - // then make all symbols available in numeric mode too. - if (!numbersOnly || ((hints & ImhFormattedNumbersOnly) && (hints & ImhDialableCharactersOnly))) + if (needsCharMap) flags |= EAknEditorFlagUseSCTNumericCharmap; m_fepState->SetFlags(flags); ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateFlagsUpdate); @@ -490,8 +491,10 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG); } else if (hints & ImhEmailCharactersOnly) { m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_EMAIL_ADDR_SPECIAL_CHARACTER_TABLE_DIALOG); - } else { + } else if (needsCharMap) { m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG); + } else { + m_fepState->SetSpecialCharacterTableResourceId(0); } if (hints & ImhHiddenText) { diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp index 8eef2cc..26b7b00 100644 --- a/tests/auto/qinputcontext/tst_qinputcontext.cpp +++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp @@ -882,6 +882,27 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << QString("44") << QString(""); events.clear(); + + // Test that the symbol key successfully does nothing when in number-only mode. + events << FepReplayEvent(EEventKeyDown, EStdKeyLeftFunc, 0, 0, 0); + events << FepReplayEvent(EEventKeyUp, EStdKeyLeftFunc, 0, 0, 0); + QTest::newRow("Dead symbols key") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 0 + << QLineEdit::Normal + << events + << QString("") + << QString(""); + QTest::newRow("Dead symbols key and password") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 0 + << QLineEdit::Password + << events + << QString("") + << QString(""); + events.clear(); #endif } |