branch | RCL_3 |
changeset 15 | 51c0f5edf5ef |
parent 0 | ba25891c3a9e |
child 19 | 7ca52d38f8c3 |
6:aba6b8104af3 | 15:51c0f5edf5ef |
---|---|
1 /* |
1 /* |
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
131 |
131 |
132 // --------------------------------------------------------------------------- |
132 // --------------------------------------------------------------------------- |
133 // CAppMngr2Model::PackageInfo() |
133 // CAppMngr2Model::PackageInfo() |
134 // --------------------------------------------------------------------------- |
134 // --------------------------------------------------------------------------- |
135 // |
135 // |
136 CAppMngr2PackageInfo& CAppMngr2Model::PackageInfo( TInt aIndex ) const |
136 CAppMngr2PackageInfo& CAppMngr2Model::PackageInfo( TInt aIndex ) const |
137 { |
137 { |
138 return *( reinterpret_cast< CAppMngr2PackageInfo* >( iInstallationFiles->At( aIndex ) ) ); |
138 return *( reinterpret_cast< CAppMngr2PackageInfo* >( iInstallationFiles->At( aIndex ) ) ); |
139 } |
139 } |
140 |
140 |
141 // --------------------------------------------------------------------------- |
141 // --------------------------------------------------------------------------- |
143 // --------------------------------------------------------------------------- |
143 // --------------------------------------------------------------------------- |
144 // |
144 // |
145 void CAppMngr2Model::LoadIconsL( CAknIconArray& aIconArray ) |
145 void CAppMngr2Model::LoadIconsL( CAknIconArray& aIconArray ) |
146 { |
146 { |
147 LoadDefaultIconsL( aIconArray ); |
147 LoadDefaultIconsL( aIconArray ); |
148 |
148 |
149 TInt pluginCount = iPlugins.Count(); |
149 TInt pluginCount = iPlugins.Count(); |
150 for( TInt index = 0; index < pluginCount; index++ ) |
150 for( TInt index = 0; index < pluginCount; index++ ) |
151 { |
151 { |
152 iPlugins[ index ]->LoadIconsL( aIconArray ); |
152 iPlugins[ index ]->LoadIconsL( aIconArray ); |
153 } |
153 } |
177 // --------------------------------------------------------------------------- |
177 // --------------------------------------------------------------------------- |
178 // |
178 // |
179 void CAppMngr2Model::HandleCommandL( CAppMngr2InfoBase& aInfo, TInt aCommand ) |
179 void CAppMngr2Model::HandleCommandL( CAppMngr2InfoBase& aInfo, TInt aCommand ) |
180 { |
180 { |
181 FLOG( "CAppMngr2Model::HandleCommandL( %d ), IsActive() = %d", aCommand, IsActive() ); |
181 FLOG( "CAppMngr2Model::HandleCommandL( %d ), IsActive() = %d", aCommand, IsActive() ); |
182 |
182 |
183 if( !IsActive() ) |
183 if( !IsActive() ) |
184 { |
184 { |
185 // About to start plugin specific command. Note that when the command completes |
185 // About to start plugin specific command. Note that when the command completes |
186 // we need to call CAppMngr2InfoBase::CommandComplete() function. For this (and |
186 // we need to call CAppMngr2InfoBase::CommandComplete() function. For this (and |
187 // to indicate that there is a plugin specific command on-going) we take the |
187 // to indicate that there is a plugin specific command on-going) we take the |
202 } |
202 } |
203 |
203 |
204 iActiveItem = &aInfo; |
204 iActiveItem = &aInfo; |
205 iActiveCommand = aCommand; |
205 iActiveCommand = aCommand; |
206 FLOG( "CAppMngr2Model::HandleCommandL, iActiveItem = 0x%08x '%S'", |
206 FLOG( "CAppMngr2Model::HandleCommandL, iActiveItem = 0x%08x '%S'", |
207 iActiveItem, &( iActiveItem->Name() ) ); |
207 iActiveItem, &( iActiveItem->Name() ) ); |
208 TRAPD( err, iActiveItem->HandleCommandL( aCommand, iStatus ) ); |
208 TRAPD( err, iActiveItem->HandleCommandL( aCommand, iStatus ) ); |
209 FLOG( "CAppMngr2Model::HandleCommandL, command started, err = %d", err ); |
209 FLOG( "CAppMngr2Model::HandleCommandL, command started, err = %d", err ); |
210 SetActive(); |
210 SetActive(); |
211 if( err ) |
211 if( err ) |
212 { |
212 { |
224 // CAppMngr2Model::StartFetchingInstallationFilesL() |
224 // CAppMngr2Model::StartFetchingInstallationFilesL() |
225 // --------------------------------------------------------------------------- |
225 // --------------------------------------------------------------------------- |
226 // |
226 // |
227 void CAppMngr2Model::StartFetchingInstallationFilesL() |
227 void CAppMngr2Model::StartFetchingInstallationFilesL() |
228 { |
228 { |
229 FLOG( "CAppMngr2Model::StartFetchingInstallationFilesL" ); |
229 FLOG( "CAppMngr2Model::StartFetchingInstallationFilesL, fetching %d", |
230 FLOG_PERF_START( FetchInstallationFiles ) |
230 iFetchingInstallationFiles ); |
231 |
231 if( !iFetchingInstallationFiles ) |
232 // Installation files cache must be enabled until scanner has completed. |
232 { |
233 // This ensures that scanner has time to call GetInstallationFilesL() for |
233 FLOG_PERF_START( FetchInstallationFiles ) |
234 // each plugin and for each directory before the first call completes. |
234 iFetchingInstallationFiles = ETrue; |
235 // If the first call completes before scanner has made all these requets, |
235 |
236 // cache will be turned off and partial results are displayed. |
236 // Installation files cache must be enabled until scanner has completed. |
237 iInstallationFiles->IncrementCacheUseStartingNewRoundL(); |
237 // This ensures that scanner has time to call GetInstallationFilesL() for |
238 |
238 // each plugin and for each directory before the first call completes. |
239 iScanner->StartScanningL(); |
239 // If the first call completes before scanner has made all these requets, |
240 // cache will be turned off and partial results are displayed. |
|
241 iInstallationFiles->IncrementCacheUseStartingNewRoundL(); |
|
242 |
|
243 iScanner->StartScanningL(); |
|
244 } |
|
240 } |
245 } |
241 |
246 |
242 // --------------------------------------------------------------------------- |
247 // --------------------------------------------------------------------------- |
243 // CAppMngr2Model::StartFetchingInstalledAppsL() |
248 // CAppMngr2Model::StartFetchingInstalledAppsL() |
244 // --------------------------------------------------------------------------- |
249 // --------------------------------------------------------------------------- |
245 // |
250 // |
246 void CAppMngr2Model::StartFetchingInstalledAppsL() |
251 void CAppMngr2Model::StartFetchingInstalledAppsL() |
247 { |
252 { |
248 FLOG( "CAppMngr2Model::StartFetchingInstalledAppsL" ); |
253 FLOG( "CAppMngr2Model::StartFetchingInstalledAppsL, fetching %d", |
249 FLOG_PERF_START( FetchInstalledApps ) |
254 iFetchingInstalledApps ); |
250 |
255 if( !iFetchingInstalledApps ) |
251 // Additional cache increment to ensure that iInstalledApps cache is |
256 { |
252 // used until GetInstalledAppsL() function is called for each plugin. |
257 FLOG_PERF_START( FetchInstalledApps ) |
253 // Without this, the fastest plugin might get it's list complete before |
258 iFetchingInstalledApps = ETrue; |
254 // other IncrementCacheUseL() calls and iInstalledApps would display |
259 |
255 // partial list. |
260 // Additional cache increment to ensure that iInstalledApps cache is |
256 iInstalledApps->IncrementCacheUseStartingNewRoundL(); |
261 // used until GetInstalledAppsL() function is called for each plugin. |
257 |
262 // Without this, the fastest plugin might get it's list complete before |
258 TInt pluginCount = iPlugins.Count(); |
263 // other IncrementCacheUseL() calls and iInstalledApps would display |
259 for( TInt pluginIndex = 0; pluginIndex < pluginCount; pluginIndex++ ) |
264 // partial list. |
260 { |
265 iInstalledApps->IncrementCacheUseStartingNewRoundL(); |
261 CAppMngr2AppInfoMaker* appInfoMaker = CAppMngr2AppInfoMaker::NewLC( |
266 |
262 iPlugins[ pluginIndex ]->Runtime(), *this, iFs ); |
267 TInt pluginCount = iPlugins.Count(); |
263 |
268 for( TInt pluginIndex = 0; pluginIndex < pluginCount; pluginIndex++ ) |
264 TRAPD( err, appInfoMaker->StartGettingInstalledAppsL() ); |
269 { |
265 FLOG( "CAppMngr2Model::StartFetchingInstalledAppsL, plugin 0x%08x, err = %d", |
270 CAppMngr2AppInfoMaker* appInfoMaker = CAppMngr2AppInfoMaker::NewLC( |
266 iPlugins[ pluginIndex ]->Runtime().RuntimeUid().iUid, err ); |
271 iPlugins[ pluginIndex ]->Runtime(), *this, iFs ); |
267 if( err == KErrNone ) |
272 |
268 { |
273 TRAPD( err, appInfoMaker->StartGettingInstalledAppsL() ); |
269 iInfoMakers.AppendL( appInfoMaker ); |
274 FLOG( "CAppMngr2Model::StartFetchingInstalledAppsL, plugin 0x%08x, err = %d", |
270 CleanupStack::Pop( appInfoMaker ); |
275 iPlugins[ pluginIndex ]->Runtime().RuntimeUid().iUid, err ); |
271 iInstalledApps->IncrementCacheUseL(); |
276 if( err == KErrNone ) |
272 } |
277 { |
273 else |
278 iInfoMakers.AppendL( appInfoMaker ); |
274 { |
279 CleanupStack::Pop( appInfoMaker ); |
275 CleanupStack::PopAndDestroy( appInfoMaker ); |
280 iInstalledApps->IncrementCacheUseL(); |
276 } |
281 } |
277 } |
282 else |
278 |
283 { |
279 // All GetInstalledAppsL() requests have been issued |
284 CleanupStack::PopAndDestroy( appInfoMaker ); |
280 iInstalledApps->DecrementCacheUse(); |
285 } |
286 } |
|
287 |
|
288 // All GetInstalledAppsL() requests have been issued |
|
289 iInstalledApps->DecrementCacheUse(); |
|
290 } |
|
281 } |
291 } |
282 |
292 |
283 // --------------------------------------------------------------------------- |
293 // --------------------------------------------------------------------------- |
284 // CAppMngr2Model::DoCancel() |
294 // CAppMngr2Model::DoCancel() |
285 // --------------------------------------------------------------------------- |
295 // --------------------------------------------------------------------------- |
286 // |
296 // |
287 void CAppMngr2Model::DoCancel() |
297 void CAppMngr2Model::DoCancel() |
288 { |
298 { |
289 FLOG( "CAppMngr2Model::DoCancel, iActiveItem = 0x%08x", iActiveItem ); |
299 FLOG( "CAppMngr2Model::DoCancel, iActiveItem = 0x%08x", iActiveItem ); |
290 |
300 |
291 if( iActiveItem ) |
301 if( iActiveItem ) |
292 { |
302 { |
293 iActiveItem->CancelCommand(); |
303 iActiveItem->CancelCommand(); |
294 iActiveItem = NULL; |
304 iActiveItem = NULL; |
295 if( !iClosing ) |
305 if( !iClosing ) |
322 iInstalledApps->EnableRefreshNotificationsL(); |
332 iInstalledApps->EnableRefreshNotificationsL(); |
323 iInstallationFiles->EnableRefreshNotificationsL(); |
333 iInstallationFiles->EnableRefreshNotificationsL(); |
324 |
334 |
325 // Leave on error. This displays error note (if error notes are enabled). |
335 // Leave on error. This displays error note (if error notes are enabled). |
326 User::LeaveIfError( err ); |
336 User::LeaveIfError( err ); |
327 |
337 |
328 // If the command is EAppMngr2CmdUninstall or EAppMngr2CmdRemove, and it |
338 // If the command is EAppMngr2CmdUninstall or EAppMngr2CmdRemove, and it |
329 // completed without errors, then we remove the current item immediatelty |
339 // completed without errors, then we remove the current item immediatelty |
330 // from the displayed list. Otherwise it may take quite long time until |
340 // from the displayed list. Otherwise it may take quite long time until |
331 // the item is removed from the UI, and in worst case it may not be removed |
341 // the item is removed from the UI, and in worst case it may not be removed |
332 // at all. |
342 // at all. |
353 // --------------------------------------------------------------------------- |
363 // --------------------------------------------------------------------------- |
354 // |
364 // |
355 void CAppMngr2Model::RefreshInstalledApps() |
365 void CAppMngr2Model::RefreshInstalledApps() |
356 { |
366 { |
357 FLOG( "CAppMngr2Model::RefreshInstalledApps" ); |
367 FLOG( "CAppMngr2Model::RefreshInstalledApps" ); |
358 |
368 |
359 TRAP_IGNORE( StartFetchingInstalledAppsL() ); |
369 TRAP_IGNORE( StartFetchingInstalledAppsL() ); |
360 } |
370 } |
361 |
371 |
362 // --------------------------------------------------------------------------- |
372 // --------------------------------------------------------------------------- |
363 // CAppMngr2Model::RefreshInstallationFiles() |
373 // CAppMngr2Model::RefreshInstallationFiles() |
375 // --------------------------------------------------------------------------- |
385 // --------------------------------------------------------------------------- |
376 // |
386 // |
377 void CAppMngr2Model::ScanningResultL( RPointerArray<CAppMngr2RecognizedFile>& aResult ) |
387 void CAppMngr2Model::ScanningResultL( RPointerArray<CAppMngr2RecognizedFile>& aResult ) |
378 { |
388 { |
379 FLOG( "CAppMngr2Model::ScanningResultL, begin: aResult.Count() = %d", aResult.Count() ); |
389 FLOG( "CAppMngr2Model::ScanningResultL, begin: aResult.Count() = %d", aResult.Count() ); |
380 |
390 |
381 // Split recognition result array into smaller (plugin specific) arrays. Plugin |
391 // Split recognition result array into smaller (plugin specific) arrays. Plugin |
382 // specific arrays are maintained by CAppMngr2PackageInfoMaker objects, so one |
392 // specific arrays are maintained by CAppMngr2PackageInfoMaker objects, so one |
383 // CAppMngr2PackageInfoMaker object is needed for each plugin that has recognized |
393 // CAppMngr2PackageInfoMaker object is needed for each plugin that has recognized |
384 // files. |
394 // files. |
385 TInt pluginCount = iPlugins.Count(); |
395 TInt pluginCount = iPlugins.Count(); |
422 // --------------------------------------------------------------------------- |
432 // --------------------------------------------------------------------------- |
423 // |
433 // |
424 void CAppMngr2Model::ScanningComplete() |
434 void CAppMngr2Model::ScanningComplete() |
425 { |
435 { |
426 FLOG( "CAppMngr2Model::ScanningComplete" ); |
436 FLOG( "CAppMngr2Model::ScanningComplete" ); |
427 |
437 |
428 iInstallationFiles->DecrementCacheUse(); |
438 iInstallationFiles->DecrementCacheUse(); |
429 } |
439 } |
430 |
440 |
431 // --------------------------------------------------------------------------- |
441 // --------------------------------------------------------------------------- |
432 // CAppMngr2Model::DirectoryChangedL() |
442 // CAppMngr2Model::DirectoryChangedL() |
433 // --------------------------------------------------------------------------- |
443 // --------------------------------------------------------------------------- |
434 // |
444 // |
435 void CAppMngr2Model::DirectoryChangedL( const TDesC& /*aChangedDir*/ ) |
445 void CAppMngr2Model::DirectoryChangedL( const TDesC& /*aChangedDir*/ ) |
436 { |
446 { |
437 FLOG( "CAppMngr2Model::DirectoryChangedL" ); |
447 FLOG( "CAppMngr2Model::DirectoryChangedL" ); |
438 |
448 |
439 // This might be improved by scanning the changed directory only. Model |
449 // This might be improved by scanning the changed directory only. Model |
440 // could record which items are got from which directory, so that it could |
450 // could record which items are got from which directory, so that it could |
441 // remove those items that were created from the changed directory and |
451 // remove those items that were created from the changed directory and |
442 // re-scan only the changed directory. Scanner should also support |
452 // re-scan only the changed directory. Scanner should also support |
443 // scanning one directory only. Now, we just scan all again. |
453 // scanning one directory only. Now, we just scan all again. |
449 // --------------------------------------------------------------------------- |
459 // --------------------------------------------------------------------------- |
450 // |
460 // |
451 void CAppMngr2Model::HandleAppListEvent( TInt /*aEvent*/ ) |
461 void CAppMngr2Model::HandleAppListEvent( TInt /*aEvent*/ ) |
452 { |
462 { |
453 FLOG( "CAppMngr2Model::HandleAppListEvent" ); |
463 FLOG( "CAppMngr2Model::HandleAppListEvent" ); |
454 |
464 |
455 TRAP_IGNORE( StartFetchingInstalledAppsL() ); |
465 TRAP_IGNORE( StartFetchingInstalledAppsL() ); |
456 } |
466 } |
457 |
467 |
458 // --------------------------------------------------------------------------- |
468 // --------------------------------------------------------------------------- |
459 // CAppMngr2Model::NewAppsCreatedL() |
469 // CAppMngr2Model::NewAppsCreatedL() |
462 void CAppMngr2Model::NewAppsCreatedL( const CAppMngr2InfoMaker& aMaker, |
472 void CAppMngr2Model::NewAppsCreatedL( const CAppMngr2InfoMaker& aMaker, |
463 RPointerArray<CAppMngr2AppInfo>& aAppInfos ) |
473 RPointerArray<CAppMngr2AppInfo>& aAppInfos ) |
464 { |
474 { |
465 FLOG( "CAppMngr2Model::NewAppsCreatedL, plugin 0x%08x: packageCount = %d", |
475 FLOG( "CAppMngr2Model::NewAppsCreatedL, plugin 0x%08x: packageCount = %d", |
466 aMaker.RuntimeUid().iUid, aAppInfos.Count() ); |
476 aMaker.RuntimeUid().iUid, aAppInfos.Count() ); |
467 |
477 |
468 iInstalledApps->AddItemsInOrderL( aAppInfos ); |
478 iInstalledApps->AddItemsInOrderL( aAppInfos ); |
469 iInstalledApps->DecrementCacheUse(); |
479 iInstalledApps->DecrementCacheUse(); |
470 CloseInfoMaker( aMaker ); |
480 CloseInfoMaker( aMaker ); |
471 } |
481 } |
472 |
482 |
481 TInt /*aError*/ ) |
491 TInt /*aError*/ ) |
482 #endif |
492 #endif |
483 { |
493 { |
484 FLOG( "CAppMngr2Model::ErrorInCreatingAppsL, plugin 0x%08x: error = %d", |
494 FLOG( "CAppMngr2Model::ErrorInCreatingAppsL, plugin 0x%08x: error = %d", |
485 aMaker.RuntimeUid().iUid, aError ); |
495 aMaker.RuntimeUid().iUid, aError ); |
486 |
496 |
487 iInstalledApps->DecrementCacheUse(); |
497 iInstalledApps->DecrementCacheUse(); |
488 CloseInfoMaker( aMaker ); |
498 CloseInfoMaker( aMaker ); |
489 } |
499 } |
490 |
500 |
491 // --------------------------------------------------------------------------- |
501 // --------------------------------------------------------------------------- |
495 void CAppMngr2Model::NewPackagesCreatedL( const CAppMngr2InfoMaker& aMaker, |
505 void CAppMngr2Model::NewPackagesCreatedL( const CAppMngr2InfoMaker& aMaker, |
496 RPointerArray<CAppMngr2PackageInfo>& aPackageInfos ) |
506 RPointerArray<CAppMngr2PackageInfo>& aPackageInfos ) |
497 { |
507 { |
498 FLOG( "CAppMngr2Model::NewPackagesCreatedL, plugin 0x%08x: packageCount = %d", |
508 FLOG( "CAppMngr2Model::NewPackagesCreatedL, plugin 0x%08x: packageCount = %d", |
499 aMaker.RuntimeUid().iUid, aPackageInfos.Count() ); |
509 aMaker.RuntimeUid().iUid, aPackageInfos.Count() ); |
500 |
510 |
501 iInstallationFiles->AddItemsInOrderL( aPackageInfos ); |
511 iInstallationFiles->AddItemsInOrderL( aPackageInfos ); |
502 iInstallationFiles->DecrementCacheUse(); |
512 iInstallationFiles->DecrementCacheUse(); |
503 CloseInfoMaker( aMaker ); |
513 CloseInfoMaker( aMaker ); |
504 } |
514 } |
505 |
515 |
514 TInt /*aError*/ ) |
524 TInt /*aError*/ ) |
515 #endif |
525 #endif |
516 { |
526 { |
517 FLOG( "CAppMngr2Model::ErrorInCreatingPackagesL, plugin 0x%08x: error = %d", |
527 FLOG( "CAppMngr2Model::ErrorInCreatingPackagesL, plugin 0x%08x: error = %d", |
518 aMaker.RuntimeUid().iUid, aError ); |
528 aMaker.RuntimeUid().iUid, aError ); |
519 |
529 |
520 iInstallationFiles->DecrementCacheUse(); |
530 iInstallationFiles->DecrementCacheUse(); |
521 CloseInfoMaker( aMaker ); |
531 CloseInfoMaker( aMaker ); |
522 } |
532 } |
523 |
533 |
524 // --------------------------------------------------------------------------- |
534 // --------------------------------------------------------------------------- |
526 // --------------------------------------------------------------------------- |
536 // --------------------------------------------------------------------------- |
527 // |
537 // |
528 void CAppMngr2Model::ArrayContentChanged( CAppMngr2InfoArray* aArray, |
538 void CAppMngr2Model::ArrayContentChanged( CAppMngr2InfoArray* aArray, |
529 TInt aMoreRefreshesExpected ) |
539 TInt aMoreRefreshesExpected ) |
530 { |
540 { |
541 FLOG( "CAppMngr2Model::ArrayContentChanged, more = %d", aMoreRefreshesExpected ); |
|
531 if( aArray == iInstalledApps ) |
542 if( aArray == iInstalledApps ) |
532 { |
543 { |
533 FLOG_PERF_STOP( FetchInstalledApps ) |
544 FLOG_PERF_STOP( FetchInstalledApps ) |
534 FLOG_PERF_PRINT( FetchInstalledApps ) |
545 FLOG_PERF_PRINT( FetchInstalledApps ) |
535 iObs.InstalledAppsChanged( aMoreRefreshesExpected ); |
546 iObs.InstalledAppsChanged( aMoreRefreshesExpected ); |
547 if( !aMoreRefreshesExpected ) |
|
548 { |
|
549 FLOG( "CAppMngr2Model::ArrayContentChanged: StartFetchingInstalledAppsL done" ); |
|
550 iFetchingInstalledApps = EFalse; |
|
551 } |
|
536 } |
552 } |
537 if( aArray == iInstallationFiles ) |
553 if( aArray == iInstallationFiles ) |
538 { |
554 { |
539 FLOG_PERF_STOP( FetchInstallationFiles ) |
555 FLOG_PERF_STOP( FetchInstallationFiles ) |
540 FLOG_PERF_PRINT( FetchInstallationFiles ) |
556 FLOG_PERF_PRINT( FetchInstallationFiles ) |
541 iObs.InstallationFilesChanged( aMoreRefreshesExpected ); |
557 iObs.InstallationFilesChanged( aMoreRefreshesExpected ); |
558 if( !aMoreRefreshesExpected ) |
|
559 { |
|
560 FLOG( "CAppMngr2Model::ArrayContentChanged: StartFetchingInstallationFilesL done" ); |
|
561 iFetchingInstallationFiles = EFalse; |
|
562 } |
|
542 } |
563 } |
543 } |
564 } |
544 |
565 |
545 // --------------------------------------------------------------------------- |
566 // --------------------------------------------------------------------------- |
546 // CAppMngr2Model::CAppMngr2Model() |
567 // CAppMngr2Model::CAppMngr2Model() |
561 FLOG( "CAppMngr2Model::ConstructL" ); |
582 FLOG( "CAppMngr2Model::ConstructL" ); |
562 iClosing = EFalse; |
583 iClosing = EFalse; |
563 |
584 |
564 iInstalledApps = CAppMngr2AppInfoArray::NewL( *this ); |
585 iInstalledApps = CAppMngr2AppInfoArray::NewL( *this ); |
565 iInstallationFiles = CAppMngr2PackageInfoArray::NewL( *this ); |
586 iInstallationFiles = CAppMngr2PackageInfoArray::NewL( *this ); |
566 |
587 |
567 FLOG_PERF_STATIC_BEGIN( LoadPluginsL ) |
588 FLOG_PERF_STATIC_BEGIN( LoadPluginsL ) |
568 LoadPluginsL(); |
589 LoadPluginsL(); |
569 FLOG_PERF_STATIC_END( LoadPluginsL ) |
590 FLOG_PERF_STATIC_END( LoadPluginsL ) |
570 FLOG_PERF_STATIC_BEGIN( CreateScannerL ) |
591 FLOG_PERF_STATIC_BEGIN( CreateScannerL ) |
571 CreateScannerL(); |
592 CreateScannerL(); |
583 // --------------------------------------------------------------------------- |
604 // --------------------------------------------------------------------------- |
584 // |
605 // |
585 void CAppMngr2Model::LoadDefaultIconsL( CAknIconArray& aIconArray ) |
606 void CAppMngr2Model::LoadDefaultIconsL( CAknIconArray& aIconArray ) |
586 { |
607 { |
587 FLOG( "CAppMngr2Model::LoadDefaultIconsL" ); |
608 FLOG( "CAppMngr2Model::LoadDefaultIconsL" ); |
588 |
609 |
589 MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); |
610 MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); |
590 HBufC* bitmapFile = TAppMngr2DriveUtils::FullBitmapFileNameLC( KAppMngr2BitmapFile, iFs ); |
611 HBufC* bitmapFile = TAppMngr2DriveUtils::FullBitmapFileNameLC( KAppMngr2BitmapFile, iFs ); |
591 CFbsBitmap* bitmap = NULL; |
612 CFbsBitmap* bitmap = NULL; |
592 CFbsBitmap* mask = NULL; |
613 CFbsBitmap* mask = NULL; |
593 CGulIcon* icon = NULL; |
614 CGulIcon* icon = NULL; |
594 |
615 |
595 // Note that icons can be graphically-skinned (icon graphic defined in theme) |
616 // Note that icons can be graphically-skinned (icon graphic defined in theme) |
596 // or color-skinned (icon colors change depending on background color defined |
617 // or color-skinned (icon colors change depending on background color defined |
597 // in theme). Normal icons are graphically-skinned and indicator icons are |
618 // in theme). Normal icons are graphically-skinned and indicator icons are |
598 // color-skinned. AknsUtils::CreateGulIconL() creates graphically-skinned icons, |
619 // color-skinned. AknsUtils::CreateGulIconL() creates graphically-skinned icons, |
599 // and AknsUtils::CreateColorIconL() creates color-skinned icons. Hence both |
620 // and AknsUtils::CreateColorIconL() creates color-skinned icons. Hence both |
600 // of these functions are used below. |
621 // of these functions are used below. |
601 |
622 |
602 // Icon 0: EAppMngr2IconIndex_QgnIndiAmInstMmcAdd |
623 // Icon 0: EAppMngr2IconIndex_QgnIndiAmInstMmcAdd |
603 // Indicator icon for items stored/installed in memory card |
624 // Indicator icon for items stored/installed in memory card |
604 AknsUtils::CreateColorIconLC( skinInstance, |
625 AknsUtils::CreateColorIconLC( skinInstance, |
605 KAknsIIDQgnIndiMmcAdd, KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, |
626 KAknsIIDQgnIndiMmcAdd, KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, |
606 bitmap, mask, *bitmapFile, |
627 bitmap, mask, *bitmapFile, |
607 EMbmAppmngr2Qgn_indi_mmc_add, |
628 EMbmAppmngr2Qgn_indi_mmc_add, |
608 EMbmAppmngr2Qgn_indi_mmc_add_mask, |
629 EMbmAppmngr2Qgn_indi_mmc_add_mask, |
609 KRgbBlack ); |
630 KRgbBlack ); |
610 icon = CGulIcon::NewL( bitmap, mask ); |
631 icon = CGulIcon::NewL( bitmap, mask ); |
611 icon->SetBitmapsOwnedExternally( EFalse ); |
632 icon->SetBitmapsOwnedExternally( EFalse ); |
614 aIconArray.AppendL( icon ); |
635 aIconArray.AppendL( icon ); |
615 CleanupStack::Pop( icon ); |
636 CleanupStack::Pop( icon ); |
616 |
637 |
617 // Icon 1: EAppMngr2IconIndex_QgnIndiFmgrMsAdd |
638 // Icon 1: EAppMngr2IconIndex_QgnIndiFmgrMsAdd |
618 // Indicator icon for items stored/installed in mass memory |
639 // Indicator icon for items stored/installed in mass memory |
619 AknsUtils::CreateColorIconLC( skinInstance, |
640 AknsUtils::CreateColorIconLC( skinInstance, |
620 KAknsIIDQgnIndiFmgrMsAdd, KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, |
641 KAknsIIDQgnIndiFmgrMsAdd, KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13, |
621 bitmap, mask, *bitmapFile, |
642 bitmap, mask, *bitmapFile, |
622 EMbmAppmngr2Qgn_indi_fmgr_ms_add, |
643 EMbmAppmngr2Qgn_indi_fmgr_ms_add, |
623 EMbmAppmngr2Qgn_indi_fmgr_ms_add_mask, |
644 EMbmAppmngr2Qgn_indi_fmgr_ms_add_mask, |
624 KRgbBlack ); |
645 KRgbBlack ); |
625 icon = CGulIcon::NewL( bitmap, mask ); |
646 icon = CGulIcon::NewL( bitmap, mask ); |
626 icon->SetBitmapsOwnedExternally( EFalse ); |
647 icon->SetBitmapsOwnedExternally( EFalse ); |
631 |
652 |
632 // Icon 2: EAppMngr2IconIndex_QgnPropUnknown |
653 // Icon 2: EAppMngr2IconIndex_QgnPropUnknown |
633 // List icon for items that are not known |
654 // List icon for items that are not known |
634 icon = AknsUtils::CreateGulIconL( skinInstance, |
655 icon = AknsUtils::CreateGulIconL( skinInstance, |
635 KAknsIIDQgnPropUnknown, *bitmapFile, |
656 KAknsIIDQgnPropUnknown, *bitmapFile, |
636 EMbmAppmngr2Qgn_prop_unknown, |
657 EMbmAppmngr2Qgn_prop_unknown, |
637 EMbmAppmngr2Qgn_prop_unknown_mask ); |
658 EMbmAppmngr2Qgn_prop_unknown_mask ); |
638 CleanupStack::PushL( icon ); |
659 CleanupStack::PushL( icon ); |
639 aIconArray.AppendL( icon ); |
660 aIconArray.AppendL( icon ); |
640 CleanupStack::Pop( icon ); |
661 CleanupStack::Pop( icon ); |
641 |
662 |
642 CleanupStack::PopAndDestroy( bitmapFile ); |
663 CleanupStack::PopAndDestroy( bitmapFile ); |
643 |
664 |
644 // Additionally some unknown indicator icon could be defined. |
665 // Additionally some unknown indicator icon could be defined. |
645 // Now, if some plugin gives incorrect index fox indicator icon, |
666 // Now, if some plugin gives incorrect index fox indicator icon, |
646 // then no indicator icon is displayed. |
667 // then no indicator icon is displayed. |
647 } |
668 } |
648 |
669 |
651 // --------------------------------------------------------------------------- |
672 // --------------------------------------------------------------------------- |
652 // |
673 // |
653 void CAppMngr2Model::LoadPluginsL() |
674 void CAppMngr2Model::LoadPluginsL() |
654 { |
675 { |
655 FLOG( "CAppMngr2Model::LoadPluginsL" ); |
676 FLOG( "CAppMngr2Model::LoadPluginsL" ); |
656 |
677 |
657 RImplInfoPtrArray implInfoArray; |
678 RImplInfoPtrArray implInfoArray; |
658 CleanupResetAndDestroyPushL( implInfoArray ); |
679 CleanupResetAndDestroyPushL( implInfoArray ); |
659 REComSession::ListImplementationsL( KAppMngr2PluginInterface, implInfoArray ); |
680 REComSession::ListImplementationsL( KAppMngr2PluginInterface, implInfoArray ); |
660 |
681 |
661 CAppMngr2PluginHolder* pluginHolder = NULL; |
682 CAppMngr2PluginHolder* pluginHolder = NULL; |
745 iScanner->AddDirectoryL( dirName ); |
766 iScanner->AddDirectoryL( dirName ); |
746 } |
767 } |
747 } |
768 } |
748 CleanupStack::PopAndDestroy( &dirsToScan ); |
769 CleanupStack::PopAndDestroy( &dirsToScan ); |
749 } |
770 } |
750 |
771 |
751 // KSWInstallerPackageFolder directory if defined in CenRep |
772 // KSWInstallerPackageFolder directory if defined in CenRep |
752 CRepository* cenrep = CRepository::NewLC( KCRUidSWInstallerLV ); |
773 CRepository* cenrep = CRepository::NewLC( KCRUidSWInstallerLV ); |
753 err = cenrep->Get( KSWInstallerPackageFolder, path ); |
774 err = cenrep->Get( KSWInstallerPackageFolder, path ); |
754 CleanupStack::PopAndDestroy( cenrep ); |
775 CleanupStack::PopAndDestroy( cenrep ); |
755 if( err == KErrNone ) |
776 if( err == KErrNone ) |
778 TChar driveLetter; |
799 TChar driveLetter; |
779 if( RFs::DriveToChar( driveNumber, driveLetter ) == KErrNone ) |
800 if( RFs::DriveToChar( driveNumber, driveLetter ) == KErrNone ) |
780 { |
801 { |
781 TFileName fullPath; |
802 TFileName fullPath; |
782 fullPath.Format( KDriveSpec, static_cast<TUint>( driveLetter ) ); |
803 fullPath.Format( KDriveSpec, static_cast<TUint>( driveLetter ) ); |
783 fullPath.Append( path ); |
804 fullPath.Append( path ); |
784 iScanner->AddDirectoryL( fullPath ); |
805 iScanner->AddDirectoryL( fullPath ); |
785 } |
806 } |
786 } |
807 } |
787 } |
808 } |
788 } |
809 } |
807 // --------------------------------------------------------------------------- |
828 // --------------------------------------------------------------------------- |
808 // |
829 // |
809 void CAppMngr2Model::FetchDataTypesL() |
830 void CAppMngr2Model::FetchDataTypesL() |
810 { |
831 { |
811 FLOG( "CAppMngr2Model::FetchDataTypesL" ); |
832 FLOG( "CAppMngr2Model::FetchDataTypesL" ); |
812 |
833 |
813 TInt pluginCount = iPlugins.Count(); |
834 TInt pluginCount = iPlugins.Count(); |
814 for( TInt pluginIndex = 0; pluginIndex < pluginCount; pluginIndex++ ) |
835 for( TInt pluginIndex = 0; pluginIndex < pluginCount; pluginIndex++ ) |
815 { |
836 { |
816 FLOG( "CAppMngr2Model::FetchDataTypesL: pluginIndex = %d", pluginIndex ); |
837 FLOG( "CAppMngr2Model::FetchDataTypesL: pluginIndex = %d", pluginIndex ); |
817 TRAP_IGNORE( iPlugins[ pluginIndex ]->FetchDataTypesL() ); |
838 TRAP_IGNORE( iPlugins[ pluginIndex ]->FetchDataTypesL() ); |
825 void CAppMngr2Model::CloseInfoMaker( const CAppMngr2InfoMaker& aMaker ) |
846 void CAppMngr2Model::CloseInfoMaker( const CAppMngr2InfoMaker& aMaker ) |
826 { |
847 { |
827 const CAppMngr2InfoMaker* makerToClose = &aMaker; |
848 const CAppMngr2InfoMaker* makerToClose = &aMaker; |
828 for( TInt index = iInfoMakers.Count() - 1; index >= 0; index-- ) |
849 for( TInt index = iInfoMakers.Count() - 1; index >= 0; index-- ) |
829 { |
850 { |
830 CAppMngr2InfoMaker* maker = iInfoMakers[ index ]; |
851 CAppMngr2InfoMaker* maker = iInfoMakers[ index ]; |
831 if( maker == makerToClose ) |
852 if( maker == makerToClose ) |
832 { |
853 { |
833 iInfoMakers.Remove( index ); |
854 iInfoMakers.Remove( index ); |
834 delete maker; |
855 delete maker; |
835 break; |
856 break; |