src/hbcore/inputfw/hbinputcontextproxy.cpp
changeset 6 c3690ec91ef8
parent 5 627c4a0fd0e7
child 7 923ff622b8b9
--- a/src/hbcore/inputfw/hbinputcontextproxy.cpp	Fri Jun 11 13:58:22 2010 +0300
+++ b/src/hbcore/inputfw/hbinputcontextproxy.cpp	Wed Jun 23 18:33:25 2010 +0300
@@ -29,6 +29,7 @@
 #include <QGraphicsProxyWidget>
 #include <QGraphicsView>
 #include <hbinputmethod.h>
+#include <hbinputsettingproxy.h>
 
 /*!
 @alpha
@@ -50,7 +51,7 @@
 \sa HbInputMethod
 */
 
-HbInputContextProxy::HbInputContextProxy(HbInputMethod* target) : mTarget(target)
+HbInputContextProxy::HbInputContextProxy(HbInputMethod *target) : mTarget(target)
 {
 }
 
@@ -68,7 +69,7 @@
         return mTarget->actions();
     }
 
-    return QList<QAction*>();
+    return QList<QAction *>();
 }
 
 /*!
@@ -93,10 +94,10 @@
 */
 void HbInputContextProxy::setInputFrameworkFocus(QObject *widget)
 {
-    if(mTarget) {
-        if(!widget) {
+    if (mTarget) {
+        if (!widget) {
             mTarget->setFocusObject(0);
-        } else if (HbInputFocusObject::isEditor(widget) && !HbInputFocusObject::isReadOnlyWidget(widget)) {           
+        } else if (HbInputFocusObject::isEditor(widget) && !HbInputFocusObject::isReadOnlyWidget(widget)) {
             mTarget->setFocusObject(new HbInputFocusObject(widget));
         }
     }
@@ -106,25 +107,26 @@
 \internal
 \reimp
 */
-bool HbInputContextProxy::filterEvent(const QEvent* event)
+bool HbInputContextProxy::filterEvent(const QEvent *event)
 {
     if (mTarget) {
 #if QT_VERSION >= 0x040600
-        if (event->type() == QEvent::CloseSoftwareInputPanel) {
+        bool orientationCompleted = HbInputSettingProxy::instance()->orientationChangeCompleted();
+        if (event->type() == QEvent::CloseSoftwareInputPanel && orientationCompleted) {
             setInputFrameworkFocus(0);
-            return true;            
-        } else if (event->type() == QEvent::RequestSoftwareInputPanel) {           
-            if(QWidget * focusedWidget =  qApp->focusWidget()) {
+            return true;
+        } else if (event->type() == QEvent::RequestSoftwareInputPanel && orientationCompleted) {           
+            if (QWidget *focusedWidget =  qApp->focusWidget()) {
                 // see if the focused widget is graphics view, if so get the focused graphics item in the view
                 // and acivate inputmethod for the focused graphics item
-                if (QGraphicsView * graphicsView = qobject_cast<QGraphicsView*>(focusedWidget)) {
-                    if (QGraphicsScene * scene = graphicsView->scene()) {
-                        if (QGraphicsItem * fItem = scene->focusItem()) {
+                if (QGraphicsView *graphicsView = qobject_cast<QGraphicsView *>(focusedWidget)) {
+                    if (QGraphicsScene *scene = graphicsView->scene()) {
+                        if (QGraphicsItem *fItem = scene->focusItem()) {
                             QGraphicsProxyWidget *proxy  = qgraphicsitem_cast<QGraphicsProxyWidget *>(fItem);
-                            if (proxy) {    
+                            if (proxy) {
                                 setInputFrameworkFocus(proxy->widget()->focusWidget());
                             } else {
-                                setInputFrameworkFocus(static_cast<QGraphicsWidget*>(fItem));
+                                setInputFrameworkFocus(static_cast<QGraphicsWidget *>(fItem));
                             }
                         }
                     }
@@ -142,7 +144,7 @@
         const quint32 HbInputContextProxyExternalKeyboardModifier = 0x00200000;
 
         if (event->type() == QEvent::QEvent::KeyPress || event->type() == QEvent::KeyRelease) {
-            const QKeyEvent *keyEvent = static_cast<const QKeyEvent*>(event);
+            const QKeyEvent *keyEvent = static_cast<const QKeyEvent *>(event);
             if (keyEvent->nativeModifiers() & HbInputContextProxyExternalKeyboardModifier) {
                 // Operating system indicates that the event originated from an external keyboard.
                 // We let it pass here untouched.
@@ -150,19 +152,19 @@
                     mTarget->reset();
                 }
                 return false;
-			}
-		} 
+            }
+        }
 #endif
-		if(event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {
-			const QKeyEvent *keyEvent = static_cast<const QKeyEvent *>(event);
-			if (Qt::Key_unknown == keyEvent->key()) {
-				return false;
-			}
-		}
-		return mTarget->filterEvent(event);
-	}
+        if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {
+            const QKeyEvent *keyEvent = static_cast<const QKeyEvent *>(event);
+            if (Qt::Key_unknown == keyEvent->key()) {
+                return false;
+            }
+        }
+        return mTarget->filterEvent(event);
+    }
 
-	return false;
+    return false;
 }
 
 /*!
@@ -209,7 +211,7 @@
 \reimp
 */
 QString HbInputContextProxy::language()
-{   
+{
     if (mTarget) {
         return mTarget->language();
     }
@@ -221,7 +223,7 @@
 \internal
 \reimp
 */
-void HbInputContextProxy::mouseHandler(int x, QMouseEvent* event)
+void HbInputContextProxy::mouseHandler(int x, QMouseEvent *event)
 {
     if (mTarget) {
         mTarget->mouseHandler(x, event);
@@ -243,7 +245,7 @@
 \internal
 \reimp
 */
-void HbInputContextProxy::sendEvent(const QInputMethodEvent& event)
+void HbInputContextProxy::sendEvent(const QInputMethodEvent &event)
 {
     if (mTarget) {
         mTarget->sendEvent(event);
@@ -265,7 +267,7 @@
 \internal
 \reimp
 */
-void HbInputContextProxy::widgetDestroyed(QWidget* widget)
+void HbInputContextProxy::widgetDestroyed(QWidget *widget)
 {
     if (mTarget) {
         mTarget->widgetDestroyed(widget);
@@ -276,7 +278,7 @@
 \internal
 \reimp
 */
-void HbInputContextProxy::setFocusWidget(QWidget* widget)
+void HbInputContextProxy::setFocusWidget(QWidget *widget)
 {
     if (mTarget) {
         mTarget->setFocusWidget(widget);