src/hbplugins/inputmethods/touchinput/virtualqwerty.cpp
changeset 7 923ff622b8b9
parent 6 c3690ec91ef8
child 21 4633027730f5
child 34 ed14f46c0e55
--- a/src/hbplugins/inputmethods/touchinput/virtualqwerty.cpp	Wed Jun 23 18:33:25 2010 +0300
+++ b/src/hbplugins/inputmethods/touchinput/virtualqwerty.cpp	Tue Jul 06 14:36:53 2010 +0300
@@ -277,6 +277,8 @@
 
     // assign new keypad to be opened to varable mCurrentKeypad
     mCurrentKeypad =  keypadToOpen;
+    activeKeyboardChanged(currentKeyboardType());
+
 
     if (mVkbHost && mVkbHost->keypadStatus() != HbVkbHost::HbVkbStatusOpened) {
         connect(mVkbHost, SIGNAL(keypadClosed()), this, SLOT(keypadClosed()));
@@ -342,9 +344,8 @@
 
 void HbVirtualQwerty::keypadClosed()
 {
-    if (mOrientationAboutToChange) {
-        mOrientationAboutToChange = false;
-    }
+    mOrientationAboutToChange = false;
+    
     if (mVkbHost->keypadStatus() == HbVkbHost::HbVkbStatusMinimized) {
         closeExactWordPopup();
     }	
@@ -360,7 +361,14 @@
             if (mCandidatePopup) {
                 mCandidatePopup->hide();
             }
-            mVkbHost->minimizeKeypad(!stateChangeInProgress());
+
+            // Close input.
+            QInputContext* ic = qApp->inputContext();
+            if (ic) {
+                QEvent *closeEvent = new QEvent(QEvent::CloseSoftwareInputPanel);
+                ic->filterEvent(closeEvent);
+                delete closeEvent;
+            }
         }
     }
 }
@@ -518,7 +526,7 @@
 void HbVirtualQwerty::selectSpecialCharacterTableMode()
 {
     mQwertyAlphaKeypad = constructKeyboard(EModeAbc);
-    mQwertyAlphaKeypad->showSmileyPicker(4, 10);
+    mQwertyAlphaKeypad->showSmileyPicker();
 }
 
 /*!
@@ -745,7 +753,19 @@
 QPointF HbVirtualQwerty::getCursorCoordinatePosition()
 {
     QRectF microRect = focusObject()->microFocus();
-    return microRect.topLeft();
+    QPointF cursorPos = microRect.topLeft();
+	
+    if (mVkbHost) {
+        QSizeF exactPopupSize = mExactWordPopup->size();
+        QRectF activeViewRect = mVkbHost->applicationArea();
+        // if the exact word doesnt fit inside the visible area, then show it on the right side of
+        // the current cursor position        
+        if (microRect.left() + exactPopupSize.width() > activeViewRect.width()) {
+            qreal startPos = microRect.left() - exactPopupSize.width();
+			cursorPos.setX((startPos > activeViewRect.left()) ? startPos : activeViewRect.left());
+		} 		
+    }
+    return cursorPos;
 }
 
 /*!