src/hbplugins/inputmethods/touchinput/virtualqwerty.cpp
changeset 2 06ff229162e9
parent 1 f7ac710697a9
child 5 627c4a0fd0e7
equal deleted inserted replaced
1:f7ac710697a9 2:06ff229162e9
    22 ** Nokia at developer.feedback@nokia.com.
    22 ** Nokia at developer.feedback@nokia.com.
    23 **
    23 **
    24 ****************************************************************************/
    24 ****************************************************************************/
    25 #include "virtualqwerty.h"
    25 #include "virtualqwerty.h"
    26 #include <hbapplication.h>
    26 #include <hbapplication.h>
       
    27 #include <hbaction.h>
       
    28 #include <hbview.h>
       
    29 #include <hbmainwindow.h>
    27 #include <QLocale>
    30 #include <QLocale>
    28 
    31 
    29 #include <hbinputexactwordpopup.h>
    32 #include <hbinputexactwordpopup.h>
    30 #include <hbinputkeymapfactory.h>
    33 #include <hbinputkeymapfactory.h>
    31 #include <hbinputkeymap.h>
    34 #include <hbinputkeymap.h>
    32 #include <hbinputcandidatelist.h>
    35 #include <hbinputcandidatelist.h>
    33 #include <hbinputsettingproxy.h>
    36 #include <hbinputsettingproxy.h>
    34 #include <hbinpututils.h>
    37 #include <hbinpututils.h>
    35 #include <hbinputvirtualrocker.h>
    38 #include <hbinputvirtualrocker.h>
    36 #include <hbinputsctlandscape.h>
    39 #include <hbinputsctkeyboard.h>
    37 #include <hbinputqwertytouchkeyboard.h>
       
    38 #include <hbinputeditorinterface.h>
    40 #include <hbinputeditorinterface.h>
    39 #include <hbinputdef.h>
    41 #include <hbinputdef.h>
    40 #include <hbinputvkbhost.h>
    42 #include <hbinputvkbhost.h>
    41 #include <hbinputcommondialogs.h>
    43 #include <hbinputcommondialogs.h>
    42 
    44 #include <hbinputpredictionfactory.h>
    43 #include <hbmainwindow.h>
       
    44 
    45 
    45 #include "hbinputbasicqwertyhandler.h"
    46 #include "hbinputbasicqwertyhandler.h"
    46 #include "hbinputpredictionqwertyhandler.h"
    47 #include "hbinputpredictionqwertyhandler.h"
    47 #include "hbinputnumericqwertyhandler.h"
    48 #include "hbinputnumericqwertyhandler.h"
    48 #include <hbaction.h>
    49 #include "hbinputqwerty10x4touchkeyboard.h"
    49 #include <hbview.h>
    50 #include "hbinputqwerty11x4touchkeyboard.h"
    50 #include <hbinputpredictionfactory.h>
    51 #include "hbinputqwertynumerictouchkeyboard.h"
       
    52 
       
    53 const int HbVirtualQwerty4x10MaxKeysCount = 32;
    51 
    54 
    52 HbVirtualQwerty::HbVirtualQwerty() : mCurrentKeypad(0),
    55 HbVirtualQwerty::HbVirtualQwerty() : mCurrentKeypad(0),
    53                                      mQwertyAlphaKeypad(0),
    56                                      mQwertyAlphaKeypad(0),
       
    57                                      mQwerty10x4Keypad(0),
       
    58                                      mQwerty11x4Keypad(0),
    54                                      mQwertyNumericKeypad(0),
    59                                      mQwertyNumericKeypad(0),
    55                                      mSctKeypad(0),
    60                                      mSctKeypad(0),
    56                                      mKeymap(0),
    61                                      mKeymap(0),
    57                                      mExactWordPopup(0),
    62                                      mExactWordPopup(0),
    58                                      mCandidatePopup(0),
    63                                      mCandidatePopup(0),
    59                                      mOrientationAboutToChange(false),
    64                                      mOrientationAboutToChange(false),
    60                                      mSctMode(HbInputVkbWidget::HbSctViewSpecialCharacter),
       
    61                                      mShiftKeyState(0),
    65                                      mShiftKeyState(0),
    62                                      mVkbHost(0)
    66                                      mVkbHost(0)
    63 {
    67 {
    64     initializeModeHandlers();
    68     initializeModeHandlers();
    65 }
    69 }
    78     mPredictionModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionInit);
    82     mPredictionModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionInit);
    79     mNumericModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionInit);
    83     mNumericModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionInit);
    80 
    84 
    81     // autocompleter connection
    85     // autocompleter connection
    82     connect(this, SIGNAL(autoCompletionPopupClosed(QString, int)), mBasicModeHandler, SLOT(autoCompletionPopupClosed(QString, int)));
    86     connect(this, SIGNAL(autoCompletionPopupClosed(QString, int)), mBasicModeHandler, SLOT(autoCompletionPopupClosed(QString, int)));
       
    87 
       
    88     connect(HbInputSettingProxy::instance(), SIGNAL(predictiveInputStateChanged(HbKeyboardSettingFlags,bool)), this, SLOT(predictiveInputStateChanged(HbKeyboardSettingFlags,bool)));
    83 }
    89 }
    84 
    90 
    85 // ---------------------------------------------------------------------------
    91 // ---------------------------------------------------------------------------
    86 // HbVirtualQwerty::~HbVirtualQwerty
    92 // HbVirtualQwerty::~HbVirtualQwerty
    87 //
    93 //
    92     delete mCandidatePopup;
    98     delete mCandidatePopup;
    93     mCandidatePopup = 0;
    99     mCandidatePopup = 0;
    94 
   100 
    95     delete mQwertyAlphaKeypad;
   101     delete mQwertyAlphaKeypad;
    96     mQwertyAlphaKeypad = 0;
   102     mQwertyAlphaKeypad = 0;
       
   103 
       
   104     delete mQwerty10x4Keypad;
       
   105     delete mQwerty11x4Keypad;
    97 
   106 
    98     delete mQwertyNumericKeypad;
   107     delete mQwertyNumericKeypad;
    99     mQwertyNumericKeypad = 0;
   108     mQwertyNumericKeypad = 0;
   100 
   109 
   101     delete mSctKeypad;
   110     delete mSctKeypad;
   133     mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionReset);
   142     mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionReset);
   134 }
   143 }
   135 
   144 
   136 void HbVirtualQwerty::focusReceived()
   145 void HbVirtualQwerty::focusReceived()
   137 {
   146 {
       
   147     /* Update the text case */
       
   148     updateState();
   138     // set input mode to default ABC
   149     // set input mode to default ABC
   139     HbInputLanguage language = inputState().language();
   150     HbInputLanguage language = inputState().language();
   140     if ((!focusObject()->editorInterface().isNumericEditor() && inputState().inputMode() == HbInputModeNumeric) || !language.isCaseSensitiveLanguage()) {
   151     if ((!focusObject()->editorInterface().isNumericEditor() && inputState().inputMode() == HbInputModeNumeric) || !language.isCaseSensitiveLanguage()) {
   141         HbInputState state = inputState();
   152         HbInputState state = inputState();
   142         // For Case insensitive languages, the default case should be lowercase.
   153         // For Case insensitive languages, the default case should be lowercase.
   165     HbKeypadMode currentInputType = EModeAbc;
   176     HbKeypadMode currentInputType = EModeAbc;
   166     if (focusObject()->editorInterface().isNumericEditor()) {
   177     if (focusObject()->editorInterface().isNumericEditor()) {
   167         currentInputType = EModeNumeric;
   178         currentInputType = EModeNumeric;
   168     }
   179     }
   169 
   180 
   170     HbInputVkbWidget * keypadToOpen = 0;
   181     HbInputVkbWidget* keypadToOpen = 0;
   171     if (currentInputType == EModeAbc) {
   182     if (currentInputType == EModeAbc) {
   172         if(!mQwertyAlphaKeypad) {
   183         mQwertyAlphaKeypad = constructKeyboard(EModeAbc);
   173             mQwertyAlphaKeypad = constructKeypad(EModeAbc);
       
   174             connect(mQwertyAlphaKeypad, SIGNAL(smileySelected(QString)), this, SLOT(smileySelected(QString)));
       
   175             //FLICKDISABLED connect(mQwertyAlphaKeypad, SIGNAL(flickEvent(HbInputVkbWidget::FlickDirection)), this, SLOT(flickEvent(HbInputVkbWidget::FlickDirection)));
       
   176         }
       
   177         keypadToOpen = mQwertyAlphaKeypad;
   184         keypadToOpen = mQwertyAlphaKeypad;
   178     } else if(currentInputType == EModeNumeric) {
   185     } else if(currentInputType == EModeNumeric) {
   179         if(!mQwertyNumericKeypad) {
   186         if(!mQwertyNumericKeypad) {
   180             mQwertyNumericKeypad = constructKeypad(EModeNumeric);
   187             mQwertyNumericKeypad = static_cast<HbQwertyNumericKeyboard*>(constructKeyboard(EModeNumeric));
   181             mQwertyNumericKeypad->setBackgroundDrawing(true);
   188             mQwertyNumericKeypad->setBackgroundDrawing(true);
   182         }
   189         }
   183         keypadToOpen = mQwertyNumericKeypad;
   190         keypadToOpen = mQwertyNumericKeypad;
   184     }
   191     }
   185 
   192 
   188     }
   195     }
   189 
   196 
   190     // inform active mode handler about the focusrecieve event.
   197     // inform active mode handler about the focusrecieve event.
   191     mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionFocusRecieved);
   198     mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionFocusRecieved);
   192 
   199 
   193     // We need to check if this focusRecieved call is due to a orientation
   200     openKeypad(keypadToOpen);
   194     // switch. If yes we should get the keypad status prior to the orientation
       
   195     // switch and open the keypad in that state only.
       
   196     // For example we have minimized the keypad in Qwerty mode and change the
       
   197     // orientation to portrait then in Itu-T mode also keypad should be in minimized state.
       
   198     HbVkbHost *host = focusObject()->editorInterface().vkbHost();
       
   199     if (orientationContextSwitchInProgress()) {
       
   200         if (host) {
       
   201             // We can get the keypad status prior to the orientation switch from vkbHost it self.
       
   202             HbVkbHost::HbVkbStatus vkbStatus = host->keypadStatusBeforeOrientationChange();
       
   203             if (vkbStatus != HbVkbHost::HbVkbStatusClosed) {
       
   204                 openKeypad(keypadToOpen,vkbStatus == HbVkbHost::HbVkbStatusMinimized);
       
   205             }
       
   206         }
       
   207     } else {
       
   208         openKeypad(keypadToOpen);
       
   209     }
       
   210 
   201 
   211     if (mVkbHost) {
   202     if (mVkbHost) {
   212         connect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), mVkbHost, SLOT(ensureCursorVisibility()));
   203         connect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), mVkbHost, SLOT(ensureCursorVisibility()));
   213     }
   204     }
   214 
   205 
   296         }  */
   287         }  */
   297         connect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), mVkbHost, SLOT(ensureCursorVisibility()));
   288         connect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), mVkbHost, SLOT(ensureCursorVisibility()));
   298     }
   289     }
   299 }
   290 }
   300 
   291 
   301 HbQwertyKeyboard* HbVirtualQwerty::constructKeypad(HbKeypadMode currentInputType)
   292 HbInputVkbWidget* HbVirtualQwerty::constructKeyboard(HbKeypadMode currentInputType)
   302 {
   293 {
   303     HbQwertyKeyboard* keypad =  new HbQwertyKeyboard(this, mKeymap, 0, currentInputType);
   294     HbInputVkbWidget *keyboard = 0;
   304     connect(keypad, SIGNAL(keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod)),
   295     if (currentInputType == EModeAbc) {
       
   296         const HbKeyboardMap *keyboardMap = mKeymap->keyboard(HbKeyboardVirtualQwerty);
       
   297         if (keyboardMap && keyboardMap->keys.count() > HbVirtualQwerty4x10MaxKeysCount) {
       
   298             if (mQwerty11x4Keypad) {
       
   299                 return mQwerty11x4Keypad;
       
   300             }
       
   301             mQwerty11x4Keypad = new HbQwerty11x4Keyboard(this, mKeymap);
       
   302             keyboard = mQwerty11x4Keypad;
       
   303         } else {
       
   304             if (mQwerty10x4Keypad) {
       
   305                 return mQwerty10x4Keypad;
       
   306             }
       
   307             mQwerty10x4Keypad = new HbQwerty10x4Keyboard(this, mKeymap);
       
   308             keyboard = mQwerty10x4Keypad;
       
   309         }
       
   310         connect(keyboard, SIGNAL(smileySelected(QString)), this, SLOT(smileySelected(QString)));
       
   311         //FLICKDISABLED connect(keyboard, SIGNAL(flickEvent(HbInputVkbWidget::FlickDirection)), this, SLOT(flickEvent(HbInputVkbWidget::FlickDirection)));
       
   312     } else {
       
   313         keyboard = new HbQwertyNumericKeyboard(this, mKeymap);
       
   314     }    
       
   315     connect(keyboard, SIGNAL(keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod)),
   305         this, SLOT(keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod)));
   316         this, SLOT(keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod)));
   306     connect(keypad, SIGNAL(rockerDirection(int, HbInputVirtualRocker::RockerSelectionMode)),
   317     connect(keyboard, SIGNAL(rockerDirection(int, HbInputVirtualRocker::RockerSelectionMode)),
   307         this, SLOT(rockerDirection(int, HbInputVirtualRocker::RockerSelectionMode)));
   318         this, SLOT(rockerDirection(int, HbInputVirtualRocker::RockerSelectionMode)));
   308     connect(keypad, SIGNAL(mouseMovedOutOfButton()), this, SLOT(mouseMovedOutOfButton()));
   319     connect(keyboard, SIGNAL(mouseMovedOutOfButton()), this, SLOT(mouseMovedOutOfButton()));
   309     keypad->setRockerVisible(true);
   320     keyboard->setRockerVisible(true);
   310 
   321 
   311     return keypad;
   322     return keyboard;
   312 }
   323 }
   313 
   324 
   314 void HbVirtualQwerty::mouseHandler(int x, QMouseEvent* event)
   325 void HbVirtualQwerty::mouseHandler(int x, QMouseEvent* event)
   315 {
   326 {
   316     mActiveModeHandler->mouseHandler(x, event);
   327     mActiveModeHandler->mouseHandler(x, event);
   347     if (mCurrentKeypad){
   358     if (mCurrentKeypad){
   348         mCurrentKeypad->keypadLanguageChangeAnimationUpdate(0);
   359         mCurrentKeypad->keypadLanguageChangeAnimationUpdate(0);
   349     }
   360     }
   350     // load the new key keymappings for newLanguage to all keypads and all mode handlers
   361     // load the new key keymappings for newLanguage to all keypads and all mode handlers
   351     loadKeymap(aNewLanguage);
   362     loadKeymap(aNewLanguage);
       
   363 
       
   364     if (mCurrentKeypad && mCurrentKeypad != mQwertyAlphaKeypad
       
   365         && mCurrentKeypad != mQwertyNumericKeypad) {
       
   366         mCurrentKeypad->animKeyboardChange();
       
   367         openKeypad(mQwertyAlphaKeypad);
       
   368     }
       
   369 
   352     mPredictionModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionPrimaryLanguageChanged);
   370     mPredictionModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionPrimaryLanguageChanged);
   353     if (mCurrentKeypad){
   371     if (mCurrentKeypad){
   354         mCurrentKeypad->animKeyboardChange();
   372         mCurrentKeypad->animKeyboardChange();
   355     }
   373     }
   356 
   374 
   363         return;  // Just to be sure...
   381         return;  // Just to be sure...
   364     }
   382     }
   365 
   383 
   366     if (newState.inputMode() == HbInputModeNumeric && mQwertyNumericKeypad) {
   384     if (newState.inputMode() == HbInputModeNumeric && mQwertyNumericKeypad) {
   367         mQwertyNumericKeypad->setMode(EModeNumeric, HbModifierNone);
   385         mQwertyNumericKeypad->setMode(EModeNumeric, HbModifierNone);
   368     } else if(mQwertyAlphaKeypad) {
   386     } else if (mQwertyAlphaKeypad) {
   369         if (newState.textCase() == HbTextCaseUpper || newState.textCase() == HbTextCaseAutomatic) {
   387         if (newState.textCase() == HbTextCaseUpper || newState.textCase() == HbTextCaseAutomatic) {
   370             mQwertyAlphaKeypad->setMode(EModeAbc, HbModifierShiftPressed);
   388             mQwertyAlphaKeypad->setMode(EModeAbc, HbModifierShiftPressed);
   371         } else {
   389         } else {
   372             mQwertyAlphaKeypad->setMode(EModeAbc, HbModifierNone);
   390             mQwertyAlphaKeypad->setMode(EModeAbc, HbModifierNone);
   373         }
   391         }
   376     HbInputModeHandler *previousModeHandler = mActiveModeHandler;
   394     HbInputModeHandler *previousModeHandler = mActiveModeHandler;
   377     if (newState.inputMode() == HbInputModeNumeric) {
   395     if (newState.inputMode() == HbInputModeNumeric) {
   378         mActiveModeHandler = mNumericModeHandler;
   396         mActiveModeHandler = mNumericModeHandler;
   379     }  else if (newState.inputMode() == HbInputModeDefault && usePrediction()) {
   397     }  else if (newState.inputMode() == HbInputModeDefault && usePrediction()) {
   380         mActiveModeHandler = mPredictionModeHandler;
   398         mActiveModeHandler = mPredictionModeHandler;
   381         if (mQwertyAlphaKeypad) {
       
   382             mQwertyAlphaKeypad->disconnect(SIGNAL(charFromPreviewSelected(QString)));
       
   383             connect(mQwertyAlphaKeypad, SIGNAL(charFromPreviewSelected(QString)), mActiveModeHandler, SLOT(charFromPreviewSelected(QString)));
       
   384         }
       
   385     } else if (newState.inputMode() == HbInputModeDefault) {
   399     } else if (newState.inputMode() == HbInputModeDefault) {
   386         mActiveModeHandler = mBasicModeHandler;
   400         mActiveModeHandler = mBasicModeHandler;
   387         // Auto completer setup needs following line.
   401         // Auto completer setup needs following line.
   388         mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionFocusRecieved);
   402         mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionFocusRecieved);
   389         if (mQwertyAlphaKeypad) {
       
   390             mQwertyAlphaKeypad->disconnect(SIGNAL(charFromPreviewSelected(QString)));
       
   391             connect(mQwertyAlphaKeypad, SIGNAL(charFromPreviewSelected(QString)), mActiveModeHandler, SLOT(charFromPreviewSelected(QString)));
       
   392         }
       
   393     }
   403     }
   394 
   404 
   395     if (focusObject()) {
   405     if (focusObject()) {
   396         disconnect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), previousModeHandler, SLOT(cursorPositionChanged(int, int)));
   406         disconnect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), previousModeHandler, SLOT(cursorPositionChanged(int, int)));
   397         connect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), mActiveModeHandler, SLOT(cursorPositionChanged(int, int)));
   407         connect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), mActiveModeHandler, SLOT(cursorPositionChanged(int, int)));
   429             mKeymap =  keymap;
   439             mKeymap =  keymap;
   430             if (mQwertyNumericKeypad) {
   440             if (mQwertyNumericKeypad) {
   431                 mQwertyNumericKeypad->setKeymap(mKeymap);
   441                 mQwertyNumericKeypad->setKeymap(mKeymap);
   432             }
   442             }
   433 
   443 
   434             if (mQwertyAlphaKeypad) {
   444             mQwertyAlphaKeypad = constructKeyboard(EModeAbc);
   435                 mQwertyAlphaKeypad->setKeymap(mKeymap);
   445             mQwertyAlphaKeypad->setKeymap(mKeymap);
   436             }
       
   437 
   446 
   438             if (mSctKeypad) {
   447             if (mSctKeypad) {
   439                 mSctKeypad->setKeymap(mKeymap);
   448                 mSctKeypad->setKeymap(mKeymap);
   440             }
   449             }
   441 
   450 
   442             // inform mode handlers about the language change.
   451             // inform mode handlers about the language change.
   443             if(mBasicModeHandler) {
   452             if (mBasicModeHandler) {
   444                 mBasicModeHandler->setKeymap(mKeymap);
   453                 mBasicModeHandler->setKeymap(mKeymap);
   445             }
   454             }
   446             if(mPredictionModeHandler) {
   455             if (mPredictionModeHandler) {
   447                 mPredictionModeHandler->setKeymap(mKeymap);
   456                 mPredictionModeHandler->setKeymap(mKeymap);
   448             }
   457             }
   449             if(mNumericModeHandler) {
   458             if (mNumericModeHandler) {
   450                 mNumericModeHandler->setKeymap(mKeymap);
   459                 mNumericModeHandler->setKeymap(mKeymap);
   451             }
   460             }
   452         }
   461         }
   453     }
   462     }
   454 }
   463 }
   455 
   464 
   456 void HbVirtualQwerty::switchSpecialCharacterTable()
   465 void HbVirtualQwerty::switchSpecialCharacterTable()
   457 {
   466 {
   458     if (mCurrentKeypad != mSctKeypad) {
   467     if (mCurrentKeypad != mSctKeypad) {
   459         mSctMode = HbInputVkbWidget::HbSctViewSpecialCharacter;
       
   460         displaySpecialCharacterTable(this);
   468         displaySpecialCharacterTable(this);
   461     } else {
   469     } else {
   462         // we always go back to alpha qwerty mode after coming back from sct
   470         // we always go back to alpha qwerty mode after coming back from sct
   463         openKeypad(mQwertyAlphaKeypad);
   471         openKeypad(constructKeyboard(EModeAbc));
   464     }
   472     }
   465 }
   473 }
   466 
   474 
   467 void HbVirtualQwerty::secondaryInputLanguageChanged(const HbInputLanguage &newLanguage)
   475 void HbVirtualQwerty::secondaryInputLanguageChanged(const HbInputLanguage &newLanguage)
   468 {
   476 {
   473 int HbVirtualQwerty::displaySpecialCharacterTable(QObject* aReceiver)
   481 int HbVirtualQwerty::displaySpecialCharacterTable(QObject* aReceiver)
   474 {
   482 {
   475     Q_UNUSED(aReceiver);
   483     Q_UNUSED(aReceiver);
   476 
   484 
   477     if (!mSctKeypad) {
   485     if (!mSctKeypad) {
   478         mSctKeypad = new HbInputSctLandscape(this, mKeymap);
   486         mSctKeypad = new HbSctKeyboard(this, mKeymap);
   479         connect(mSctKeypad, SIGNAL(sctCharacterSelected(QString)), this, SLOT(sctCharacterSelected(QString)));
       
   480         connect(mSctKeypad, SIGNAL(smileySelected(QString)), this, SLOT(smileySelected(QString)));
   487         connect(mSctKeypad, SIGNAL(smileySelected(QString)), this, SLOT(smileySelected(QString)));
   481         connect(mSctKeypad, SIGNAL(keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod)), this, SLOT(keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod)));
   488         connect(mSctKeypad, SIGNAL(keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod)), this, SLOT(keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod)));
   482         connect(mSctKeypad, SIGNAL(rockerDirection(int, HbInputVirtualRocker::RockerSelectionMode)),
   489         connect(mSctKeypad, SIGNAL(rockerDirection(int, HbInputVirtualRocker::RockerSelectionMode)),
   483             this, SLOT(rockerDirection(int, HbInputVirtualRocker::RockerSelectionMode)));
   490             this, SLOT(rockerDirection(int, HbInputVirtualRocker::RockerSelectionMode)));
   484         mSctKeypad->setRockerVisible(true);
   491         mSctKeypad->setRockerVisible(true);
   485     }
   492     }
   486 
   493     mSctKeypad->setMode(EModeAbc, HbModifierNone);
   487     // set up sct!
       
   488     mSctKeypad->setSct(mSctMode);
       
   489     //open the keypad
   494     //open the keypad
   490     openKeypad(mSctKeypad);
   495     openKeypad(mSctKeypad);
   491 
   496 
   492     return 0;
   497     return 0;
   493 }
   498 }
   494 
   499 
   495 /*!
       
   496 Call-back implementation to indicate that a character was selected from the SCT. With this, the character is committed to the
       
   497 editor and editor is again made to focus.
       
   498 */
       
   499 void HbVirtualQwerty::sctCharacterSelected(QString character)
       
   500 {
       
   501     mActiveModeHandler->sctCharacterSelected(character);
       
   502     /* Update the text case */
       
   503     updateState();
       
   504 }
       
   505 void HbVirtualQwerty::smileySelected(QString smiley)
   500 void HbVirtualQwerty::smileySelected(QString smiley)
   506 {
   501 {
   507      mActiveModeHandler->smileySelected(smiley);
   502      mActiveModeHandler->smileySelected(smiley);
   508 }
   503 }
   509 
   504 
   510 void HbVirtualQwerty::selectSpecialCharacterTableMode()
   505 void HbVirtualQwerty::selectSpecialCharacterTableMode()
   511 {
   506 {
   512     if (mQwertyAlphaKeypad) {
   507     mQwertyAlphaKeypad = constructKeyboard(EModeAbc);
   513         mQwertyAlphaKeypad->showSmileyPicker(4, 10);
   508     mQwertyAlphaKeypad->showSmileyPicker(4, 10);
   514     }
       
   515 }
   509 }
   516 
   510 
   517 /*!
   511 /*!
   518 Slot used by mode handlers to close the autocompletion popup.
   512 Slot used by mode handlers to close the autocompletion popup.
   519 */
   513 */
   530 void HbVirtualQwerty::launchAutoCompletionPopup(const QStringList& candidates)
   524 void HbVirtualQwerty::launchAutoCompletionPopup(const QStringList& candidates)
   531 {
   525 {
   532     if (!mCandidatePopup) {
   526     if (!mCandidatePopup) {
   533         mCandidatePopup = new HbCandidateList(this);
   527         mCandidatePopup = new HbCandidateList(this);
   534         connect(mCandidatePopup, SIGNAL(candidatePopupCancelled()), this, SLOT(candidatePopupCancelled()));
   528         connect(mCandidatePopup, SIGNAL(candidatePopupCancelled()), this, SLOT(candidatePopupCancelled()));
       
   529         connect(mCandidatePopup, SIGNAL(candidateSelected(int,const QString&)), this, SLOT(candidatePopupClosed(int, const QString&)));
   535     }
   530     }
   536 
   531 
   537     if (candidates.count() > 0) {
   532     if (candidates.count() > 0) {
   538         mCandidatePopup->populateList(candidates);
   533         mCandidatePopup->populateList(candidates);
   539         mCandidatePopup->setModal(false);
   534         mCandidatePopup->setModal(false);
   544             mCandidatePopup->show();
   539             mCandidatePopup->show();
   545         }
   540         }
   546     } else if (mCandidatePopup->isVisible()) {
   541     } else if (mCandidatePopup->isVisible()) {
   547         mCandidatePopup->hide();
   542         mCandidatePopup->hide();
   548     }
   543     }
       
   544 }
       
   545 
       
   546 HbKeyboardType HbVirtualQwerty::currentKeyboardType() const
       
   547 {
       
   548     HbKeyboardType type = HbKeyboardNone;
       
   549     if (mCurrentKeypad) {
       
   550         type = mCurrentKeypad->keyboardType();
       
   551     }
       
   552     return type;
   549 }
   553 }
   550 
   554 
   551 /*!
   555 /*!
   552 Launches the candidate list.
   556 Launches the candidate list.
   553 */
   557 */
   563     //before launching candidate popup, close exact word popup if visible.
   567     //before launching candidate popup, close exact word popup if visible.
   564     closeExactWordPopup();
   568     closeExactWordPopup();
   565     if (!mCandidatePopup) {
   569     if (!mCandidatePopup) {
   566         mCandidatePopup = new HbCandidateList(this);
   570         mCandidatePopup = new HbCandidateList(this);
   567         connect(mCandidatePopup, SIGNAL(candidatePopupCancelled()), this, SLOT(candidatePopupCancelled()));
   571         connect(mCandidatePopup, SIGNAL(candidatePopupCancelled()), this, SLOT(candidatePopupCancelled()));
       
   572         connect(mCandidatePopup, SIGNAL(candidateSelected(int,const QString&)), this, SLOT(candidatePopupClosed(int, const QString&)));
   568     }
   573     }
   569     mCandidatePopup->populateList(candidates);
   574     mCandidatePopup->populateList(candidates);
   570     mCandidatePopup->setModal(true);
   575     mCandidatePopup->setModal(true);
   571 
   576 
   572     QSizeF candListSize = mCandidatePopup->size();
   577     QSizeF candListSize = mCandidatePopup->size();
   584 }
   589 }
   585 
   590 
   586 /*!
   591 /*!
   587 Commits the candidate upon closing of the candidate list.
   592 Commits the candidate upon closing of the candidate list.
   588 */
   593 */
   589 void HbVirtualQwerty::candidatePopupClosed(int closingKey)
   594 void HbVirtualQwerty::candidatePopupClosed(int closingKey, const QString& candidate)
   590 {
   595 {       
   591     if (mCandidatePopup) {
   596     if (candidate.size() > 0) {
   592         QString currentCandidate = mCandidatePopup->currentCandidate();
   597         if ((focusObject()->editorInterface().inputConstraints() & HbEditorConstraintAutoCompletingField)) {
   593         if (currentCandidate.size() > 0) {
   598             emit autoCompletionPopupClosed(candidate, closingKey);
   594             if ((focusObject()->editorInterface().constraints() & HbEditorConstraintAutoCompletingField)) {
   599         } else {
   595                 emit autoCompletionPopupClosed(currentCandidate, closingKey);
   600             mPredictionModeHandler->candidatePopupClosed(candidate, closingKey);
   596             } else {
       
   597             mPredictionModeHandler->candidatePopupClosed(currentCandidate, closingKey);
       
   598             }
       
   599         }
   601         }
   600     }
   602     }
   601 }
   603 }
   602 
   604 
   603 /*!
   605 /*!
   612         mOrientationAboutToChange = true;
   614         mOrientationAboutToChange = true;
   613         // We need to commit the inline word before orientation change.
   615         // We need to commit the inline word before orientation change.
   614         mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionCommit);
   616         mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionCommit);
   615         closeKeypad();
   617         closeKeypad();
   616     }
   618     }
   617 }
       
   618 
       
   619 /*!
       
   620 This function is called during a long key press
       
   621 for a long time.
       
   622 */
       
   623 void HbVirtualQwerty::launchCharacterPreviewPane(int key)
       
   624 {
       
   625     // In alpha keyboard, when the keypad is closed by
       
   626     // dragging it, long key press event is generated.
       
   627     // Character preview must not be shown in this case.
       
   628     if (mVkbHost && mVkbHost->keypadStatus() != HbVkbHost::HbVkbStatusOpened) {
       
   629         return;
       
   630     }
       
   631 
       
   632     // get the characters bound to the key.
       
   633     QStringList spellList;
       
   634     mActiveModeHandler->getAndFilterCharactersBoundToKey(spellList, static_cast<Qt::Key>(key));
       
   635 
       
   636     bool previewAvailable = false;
       
   637     if (spellList.size()) {
       
   638         // preview pane should show the correct case.
       
   639         int currentTextCase = focusObject()->editorInterface().textCase();
       
   640         for(int i = 0; i < spellList.size(); i++) {
       
   641             if (currentTextCase == HbTextCaseLower) {
       
   642                 spellList[i] = spellList.at(i).toLower();
       
   643             } else {
       
   644                 spellList[i] = spellList.at(i).toUpper();
       
   645             }
       
   646         }
       
   647         previewAvailable = mQwertyAlphaKeypad->previewCharacters(spellList);
       
   648     }
       
   649     mActiveModeHandler->characterPreviewAvailable(previewAvailable);
       
   650 }
   619 }
   651 
   620 
   652 /*!
   621 /*!
   653 Slot used by virtual rocker to move cursor.
   622 Slot used by virtual rocker to move cursor.
   654 */
   623 */
   688         }
   657         }
   689         break;
   658         break;
   690     default:
   659     default:
   691         break;
   660         break;
   692     }
   661     }
   693 }
       
   694 
       
   695 /*!
       
   696 \deprecated HbVirtualQwerty::predictiveInputStatusChanged(int newStatus)
       
   697     is deprecated. Use predictiveInputStateChanged instead.
       
   698 */
       
   699 void HbVirtualQwerty::predictiveInputStatusChanged(int newStatus)
       
   700 {
       
   701     predictiveInputStateChanged(HbKeyboardSettingQwerty, newStatus);
       
   702 }
   662 }
   703 
   663 
   704 /*!
   664 /*!
   705 The framework calls this method when the predictive input status changes.
   665 The framework calls this method when the predictive input status changes.
   706 */
   666 */