61 |
61 |
62 int index = mNumChr; |
62 int index = mNumChr; |
63 do { |
63 do { |
64 int currCharIndex = 0; |
64 int currCharIndex = 0; |
65 mCurrentChar = 0; |
65 mCurrentChar = 0; |
66 //This condition is to avoid get the characters mapped to Asterisk |
66 //This condition is to avoid get the characters mapped to Asterisk |
67 //Especially for Thai language we have mapped character to Asterisk |
67 //Especially for Thai language we have mapped character to Asterisk |
68 if (buttonId != HbInputButton::ButtonKeyCodeAsterisk || |
68 if (buttonId != HbInputButton::ButtonKeyCodeAsterisk || |
69 mInputMethod->currentKeyboardType() == HbKeyboardSctPortrait) { |
69 mInputMethod->currentKeyboardType() == HbKeyboardSctEmail || |
|
70 mInputMethod->currentKeyboardType() == HbKeyboardSctUrl || |
|
71 mInputMethod->currentKeyboardType() == HbKeyboardSctPortrait ) { |
70 currCharIndex = mNumChr ; |
72 currCharIndex = mNumChr ; |
71 mCurrentChar = q->getNthCharacterInKey(mNumChr, buttonId, type); |
73 mCurrentChar = q->getNthCharacterInKey(mNumChr, buttonId, type); |
72 } |
74 } |
73 |
75 |
74 if (mCurrentChar != 0) { |
76 if (mCurrentChar != 0) { |
75 if (focusObject->characterAllowedInEditor(mCurrentChar)) { |
77 if (focusObject->characterAllowedInEditor(mCurrentChar)) { |
76 //If the keypad is SCT or button has only one character that is allowed to editor, |
78 //If the keypad is SCT or button has only one character that is allowed to editor, |
77 //we can commit the character immidiately |
79 //we can commit the character immidiately |
106 if (keyEvent->isAutoRepeat() && mDownKey == buttonId) { |
108 if (keyEvent->isAutoRepeat() && mDownKey == buttonId) { |
107 mTimer->stop(); |
109 mTimer->stop(); |
108 if (mDownKey == HbInputButton::ButtonKeyCodeShift) { |
110 if (mDownKey == HbInputButton::ButtonKeyCodeShift) { |
109 mLongPressHappened = true; |
111 mLongPressHappened = true; |
110 mInputMethod->switchMode(HbInputButton::ButtonKeyCodeShift); |
112 mInputMethod->switchMode(HbInputButton::ButtonKeyCodeShift); |
111 } else if (mDownKey == HbInputButton::ButtonKeyCodeSymbol) { |
113 } else if (mDownKey == HbInputButton::ButtonKeyCodeSymbol && |
112 // launch the smiley popup when long press of Sym key is received |
114 (mInputMethod->currentKeyboardType() != HbKeyboardSctPortrait && |
|
115 mInputMethod->currentKeyboardType() != HbKeyboardSctEmail && |
|
116 mInputMethod->currentKeyboardType() != HbKeyboardSctUrl )) { |
113 mLongPressHappened = true; |
117 mLongPressHappened = true; |
114 mInputMethod->selectSpecialCharacterTableMode(); |
118 if (HbInputSettingProxy::instance()->globalInputLanguage().language() == QLocale::Chinese) { |
|
119 mInputMethod->switchMode(mDownKey); |
|
120 } else { |
|
121 mInputMethod->selectSpecialCharacterTableMode(); |
|
122 } |
115 } else if (mDownKey == HbInputButton::ButtonKeyCodeAsterisk && |
123 } else if (mDownKey == HbInputButton::ButtonKeyCodeAsterisk && |
|
124 !mInputMethod->isSctModeActive() && |
|
125 (mInputMethod->currentKeyboardType() != HbKeyboardSctPortrait && |
|
126 mInputMethod->currentKeyboardType() != HbKeyboardSctUrl && |
|
127 mInputMethod->currentKeyboardType() != HbKeyboardSctEmail )) { |
116 // launch the SCT keypad when long press of Asterisk key is |
128 // launch the SCT keypad when long press of Asterisk key is |
117 // received in non-SCT mode |
129 // received in non-SCT mode |
118 !mInputMethod->isSctModeActive()) { |
|
119 mLongPressHappened = true; |
130 mLongPressHappened = true; |
120 mInputMethod->switchMode(mDownKey); |
131 mInputMethod->switchMode(mDownKey); |
121 } else if (mDownKey != HbInputButton::ButtonKeyCodeDelete && |
132 } else if (mDownKey != HbInputButton::ButtonKeyCodeDelete && |
122 mInputMethod->currentKeyboardType() != HbKeyboardSctPortrait) { |
133 mInputMethod->currentKeyboardType() != HbKeyboardSctPortrait) { |
123 mLongPressHappened = true; |
134 mLongPressHappened = true; |
128 return true; |
139 return true; |
129 } |
140 } |
130 } |
141 } |
131 |
142 |
132 // mark a shift key double tap. This would be handled when the release event is received. |
143 // mark a shift key double tap. This would be handled when the release event is received. |
133 if ((buttonId == HbInputButton::ButtonKeyCodeShift) && (mLastKey == buttonId) && mTimer->isActive()) { |
144 if (buttonId == HbInputButton::ButtonKeyCodeShift && mLastKey == buttonId && mTimer->isActive()) { |
134 mShiftKeyDoubleTapped = true; |
145 mShiftKeyDoubleTapped = true; |
135 } |
146 } |
136 |
147 |
137 if (mInputMethod) { |
148 if (mInputMethod) { |
138 if (mLastKey != buttonId || mInputMethod->currentKeyboardType() == HbKeyboardSctPortrait) |
149 if (mLastKey != buttonId || mInputMethod->currentKeyboardType() == HbKeyboardSctPortrait || |
|
150 mInputMethod->currentKeyboardType() == HbKeyboardSctEmail || mInputMethod->currentKeyboardType() == HbKeyboardSctUrl) |
139 { |
151 { |
140 if (mCurrentChar != 0) { |
152 if (mCurrentChar != 0) { |
141 if (!focusObject->characterAllowedInEditor(mCurrentChar)) { |
153 if (!focusObject->characterAllowedInEditor(mCurrentChar)) { |
142 focusObject->sendCommitString(QString()); |
154 focusObject->sendCommitString(QString()); |
143 } else { |
155 } else { |
147 } |
159 } |
148 QChar commitChar(mCurrentChar); |
160 QChar commitChar(mCurrentChar); |
149 mCurrentChar = 0; |
161 mCurrentChar = 0; |
150 mNumChr = 0; |
162 mNumChr = 0; |
151 focusObject->filterAndCommitCharacter(commitChar); |
163 focusObject->filterAndCommitCharacter(commitChar); |
152 } |
164 } |
153 } |
165 } |
154 } |
166 |
155 |
167 // we should not launch auto-completor when function keys are pressed. |
|
168 if (buttonId == HbInputButton::ButtonKeyCodeCharacter) |
|
169 refreshAutoCompleter(); |
|
170 } |
|
171 |
156 mDownKey = buttonId; |
172 mDownKey = buttonId; |
157 mTimer->stop(); |
173 mTimer->stop(); |
158 if (mInputMethod->currentKeyboardType() == HbKeyboardVirtual12Key) { |
174 if (mInputMethod->currentKeyboardType() == HbKeyboardVirtual12Key || |
|
175 mInputMethod->currentKeyboardType() == HbKeyboardVirtual12KeyEmail || |
|
176 mInputMethod->currentKeyboardType() == HbKeyboardVirtual12KeyUrl ) { |
159 mTimer->start(HbMultiTapTimerTimeout); |
177 mTimer->start(HbMultiTapTimerTimeout); |
160 } |
178 } |
161 } |
179 } |
162 return false; |
180 return false; |
163 } |
181 } |
193 // press shift, multitap on a button. The char is entered in upper case. |
211 // press shift, multitap on a button. The char is entered in upper case. |
194 // It should be entered in lower case. |
212 // It should be entered in lower case. |
195 if (mLastKey && (HbInputButton::ButtonKeyCodeShift != mLastKey)) { |
213 if (mLastKey && (HbInputButton::ButtonKeyCodeShift != mLastKey)) { |
196 mInputMethod->updateState(); |
214 mInputMethod->updateState(); |
197 } |
215 } |
198 refreshAutoCompleter(); |
|
199 } |
216 } |
200 |
217 |
201 if (buttonId == HbInputButton::ButtonKeyCodeShift) { |
218 if (buttonId == HbInputButton::ButtonKeyCodeShift) { |
202 // single tap of shift key toggles prediction status in case insensitive languages |
219 // single tap of shift key toggles prediction status in case insensitive languages |
203 // The Editor should not be Web or URL which allows only Latin Alphabet |
220 // The Editor should not be Web or URL which allows only Latin Alphabet |
204 if (!HbInputSettingProxy::instance()->globalInputLanguage().isCaseSensitiveLanguage() && |
221 if (!mInputMethod->inputState().language().isCaseSensitiveLanguage() && |
205 ((HbEditorConstraintLatinAlphabetOnly | HbEditorConstraintAutoCompletingField)!=focusObject->editorInterface().inputConstraints()) && |
222 ((HbEditorConstraintLatinAlphabetOnly | HbEditorConstraintAutoCompletingField)!=focusObject->editorInterface().inputConstraints()) && |
206 // when the language does not support prediction in that case we should not update the state and prediction |
223 // when the language does not support prediction in that case we should not update the state and prediction |
207 HbPredictionFactory::instance()->predictionEngineForLanguage(mInputMethod->inputState().language())) { |
224 HbPredictionFactory::instance()->predictionEngineForLanguage(mInputMethod->inputState().language())) { |
208 HbInputSettingProxy::instance()->togglePrediction(); |
225 HbInputSettingProxy::instance()->togglePrediction(); |
209 } else { |
226 } else { |
213 mShiftKeyDoubleTapped = false; |
230 mShiftKeyDoubleTapped = false; |
214 mTimer->stop(); |
231 mTimer->stop(); |
215 if( HbInputSettingProxy::instance()->globalInputLanguage() == mInputMethod->inputState().language() || |
232 if( HbInputSettingProxy::instance()->globalInputLanguage() == mInputMethod->inputState().language() || |
216 HbInputSettingProxy::instance()->globalSecondaryInputLanguage() == mInputMethod->inputState().language() || |
233 HbInputSettingProxy::instance()->globalSecondaryInputLanguage() == mInputMethod->inputState().language() || |
217 ((HbEditorConstraintLatinAlphabetOnly | HbEditorConstraintAutoCompletingField)==focusObject->editorInterface().inputConstraints())){ |
234 ((HbEditorConstraintLatinAlphabetOnly | HbEditorConstraintAutoCompletingField)==focusObject->editorInterface().inputConstraints())){ |
218 // in latin variants , double tap of shift key toggles the prediction status |
235 // in latin variants , double tap of shift key toggles the prediction status |
219 // revert back to the old case as this is a double tap |
236 // revert back to the old case as this is a double tap |
220 // (the case was changed on the single tap) |
237 // (the case was changed on the single tap) |
221 updateTextCase(); |
238 updateTextCase(); |
222 // when the language does not support prediction in that case we should not update the state and prediction |
239 // when the language does not support prediction in that case we should not update the state and prediction |
223 if(HbPredictionFactory::instance()->predictionEngineForLanguage(mInputMethod->inputState().language()) && |
240 if(HbPredictionFactory::instance()->predictionEngineForLanguage(mInputMethod->inputState().language()) && |
256 // it was a long press on sct swith button. so just return form here. |
273 // it was a long press on sct swith button. so just return form here. |
257 if (!mTimer->isActive() && buttonId == HbInputButton::ButtonKeyCodeSymbol) { |
274 if (!mTimer->isActive() && buttonId == HbInputButton::ButtonKeyCodeSymbol) { |
258 return true; |
275 return true; |
259 } |
276 } |
260 // switch the keypad mode when the short key press of Asterisk key in non-SCT mode |
277 // switch the keypad mode when the short key press of Asterisk key in non-SCT mode |
261 // or SYM button or Alphabet button is received |
278 // or SYM button or Alphabet button is received |
262 if ((buttonId == HbInputButton::ButtonKeyCodeAsterisk && |
279 if ((buttonId == HbInputButton::ButtonKeyCodeAsterisk && |
263 !mInputMethod->isSctModeActive()) || buttonId == HbInputButton::ButtonKeyCodeSymbol || |
280 !mInputMethod->isSctModeActive()) || buttonId == HbInputButton::ButtonKeyCodeSymbol || |
264 buttonId == HbInputButton::ButtonKeyCodeAlphabet) { |
281 buttonId == HbInputButton::ButtonKeyCodeAlphabet) { |
265 mInputMethod->switchMode(buttonId); |
282 mInputMethod->switchMode(buttonId); |
266 return true; |
283 return true; |