src/hbwidgets/widgets/hbcombodropdown_p.cpp
changeset 28 b7da29130b0e
parent 21 4633027730f5
child 30 80e4d18b72f5
--- a/src/hbwidgets/widgets/hbcombodropdown_p.cpp	Thu Sep 02 20:44:51 2010 +0300
+++ b/src/hbwidgets/widgets/hbcombodropdown_p.cpp	Fri Sep 17 08:32:10 2010 +0300
@@ -61,7 +61,6 @@
 void HbComboDropDown::createList( )
 {
    mList = new HbListView( this );
-   mList->setLongPressEnabled( false );
    HbComboListViewItem *protoType = new HbComboListViewItem( this );
    mList->setItemPrototype( protoType );
    HbStyle::setItemName( mList, "list" );
@@ -89,44 +88,6 @@
     if ( isVisible( ) ) {
         switch( event->type( ) )
         {
-        case QEvent::GraphicsSceneMousePress:
-        case QEvent::GraphicsSceneMouseDoubleClick:
-            {
-                if( !vkbOpened ) {
-                    //if vkb is not opened and dropdown is not clicked then dismiss drop down
-                    if( !( this->isUnderMouse( ) ) ) {
-                        HbWidgetFeedback::triggered( this, Hb::InstantPopupClosed );
-                        setVisible( false );
-                        comboPrivate->q_ptr->setProperty("state","normal");
-                        backgroundPressed = true;
-                        accepted = true;
-                    }
-                } else {
-                    //if vkb is opened then dismiss drop down only if click happened outside drop down and
-                    //vkb area
-                    if( comboPrivate->mEditable ) {
-                        HbEditorInterface editorInterface( comboPrivate->q_ptr );
-                        HbVkbHost *host = editorInterface.vkbHost( );
-                        if( host ) {
-                            //get the scene rect of vkb
-                            QGraphicsWidget *vkbWidget = host->activeKeypad( )->asGraphicsWidget( );
-                            QRectF tmp = host->applicationArea( );
-                            QRectF vkbArea = vkbWidget->mapToScene( tmp ).boundingRect( );
-                            QGraphicsSceneMouseEvent *mouseEvent = 
-                                static_cast< QGraphicsSceneMouseEvent * >( event );
-                            if( !( this->isUnderMouse( ) ) &&
-                                !vkbArea.contains( mouseEvent->scenePos( ) ) ) {
-                                HbWidgetFeedback::triggered( this, Hb::InstantPopupClosed );
-                                setVisible( false );
-                                comboPrivate->q_ptr->setProperty( "state", "normal" );
-                                backgroundPressed = true;
-                                accepted = true;
-                            }
-                        }
-                    }
-                }
-            }
-            break;
         case QEvent::Gesture:
             {
                 if( !this->isUnderMouse( ) ) {
@@ -135,10 +96,46 @@
                     //dropdown area
                     if( QGestureEvent *gestureEvent = static_cast<QGestureEvent *>( event ) ) {                        
                         HbTapGesture *tapGesture = qobject_cast<HbTapGesture *>(gestureEvent->gesture(Qt::TapGesture));
-                        if( !qobject_cast<HbPanGesture *>( 
-                                gestureEvent->gesture( Qt::PanGesture ) ) &&
-                            !(tapGesture && tapGesture->state() != Qt::GestureStarted)) {
-                            accepted = true;
+                        if( tapGesture && tapGesture->state() == Qt::GestureStarted ) {
+                            if( !vkbOpened ) {
+                                //if vkb is not opened and dropdown is not clicked then dismiss drop down
+                                if( !( this->isUnderMouse( ) ) ) {
+                                    HbWidgetFeedback::triggered( this, Hb::InstantPopupClosed );
+                                    setVisible( false );
+                                    comboPrivate->q_ptr->setProperty("state","normal");
+                                    backgroundPressed = true;
+                                    accepted = true;
+                                }
+                            } else {
+                                //if vkb is opened then dismiss drop down only if click happened outside drop down and
+                                //vkb area
+                                if( comboPrivate->mEditable ) {
+                                    HbEditorInterface editorInterface( comboPrivate->q_ptr );
+                                    HbVkbHost *host = editorInterface.vkbHost( );
+                                    if( host ) {
+                                        //get the scene rect of vkb
+                                        QGraphicsWidget *vkbWidget = host->activeKeypad( )->asGraphicsWidget( );
+                                        QRectF tmp = host->applicationArea( );
+                                        QRectF vkbArea = vkbWidget->mapToScene( tmp ).boundingRect( );
+                                        //QGraphicsSceneMouseEvent *mouseEvent = 
+                                        //    static_cast< QGraphicsSceneMouseEvent * >( event );
+                                        if( !( this->isUnderMouse( ) ) &&
+                                            !vkbArea.contains( /*mouseEvent->scenePos( )*/ tapGesture->sceneStartPos() ) ) {
+                                            HbWidgetFeedback::triggered( this, Hb::InstantPopupClosed );
+                                            setVisible( false );
+                                            comboPrivate->q_ptr->setProperty( "state", "normal" );
+                                            backgroundPressed = true;
+                                            accepted = true;
+                                        }
+                                    }
+                                }
+                            }
+                        } else {
+                            if( !qobject_cast<HbPanGesture *>( 
+                                    gestureEvent->gesture( Qt::PanGesture ) ) &&
+                                !(tapGesture && tapGesture->state() != Qt::GestureStarted)) {
+                                accepted = true;
+                            }
                         }
                     }
                 }