133 CHsContentInfoArray* contentInfoArray = CHsContentInfoArray::NewL(); |
133 CHsContentInfoArray* contentInfoArray = CHsContentInfoArray::NewL(); |
134 CleanupStack::PushL( contentInfoArray ); |
134 CleanupStack::PushL( contentInfoArray ); |
135 controller.WidgetListL( *contentInfoArray ); |
135 controller.WidgetListL( *contentInfoArray ); |
136 |
136 |
137 // 2. load the widget order |
137 // 2. load the widget order |
|
138 if ( iWidgetOrder ) { Cleanup(); } |
138 iWidgetOrder = CWmPersistentWidgetOrder::NewL( iWmPlugin.FileServer() ); |
139 iWidgetOrder = CWmPersistentWidgetOrder::NewL( iWmPlugin.FileServer() ); |
139 TRAPD( loadError, iWidgetOrder->LoadL() ); |
140 TRAPD( loadError, iWidgetOrder->LoadL() ); |
140 |
141 |
141 // 3. prepare the widget data list |
142 // 3. prepare the widget data list |
142 for( TInt i=0; i<iWidgetsList.WidgetDataCount(); ++i ) |
143 for( TInt i=0; i<iWidgetsList.WidgetDataCount(); ++i ) |
150 TInt widgetsAdded = 0; |
151 TInt widgetsAdded = 0; |
151 TInt widgetsChanged = 0; |
152 TInt widgetsChanged = 0; |
152 while( contentInfoArray->Array().Count() > 0 ) |
153 while( contentInfoArray->Array().Count() > 0 ) |
153 { |
154 { |
154 CHsContentInfo* contentInfo = contentInfoArray->Array()[0]; |
155 CHsContentInfo* contentInfo = contentInfoArray->Array()[0]; |
|
156 if ( !contentInfo ) { break; } |
155 contentInfoArray->Array().Remove( 0 ); |
157 contentInfoArray->Array().Remove( 0 ); |
156 |
158 |
157 // check if this widget exists. |
159 // check if this widget exists. |
158 // if it does, keep the existing one |
160 // if it does, keep the existing one |
159 // if it does not, add it |
161 // if it does not, add it |
253 iWidgetRegistry = new (ELeave) RWidgetRegistryClientSession(); |
255 iWidgetRegistry = new (ELeave) RWidgetRegistryClientSession(); |
254 User::LeaveIfError( iWidgetRegistry->Connect() ); |
256 User::LeaveIfError( iWidgetRegistry->Connect() ); |
255 } |
257 } |
256 CleanupStack::Pop( aContentInfo ); |
258 CleanupStack::Pop( aContentInfo ); |
257 |
259 |
258 CWmWidgetData* widgetData = CWmWidgetData::NewLC( |
260 CWmWidgetData* widgetData = CWmWidgetData::NewLC( |
259 iWidgetsList.LogoSize(), |
261 iWidgetsList.LogoSize(), |
260 iWmPlugin.ResourceLoader(), |
262 iWmPlugin.ResourceLoader(), |
261 aContentInfo, iWidgetRegistry ); |
263 aContentInfo, iWidgetRegistry ); |
262 widgetData->SetPersistentWidgetOrder( iWidgetOrder ); |
264 widgetData->SetPersistentWidgetOrder( iWidgetOrder ); |
263 widgetData->SetValid( ETrue ); |
265 widgetData->SetValid( ETrue ); |
|
266 |
|
267 if ( iUninstallUid != KNullUid && |
|
268 iUninstallUid == widgetData->PublisherUid() ) |
|
269 { |
|
270 widgetData->VisualizeUninstallL(); |
|
271 } |
|
272 |
264 iWidgetsList.AddWidgetDataL( widgetData, EFalse ); |
273 iWidgetsList.AddWidgetDataL( widgetData, EFalse ); |
265 if ( iUninstallUid != KNullUid |
|
266 && iUninstallUid == widgetData->PublisherUid() ) |
|
267 { |
|
268 widgetData->VisualizeUninstallL(); |
|
269 } |
|
270 |
|
271 CleanupStack::Pop( widgetData ); |
274 CleanupStack::Pop( widgetData ); |
272 } |
275 } |
273 |
276 |
274 // --------------------------------------------------------------------------- |
277 // --------------------------------------------------------------------------- |
275 // CWmWidgetLoaderAo::Cleanup |
278 // CWmWidgetLoaderAo::Cleanup |