95 } else { |
89 } else { |
96 mFnState = HbFnOff; |
90 mFnState = HbFnOff; |
97 } |
91 } |
98 break; |
92 break; |
99 case HbInputButton::ButtonKeyCodeShift: { |
93 case HbInputButton::ButtonKeyCodeShift: { |
100 HbTextCase currentTextCase = (HbTextCase)focusObject->editorInterface().textCase(); |
94 HbTextCase currentTextCase = (HbTextCase)focusObject->editorInterface().textCase(); |
101 HbInputLanguage language = mInputMethod->inputState().language(); |
95 HbInputLanguage language = mInputMethod->inputState().language(); |
102 |
96 |
103 // Update the Case Information in HbInputState, it internally updates in HbEditorInterface as well |
97 // Update the Case Information in HbInputState, it internally updates in HbEditorInterface as well |
104 switch(currentTextCase) { |
98 switch(currentTextCase) { |
105 case HbTextCaseLower: |
99 case HbTextCaseLower: |
106 // For Case-insensitive languages, Shift Key is used to switch between character sets (i.e lower case characters and shifted characters) |
100 // For Case-insensitive languages, Shift Key is used to switch between character sets (i.e lower case characters and shifted characters) |
107 if(!language.isCaseSensitiveLanguage()){ |
101 if(!language.isCaseSensitiveLanguage()){ |
108 currentTextCase = HbTextCaseUpper; |
102 currentTextCase = HbTextCaseUpper; |
109 } |
103 } |
110 else { |
104 else { |
111 currentTextCase = HbTextCaseAutomatic; |
105 currentTextCase = HbTextCaseAutomatic; |
112 } |
106 } |
113 break; |
107 break; |
114 case HbTextCaseUpper: |
108 case HbTextCaseUpper: |
115 currentTextCase = HbTextCaseLower; |
109 currentTextCase = HbTextCaseLower; |
116 break; |
110 break; |
117 case HbTextCaseAutomatic: |
111 case HbTextCaseAutomatic: |
118 currentTextCase = HbTextCaseUpper; |
112 currentTextCase = HbTextCaseUpper; |
119 break; |
113 break; |
120 default: |
114 default: |
121 break; |
115 break; |
122 } |
116 } |
123 HbInputState state = mInputMethod->inputState(); |
117 HbInputState state = mInputMethod->inputState(); |
124 state.setTextCase(currentTextCase); |
118 state.setTextCase(currentTextCase); |
125 mInputMethod->activateState(state); |
119 mInputMethod->activateState(state); |
126 } |
120 } |
127 break; |
121 break; |
128 case HbInputButton::ButtonKeyCodeSymbol: { // Ctrl/Chr |
122 case HbInputButton::ButtonKeyCodeSymbol: { // Ctrl/Chr |
129 case HbInputButton::ButtonKeyCodeAlphabet: |
123 case HbInputButton::ButtonKeyCodeAlphabet: |
130 mInputMethod->switchSpecialCharacterTable(); |
124 mInputMethod->switchSpecialCharacterTable(); |
131 } |
125 } |
132 break; |
126 break; |
|
127 case HbInputButton::ButtonKeyCodeSettings: |
|
128 mInputMethod->closeExactWordPopup(); |
|
129 break; |
133 default: { |
130 default: { |
134 HbTextCase currentTextCase = focusObject->editorInterface().textCase(); |
131 HbTextCase currentTextCase = focusObject->editorInterface().textCase(); |
135 Qt::KeyboardModifiers modifiers = Qt::NoModifier; |
132 Qt::KeyboardModifiers modifiers = Qt::NoModifier; |
136 if (mFnState == HbFnNext) { |
133 if (mFnState == HbFnNext) { |
137 modifiers |= Qt::AltModifier; |
134 modifiers |= Qt::AltModifier; |
249 { |
240 { |
250 Q_D(HbInputPredictionQwertyHandler); |
241 Q_D(HbInputPredictionQwertyHandler); |
251 HbInputModeHandler::commitAndUpdate(string, replaceFrom, replaceLength); |
242 HbInputModeHandler::commitAndUpdate(string, replaceFrom, replaceLength); |
252 d->mInputMethod->closeExactWordPopup(); |
243 d->mInputMethod->closeExactWordPopup(); |
253 d->mExactPopupLaunched = false; |
244 d->mExactPopupLaunched = false; |
254 d->mTailShowing = false; |
245 d->mTailShowing = false; |
255 } |
246 } |
256 |
247 |
257 /*! |
248 /*! |
258 this function deletes one character and updates the engine and editor. |
249 this function deletes one character and updates the engine and editor. |
259 */ |
250 */ |
320 //can go on with prediction. This is because when we delete a key press |
311 //can go on with prediction. This is because when we delete a key press |
321 //we actually reduce ambiguity in the engine and hence we should have |
312 //we actually reduce ambiguity in the engine and hence we should have |
322 //some word getting predicted as a result to that. |
313 //some word getting predicted as a result to that. |
323 mCanContinuePrediction = true; |
314 mCanContinuePrediction = true; |
324 |
315 |
325 if(false == mTailShowing && true == mExactPopupLaunched) { |
316 if(false == mTailShowing && true == mExactPopupLaunched) { |
326 mEngine->deleteKeyPress(); |
317 mEngine->deleteKeyPress(); |
327 mEngine->updateCandidates(mBestGuessLocation); |
318 mEngine->updateCandidates(mBestGuessLocation); |
328 } |
319 } |
329 if (true == mExactPopupLaunched) { |
320 if (true == mExactPopupLaunched) { |
330 mBestGuessLocation = 0 ; |
321 mBestGuessLocation = 0 ; |
331 } |
322 } |
332 //When there is a deletion of key press, no need to update the candidate list |
323 //When there is a deletion of key press, no need to update the candidate list |
333 //This is because deletion should not cause reprediction. |
324 //This is because deletion should not cause reprediction. |
334 if(mCandidates->count() && (mCandidates->count()>mBestGuessLocation) && false == mTailShowing && false == mExactPopupLaunched) { |
325 if(mCandidates->count() && (mCandidates->count()>mBestGuessLocation) && false == mTailShowing && false == mExactPopupLaunched) { |
335 QString currentWord = mCandidates->at(mBestGuessLocation); |
326 QString currentWord = mCandidates->at(mBestGuessLocation); |
336 if(currentWord.length() > mEngine->inputLength()) { |
327 if(currentWord.length() > mEngine->inputLength()) { |
337 //chop off the autocompletion part |
328 //chop off the autocompletion part |
338 currentWord = currentWord.left(mEngine->inputLength()); |
329 currentWord = currentWord.left(mEngine->inputLength()); |
339 } |
330 } |
340 if(currentWord.length()) { |
331 if(currentWord.length()) { |
341 currentWord.chop(1); |
332 currentWord.chop(1); |
342 mEngine->deleteKeyPress(); |
333 mEngine->deleteKeyPress(); |
343 //We are not supposed to re-construct the candidate list as deletion |
334 //We are not supposed to re-construct the candidate list as deletion |
344 //does not cause reprediction. Also, candidate list construction is the |
335 //does not cause reprediction. Also, candidate list construction is the |
345 //heaviest operation out of all engine operations. |
336 //heaviest operation out of all engine operations. |
346 (*mCandidates)[mBestGuessLocation] = currentWord; |
337 (*mCandidates)[mBestGuessLocation] = currentWord; |
347 } else { |
338 } else { |
348 commit(QString(""),false); |
339 commit(QString(""),false); |
349 } |
340 } |
350 |
341 |
351 } else if(!mCandidates->count() && mEngine->inputLength() >= 1) { |
342 } else if(!mCandidates->count() && mEngine->inputLength() >= 1) { |
352 //If Input length greater or equal to one then Append the current word to candidate |
343 //If Input length greater or equal to one then Append the current word to candidate |
353 mCandidates->append(mEngine->currentWord()); |
344 mCandidates->append(mEngine->currentWord()); |
354 } |
345 } |
355 // update the editor with the new preedit text. |
346 // update the editor with the new preedit text. |
356 updateEditor(); |
347 updateEditor(); |
357 return; |
348 return; |
358 } else { |
349 } else { |