src/hbplugins/inputmethods/touchinput/hbinputbasic12keyhandler.cpp
changeset 5 627c4a0fd0e7
parent 2 06ff229162e9
child 6 c3690ec91ef8
equal deleted inserted replaced
3:11d3954df52a 5:627c4a0fd0e7
   168         HbInputFocusObject *focusObject = mInputMethod->focusObject();
   168         HbInputFocusObject *focusObject = mInputMethod->focusObject();
   169         if (!focusObject || !mDownKey) {
   169         if (!focusObject || !mDownKey) {
   170             return false;
   170             return false;
   171         }
   171         }
   172         mDownKey = 0;
   172         mDownKey = 0;
   173         if (mLongPressHappened){
   173 		if ( mLongPressHappened ){
   174             mLongPressHappened = false;
   174             mLongPressHappened = false;
   175             return false;
   175             return false;
   176         }
   176         }
   177 
   177 
   178         if (mTimer->isActive() && mLastKey != buttonId) {
   178 		if(mTimer->isActive() && mLastKey != buttonId) {
   179             mNumChr = 0;
   179             mNumChr = 0;
   180 
   180 
   181             // For QLineEdit it works fine. For HbLineEdit, need to set the state 
   181             // For QLineEdit it works fine. For HbLineEdit, need to set the state 
   182             // to lower by calling activateState().
   182             // to lower by calling activateState().
   183             // This is needed for the scenario - When automatic text case is true
   183             // This is needed for the scenario - When automatic text case is true
   196             mInputMethod->closeKeypad();
   196             mInputMethod->closeKeypad();
   197             mLastKey = buttonId;
   197             mLastKey = buttonId;
   198             return true;
   198             return true;
   199         } else if (buttonId == HbInputButton::ButtonKeyCodeShift) {
   199         } else if (buttonId == HbInputButton::ButtonKeyCodeShift) {
   200             // single tap of shift key toggles prediction status in case insensitive languages
   200             // single tap of shift key toggles prediction status in case insensitive languages
   201 			// The Editor should not be Web or URL which allows only Latin Alphabet
   201             // The Editor should not be Web or URL which allows only Latin Alphabet
   202             if (!HbInputSettingProxy::instance()->globalInputLanguage().isCaseSensitiveLanguage() &&
   202             if (!HbInputSettingProxy::instance()->globalInputLanguage().isCaseSensitiveLanguage() &&
   203                                 ((HbEditorConstraintLatinAlphabetOnly | HbEditorConstraintAutoCompletingField)!=focusObject->editorInterface().inputConstraints()) &&
   203                                 ((HbEditorConstraintLatinAlphabetOnly | HbEditorConstraintAutoCompletingField)!=focusObject->editorInterface().inputConstraints()) &&
   204                 // when the language does not support prediction in that case we should not update the state and prediction
   204                 // when the language does not support prediction in that case we should not update the state and prediction
   205                 HbPredictionFactory::instance()->predictionEngineForLanguage(mInputMethod->inputState().language())) {
   205                 HbPredictionFactory::instance()->predictionEngineForLanguage(mInputMethod->inputState().language())) {
   206                 HbInputSettingProxy::instance()->togglePrediction();
   206                 HbInputSettingProxy::instance()->togglePrediction();
   216                         // in latin variants , double tap of shift key toggles the prediction status	
   216                         // in latin variants , double tap of shift key toggles the prediction status	
   217                         // revert back to the old case as this is a double tap 
   217                         // revert back to the old case as this is a double tap 
   218                         // (the case was changed on the single tap)
   218                         // (the case was changed on the single tap)
   219                         updateTextCase();
   219                         updateTextCase();
   220                         // when the language does not support prediction in that case we should not update the state and prediction
   220                         // when the language does not support prediction in that case we should not update the state and prediction
   221                         if(HbPredictionFactory::instance()->predictionEngineForLanguage(mInputMethod->inputState().language())) {
   221                         if(HbPredictionFactory::instance()->predictionEngineForLanguage(mInputMethod->inputState().language()) &&
       
   222                             mInputMethod->focusObject()->editorInterface().isPredictionAllowed()) {
   222                             q->togglePrediction();
   223                             q->togglePrediction();
   223                         }
   224                         }
   224                     } else {
   225                     } else {
   225                         // if the global language is different from the input mode language, we should 
   226                         // if the global language is different from the input mode language, we should 
   226                         // go back to the root state
   227                         // go back to the root state