contentstorage/casrv/causifscanner/src/causifscanner.cpp
changeset 115 3ab5c078b490
parent 109 e0aa398e6810
child 116 305818acdca4
equal deleted inserted replaced
109:e0aa398e6810 115:3ab5c078b490
   192     CleanupResetAndDestroyPushL( resultUsifArray );
   192     CleanupResetAndDestroyPushL( resultUsifArray );
   193     GetUsifPackageEntriesL( resultUsifArray );
   193     GetUsifPackageEntriesL( resultUsifArray );
   194 
   194 
   195     for( TInt i(0); i < resultUsifArray.Count(); i++ )
   195     for( TInt i(0); i < resultUsifArray.Count(); i++ )
   196         {
   196         {
   197         if( PackageExists( entries, resultUsifArray[i] ) == KErrNotFound )
   197         TInt entryIndex = PackageExists( entries, resultUsifArray[i]);
       
   198         // entry is not present in CaStorage
       
   199         if( entryIndex == KErrNotFound )
   198             {
   200             {
   199             CCaInnerEntry *caEntry = CCaInnerEntry::NewLC();
   201             CCaInnerEntry *caEntry = CCaInnerEntry::NewLC();
   200             CreateCaEntryFromEntryL( resultUsifArray[i], caEntry );
   202             CreateCaEntryFromEntryL( resultUsifArray[i], caEntry );
       
   203             // in case we rebuild our db mark as missing
       
   204             if( !(iSoftwareRegistry.IsComponentPresentL( 
       
   205                     resultUsifArray[i]->ComponentId())) )
       
   206                 {
       
   207                 caEntry->SetFlags( caEntry->GetFlags() | EMissing );
       
   208                 }
   201             iStorageProxy.AddL( caEntry );
   209             iStorageProxy.AddL( caEntry );
   202             CleanupStack::PopAndDestroy( caEntry );
   210             CleanupStack::PopAndDestroy( caEntry );
       
   211             } 
       
   212         // found in the CaStorage, mark is as missing
       
   213         else if( !(iSoftwareRegistry.IsComponentPresentL( 
       
   214                 resultUsifArray[i]->ComponentId() ))  ) 
       
   215             {
       
   216             if( !( entries[entryIndex]->GetFlags() & EMissing ) )
       
   217                 {
       
   218                 entries[entryIndex]->SetFlags( 
       
   219                         ( entries[entryIndex]->GetFlags() | EMissing ) );
       
   220                 iStorageProxy.AddL( 
       
   221                         entries[entryIndex], EFalse, EItemDisappeared );
       
   222                 }
       
   223             }
       
   224         // found in the storage remove missing flag as this is Present in scr
       
   225         else if (entries[entryIndex]->GetFlags() & EMissing)
       
   226             {
       
   227             entries[entryIndex]->SetFlags( 
       
   228                     entries[entryIndex]->GetFlags() & ~EMissing );
       
   229             iStorageProxy.AddL( entries[entryIndex]);            
   203             }
   230             }
   204         }
   231         }
   205 
   232 
   206     CleanupStack::PopAndDestroy( &resultUsifArray );
   233     CleanupStack::PopAndDestroy( &resultUsifArray );
   207     CleanupStack::PopAndDestroy( &entries );
   234     CleanupStack::PopAndDestroy( &entries );
   266     // Iterate over the matching components
   293     // Iterate over the matching components
   267     //The ownership is transferred to the calling client.
   294     //The ownership is transferred to the calling client.
   268     while( CComponentEntry* entry = scrView.NextComponentL() )
   295     while( CComponentEntry* entry = scrView.NextComponentL() )
   269         {
   296         {
   270         CleanupStack::PushL( entry );
   297         CleanupStack::PushL( entry );
   271         if( iSoftwareRegistry.IsComponentPresentL( entry->ComponentId() ) )
   298         aArray.AppendL( entry );
   272             {
   299         CleanupStack::Pop( entry );
   273             aArray.AppendL( entry );
       
   274             CleanupStack::Pop( entry );
       
   275             }
       
   276         else
       
   277             {
       
   278             CleanupStack::PopAndDestroy( entry );
       
   279             }
       
   280         }
   300         }
   281     CleanupStack::PopAndDestroy( &scrView );
   301     CleanupStack::PopAndDestroy( &scrView );
   282     CleanupStack::PopAndDestroy( filter );
   302     CleanupStack::PopAndDestroy( filter );
   283     }
   303     }
   284 
   304 
   323             TUint uint( 0 );
   343             TUint uint( 0 );
   324             User::LeaveIfError( lex.Val( uint ) );
   344             User::LeaveIfError( lex.Val( uint ) );
   325             //for each usif entry check if entry has to be removed
   345             //for each usif entry check if entry has to be removed
   326             for( TInt k( 0 ); k < aUsifArray.Count(); k++ )
   346             for( TInt k( 0 ); k < aUsifArray.Count(); k++ )
   327                 {
   347                 {
   328                 if( aUsifArray[k]->ComponentId() == uint
   348                 if( aUsifArray[k]->ComponentId() == uint)
   329                         && iSoftwareRegistry.IsComponentPresentL( uint ) )
       
   330                     {
   349                     {
   331                     delete aCaArray[i];
   350                     delete aCaArray[i];
   332                     aCaArray.Remove( i );
   351                     aCaArray.Remove( i );
   333                     break;
   352                     break;
   334                     }
   353                     }