idlehomescreen/widgetmanager/src/wmlistbox.cpp
changeset 2 08c6ee43b396
parent 1 5315654608de
child 4 4d54b72983ae
--- a/idlehomescreen/widgetmanager/src/wmlistbox.cpp	Thu Jan 07 12:39:41 2010 +0200
+++ b/idlehomescreen/widgetmanager/src/wmlistbox.cpp	Mon Jan 18 20:10:36 2010 +0200
@@ -99,7 +99,7 @@
             EMbmWidgetmanagerQgn_menu_hswidget,
             EMbmWidgetmanagerQgn_menu_hswidget_mask
             );
-	
+
     AknsUtils::CreateColorIconL(
             skin,
             KAknsIIDQgnIndiWmAdd,
@@ -232,11 +232,11 @@
     logoLayout.LayoutRect( itemRect,
              AknLayoutScalable_Apps::listrow_wgtman_pane_g1().LayoutLine() );
 
-    if ( !bitmap )
+    if ( !bitmap && !wData.IsPrepairingLogo() )
         {
         logoLayout.DrawImage( gc, iDefaultLogoImage, iDefaultLogoImageMask );
         }
-    else
+    else if( bitmap && mask )
         {
         logoLayout.DrawImage( gc, bitmap, mask );
         }
@@ -255,14 +255,13 @@
 
     TAknTextLineLayout titleTextLayout = 
               AknLayoutScalable_Apps::listrow_wgtman_pane_t1().LayoutLine();
-    TAknTextLineLayout descTextLayout =
-            AknLayoutScalable_Apps::listrow_wgtman_pane_t2().LayoutLine();
 
     TAknLayoutText textLayout;
     textLayout.LayoutText( itemRect, titleTextLayout );
     textLayout.DrawText( gc, wData.Name(), ETrue, textColor );
     
-    if ( wData.HsContentInfo().CanBeAdded() )
+    if ( !wData.IsUninstalling() &&
+        wData.HsContentInfo().CanBeAdded() )
         {
         // DRAW ADD BUTTON
         TAknLayoutRect addButtonLayout;
@@ -280,11 +279,31 @@
             }        
         }
 
-    gc.SetPenSize(TSize(1,1));
-
-    // DRAW DESCRIPTION TEXT
-    textLayout.LayoutText( itemRect, descTextLayout );
-    textLayout.DrawText( gc, wData.Description(), ETrue, textColor );
+    if ( !wData.IsUninstalling() )
+        {
+        TAknTextLineLayout descTextLayout =
+            AknLayoutScalable_Apps::listrow_wgtman_pane_t2().LayoutLine();
+        gc.SetPenSize(TSize(1,1));
+        // DRAW DESCRIPTION TEXT
+        textLayout.LayoutText( itemRect, descTextLayout );
+        textLayout.DrawText( gc, wData.Description(), ETrue, textColor );
+        }
+    else
+        {
+        // draw animation
+        TAknLayoutRect animationLayout;
+        animationLayout.LayoutRect( itemRect,
+             AknLayoutScalable_Apps::wait_bar_pane_cp09().LayoutLine() );
+        TSize size = animationLayout.Rect().Size();
+        CFbsBitmap* animBitmap = 
+                const_cast<CFbsBitmap*>(wData.AnimationBitmap( size ));
+        CFbsBitmap* animMask = 
+                const_cast<CFbsBitmap*>(wData.AnimationMask( size ));
+        if ( animBitmap && animMask )
+            {
+            animationLayout.DrawImage( gc, animBitmap, animMask );
+            }
+        }
     gc.DiscardFont();
     }
 
@@ -400,6 +419,7 @@
     {
     iFindPaneIsVisible = EFalse;
 	iPressedDown = EFalse;
+	iLogoSize = TSize( 0, 0);
     }
 
 // ---------------------------------------------------------
@@ -409,6 +429,7 @@
 CWmListBox::~CWmListBox()
     {
     iWidgetDatas.ResetAndDestroy();
+    iTrashedData.ResetAndDestroy();
     }
 
 // ---------------------------------------------------------
