--- a/idlehomescreen/widgetmanager/src/wmwidgetloaderao.cpp Thu Jan 07 12:39:41 2010 +0200
+++ b/idlehomescreen/widgetmanager/src/wmwidgetloaderao.cpp Mon Jan 18 20:10:36 2010 +0200
@@ -123,20 +123,23 @@
//
void CWmWidgetLoaderAo::DoLoadWidgetsL()
{
- // 1. mark all the existing widgets initially non-valid
- for( TInt i=0; i<iWidgetsList.WidgetDataCount(); ++i )
- iWidgetsList.WidgetData(i).SetValid( EFalse );
-
- // 2. load the widgets array
+ // 1. load the widgets array
MHsContentController& controller = iWmPlugin.ContentController();
CHsContentInfoArray* contentInfoArray = CHsContentInfoArray::NewL();
CleanupStack::PushL( contentInfoArray );
controller.WidgetListL( *contentInfoArray );
- // 3. load the widget order
+ // 2. load the widget order
iWidgetOrder = CWmPersistentWidgetOrder::NewL( iWmPlugin.FileServer() );
TRAPD( loadError, iWidgetOrder->LoadL() );
+ // 3. prepare the widget data list
+ for( TInt i=0; i<iWidgetsList.WidgetDataCount(); ++i )
+ {
+ iWidgetsList.WidgetData(i).SetPersistentWidgetOrder( iWidgetOrder );
+ iWidgetsList.WidgetData(i).SetValid( EFalse );
+ }
+
// 4. loop through the content array and compare it against the existing
// widget data.
TInt widgetsAdded = 0;
@@ -178,7 +181,15 @@
++widgetsRemoved;
}
}
- if ( widgetsRemoved > 0 )
+
+ // update listbox
+ if ( widgetsAdded > 0 )
+ {
+ iWidgetsList.HandleItemAdditionL();
+ }
+
+ if ( widgetsRemoved > 0 || widgetsAdded > 0 ||
+ widgetsChanged > 0 )
{
iWidgetsList.DrawDeferred();
}
@@ -203,7 +214,7 @@
{
iWidgetOrder->StoreL( iWidgetsList.WidgetDataArray() );
}
-
+
}
// ---------------------------------------------------------
@@ -240,10 +251,12 @@
CleanupStack::Pop( aContentInfo );
CWmWidgetData* widgetData = CWmWidgetData::NewLC(
+ iWidgetsList.LogoSize(),
+ iWmPlugin.ResourceLoader(),
aContentInfo, iWidgetRegistry );
widgetData->SetPersistentWidgetOrder( iWidgetOrder );
widgetData->SetValid( ETrue );
- iWidgetsList.AddWidgetDataL( widgetData );
+ iWidgetsList.AddWidgetDataL( widgetData, EFalse );
CleanupStack::Pop( widgetData );
}
@@ -262,7 +275,11 @@
iWidgetRegistry = NULL;
}
- // delete widget order
+ // delete widget order and references to it
+ for( TInt i=0; i<iWidgetsList.WidgetDataCount(); ++i )
+ {
+ iWidgetsList.WidgetData(i).SetPersistentWidgetOrder( NULL );
+ }
delete iWidgetOrder;
iWidgetOrder = NULL;
}