113 currentTextCase = HbTextCaseUpper; |
113 currentTextCase = HbTextCaseUpper; |
114 } |
114 } |
115 else { |
115 else { |
116 currentTextCase = HbTextCaseAutomatic; |
116 currentTextCase = HbTextCaseAutomatic; |
117 } |
117 } |
118 break; |
118 break; |
119 case HbTextCaseUpper: |
119 case HbTextCaseUpper: |
120 currentTextCase = HbTextCaseLower; |
120 currentTextCase = HbTextCaseLower; |
121 break; |
121 break; |
122 case HbTextCaseAutomatic: |
122 case HbTextCaseAutomatic: |
123 currentTextCase = HbTextCaseUpper; |
123 currentTextCase = HbTextCaseUpper; |
124 break; |
124 break; |
125 default: |
125 default: |
126 break; |
126 break; |
127 } |
127 } |
128 HbInputState state = mInputMethod->inputState(); |
128 HbInputState state = mInputMethod->inputState(); |
129 state.setTextCase(currentTextCase); |
129 state.setTextCase(currentTextCase); |
130 mInputMethod->activateState(state); |
130 mInputMethod->activateState(state); |
131 } |
131 } |
132 break; |
132 break; |
133 case HbInputButton::ButtonKeyCodeSymbol: { // Ctrl/Chr |
133 case HbInputButton::ButtonKeyCodeSymbol: { // Ctrl/Chr |
134 case HbInputButton::ButtonKeyCodeAlphabet: |
134 case HbInputButton::ButtonKeyCodeAlphabet: |
135 mInputMethod->switchSpecialCharacterTable(); |
135 mInputMethod->switchSpecialCharacterTable(); |
136 q->HbInputPredictionHandler::actionHandler(HbInputModeHandler::HbInputModeActionSetKeypad); |
136 } |
137 } |
|
138 break; |
137 break; |
139 case HbInputButton::ButtonKeyCodeSettings: |
138 case HbInputButton::ButtonKeyCodeSettings: |
140 mInputMethod->closeExactWordPopup(); |
139 mInputMethod->closeExactWordPopup(); |
141 break; |
140 break; |
142 default: { |
141 default: { |
143 HbTextCase currentTextCase = focusObject->editorInterface().textCase(); |
142 HbTextCase currentTextCase = focusObject->editorInterface().textCase(); |
144 Qt::KeyboardModifiers modifiers = Qt::NoModifier; |
143 Qt::KeyboardModifiers modifiers = Qt::NoModifier; |
145 if (mFnState == HbFnNext) { |
144 if (mFnState == HbFnNext) { |
146 modifiers |= Qt::AltModifier; |
145 modifiers |= Qt::AltModifier; |
287 Q_D(HbInputPredictionQwertyHandler); |
286 Q_D(HbInputPredictionQwertyHandler); |
288 d->commitSecondaryWord(); |
287 d->commitSecondaryWord(); |
289 } |
288 } |
290 |
289 |
291 void HbInputPredictionQwertyHandler::sctCharacterSelected(QString character) |
290 void HbInputPredictionQwertyHandler::sctCharacterSelected(QString character) |
292 { |
291 { |
293 HbInputPredictionHandler::sctCharacterSelected(character); |
292 HbInputPredictionHandler::sctCharacterSelected(character); |
294 } |
293 } |
295 |
294 |
296 void HbInputPredictionQwertyHandler::smileySelected(QString smiley) |
295 void HbInputPredictionQwertyHandler::smileySelected(QString smiley) |
297 { |
296 { |
326 //we actually reduce ambiguity in the engine and hence we should have |
325 //we actually reduce ambiguity in the engine and hence we should have |
327 //some word getting predicted as a result to that. |
326 //some word getting predicted as a result to that. |
328 mCanContinuePrediction = true; |
327 mCanContinuePrediction = true; |
329 |
328 |
330 int tailLength = mInputMethod->focusObject()->preEditString().length() - mEngine->inputLength(); |
329 int tailLength = mInputMethod->focusObject()->preEditString().length() - mEngine->inputLength(); |
331 if(tailLength <= 0 && true == mExactPopupLaunched) { |
330 if( true == mExactPopupLaunched ) { |
332 mEngine->deleteKeyPress(); |
331 mEngine->deleteKeyPress(); |
333 mEngine->updateCandidates(mBestGuessLocation); |
332 mEngine->updateCandidates(mBestGuessLocation); |
334 } |
333 } |
335 |
334 |
336 mBestGuessLocation = 0; |
335 mBestGuessLocation = 0; |
357 } else { |
356 } else { |
358 // we come here if their is no data in engine. |
357 // we come here if their is no data in engine. |
359 // once the word is committed, we can not bring it back to inline edit. |
358 // once the word is committed, we can not bring it back to inline edit. |
360 // so if the engine does not have any data, we just send backspace event to the editor. |
359 // so if the engine does not have any data, we just send backspace event to the editor. |
361 Q_Q(HbInputPredictionQwertyHandler); |
360 Q_Q(HbInputPredictionQwertyHandler); |
362 QKeyEvent event = QKeyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier); |
361 QKeyEvent event = QKeyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier); |
363 q->sendAndUpdate(event); |
362 q->sendAndUpdate(event); |
364 event = QKeyEvent(QEvent::KeyRelease, Qt::Key_Backspace, Qt::NoModifier); |
363 event = QKeyEvent(QEvent::KeyRelease, Qt::Key_Backspace, Qt::NoModifier); |
365 q->sendAndUpdate(event); |
364 q->sendAndUpdate(event); |
366 return; |
365 return; |
367 } |
366 } |
433 //This makes the whole text field grey insted of just the auto-completion part. Anyways, it does not cause crash. |
432 //This makes the whole text field grey insted of just the auto-completion part. Anyways, it does not cause crash. |
434 //This should be treated as a work around till QGraphicsWebView is fixed. |
433 //This should be treated as a work around till QGraphicsWebView is fixed. |
435 list.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, QInputMethodEvent::TextFormat, gray)); |
434 list.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, QInputMethodEvent::TextFormat, gray)); |
436 } else { |
435 } else { |
437 list.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, mEngine->inputLength(), taillength, gray)); |
436 list.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, mEngine->inputLength(), taillength, gray)); |
438 } |
437 } |
439 list.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, mEngine->inputLength(), 0, 0)); |
438 list.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, mEngine->inputLength(), 0, 0)); |
440 // the best guess word is sent to the editor |
439 // the best guess word is sent to the editor |
441 QInputMethodEvent event(bestGuessWord, list); |
440 QInputMethodEvent event(bestGuessWord, list); |
442 focusedObject->sendEvent(event); |
441 focusedObject->sendEvent(event); |
443 } else { |
442 } else { |
470 } |
469 } |
471 |
470 |
472 void HbInputPredictionQwertyHandlerPrivate::showExactWordPopupIfNeeded() |
471 void HbInputPredictionQwertyHandlerPrivate::showExactWordPopupIfNeeded() |
473 { |
472 { |
474 Q_Q(HbInputPredictionHandler); |
473 Q_Q(HbInputPredictionHandler); |
475 if (mShowTooltip && mCandidates->count() > mPrimaryCandidateIndex && mCandidates->at(0).mid(0, mEngine->inputLength()) \ |
474 if (mShowTooltip && mCandidates && mCandidates->count() > mSecondaryCandidateIndex && mPrimaryCandidateIndex != mSecondaryCandidateIndex) { |
476 != mCandidates->at(mPrimaryCandidateIndex).mid(0, mEngine->inputLength())) { |
|
477 q->processExactWord(mCandidates->at(mSecondaryCandidateIndex)); |
475 q->processExactWord(mCandidates->at(mSecondaryCandidateIndex)); |
478 } else { |
476 } else { |
479 QString empty; |
477 QString empty; |
480 q->processExactWord(empty); |
478 q->processExactWord(empty); |
481 } |
479 } |