@@ -456,13 +477,13 @@
 // CWmListBox::AddWidgetDataL
 // ---------------------------------------------------------
 //
-void CWmListBox::AddWidgetDataL( CWmWidgetData* aWidgetData )
+void CWmListBox::AddWidgetDataL( CWmWidgetData* aWidgetData,
+        TBool aRedraw )
     {
     aWidgetData->SetObserver( this );
-    aWidgetData->SetLogoSize( LogoSize() );
     iWidgetDatas.InsertInOrderAllowRepeatsL( aWidgetData,
             SortOrder(EStoredOrder) );
-    HandleItemAdditionL();
+    if ( aRedraw ) { HandleItemAdditionL(); }
     }
 
 // ---------------------------------------------------------
@@ -476,12 +497,24 @@
     // remove widget data
     CWmWidgetData* data = iWidgetDatas[realIndex];
     iWidgetDatas.Remove( realIndex );
-    delete data;
-
     // reorganise
     TRAP_IGNORE(
         AknListBoxUtils::HandleItemRemovalAndPositionHighlightL(
             this, realIndex, current ) );
+    
+    // widgetlist changed notification comes too early before even
+    // uninstall is completed. in wk04_2010 there is going to be fix 
+    // available for this issue. add data object to trashed array so
+    // that its not visible in list and is destroyed later.
+    if ( data->IsUninstalling() && data->IsActive() )
+        {
+        iTrashedData.Append( data );
+        }
+    else
+        {
+        // delete now
+        delete data;
+        }
     }
 
 // ---------------------------------------------------------
@@ -519,6 +552,9 @@
             cellData,
             this );
     CleanupStack::Pop(); // cellData
+
+    // enable extended drawing
+    EnableExtendedDrawingL();
     }
 
 // ---------------------------------------------------------
@@ -527,10 +563,11 @@
 //
 void CWmListBox::HandleLayoutChanged()
     {
-	TSize ls = LogoSize();
+    iLogoSize = TSize( 0, 0);
+	iLogoSize = LogoSize();
     for ( TInt i=0; i<iWidgetDatas.Count(); i++)
         {
-        iWidgetDatas[i]->ReCreateLogo( ls );
+        iWidgetDatas[i]->ReCreateLogo( iLogoSize );
         }
     }
 
@@ -561,7 +598,7 @@
         if ( index >= 0 )
             {
             // redraw item.
-            RedrawItem( RealIndex( index ) );			
+            RedrawItem( RealIndex( index ) );
             }
         }
     else
@@ -677,15 +714,22 @@
 //
 TSize CWmListBox::LogoSize()
     {
-    TAknLayoutRect rowLayoutRect;
-    rowLayoutRect.LayoutRect( Rect(),
-            AknLayoutScalable_Apps::listrow_wgtman_pane().LayoutLine() );
-    TAknLayoutRect logoLayoutRect;
-    logoLayoutRect.LayoutRect( rowLayoutRect.Rect(),
-            AknLayoutScalable_Apps::listrow_wgtman_pane_g1().LayoutLine() );
-    return logoLayoutRect.Rect().Size();
+    TSize size( iLogoSize );    
+    if ( size.iWidth == 0 || size.iHeight == 0 )
+        {
+        TAknLayoutRect rowLayoutRect;
+        rowLayoutRect.LayoutRect( Rect(),
+                AknLayoutScalable_Apps::listrow_wgtman_pane().LayoutLine() );
+        TAknLayoutRect logoLayoutRect;
+        logoLayoutRect.LayoutRect( rowLayoutRect.Rect(),
+                AknLayoutScalable_Apps::listrow_wgtman_pane_g1().LayoutLine() );
+        size = logoLayoutRect.Rect().Size();
+        iLogoSize = size;
+        }
+    return size;
     }
 
+
 // ---------------------------------------------------------
 // CWmListBox::DefaultLogo
 // ---------------------------------------------------------