contentstorage/casrv/causifscanner/src/causifscanner.cpp
changeset 124 e36b2f4799c0
parent 121 0b3699f6c654
child 125 26079c1bb561
equal deleted inserted replaced
121:0b3699f6c654 124:e36b2f4799c0
    56 //
    56 //
    57 // ---------------------------------------------------------------------------
    57 // ---------------------------------------------------------------------------
    58 //
    58 //
    59 void CCaUsifScanner::ConstructL()
    59 void CCaUsifScanner::ConstructL()
    60     {
    60     {
    61     iSystemInstallNotifier = CCaInstallNotifier::NewL( *this,
    61     iInstallNotifier = CCaInstallNotifier::NewL( *this );
    62             CCaInstallNotifier::ESisInstallNotification );
       
    63 
       
    64     iUsifUninstallNotifier = CCaInstallNotifier::NewL( *this,
       
    65             CCaInstallNotifier::EUsifUninstallNotification );
       
    66 
       
    67     iJavaInstallNotifier = CCaInstallNotifier::NewL( *this,
       
    68                 CCaInstallNotifier::EJavaInstallNotification );
       
    69 
    62 
    70     User::LeaveIfError( iFs.Connect() );
    63     User::LeaveIfError( iFs.Connect() );
    71     iMmcWatcher = CCaMmcWatcher::NewL( iFs, this );
    64     iMmcWatcher = CCaMmcWatcher::NewL( iFs, this );
    72 
    65 
    73     UpdateUsifListL();
    66     UpdateUsifListL();
    79 //
    72 //
    80 CCaUsifScanner::~CCaUsifScanner()
    73 CCaUsifScanner::~CCaUsifScanner()
    81     {
    74     {
    82     delete iMmcWatcher;
    75     delete iMmcWatcher;
    83     iFs.Close();
    76     iFs.Close();
    84     delete iJavaInstallNotifier;
    77     delete iInstallNotifier;
    85     delete iUsifUninstallNotifier;
       
    86     delete iSystemInstallNotifier;
       
    87     }
    78     }
    88 
    79 
    89 // ---------------------------------------------------------------------------
    80 // ---------------------------------------------------------------------------
    90 //
    81 //
    91 // ---------------------------------------------------------------------------
    82 // ---------------------------------------------------------------------------
   108 
    99 
   109 // ---------------------------------------------------------------------------
   100 // ---------------------------------------------------------------------------
   110 //
   101 //
   111 // ---------------------------------------------------------------------------
   102 // ---------------------------------------------------------------------------
   112 //
   103 //
   113 void CCaUsifScanner::HandleInstallNotifyL( TInt /*aUid*/)
   104 void CCaUsifScanner::HandleInstallNotifyL()
   114     {
   105     {
   115     UpdateUsifListL();
   106     UpdateUsifListL();
   116     }
   107     }
   117 
   108 
   118 // ---------------------------------------------------------------------------
   109 // ---------------------------------------------------------------------------
   157         aCaEntry->AddAttributeL( KCaAttrAppType, KCaAttrAppTypeValueJava );
   148         aCaEntry->AddAttributeL( KCaAttrAppType, KCaAttrAppTypeValueJava );
   158         }
   149         }
   159     else if( !aEntry->SoftwareType().Compare( KSoftwareTypeWidget ) )
   150     else if( !aEntry->SoftwareType().Compare( KSoftwareTypeWidget ) )
   160         {
   151         {
   161         aCaEntry->AddAttributeL( KCaAttrAppType, KCaAttrAppTypeValueCWRT );
   152         aCaEntry->AddAttributeL( KCaAttrAppType, KCaAttrAppTypeValueCWRT );
   162         } 
   153         }
   163     if( aEntry->Name().Compare( KNullDesC ) )
   154     if( aEntry->Name().Compare( KNullDesC ) )
   164         {
   155         {
   165         aCaEntry->SetTextL( aEntry->Name() );
   156         aCaEntry->SetTextL( aEntry->Name() );
   166         }
   157         }
   167     if( !aEntry->IsHidden() )
   158     if( !aEntry->IsHidden() )
   203         if( entryIndex == KErrNotFound )
   194         if( entryIndex == KErrNotFound )
   204             {
   195             {
   205             CCaInnerEntry *caEntry = CCaInnerEntry::NewLC();
   196             CCaInnerEntry *caEntry = CCaInnerEntry::NewLC();
   206             CreateCaEntryFromEntryL( resultUsifArray[i], caEntry );
   197             CreateCaEntryFromEntryL( resultUsifArray[i], caEntry );
   207             // in case we rebuild our db mark as missing
   198             // in case we rebuild our db mark as missing
   208             if( !(iSoftwareRegistry.IsComponentPresentL( 
   199             if( !(iSoftwareRegistry.IsComponentPresentL(
   209                     resultUsifArray[i]->ComponentId())) )
   200                     resultUsifArray[i]->ComponentId())) )
   210                 {
   201                 {
   211                 caEntry->SetFlags( caEntry->GetFlags() | EMissing );
   202                 caEntry->SetFlags( caEntry->GetFlags() | EMissing );
   212                 }
   203                 }
   213             iStorageProxy.AddL( caEntry );
   204             iStorageProxy.AddL( caEntry );
   214             CleanupStack::PopAndDestroy( caEntry );
   205             CleanupStack::PopAndDestroy( caEntry );
   215             } 
   206             }
   216         // found in the CaStorage, mark is as missing
   207         // found in the CaStorage, mark is as missing
   217         else if( !(iSoftwareRegistry.IsComponentPresentL( 
   208         else if( !(iSoftwareRegistry.IsComponentPresentL(
   218                 resultUsifArray[i]->ComponentId() ))  ) 
   209                 resultUsifArray[i]->ComponentId() ))  )
   219             {
   210             {
   220             if( !( entries[entryIndex]->GetFlags() & EMissing ) )
   211             if( !( entries[entryIndex]->GetFlags() & EMissing ) )
   221                 {
   212                 {
   222                 entries[entryIndex]->SetFlags( 
   213                 entries[entryIndex]->SetFlags(
   223                         ( entries[entryIndex]->GetFlags() | EMissing ) );
   214                         ( entries[entryIndex]->GetFlags() | EMissing ) );
   224                 iStorageProxy.AddL( 
   215                 iStorageProxy.AddL(
   225                         entries[entryIndex], EFalse, EItemDisappeared );
   216                         entries[entryIndex], EFalse, EItemDisappeared );
   226                 }
   217                 }
   227             }
   218             }
   228         // found in the storage remove missing flag as this is Present in scr
   219         // found in the storage remove missing flag as this is Present in scr
   229         else if (entries[entryIndex]->GetFlags() & EMissing)
   220         else if (entries[entryIndex]->GetFlags() & EMissing)
   230             {
   221             {
   231             entries[entryIndex]->SetFlags( 
   222             entries[entryIndex]->SetFlags(
   232                     entries[entryIndex]->GetFlags() & ~EMissing );
   223                     entries[entryIndex]->GetFlags() & ~EMissing );
   233             iStorageProxy.AddL( entries[entryIndex]);            
   224             iStorageProxy.AddL( entries[entryIndex]);
   234             }
   225             }
   235         }
   226         }
   236 
   227 
   237     CleanupStack::PopAndDestroy( &resultUsifArray );
   228     CleanupStack::PopAndDestroy( &resultUsifArray );
   238     CleanupStack::PopAndDestroy( &entries );
   229     CleanupStack::PopAndDestroy( &entries );