src/hbplugins/inputmethods/touchinput/virtual12key.cpp
changeset 6 c3690ec91ef8
parent 5 627c4a0fd0e7
child 7 923ff622b8b9
equal deleted inserted replaced
5:627c4a0fd0e7 6:c3690ec91ef8
    96             mBasicModeHandler, SLOT(filterEvent(const QKeyEvent *)));
    96             mBasicModeHandler, SLOT(filterEvent(const QKeyEvent *)));
    97     connect(mPredictionModeHandler, SIGNAL(passActionHandler(HbInputModeAction )),
    97     connect(mPredictionModeHandler, SIGNAL(passActionHandler(HbInputModeAction )),
    98             mBasicModeHandler, SLOT(actionHandler(HbInputModeAction )));
    98             mBasicModeHandler, SLOT(actionHandler(HbInputModeAction )));
    99 
    99 
   100     connect(HbInputSettingProxy::instance(), SIGNAL(predictiveInputStateChanged(HbKeyboardSettingFlags,bool)), this, SLOT(predictiveInputStateChanged(HbKeyboardSettingFlags,bool)));
   100     connect(HbInputSettingProxy::instance(), SIGNAL(predictiveInputStateChanged(HbKeyboardSettingFlags,bool)), this, SLOT(predictiveInputStateChanged(HbKeyboardSettingFlags,bool)));
       
   101     connect(HbInputSettingProxy::instance(), SIGNAL(autocompletionStateChanged(HbKeyboardSettingFlags,bool)), this, SLOT(autocompletionStateChanged(HbKeyboardSettingFlags,bool)));
       
   102     mPredictionModeHandler->setAutocompletionStatus(HbInputSettingProxy::instance()->isAutocompletionEnabled(HbKeyboardSetting12key));
   101 }
   103 }
   102 
   104 
   103 bool HbVirtual12Key::isSctModeActive() const
   105 bool HbVirtual12Key::isSctModeActive() const
   104 {
   106 {
   105     return (mCurrentKeypad == mSctKeypad);
   107     return (mCurrentKeypad == mSctKeypad);
   284 /*!
   286 /*!
   285 Opens the virtual keypad for input.
   287 Opens the virtual keypad for input.
   286 */
   288 */
   287 void HbVirtual12Key::openKeypad(HbInputVkbWidget * keypadToOpen,bool inMinimizedMode)
   289 void HbVirtual12Key::openKeypad(HbInputVkbWidget * keypadToOpen,bool inMinimizedMode)
   288 {
   290 {
       
   291     // if null is sent, just return.
       
   292     if(!keypadToOpen || !focusObject()) {
       
   293         return;
       
   294     }
       
   295 
   289     mKeyboardChangeAlreadyInprogress = true;
   296     mKeyboardChangeAlreadyInprogress = true;
   290     HbInputSettingProxy::instance()->setActiveKeyboard(HbKeyboardVirtual12Key);
   297     HbInputSettingProxy::instance()->setActiveKeyboard(HbKeyboardVirtual12Key);
   291     mKeyboardChangeAlreadyInprogress = false;
   298     mKeyboardChangeAlreadyInprogress = false;
   292 
   299 
   293     // if null is sent, just return.
       
   294     if(!keypadToOpen) {
       
   295         return;
       
   296     }
       
   297     bool disableAnimation = false;
   300     bool disableAnimation = false;
   298     // see if we are trying to open a different keypad than what is already opened.
   301     // see if we are trying to open a different keypad than what is already opened.
   299     if (mCurrentKeypad != keypadToOpen) {
   302     if (mCurrentKeypad != keypadToOpen) {
   300         // close currently open keypad. We always close keypad without animation
   303         // close currently open keypad. We always close keypad without animation
   301         // keypad should be closed with animation only when we loses focus and this is handled
   304         // keypad should be closed with animation only when we loses focus and this is handled
   327         if (inMinimizedMode) {
   330         if (inMinimizedMode) {
   328             mVkbHost->openMinimizedKeypad(mCurrentKeypad, this);
   331             mVkbHost->openMinimizedKeypad(mCurrentKeypad, this);
   329         } else {
   332         } else {
   330             mVkbHost->openKeypad(mCurrentKeypad, this, (!stateChangeInProgress() && !disableAnimation));
   333             mVkbHost->openKeypad(mCurrentKeypad, this, (!stateChangeInProgress() && !disableAnimation));
   331         }
   334         }
   332         connect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)),
   335         if (focusObject()) {
   333                 mVkbHost, SLOT(ensureCursorVisibility()));
   336             connect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)),
       
   337                     mVkbHost, SLOT(ensureCursorVisibility()));
       
   338         }
   334     }
   339     }
   335 }
   340 }
   336 
   341 
   337 /*!
   342 /*!
   338 vkb widget is about to call a custom action that is mapped to one of the keypad buttons.
   343 vkb widget is about to call a custom action that is mapped to one of the keypad buttons.
   363         HbInputFocusObject *focusedObject = focusObject();
   368         HbInputFocusObject *focusedObject = focusObject();
   364         if (focusedObject) {
   369         if (focusedObject) {
   365             // Just refresh the situation.
   370             // Just refresh the situation.
   366             inputStateActivated(inputState());
   371             inputStateActivated(inputState());
   367         }
   372         }
       
   373     }
       
   374 }
       
   375 
       
   376 void HbVirtual12Key::autocompletionStateChanged(HbKeyboardSettingFlags keyboardType, bool newState)
       
   377 {
       
   378     if (keyboardType & HbKeyboardSetting12key) {
       
   379         mPredictionModeHandler->setAutocompletionStatus(newState);
   368     }
   380     }
   369 }
   381 }
   370 
   382 
   371 /*!
   383 /*!
   372 Call back indicating that the keypad is closed.
   384 Call back indicating that the keypad is closed.
   510         }
   522         }
   511     }
   523     }
   512 
   524 
   513     HbInputModeHandler *previousModeHandler = mActiveModeHandler;
   525     HbInputModeHandler *previousModeHandler = mActiveModeHandler;
   514 	if (newState.inputMode() == HbInputModeDefault && usePrediction()) {
   526 	if (newState.inputMode() == HbInputModeDefault && usePrediction()) {
   515         mActiveModeHandler = mPredictionModeHandler;
   527         mActiveModeHandler = mPredictionModeHandler;        
   516         // by passing HbInputModeActionFocusRecieved we will be setting the candidate list and keypad
   528         // by passing HbInputModeActionFocusRecieved we will be setting the candidate list and keypad
   517         mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionFocusRecieved);
   529         mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionFocusRecieved);
   518     } else if (newState.inputMode() == HbInputModeDefault) {
   530     } else if (newState.inputMode() == HbInputModeDefault) {
   519         mActiveModeHandler = mBasicModeHandler;
   531         mActiveModeHandler = mBasicModeHandler;
   520         // Auto completer setup needs following line.
   532         // Auto completer setup needs following line.
   551 It first checks if we already have keymappings data of given language in mKeyData, if not then gets the
   563 It first checks if we already have keymappings data of given language in mKeyData, if not then gets the
   552 keymappings,loads them to all avaialble keyboards and to all mode handlers
   564 keymappings,loads them to all avaialble keyboards and to all mode handlers
   553 */
   565 */
   554 void HbVirtual12Key::loadKeymap(const HbInputLanguage &newLanguage)
   566 void HbVirtual12Key::loadKeymap(const HbInputLanguage &newLanguage)
   555 {
   567 {
   556     //dont try to get the keymappings if we ( mKeyData) already have keymappings for newLanguage
   568     //don't try to get the keymappings if we ( mKeyData) already have keymappings for newLanguage
   557     if (!mKeymap || mKeymap->language().language() != newLanguage.language()) {
   569     if (!mKeymap || mKeymap->language().language() != newLanguage.language()) {
   558         const HbKeymap* keymap = HbKeymapFactory::instance()->keymap(newLanguage);
   570         const HbKeymap* keymap = HbKeymapFactory::instance()->keymap(newLanguage);
   559         if(keymap) {
   571         if(keymap) {
   560             mKeymap = keymap;
   572             mKeymap = keymap;
   561             if (mItutKeypad) {
   573             if (mItutKeypad) {
   807     }
   819     }
   808 
   820 
   809     return false;
   821     return false;
   810 }
   822 }
   811 
   823 
   812 /*!
       
   813 This function returns true if the latest mouse release was part of a horizontal flick event
       
   814 */
       
   815 HbInputVkbWidget::HbFlickDirection HbVirtual12Key::flickDirection() const
       
   816 {
       
   817     if (mCurrentKeypad) {
       
   818         return mCurrentKeypad->flickDirection();
       
   819     } else {
       
   820         return HbInputVkbWidget::HbFlickDirectionNone;
       
   821     }
       
   822 }
       
   823 // End of file
   824 // End of file