appinstaller/AppMngr2/src/appmngr2model.cpp
branchRCL_3
changeset 65 7333d7932ef7
parent 19 7ca52d38f8c3
child 66 8b7f4e561641
equal deleted inserted replaced
62:5cc91383ab1e 65:7333d7932ef7
     1 /*
     1 /*
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2009 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, fetching %d",
   229     FLOG( "CAppMngr2Model::StartFetchingInstallationFilesL" );
   230             iFetchingInstallationFiles );
   230     FLOG_PERF_START( FetchInstallationFiles )
   231     if( !iFetchingInstallationFiles )
   231     
   232         {
   232     // Installation files cache must be enabled until scanner has completed.
   233         FLOG_PERF_START( FetchInstallationFiles )
   233     // This ensures that scanner has time to call GetInstallationFilesL() for
   234         iFetchingInstallationFiles = ETrue;
   234     // each plugin and for each directory before the first call completes.
   235 
   235     // If the first call completes before scanner has made all these requets,
   236         // Installation files cache must be enabled until scanner has completed.
   236     // cache will be turned off and partial results are displayed.
   237         // This ensures that scanner has time to call GetInstallationFilesL() for
   237     iInstallationFiles->IncrementCacheUseStartingNewRoundL();
   238         // each plugin and for each directory before the first call completes.
   238 
   239         // If the first call completes before scanner has made all these requets,
   239     iScanner->StartScanningL();
   240         // cache will be turned off and partial results are displayed.
       
   241         iInstallationFiles->IncrementCacheUseStartingNewRoundL();
       
   242 
       
   243         iScanner->StartScanningL();
       
   244         }
       
   245     }
   240     }
   246 
   241 
   247 // ---------------------------------------------------------------------------
   242 // ---------------------------------------------------------------------------
   248 // CAppMngr2Model::StartFetchingInstalledAppsL()
   243 // CAppMngr2Model::StartFetchingInstalledAppsL()
   249 // ---------------------------------------------------------------------------
   244 // ---------------------------------------------------------------------------
   250 //
   245 //
   251 void CAppMngr2Model::StartFetchingInstalledAppsL()
   246 void CAppMngr2Model::StartFetchingInstalledAppsL()
   252     {
   247     {
   253     FLOG( "CAppMngr2Model::StartFetchingInstalledAppsL, fetching %d",
   248     FLOG( "CAppMngr2Model::StartFetchingInstalledAppsL" );
   254             iFetchingInstalledApps );
   249     FLOG_PERF_START( FetchInstalledApps )
   255     if( !iFetchingInstalledApps )
   250 
   256         {
   251     // Additional cache increment to ensure that iInstalledApps cache is
   257         FLOG_PERF_START( FetchInstalledApps )
   252     // used until GetInstalledAppsL() function is called for each plugin.
   258         iFetchingInstalledApps = ETrue;
   253     // Without this, the fastest plugin might get it's list complete before
   259 
   254     // other IncrementCacheUseL() calls and iInstalledApps would display
   260         // Additional cache increment to ensure that iInstalledApps cache is
   255     // partial list.
   261         // used until GetInstalledAppsL() function is called for each plugin.
   256     iInstalledApps->IncrementCacheUseStartingNewRoundL();
   262         // Without this, the fastest plugin might get it's list complete before
   257     
   263         // other IncrementCacheUseL() calls and iInstalledApps would display
   258     TInt pluginCount = iPlugins.Count();
   264         // partial list.
   259     for( TInt pluginIndex = 0; pluginIndex < pluginCount; pluginIndex++ )
   265         iInstalledApps->IncrementCacheUseStartingNewRoundL();
   260         {
   266 
   261         CAppMngr2AppInfoMaker* appInfoMaker = CAppMngr2AppInfoMaker::NewLC(
   267         TInt pluginCount = iPlugins.Count();
   262                 iPlugins[ pluginIndex ]->Runtime(), *this, iFs );
   268         for( TInt pluginIndex = 0; pluginIndex < pluginCount; pluginIndex++ )
   263         
   269             {
   264         TRAPD( err, appInfoMaker->StartGettingInstalledAppsL() );
   270             CAppMngr2AppInfoMaker* appInfoMaker = CAppMngr2AppInfoMaker::NewLC(
   265         FLOG( "CAppMngr2Model::StartFetchingInstalledAppsL, plugin 0x%08x, err = %d",
   271                     iPlugins[ pluginIndex ]->Runtime(), *this, iFs );
   266                 iPlugins[ pluginIndex ]->Runtime().RuntimeUid().iUid, err );
   272 
   267         if( err == KErrNone )
   273             TRAPD( err, appInfoMaker->StartGettingInstalledAppsL() );
   268             {
   274             FLOG( "CAppMngr2Model::StartFetchingInstalledAppsL, plugin 0x%08x, err = %d",
   269             iInfoMakers.AppendL( appInfoMaker );
   275                     iPlugins[ pluginIndex ]->Runtime().RuntimeUid().iUid, err );
   270             CleanupStack::Pop( appInfoMaker );
   276             if( err == KErrNone )
   271             iInstalledApps->IncrementCacheUseL();
   277                 {
   272             }
   278                 iInfoMakers.AppendL( appInfoMaker );
   273         else
   279                 CleanupStack::Pop( appInfoMaker );
   274             {
   280                 iInstalledApps->IncrementCacheUseL();
   275             CleanupStack::PopAndDestroy( appInfoMaker );
   281                 }
   276             }
   282             else
   277         }
   283                 {
   278 
   284                 CleanupStack::PopAndDestroy( appInfoMaker );
   279     // All GetInstalledAppsL() requests have been issued
   285                 }
   280     iInstalledApps->DecrementCacheUse();
   286             }
       
   287 
       
   288         // All GetInstalledAppsL() requests have been issued
       
   289         iInstalledApps->DecrementCacheUse();
       
   290         }
       
   291     }
       
   292 
       
   293 // ---------------------------------------------------------------------------
       
   294 // CAppMngr2Model::IsUninstall()
       
   295 // ---------------------------------------------------------------------------
       
   296 //
       
   297 TBool CAppMngr2Model::IsUninstall()
       
   298     {       
       
   299     if ( iActiveCommand == EAppMngr2CmdUninstall )
       
   300         {
       
   301         FLOG( "CAppMngr2Model::IsUninstall: ETrue" );
       
   302         return ETrue;
       
   303         }   
       
   304     FLOG( "CAppMngr2Model::IsUninstall: EFalse" );
       
   305     return EFalse;    
       
   306     }
   281     }
   307 
   282 
   308 // ---------------------------------------------------------------------------
   283 // ---------------------------------------------------------------------------
   309 // CAppMngr2Model::DoCancel()
   284 // CAppMngr2Model::DoCancel()
   310 // ---------------------------------------------------------------------------
   285 // ---------------------------------------------------------------------------
   311 //
   286 //
   312 void CAppMngr2Model::DoCancel()
   287 void CAppMngr2Model::DoCancel()
   313     {
   288     {
   314     FLOG( "CAppMngr2Model::DoCancel, iActiveItem = 0x%08x", iActiveItem );
   289     FLOG( "CAppMngr2Model::DoCancel, iActiveItem = 0x%08x", iActiveItem );
   315 
   290     
   316     if( iActiveItem )
   291     if( iActiveItem )
   317         {
   292         {
   318         iActiveItem->CancelCommand();
   293         iActiveItem->CancelCommand();
   319         iActiveItem = NULL;
   294         iActiveItem = NULL;
   320         if( !iClosing )
   295         if( !iClosing )
   347         iInstalledApps->EnableRefreshNotificationsL();
   322         iInstalledApps->EnableRefreshNotificationsL();
   348         iInstallationFiles->EnableRefreshNotificationsL();
   323         iInstallationFiles->EnableRefreshNotificationsL();
   349 
   324 
   350         // Leave on error. This displays error note (if error notes are enabled).
   325         // Leave on error. This displays error note (if error notes are enabled).
   351         User::LeaveIfError( err );
   326         User::LeaveIfError( err );
   352 
   327         
   353         // If the command is EAppMngr2CmdUninstall or EAppMngr2CmdRemove, and it
   328         // If the command is EAppMngr2CmdUninstall or EAppMngr2CmdRemove, and it
   354         // completed without errors, then we remove the current item immediatelty
   329         // completed without errors, then we remove the current item immediatelty
   355         // from the displayed list. Otherwise it may take quite long time until
   330         // from the displayed list. Otherwise it may take quite long time until
   356         // the item is removed from the UI, and in worst case it may not be removed
   331         // the item is removed from the UI, and in worst case it may not be removed
   357         // at all.
   332         // at all.
   378 // ---------------------------------------------------------------------------
   353 // ---------------------------------------------------------------------------
   379 //
   354 //
   380 void CAppMngr2Model::RefreshInstalledApps()
   355 void CAppMngr2Model::RefreshInstalledApps()
   381     {
   356     {
   382     FLOG( "CAppMngr2Model::RefreshInstalledApps" );
   357     FLOG( "CAppMngr2Model::RefreshInstalledApps" );
   383 
   358     
   384     TRAP_IGNORE( StartFetchingInstalledAppsL() );
   359     TRAP_IGNORE( StartFetchingInstalledAppsL() );
   385     }
   360     }
   386 
   361 
   387 // ---------------------------------------------------------------------------
   362 // ---------------------------------------------------------------------------
   388 // CAppMngr2Model::RefreshInstallationFiles()
   363 // CAppMngr2Model::RefreshInstallationFiles()
   400 // ---------------------------------------------------------------------------
   375 // ---------------------------------------------------------------------------
   401 //
   376 //
   402 void CAppMngr2Model::ScanningResultL( RPointerArray<CAppMngr2RecognizedFile>& aResult )
   377 void CAppMngr2Model::ScanningResultL( RPointerArray<CAppMngr2RecognizedFile>& aResult )
   403     {
   378     {
   404     FLOG( "CAppMngr2Model::ScanningResultL, begin: aResult.Count() = %d", aResult.Count() );
   379     FLOG( "CAppMngr2Model::ScanningResultL, begin: aResult.Count() = %d", aResult.Count() );
   405 
   380     
   406     // Split recognition result array into smaller (plugin specific) arrays. Plugin
   381     // Split recognition result array into smaller (plugin specific) arrays. Plugin
   407     // specific arrays are maintained by CAppMngr2PackageInfoMaker objects, so one
   382     // specific arrays are maintained by CAppMngr2PackageInfoMaker objects, so one
   408     // CAppMngr2PackageInfoMaker object is needed for each plugin that has recognized
   383     // CAppMngr2PackageInfoMaker object is needed for each plugin that has recognized
   409     // files.
   384     // files.
   410     TInt pluginCount = iPlugins.Count();
   385     TInt pluginCount = iPlugins.Count();
   447 // ---------------------------------------------------------------------------
   422 // ---------------------------------------------------------------------------
   448 //
   423 //
   449 void CAppMngr2Model::ScanningComplete()
   424 void CAppMngr2Model::ScanningComplete()
   450     {
   425     {
   451     FLOG( "CAppMngr2Model::ScanningComplete" );
   426     FLOG( "CAppMngr2Model::ScanningComplete" );
   452 
   427     
   453     iInstallationFiles->DecrementCacheUse();
   428     iInstallationFiles->DecrementCacheUse();
   454     }
   429     }
   455 
   430 
   456 // ---------------------------------------------------------------------------
   431 // ---------------------------------------------------------------------------
   457 // CAppMngr2Model::DirectoryChangedL()
   432 // CAppMngr2Model::DirectoryChangedL()
   458 // ---------------------------------------------------------------------------
   433 // ---------------------------------------------------------------------------
   459 //
   434 //
   460 void CAppMngr2Model::DirectoryChangedL( const TDesC& /*aChangedDir*/ )
   435 void CAppMngr2Model::DirectoryChangedL( const TDesC& /*aChangedDir*/ )
   461     {
   436     {
   462     FLOG( "CAppMngr2Model::DirectoryChangedL" );
   437     FLOG( "CAppMngr2Model::DirectoryChangedL" );
   463 
   438     
   464     // This might be improved by scanning the changed directory only. Model
   439     // This might be improved by scanning the changed directory only. Model
   465     // could record which items are got from which directory, so that it could
   440     // could record which items are got from which directory, so that it could
   466     // remove those items that were created from the changed directory and
   441     // remove those items that were created from the changed directory and
   467     // re-scan only the changed directory. Scanner should also support
   442     // re-scan only the changed directory. Scanner should also support
   468     // scanning one directory only. Now, we just scan all again.
   443     // scanning one directory only. Now, we just scan all again.
   474 // ---------------------------------------------------------------------------
   449 // ---------------------------------------------------------------------------
   475 //
   450 //
   476 void CAppMngr2Model::HandleAppListEvent( TInt /*aEvent*/ )
   451 void CAppMngr2Model::HandleAppListEvent( TInt /*aEvent*/ )
   477     {
   452     {
   478     FLOG( "CAppMngr2Model::HandleAppListEvent" );
   453     FLOG( "CAppMngr2Model::HandleAppListEvent" );
   479 
   454     
   480     TRAP_IGNORE( StartFetchingInstalledAppsL() );
   455     TRAP_IGNORE( StartFetchingInstalledAppsL() );
   481     }
   456     }
   482 
   457 
   483 // ---------------------------------------------------------------------------
   458 // ---------------------------------------------------------------------------
   484 // CAppMngr2Model::NewAppsCreatedL()
   459 // CAppMngr2Model::NewAppsCreatedL()
   487 void CAppMngr2Model::NewAppsCreatedL( const CAppMngr2InfoMaker& aMaker,
   462 void CAppMngr2Model::NewAppsCreatedL( const CAppMngr2InfoMaker& aMaker,
   488         RPointerArray<CAppMngr2AppInfo>& aAppInfos )
   463         RPointerArray<CAppMngr2AppInfo>& aAppInfos )
   489     {
   464     {
   490     FLOG( "CAppMngr2Model::NewAppsCreatedL, plugin 0x%08x: packageCount = %d",
   465     FLOG( "CAppMngr2Model::NewAppsCreatedL, plugin 0x%08x: packageCount = %d",
   491             aMaker.RuntimeUid().iUid, aAppInfos.Count() );
   466             aMaker.RuntimeUid().iUid, aAppInfos.Count() );
   492 
   467     
   493     iInstalledApps->AddItemsInOrderL( aAppInfos );
   468     iInstalledApps->AddItemsInOrderL( aAppInfos );
   494     iInstalledApps->DecrementCacheUse();
   469     iInstalledApps->DecrementCacheUse();
   495     CloseInfoMaker( aMaker );
   470     CloseInfoMaker( aMaker );
   496     }
   471     }
   497 
   472 
   506         TInt /*aError*/ )
   481         TInt /*aError*/ )
   507 #endif
   482 #endif
   508     {
   483     {
   509     FLOG( "CAppMngr2Model::ErrorInCreatingAppsL, plugin 0x%08x: error = %d",
   484     FLOG( "CAppMngr2Model::ErrorInCreatingAppsL, plugin 0x%08x: error = %d",
   510             aMaker.RuntimeUid().iUid, aError );
   485             aMaker.RuntimeUid().iUid, aError );
   511 
   486     
   512     iInstalledApps->DecrementCacheUse();
   487     iInstalledApps->DecrementCacheUse();
   513     CloseInfoMaker( aMaker );
   488     CloseInfoMaker( aMaker );
   514     }
   489     }
   515 
   490 
   516 // ---------------------------------------------------------------------------
   491 // ---------------------------------------------------------------------------
   520 void CAppMngr2Model::NewPackagesCreatedL( const CAppMngr2InfoMaker& aMaker,
   495 void CAppMngr2Model::NewPackagesCreatedL( const CAppMngr2InfoMaker& aMaker,
   521             RPointerArray<CAppMngr2PackageInfo>& aPackageInfos )
   496             RPointerArray<CAppMngr2PackageInfo>& aPackageInfos )
   522     {
   497     {
   523     FLOG( "CAppMngr2Model::NewPackagesCreatedL, plugin 0x%08x: packageCount = %d",
   498     FLOG( "CAppMngr2Model::NewPackagesCreatedL, plugin 0x%08x: packageCount = %d",
   524             aMaker.RuntimeUid().iUid, aPackageInfos.Count() );
   499             aMaker.RuntimeUid().iUid, aPackageInfos.Count() );
   525 
   500     
   526     iInstallationFiles->AddItemsInOrderL( aPackageInfos );
   501     iInstallationFiles->AddItemsInOrderL( aPackageInfos );
   527     iInstallationFiles->DecrementCacheUse();
   502     iInstallationFiles->DecrementCacheUse();
   528     CloseInfoMaker( aMaker );
   503     CloseInfoMaker( aMaker );
   529     }
   504     }
   530 
   505 
   539         TInt /*aError*/ )
   514         TInt /*aError*/ )
   540 #endif
   515 #endif
   541     {
   516     {
   542     FLOG( "CAppMngr2Model::ErrorInCreatingPackagesL, plugin 0x%08x: error = %d",
   517     FLOG( "CAppMngr2Model::ErrorInCreatingPackagesL, plugin 0x%08x: error = %d",
   543             aMaker.RuntimeUid().iUid, aError );
   518             aMaker.RuntimeUid().iUid, aError );
   544 
   519     
   545     iInstallationFiles->DecrementCacheUse();
   520     iInstallationFiles->DecrementCacheUse();
   546     CloseInfoMaker( aMaker );
   521     CloseInfoMaker( aMaker );
   547     }
   522     }
   548 
   523 
   549 // ---------------------------------------------------------------------------
   524 // ---------------------------------------------------------------------------
   551 // ---------------------------------------------------------------------------
   526 // ---------------------------------------------------------------------------
   552 //
   527 //
   553 void CAppMngr2Model::ArrayContentChanged( CAppMngr2InfoArray* aArray,
   528 void CAppMngr2Model::ArrayContentChanged( CAppMngr2InfoArray* aArray,
   554         TInt aMoreRefreshesExpected )
   529         TInt aMoreRefreshesExpected )
   555     {
   530     {
   556     FLOG( "CAppMngr2Model::ArrayContentChanged, more = %d", aMoreRefreshesExpected );
       
   557     if( aArray == iInstalledApps )
   531     if( aArray == iInstalledApps )
   558         {
   532         {
   559         FLOG_PERF_STOP( FetchInstalledApps )
   533         FLOG_PERF_STOP( FetchInstalledApps )
   560         FLOG_PERF_PRINT( FetchInstalledApps )
   534         FLOG_PERF_PRINT( FetchInstalledApps )
   561         iObs.InstalledAppsChanged( aMoreRefreshesExpected );
   535         iObs.InstalledAppsChanged( aMoreRefreshesExpected );
   562         if( !aMoreRefreshesExpected )
       
   563             {
       
   564             FLOG( "CAppMngr2Model::ArrayContentChanged: StartFetchingInstalledAppsL done" );
       
   565             iFetchingInstalledApps = EFalse;
       
   566             }
       
   567         }
   536         }
   568     if( aArray == iInstallationFiles )
   537     if( aArray == iInstallationFiles )
   569         {
   538         {
   570         FLOG_PERF_STOP( FetchInstallationFiles )
   539         FLOG_PERF_STOP( FetchInstallationFiles )
   571         FLOG_PERF_PRINT( FetchInstallationFiles )
   540         FLOG_PERF_PRINT( FetchInstallationFiles )
   572         iObs.InstallationFilesChanged( aMoreRefreshesExpected );
   541         iObs.InstallationFilesChanged( aMoreRefreshesExpected );
   573         if( !aMoreRefreshesExpected )
       
   574             {
       
   575             FLOG( "CAppMngr2Model::ArrayContentChanged: StartFetchingInstallationFilesL done" );
       
   576             iFetchingInstallationFiles = EFalse;
       
   577             }
       
   578         }
   542         }
   579     }
   543     }
   580 
   544 
   581 // ---------------------------------------------------------------------------
   545 // ---------------------------------------------------------------------------
   582 // CAppMngr2Model::CAppMngr2Model()
   546 // CAppMngr2Model::CAppMngr2Model()
   597     FLOG( "CAppMngr2Model::ConstructL" );
   561     FLOG( "CAppMngr2Model::ConstructL" );
   598     iClosing = EFalse;
   562     iClosing = EFalse;
   599 
   563 
   600     iInstalledApps = CAppMngr2AppInfoArray::NewL( *this );
   564     iInstalledApps = CAppMngr2AppInfoArray::NewL( *this );
   601     iInstallationFiles = CAppMngr2PackageInfoArray::NewL( *this );
   565     iInstallationFiles = CAppMngr2PackageInfoArray::NewL( *this );
   602 
   566     
   603     FLOG_PERF_STATIC_BEGIN( LoadPluginsL )
   567     FLOG_PERF_STATIC_BEGIN( LoadPluginsL )
   604     LoadPluginsL();
   568     LoadPluginsL();
   605     FLOG_PERF_STATIC_END( LoadPluginsL )
   569     FLOG_PERF_STATIC_END( LoadPluginsL )
   606     FLOG_PERF_STATIC_BEGIN( CreateScannerL )
   570     FLOG_PERF_STATIC_BEGIN( CreateScannerL )
   607     CreateScannerL();
   571     CreateScannerL();
   619 // ---------------------------------------------------------------------------
   583 // ---------------------------------------------------------------------------
   620 //
   584 //
   621 void CAppMngr2Model::LoadDefaultIconsL( CAknIconArray& aIconArray )
   585 void CAppMngr2Model::LoadDefaultIconsL( CAknIconArray& aIconArray )
   622     {
   586     {
   623     FLOG( "CAppMngr2Model::LoadDefaultIconsL" );
   587     FLOG( "CAppMngr2Model::LoadDefaultIconsL" );
   624 
   588     
   625     MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
   589     MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
   626     HBufC* bitmapFile = TAppMngr2DriveUtils::FullBitmapFileNameLC( KAppMngr2BitmapFile, iFs );
   590     HBufC* bitmapFile = TAppMngr2DriveUtils::FullBitmapFileNameLC( KAppMngr2BitmapFile, iFs );
   627     CFbsBitmap* bitmap = NULL;
   591     CFbsBitmap* bitmap = NULL;
   628     CFbsBitmap* mask = NULL;
   592     CFbsBitmap* mask = NULL;
   629     CGulIcon* icon = NULL;
   593     CGulIcon* icon = NULL;
   630 
   594     
   631     // Note that icons can be graphically-skinned (icon graphic defined in theme)
   595     // Note that icons can be graphically-skinned (icon graphic defined in theme)
   632     // or color-skinned (icon colors change depending on background color defined
   596     // or color-skinned (icon colors change depending on background color defined
   633     // in theme). Normal icons are graphically-skinned and indicator icons are
   597     // in theme). Normal icons are graphically-skinned and indicator icons are
   634     // color-skinned. AknsUtils::CreateGulIconL() creates graphically-skinned icons,
   598     // color-skinned. AknsUtils::CreateGulIconL() creates graphically-skinned icons,
   635     // and AknsUtils::CreateColorIconL() creates color-skinned icons. Hence both
   599     // and AknsUtils::CreateColorIconL() creates color-skinned icons. Hence both
   636     // of these functions are used below.
   600     // of these functions are used below.
   637 
   601 
   638     // Icon 0: EAppMngr2IconIndex_QgnIndiAmInstMmcAdd
   602     // Icon 0: EAppMngr2IconIndex_QgnIndiAmInstMmcAdd
   639     // Indicator icon for items stored/installed in memory card
   603     // Indicator icon for items stored/installed in memory card
   640     AknsUtils::CreateColorIconLC( skinInstance,
   604     AknsUtils::CreateColorIconLC( skinInstance, 
   641             KAknsIIDQgnIndiMmcAdd, KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13,
   605             KAknsIIDQgnIndiMmcAdd, KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13,
   642             bitmap, mask, *bitmapFile,
   606             bitmap, mask, *bitmapFile, 
   643             EMbmAppmngr2Qgn_indi_mmc_add,
   607             EMbmAppmngr2Qgn_indi_mmc_add,
   644             EMbmAppmngr2Qgn_indi_mmc_add_mask,
   608             EMbmAppmngr2Qgn_indi_mmc_add_mask,
   645             KRgbBlack );
   609             KRgbBlack );
   646     icon = CGulIcon::NewL( bitmap, mask );
   610     icon = CGulIcon::NewL( bitmap, mask );
   647     icon->SetBitmapsOwnedExternally( EFalse );
   611     icon->SetBitmapsOwnedExternally( EFalse );
   650     aIconArray.AppendL( icon );
   614     aIconArray.AppendL( icon );
   651     CleanupStack::Pop( icon );
   615     CleanupStack::Pop( icon );
   652 
   616 
   653     // Icon 1: EAppMngr2IconIndex_QgnIndiFmgrMsAdd
   617     // Icon 1: EAppMngr2IconIndex_QgnIndiFmgrMsAdd
   654     // Indicator icon for items stored/installed in mass memory
   618     // Indicator icon for items stored/installed in mass memory
   655     AknsUtils::CreateColorIconLC( skinInstance,
   619     AknsUtils::CreateColorIconLC( skinInstance, 
   656             KAknsIIDQgnIndiFmgrMsAdd, KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13,
   620             KAknsIIDQgnIndiFmgrMsAdd, KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13,
   657             bitmap, mask, *bitmapFile,
   621             bitmap, mask, *bitmapFile, 
   658             EMbmAppmngr2Qgn_indi_fmgr_ms_add,
   622             EMbmAppmngr2Qgn_indi_fmgr_ms_add,
   659             EMbmAppmngr2Qgn_indi_fmgr_ms_add_mask,
   623             EMbmAppmngr2Qgn_indi_fmgr_ms_add_mask,
   660             KRgbBlack );
   624             KRgbBlack );
   661     icon = CGulIcon::NewL( bitmap, mask );
   625     icon = CGulIcon::NewL( bitmap, mask );
   662     icon->SetBitmapsOwnedExternally( EFalse );
   626     icon->SetBitmapsOwnedExternally( EFalse );
   667 
   631 
   668     // Icon 2: EAppMngr2IconIndex_QgnPropUnknown
   632     // Icon 2: EAppMngr2IconIndex_QgnPropUnknown
   669     // List icon for items that are not known
   633     // List icon for items that are not known
   670     icon = AknsUtils::CreateGulIconL( skinInstance,
   634     icon = AknsUtils::CreateGulIconL( skinInstance,
   671             KAknsIIDQgnPropUnknown, *bitmapFile,
   635             KAknsIIDQgnPropUnknown, *bitmapFile,
   672             EMbmAppmngr2Qgn_prop_unknown,
   636             EMbmAppmngr2Qgn_prop_unknown, 
   673             EMbmAppmngr2Qgn_prop_unknown_mask );
   637             EMbmAppmngr2Qgn_prop_unknown_mask );
   674     CleanupStack::PushL( icon );
   638     CleanupStack::PushL( icon );
   675     aIconArray.AppendL( icon );
   639     aIconArray.AppendL( icon );
   676     CleanupStack::Pop( icon );
   640     CleanupStack::Pop( icon );
   677 
   641 
   678     CleanupStack::PopAndDestroy( bitmapFile );
   642     CleanupStack::PopAndDestroy( bitmapFile );
   679 
   643     
   680     // Additionally some unknown indicator icon could be defined.
   644     // Additionally some unknown indicator icon could be defined.
   681     // Now, if some plugin gives incorrect index fox indicator icon,
   645     // Now, if some plugin gives incorrect index fox indicator icon,
   682     // then no indicator icon is displayed.
   646     // then no indicator icon is displayed.
   683     }
   647     }
   684 
   648 
   687 // ---------------------------------------------------------------------------
   651 // ---------------------------------------------------------------------------
   688 //
   652 //
   689 void CAppMngr2Model::LoadPluginsL()
   653 void CAppMngr2Model::LoadPluginsL()
   690     {
   654     {
   691     FLOG( "CAppMngr2Model::LoadPluginsL" );
   655     FLOG( "CAppMngr2Model::LoadPluginsL" );
   692 
   656     
   693     RImplInfoPtrArray implInfoArray;
   657     RImplInfoPtrArray implInfoArray;
   694     CleanupResetAndDestroyPushL( implInfoArray  );
   658     CleanupResetAndDestroyPushL( implInfoArray  );
   695     REComSession::ListImplementationsL( KAppMngr2PluginInterface, implInfoArray );
   659     REComSession::ListImplementationsL( KAppMngr2PluginInterface, implInfoArray );
   696 
   660 
   697     CAppMngr2PluginHolder* pluginHolder = NULL;
   661     CAppMngr2PluginHolder* pluginHolder = NULL;
   781                 iScanner->AddDirectoryL( dirName );
   745                 iScanner->AddDirectoryL( dirName );
   782                 }
   746                 }
   783             }
   747             }
   784         CleanupStack::PopAndDestroy( &dirsToScan );
   748         CleanupStack::PopAndDestroy( &dirsToScan );
   785         }
   749         }
   786 
   750     
   787     // KSWInstallerPackageFolder directory if defined in CenRep
   751     // KSWInstallerPackageFolder directory if defined in CenRep
   788     CRepository* cenrep = CRepository::NewLC( KCRUidSWInstallerLV );
   752     CRepository* cenrep = CRepository::NewLC( KCRUidSWInstallerLV );
   789     err = cenrep->Get( KSWInstallerPackageFolder, path );
   753     err = cenrep->Get( KSWInstallerPackageFolder, path );
   790     CleanupStack::PopAndDestroy( cenrep );
   754     CleanupStack::PopAndDestroy( cenrep );
   791     if( err == KErrNone )
   755     if( err == KErrNone )
   814                             TChar driveLetter;
   778                             TChar driveLetter;
   815                             if( RFs::DriveToChar( driveNumber, driveLetter ) == KErrNone )
   779                             if( RFs::DriveToChar( driveNumber, driveLetter ) == KErrNone )
   816                                 {
   780                                 {
   817                                 TFileName fullPath;
   781                                 TFileName fullPath;
   818                                 fullPath.Format( KDriveSpec, static_cast<TUint>( driveLetter ) );
   782                                 fullPath.Format( KDriveSpec, static_cast<TUint>( driveLetter ) );
   819                                 fullPath.Append( path );
   783                                 fullPath.Append( path ); 
   820                                 iScanner->AddDirectoryL( fullPath );
   784                                 iScanner->AddDirectoryL( fullPath );
   821                                 }
   785                                 }
   822                             }
   786                             }
   823                         }
   787                         }
   824                     }
   788                     }
   843 // ---------------------------------------------------------------------------
   807 // ---------------------------------------------------------------------------
   844 //
   808 //
   845 void CAppMngr2Model::FetchDataTypesL()
   809 void CAppMngr2Model::FetchDataTypesL()
   846     {
   810     {
   847     FLOG( "CAppMngr2Model::FetchDataTypesL" );
   811     FLOG( "CAppMngr2Model::FetchDataTypesL" );
   848 
   812     
   849     TInt pluginCount = iPlugins.Count();
   813     TInt pluginCount = iPlugins.Count();
   850     for( TInt pluginIndex = 0; pluginIndex < pluginCount; pluginIndex++ )
   814     for( TInt pluginIndex = 0; pluginIndex < pluginCount; pluginIndex++ )
   851         {
   815         {
   852         FLOG( "CAppMngr2Model::FetchDataTypesL: pluginIndex = %d", pluginIndex );
   816         FLOG( "CAppMngr2Model::FetchDataTypesL: pluginIndex = %d", pluginIndex );
   853         TRAP_IGNORE( iPlugins[ pluginIndex ]->FetchDataTypesL() );
   817         TRAP_IGNORE( iPlugins[ pluginIndex ]->FetchDataTypesL() );
   861 void CAppMngr2Model::CloseInfoMaker( const CAppMngr2InfoMaker& aMaker )
   825 void CAppMngr2Model::CloseInfoMaker( const CAppMngr2InfoMaker& aMaker )
   862     {
   826     {
   863     const CAppMngr2InfoMaker* makerToClose = &aMaker;
   827     const CAppMngr2InfoMaker* makerToClose = &aMaker;
   864     for( TInt index = iInfoMakers.Count() - 1; index >= 0; index-- )
   828     for( TInt index = iInfoMakers.Count() - 1; index >= 0; index-- )
   865         {
   829         {
   866         CAppMngr2InfoMaker* maker = iInfoMakers[ index ];
   830         CAppMngr2InfoMaker* maker = iInfoMakers[ index ]; 
   867         if( maker == makerToClose )
   831         if( maker == makerToClose )
   868             {
   832             {
   869             iInfoMakers.Remove( index );
   833             iInfoMakers.Remove( index );
   870             delete maker;
   834             delete maker;
   871             break;
   835             break;