diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2010-08-06 15:25:15 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2010-08-06 15:25:15 (GMT) |
commit | 6eb7a210eed1b392431fc913d13d205b8ccc1933 (patch) | |
tree | 349f5651c19350221bdfbbb2a46b38207e8086e2 /src | |
parent | e4c144db1cde192745a198160a01fca1416fe855 (diff) | |
download | Qt-6eb7a210eed1b392431fc913d13d205b8ccc1933.zip Qt-6eb7a210eed1b392431fc913d13d205b8ccc1933.tar.gz Qt-6eb7a210eed1b392431fc913d13d205b8ccc1933.tar.bz2 |
Fixes for combining multiple Qt::ImhXXXOnly with S60 FEP
When one restriction is a superset of another (e.g. ImhDigitsOnly |
ImhDialableCharactersOnly), the less restrictive one is used
When two restrictions are incompatible (e.g. ImhDialableCharactersOnly |
ImhFormattedNumbersOnly), fall back to allowing all symbols
Note for some combinations additional characters not in the union can
be entered, this is a limitation of the API to AVKON FEP.
Before this change, some characters in the union could not be entered
at all, which is worse.
Tested on I8510 (3.2), 5800XM (5.0), N8(symbian^3)
Task Number: QTBUG-12726
Reviewed-by: Alessandro Portale
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index ae51b1c..44fe7da 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -359,10 +359,10 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) commitTemporaryPreeditString(); - bool numbersOnly = (hints & ImhDigitsOnly) || (hints & ImhFormattedNumbersOnly) - || (hints & ImhDialableCharactersOnly); - bool noOnlys = !(numbersOnly || (hints & ImhUppercaseOnly) - || (hints & ImhLowercaseOnly)); + const bool anynumbermodes = hints & (ImhDigitsOnly | ImhFormattedNumbersOnly | ImhDialableCharactersOnly); + const bool anytextmodes = hints & (ImhUppercaseOnly | ImhLowercaseOnly | ImhEmailCharactersOnly | ImhUrlCharactersOnly); + const bool numbersOnly = anynumbermodes && !anytextmodes; + const bool noOnlys = !(hints & ImhExclusiveInputMask); TInt flags; Qt::InputMethodHints oldHints = hints; @@ -374,8 +374,7 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) } if (!noOnlys) { // Make sure that the preference is within the permitted set. - if (hints & ImhPreferNumbers && !(hints & ImhDigitsOnly || hints & ImhFormattedNumbersOnly - || hints & ImhDialableCharactersOnly)) { + if (hints & ImhPreferNumbers && !anynumbermodes) { hints &= ~ImhPreferNumbers; } else if (hints & ImhPreferUppercase && !(hints & ImhUppercaseOnly)) { hints &= ~ImhPreferUppercase; @@ -402,18 +401,21 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) m_fepState->SetCurrentInputMode(EAknEditorTextInputMode); } flags = 0; - if (numbersOnly) { - flags |= EAknEditorNumericInputMode; + if (noOnlys || (anynumbermodes && anytextmodes)) { + flags = EAknEditorAllInputModes; } - if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 - && ((hints & ImhFormattedNumbersOnly) || (hints & ImhDialableCharactersOnly))) { - //workaround - the * key does not launch the symbols menu, making it impossible to use these modes unless text mode is enabled. - flags |= EAknEditorTextInputMode; + else if (anynumbermodes) { + flags |= EAknEditorNumericInputMode; + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 + && ((hints & ImhFormattedNumbersOnly) || (hints & ImhDialableCharactersOnly))) { + //workaround - the * key does not launch the symbols menu, making it impossible to use these modes unless text mode is enabled. + flags |= EAknEditorTextInputMode; + } } - if (hints & ImhUppercaseOnly || hints & ImhLowercaseOnly) { + else if (anytextmodes) { flags |= EAknEditorTextInputMode; } - if (flags == 0) { + else { flags = EAknEditorAllInputModes; } m_fepState->SetPermittedInputModes(flags); @@ -460,27 +462,33 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) if (hints & ImhNoPredictiveText || hints & ImhHiddenText) { flags |= EAknEditorFlagNoT9; } - // if alphanumeric input, then make all symbols available in numeric mode too. - if (!numbersOnly) + // 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))) flags |= EAknEditorFlagUseSCTNumericCharmap; m_fepState->SetFlags(flags); ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateFlagsUpdate); - if (hints & ImhFormattedNumbersOnly) { + if (hints & ImhDialableCharactersOnly) { + // This is first, because if (ImhDialableCharactersOnly | ImhFormattedNumbersOnly) + // is specified, this one is more natural (# key enters a #) + flags = EAknEditorStandardNumberModeKeymap; + } else if (hints & ImhFormattedNumbersOnly) { + // # key enters decimal point flags = EAknEditorCalculatorNumberModeKeymap; } else if (hints & ImhDigitsOnly) { + // This is last, because it is most restrictive (# key is inactive) flags = EAknEditorPlainNumberModeKeymap; } else { - // ImhDialableCharactersOnly is the fallback as well, so we don't need to check for - // that flag. flags = EAknEditorStandardNumberModeKeymap; } m_fepState->SetNumericKeymap(static_cast<TAknEditorNumericKeymap>(flags)); - if (hints & ImhEmailCharactersOnly) { - m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_EMAIL_ADDR_SPECIAL_CHARACTER_TABLE_DIALOG); - } else if (hints & ImhUrlCharactersOnly) { + if (hints & ImhUrlCharactersOnly) { + // URL characters is everything except space, so a superset of the other restrictions 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 { m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG); } |