diff -r 896e9dbc5f19 -r 065198191975 qtinternetradio/ui/src/iropenwebaddressview.cpp --- a/qtinternetradio/ui/src/iropenwebaddressview.cpp Wed Aug 18 09:40:26 2010 +0300 +++ b/qtinternetradio/ui/src/iropenwebaddressview.cpp Thu Sep 02 20:17:46 2010 +0300 @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include "irviewmanager.h" #include "irapplication.h" @@ -49,10 +51,6 @@ iNameEditorPtr(NULL), iPlayButton(NULL) { - //this view won't be starting view, don't need lazy init - IRBaseView::lazyInit(); - setInitCompleted(true); - // Listen to the orientation change event connect( getViewManager(), SIGNAL( orientationChanged(Qt::Orientation) ), this, SLOT( handleOrientationChanged(Qt::Orientation) ) ); @@ -75,6 +73,7 @@ initDataForm(); initDetails(); iForm->setModel(iModel); + iForm->installEventFilter(this); initMenu(); // get a new instance different from the base class. Because it's used in destructor and @@ -96,7 +95,6 @@ HbDataFormViewItem* dataformviewitemUrl = static_cast(viewItemUrl); HbWidget *widgetUrl = dataformviewitemUrl->dataItemContentWidget(); iUrlEditorPtr = static_cast(widgetUrl); - iUrlEditorPtr->installEventFilter(this); // Find the play button objects iPlayButton = qobject_cast(iLoader.findObject(OPEN_WEB_ADDRESS_VIEW_OBJECT_PLAY_BUTTON)); @@ -109,6 +107,8 @@ // TODO: te be deleted if there's no difference between the landscape and portrait. // handleOrientationChanged(getViewManager()->orientation()); + + grabGesture(Qt::TapGesture); } IROpenWebAddressView::~IROpenWebAddressView() @@ -403,10 +403,11 @@ iName->setContentWidgetData(QString("text"), QString("")); } } - else if( (object == iUrlEditorPtr || object == iNameEditorPtr) - && event->type() == QEvent::FocusOut ) + else if( object == iForm && + event->type() == QEvent::GestureOverride) { - hideVkb(); + QGestureEvent *e = static_cast(event); + gestureEvent(e); } return false; @@ -421,3 +422,26 @@ delete event; } } + +void IROpenWebAddressView::gestureEvent(QGestureEvent *aEvent) +{ + HbTapGesture *tapGesture = qobject_cast(aEvent->gesture(Qt::TapGesture)); + if (!tapGesture) + { + return; + } + + if (Qt::GestureStarted == tapGesture->state()) + { + QPointF tapScenePoint = tapGesture->scenePosition(); + QPointF tapLocalPointUrl = iUrlEditorPtr->sceneTransform().inverted().map(tapScenePoint); + QPointF tapLocalPointName = iNameEditorPtr->sceneTransform().inverted().map(tapScenePoint); + + if (!iUrlEditorPtr->contains(tapLocalPointUrl) && + !iNameEditorPtr->contains(tapLocalPointName) && + HbVkbHost::HbVkbStatusOpened == HbVkbHostBridge::instance()->keypadStatus()) + { + hideVkb(); + } + } +}