src/hbplugins/inputmethods/touchinput/virtualqwerty.cpp
changeset 7 923ff622b8b9
parent 6 c3690ec91ef8
child 21 4633027730f5
child 34 ed14f46c0e55
equal deleted inserted replaced
6:c3690ec91ef8 7:923ff622b8b9
   275     QObject::connect(keypadToOpen,SIGNAL(aboutToActivateCustomAction(HbAction*)),
   275     QObject::connect(keypadToOpen,SIGNAL(aboutToActivateCustomAction(HbAction*)),
   276         this,SLOT(aboutToActivateCustomAction(HbAction*)));
   276         this,SLOT(aboutToActivateCustomAction(HbAction*)));
   277 
   277 
   278     // assign new keypad to be opened to varable mCurrentKeypad
   278     // assign new keypad to be opened to varable mCurrentKeypad
   279     mCurrentKeypad =  keypadToOpen;
   279     mCurrentKeypad =  keypadToOpen;
       
   280     activeKeyboardChanged(currentKeyboardType());
       
   281 
   280 
   282 
   281     if (mVkbHost && mVkbHost->keypadStatus() != HbVkbHost::HbVkbStatusOpened) {
   283     if (mVkbHost && mVkbHost->keypadStatus() != HbVkbHost::HbVkbStatusOpened) {
   282         connect(mVkbHost, SIGNAL(keypadClosed()), this, SLOT(keypadClosed()));
   284         connect(mVkbHost, SIGNAL(keypadClosed()), this, SLOT(keypadClosed()));
   283         if (inMinimizedMode) {
   285         if (inMinimizedMode) {
   284             mVkbHost->openMinimizedKeypad(mCurrentKeypad, this);
   286             mVkbHost->openMinimizedKeypad(mCurrentKeypad, this);
   340     mActiveModeHandler->mouseHandler(x, event);
   342     mActiveModeHandler->mouseHandler(x, event);
   341 }
   343 }
   342 
   344 
   343 void HbVirtualQwerty::keypadClosed()
   345 void HbVirtualQwerty::keypadClosed()
   344 {
   346 {
   345     if (mOrientationAboutToChange) {
   347     mOrientationAboutToChange = false;
   346         mOrientationAboutToChange = false;
   348     
   347     }
       
   348     if (mVkbHost->keypadStatus() == HbVkbHost::HbVkbStatusMinimized) {
   349     if (mVkbHost->keypadStatus() == HbVkbHost::HbVkbStatusMinimized) {
   349         closeExactWordPopup();
   350         closeExactWordPopup();
   350     }	
   351     }	
   351 }
   352 }
   352 
   353 
   358             // We need to commit the inline word when we minimize the keypad
   359             // We need to commit the inline word when we minimize the keypad
   359             mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionCommit);
   360             mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionCommit);
   360             if (mCandidatePopup) {
   361             if (mCandidatePopup) {
   361                 mCandidatePopup->hide();
   362                 mCandidatePopup->hide();
   362             }
   363             }
   363             mVkbHost->minimizeKeypad(!stateChangeInProgress());
   364 
       
   365             // Close input.
       
   366             QInputContext* ic = qApp->inputContext();
       
   367             if (ic) {
       
   368                 QEvent *closeEvent = new QEvent(QEvent::CloseSoftwareInputPanel);
       
   369                 ic->filterEvent(closeEvent);
       
   370                 delete closeEvent;
       
   371             }
   364         }
   372         }
   365     }
   373     }
   366 }
   374 }
   367 
   375 
   368 void HbVirtualQwerty::inputLanguageChanged(const HbInputLanguage &aNewLanguage)
   376 void HbVirtualQwerty::inputLanguageChanged(const HbInputLanguage &aNewLanguage)
   516 }
   524 }
   517 
   525 
   518 void HbVirtualQwerty::selectSpecialCharacterTableMode()
   526 void HbVirtualQwerty::selectSpecialCharacterTableMode()
   519 {
   527 {
   520     mQwertyAlphaKeypad = constructKeyboard(EModeAbc);
   528     mQwertyAlphaKeypad = constructKeyboard(EModeAbc);
   521     mQwertyAlphaKeypad->showSmileyPicker(4, 10);
   529     mQwertyAlphaKeypad->showSmileyPicker();
   522 }
   530 }
   523 
   531 
   524 /*!
   532 /*!
   525 Slot used by mode handlers to close the autocompletion popup.
   533 Slot used by mode handlers to close the autocompletion popup.
   526 */
   534 */
   743 }
   751 }
   744 
   752 
   745 QPointF HbVirtualQwerty::getCursorCoordinatePosition()
   753 QPointF HbVirtualQwerty::getCursorCoordinatePosition()
   746 {
   754 {
   747     QRectF microRect = focusObject()->microFocus();
   755     QRectF microRect = focusObject()->microFocus();
   748     return microRect.topLeft();
   756     QPointF cursorPos = microRect.topLeft();
       
   757 	
       
   758     if (mVkbHost) {
       
   759         QSizeF exactPopupSize = mExactWordPopup->size();
       
   760         QRectF activeViewRect = mVkbHost->applicationArea();
       
   761         // if the exact word doesnt fit inside the visible area, then show it on the right side of
       
   762         // the current cursor position        
       
   763         if (microRect.left() + exactPopupSize.width() > activeViewRect.width()) {
       
   764             qreal startPos = microRect.left() - exactPopupSize.width();
       
   765 			cursorPos.setX((startPos > activeViewRect.left()) ? startPos : activeViewRect.left());
       
   766 		} 		
       
   767     }
       
   768     return cursorPos;
   749 }
   769 }
   750 
   770 
   751 /*!
   771 /*!
   752 Returns true if prediction is on, prediction engine is available and predictions is allowed in current editor.
   772 Returns true if prediction is on, prediction engine is available and predictions is allowed in current editor.
   753 */
   773 */