src/hbplugins/inputmethods/touchinput/hbinputbasic12keyhandler.cpp
changeset 21 4633027730f5
parent 7 923ff622b8b9
child 23 e6ad4ef83b23
equal deleted inserted replaced
7:923ff622b8b9 21:4633027730f5
    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) {
   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             mInputMethod->selectSpecialCharacterTableMode();
   115         } else if (mDownKey == HbInputButton::ButtonKeyCodeAsterisk &&
   119         } else if (mDownKey == HbInputButton::ButtonKeyCodeAsterisk &&
       
   120 			!mInputMethod->isSctModeActive() && 
       
   121 			(mInputMethod->currentKeyboardType() != HbKeyboardSctPortrait &&
       
   122             mInputMethod->currentKeyboardType() != HbKeyboardSctUrl &&
       
   123             mInputMethod->currentKeyboardType() != HbKeyboardSctEmail )) {
   116             // launch the SCT keypad when long press of Asterisk key is 
   124             // launch the SCT keypad when long press of Asterisk key is 
   117 			// received in non-SCT mode
   125 			// received in non-SCT mode
   118             !mInputMethod->isSctModeActive()) {
       
   119             mLongPressHappened = true;
   126             mLongPressHappened = true;
   120             mInputMethod->switchMode(mDownKey);
   127             mInputMethod->switchMode(mDownKey);
   121         } else if (mDownKey != HbInputButton::ButtonKeyCodeDelete &&
   128         } else if (mDownKey != HbInputButton::ButtonKeyCodeDelete &&
   122                    mInputMethod->currentKeyboardType() != HbKeyboardSctPortrait) {
   129                    mInputMethod->currentKeyboardType() != HbKeyboardSctPortrait) {
   123             mLongPressHappened = true;
   130             mLongPressHappened = true;
   128             return true;
   135             return true;
   129         }
   136         }
   130     }
   137     }
   131 
   138 
   132     // mark a shift key double tap. This would be handled when the release event is received.
   139     // 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()) {
   140     if (buttonId == HbInputButton::ButtonKeyCodeShift && mLastKey == buttonId && mTimer->isActive()) {
   134         mShiftKeyDoubleTapped = true;        
   141         mShiftKeyDoubleTapped = true;        
   135     }
   142     }
   136 
   143 
   137     if (mInputMethod) {
   144     if (mInputMethod) {
   138         if (mLastKey != buttonId || mInputMethod->currentKeyboardType() == HbKeyboardSctPortrait)
   145         if (mLastKey != buttonId || mInputMethod->currentKeyboardType() == HbKeyboardSctPortrait || 
       
   146             mInputMethod->currentKeyboardType() == HbKeyboardSctEmail || mInputMethod->currentKeyboardType() == HbKeyboardSctUrl)
   139         {
   147         {
   140             if (mCurrentChar != 0) {
   148             if (mCurrentChar != 0) {
   141                 if (!focusObject->characterAllowedInEditor(mCurrentChar)) {
   149                 if (!focusObject->characterAllowedInEditor(mCurrentChar)) {
   142                     focusObject->sendCommitString(QString());            
   150                     focusObject->sendCommitString(QString());            
   143                 } else {
   151                 } else {
   147                     }
   155                     }
   148                     QChar commitChar(mCurrentChar);
   156                     QChar commitChar(mCurrentChar);
   149                     mCurrentChar = 0;
   157                     mCurrentChar = 0;
   150                     mNumChr = 0;
   158                     mNumChr = 0;
   151                     focusObject->filterAndCommitCharacter(commitChar);
   159                     focusObject->filterAndCommitCharacter(commitChar);
   152                 }            
   160                 }
   153             }            
   161             }
   154         }
   162 
   155 
   163             // we should not launch auto-completor when function keys are pressed.
       
   164             if (buttonId == HbInputButton::ButtonKeyCodeCharacter)
       
   165                 refreshAutoCompleter();
       
   166         }
       
   167     
   156         mDownKey = buttonId;
   168         mDownKey = buttonId;
   157         mTimer->stop();
   169         mTimer->stop();
   158         if (mInputMethod->currentKeyboardType() == HbKeyboardVirtual12Key) {
   170         if (mInputMethod->currentKeyboardType() == HbKeyboardVirtual12Key || 
       
   171             mInputMethod->currentKeyboardType() == HbKeyboardVirtual12KeyEmail || 
       
   172             mInputMethod->currentKeyboardType() == HbKeyboardVirtual12KeyUrl ) {
   159             mTimer->start(HbMultiTapTimerTimeout);
   173             mTimer->start(HbMultiTapTimerTimeout);
   160         }
   174         }
   161     }
   175     }
   162     return false;
   176     return false;
   163 }
   177 }
   193             // press shift, multitap on a button. The char is entered in upper case.
   207             // press shift, multitap on a button. The char is entered in upper case.
   194             // It should be entered in lower case.
   208             // It should be entered in lower case.
   195             if (mLastKey && (HbInputButton::ButtonKeyCodeShift != mLastKey)) {
   209             if (mLastKey && (HbInputButton::ButtonKeyCodeShift != mLastKey)) {
   196                 mInputMethod->updateState();
   210                 mInputMethod->updateState();
   197             }
   211             }
   198             refreshAutoCompleter();
       
   199         }
   212         }
   200 
   213 
   201         if (buttonId == HbInputButton::ButtonKeyCodeShift) {
   214         if (buttonId == HbInputButton::ButtonKeyCodeShift) {
   202             // single tap of shift key toggles prediction status in case insensitive languages
   215             // 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
   216             // The Editor should not be Web or URL which allows only Latin Alphabet