src/hbcore/gui/hbpopupmanager.cpp
branchGCC_SURGE
changeset 15 f378acbc9cfb
parent 6 c3690ec91ef8
child 21 4633027730f5
child 34 ed14f46c0e55
--- a/src/hbcore/gui/hbpopupmanager.cpp	Thu Jul 15 14:03:49 2010 +0100
+++ b/src/hbcore/gui/hbpopupmanager.cpp	Thu Jul 22 16:36:53 2010 +0100
@@ -94,7 +94,7 @@
 {
     if (!mPopup.isNull()) {
         const QSizeF popupPreferredSize = 
-            mPopup->effectiveSizeHint(Qt::PreferredSize);
+                mPopup->effectiveSizeHint(Qt::PreferredSize);
         const QSizeF usedSize( qMin(rect.width(),   popupPreferredSize.width() ),
                                qMin( rect.height(), popupPreferredSize.height() ) );
         QPointF usedPos(rect.left(), rect.top());
@@ -157,7 +157,12 @@
 
             usedPos = QPointF(usedx, usedy);
         }
-        mPopup->setGeometry(QRectF(usedPos, usedSize));
+        if (((HbPopupPrivate*)HbPopupPrivate::d_ptr(mPopup))->mAutoLayouting) {
+            mPopup->setGeometry(QRectF(usedPos, usedSize));
+            ((HbPopupPrivate*)HbPopupPrivate::d_ptr(mPopup))->mAutoLayouting = true;
+        } else {
+            mPopup->resize(usedSize);
+        }
     }
 }
 
@@ -177,14 +182,13 @@
 {
     Q_UNUSED( obj );
     switch( event->type() ) {
-        case QEvent::LayoutRequest: {
+        case QEvent::LayoutRequest:
+        case QEvent::ContextMenu:
+        case QEvent::Close:
+            {
             updateGeometry();
             break;
-        }
-        case QEvent::ContextMenu: {
-            updateGeometry();
-            break;
-        }
+            }
         default:
             break;
     }
@@ -416,8 +420,7 @@
                  popup->metaObject()->className() != QLatin1String("HbExactWordPopup") &&
                  popup->metaObject()->className() != QLatin1String("HbInputSmileyPicker") &&
                  popup->metaObject()->className() != QLatin1String("Hb12KeyCustomKeypad") &&
-				 popup->metaObject()->className() != QLatin1String("HbInputThaiSpecialPopup") &&
-                 !popup->inherits("HbInputVkbWidget")) {
+				 !popup->inherits("HbInputVkbWidget")) {
                 setGeometryForPopup( popup );
             }
         }
@@ -432,8 +435,12 @@
             if(!initialFocusedItem && scene) {
                 initialFocusedItem = scene->focusItem();
             }
-
-            topLevelFocusablePopup->setFocus();
+            
+            // an embedded graphics item is already having a 
+            // focus so do not set focus as graphicsscene will automatically
+            // set the focus to the embedded item.
+            if (!topLevelFocusablePopup->focusItem())
+                topLevelFocusablePopup->setFocus();
         }
 
         updateFading();
@@ -485,7 +492,8 @@
 
             // Move the focus to the initial focus item if there is no current focus item or
             // the ancestor of the current fucus item is popup
-            if( !scene->focusItem() || popup->hasFocus() || popup->isAncestorOf(scene->focusItem())) {
+            if( !scene->focusItem() || scene->focusItem() == popup ||
+                popup->isAncestorOf(scene->focusItem())) {
                 initialFocusedItem->setFocus();
                 initialFocusedItem = 0;
             }