src/hbcore/gui/hbpopup.cpp
changeset 28 b7da29130b0e
parent 23 e6ad4ef83b23
child 30 80e4d18b72f5
--- a/src/hbcore/gui/hbpopup.cpp	Thu Sep 02 20:44:51 2010 +0300
+++ b/src/hbcore/gui/hbpopup.cpp	Fri Sep 17 08:32:10 2010 +0300
@@ -39,7 +39,6 @@
 #include <QGraphicsSceneMouseEvent>
 #include <QShowEvent>
 #include <QHideEvent>
-#include <QEventLoop>
 #include <QPointer>
 #include <QDebug>
 #include <QBitmap>
@@ -360,7 +359,6 @@
 }
 
 HbPopupPrivate::HbPopupPrivate( ) :
-    eventLoop(0),
     hasEffects(false),
     closed(false),
     hidingInProgress(true),
@@ -415,7 +413,6 @@
     if (!q->parentItem()) {
         backgroundItem = new HbPopupBackGround(q);
         backgroundItem->setVisible(false);
-
         // Popup is invisible by default (explicit show or open call is required)
         q->setVisible(false);
     }
@@ -424,9 +421,9 @@
     itemFlags |= QGraphicsItem::ItemClipsToShape;
     itemFlags |= QGraphicsItem::ItemClipsChildrenToShape;
     itemFlags |= QGraphicsItem::ItemSendsGeometryChanges;
-    //itemFlags |= QGraphicsItem::ItemIsPanel;
+    itemFlags |= QGraphicsItem::ItemIsPanel;
     q->setFlags(itemFlags);
-    //q->setActive(false);
+    q->setActive(false);
 }
 
 void HbPopupPrivate::_q_appearEffectEnded(HbEffect::EffectStatus status)
@@ -492,6 +489,8 @@
         QEvent userEvent(QEvent::ContextMenu);
         QCoreApplication::sendEvent(q, &userEvent);
     }
+
+    q->repolish();
 #ifdef HB_EFFECTS
     if (mOrientationEffectHide) {
         HbEffect::cancel(q);
@@ -779,9 +778,6 @@
         hbScene->d_ptr->hidePopup(this);
     }
 
-    if (d->eventLoop) {
-        d->eventLoop->exit();
-    }
     if (d->backgroundItem) {
         // Set backgroundItem->popup to 0 to avoid double deletion
         // e.g. when popup is deleted by scene before its backgroundItem
@@ -1011,6 +1007,9 @@
             // Note: when visibility changes to "visible" base class implementation needs
             //       to be called otherwise showEvent() is not called.
         } else {
+            if(isPanel() && isActive() && d->mActivePopup) {
+                setActive(false);
+            }
             d->aboutToShowSignalGuard = false;
             if (!d->hidingInProgress) {
                 emit aboutToHide();
@@ -1087,9 +1086,11 @@
  */
 void HbPopup::mouseReleaseEvent(QGraphicsSceneMouseEvent *event )
 {
-    QGraphicsItem::mouseReleaseEvent(event);        
+    Q_D(HbPopup);
+    d->handleBackgroundMouseReleaseEvent(event);
+
+    QGraphicsItem::mouseReleaseEvent(event);
     event->accept();
-    // Note: Mouse release event is always handled in handleBackgroundMouseReleaseEvent
 }
 
 /*!
@@ -1113,7 +1114,11 @@
     //  - and registered to HbPopupManager
     //  otherwise popup is treated as normal widget
     if(d->duplicateShowEvent){
-        d->duplicateShowEvent = false;
+        d->duplicateShowEvent = false;        
+        //setting popup as active panel failed in previous showEvent
+        if (d->mActivePopup) {
+            setActive(true);
+        }
         return;
     }
     if (!parentItem()) {
@@ -1122,9 +1127,9 @@
         if(d->addPopupToScene()) {
               d->duplicateShowEvent = true;
         }
-        /*if (d->mActivePopup) {
+        if (d->mActivePopup) {
             setActive(true);
-        }*/
+        }
         // Popup clears closed state
         d->closed = false;
         if (d->backgroundItem) {
@@ -1172,14 +1177,8 @@
     }
 
     HbWidgetFeedback::triggered(this, Hb::InstantPopupClosed);
-    if (d->eventLoop) {
-        d->eventLoop->exit();
-    }
 
     d->doSetModal( d->modal );
-    /*if (d->mActivePopup) {
-        setActive(false);
-    }*/
 }
 
 /*!