src/hbcore/inputfw/hbinputcontextproxy.cpp
changeset 7 923ff622b8b9
parent 6 c3690ec91ef8
child 21 4633027730f5
child 34 ed14f46c0e55
equal deleted inserted replaced
6:c3690ec91ef8 7:923ff622b8b9
    96 {
    96 {
    97     if (mTarget) {
    97     if (mTarget) {
    98         if (!widget) {
    98         if (!widget) {
    99             mTarget->setFocusObject(0);
    99             mTarget->setFocusObject(0);
   100         } else if (HbInputFocusObject::isEditor(widget) && !HbInputFocusObject::isReadOnlyWidget(widget)) {
   100         } else if (HbInputFocusObject::isEditor(widget) && !HbInputFocusObject::isReadOnlyWidget(widget)) {
       
   101             if (mTarget->focusObject() && mTarget->focusObject()->object() == widget) {
       
   102                 // Already focused to given widget.                 
       
   103                 return;
       
   104             } 
   101             mTarget->setFocusObject(new HbInputFocusObject(widget));
   105             mTarget->setFocusObject(new HbInputFocusObject(widget));
   102         }
   106         }
   103     }
   107     }
   104 }
   108 }
   105 
   109 
   108 \reimp
   112 \reimp
   109 */
   113 */
   110 bool HbInputContextProxy::filterEvent(const QEvent *event)
   114 bool HbInputContextProxy::filterEvent(const QEvent *event)
   111 {
   115 {
   112     if (mTarget) {
   116     if (mTarget) {
   113 #if QT_VERSION >= 0x040600
       
   114         bool orientationCompleted = HbInputSettingProxy::instance()->orientationChangeCompleted();
   117         bool orientationCompleted = HbInputSettingProxy::instance()->orientationChangeCompleted();
   115         if (event->type() == QEvent::CloseSoftwareInputPanel && orientationCompleted) {
   118         if (event->type() == QEvent::CloseSoftwareInputPanel && orientationCompleted) {
   116             setInputFrameworkFocus(0);
   119             setInputFrameworkFocus(0);
   117             return true;
   120             return true;
   118         } else if (event->type() == QEvent::RequestSoftwareInputPanel && orientationCompleted) {           
   121         } else if (event->type() == QEvent::RequestSoftwareInputPanel && orientationCompleted) {
   119             if (QWidget *focusedWidget =  qApp->focusWidget()) {
   122             if (QWidget *focusedWidget =  qApp->focusWidget()) {
   120                 // see if the focused widget is graphics view, if so get the focused graphics item in the view
   123                 // see if the focused widget is graphics view, if so get the focused graphics item in the view
   121                 // and acivate inputmethod for the focused graphics item
   124                 // and acivate inputmethod for the focused graphics item
   122                 if (QGraphicsView *graphicsView = qobject_cast<QGraphicsView *>(focusedWidget)) {
   125                 if (QGraphicsView *graphicsView = qobject_cast<QGraphicsView *>(focusedWidget)) {
   123                     if (QGraphicsScene *scene = graphicsView->scene()) {
   126                     if (QGraphicsScene *scene = graphicsView->scene()) {
   136                     setInputFrameworkFocus(focusedWidget);
   139                     setInputFrameworkFocus(focusedWidget);
   137                 }
   140                 }
   138             }
   141             }
   139             return true;
   142             return true;
   140         }
   143         }
   141 #endif
       
   142 
   144 
   143 #ifdef Q_OS_SYMBIAN
   145 #ifdef Q_OS_SYMBIAN
   144         const quint32 HbInputContextProxyExternalKeyboardModifier = 0x00200000;
   146         const quint32 HbInputContextProxyExternalKeyboardModifier = 0x00200000;
   145 
   147 
   146         if (event->type() == QEvent::QEvent::KeyPress || event->type() == QEvent::KeyRelease) {
   148         if (event->type() == QEvent::QEvent::KeyPress || event->type() == QEvent::KeyRelease) {