contentstorage/casrv/caappscanner/src/casrvappscanner.cpp
changeset 103 b99b84bcd2d1
parent 83 156f692b1687
child 104 9b022b1f357c
equal deleted inserted replaced
83:156f692b1687 103:b99b84bcd2d1
   139     User::LeaveIfError( iApaLsSession.GetAllApps() ); // This is async.
   139     User::LeaveIfError( iApaLsSession.GetAllApps() ); // This is async.
   140     User::LeaveIfError( iSoftwareRegistry.Connect() );
   140     User::LeaveIfError( iSoftwareRegistry.Connect() );
   141     iApaLsSession.RegisterListPopulationCompleteObserver( iStatus );
   141     iApaLsSession.RegisterListPopulationCompleteObserver( iStatus );
   142     iCollectionDownloadId = 0;
   142     iCollectionDownloadId = 0;
   143     iAllCollectionId = 0;
   143     iAllCollectionId = 0;
       
   144     
       
   145     //TODO temporary sollution for fake uninstall progres notification
       
   146     ClearUninstallFlagL();
       
   147     
   144     SetActive();
   148     SetActive();
       
   149     }
       
   150 
       
   151 // ---------------------------------------------------------
       
   152 //
       
   153 // ---------------------------------------------------------
       
   154 //
       
   155 //TODO temporary sollution for fake uninstall progres notification
       
   156 void CCaSrvAppScanner::ClearUninstallFlagL()
       
   157     {
       
   158     CCaInnerQuery* uninstallQuery = CCaInnerQuery::NewLC();
       
   159     uninstallQuery->SetFlagsOn( EUninstall );
       
   160     
       
   161     RPointerArray<CCaInnerEntry> resultArray;
       
   162     CleanupResetAndDestroyPushL( resultArray );
       
   163     iCaStorageProxy.GetEntriesL( uninstallQuery, resultArray );
       
   164     for( TInt i = 0; i < resultArray.Count(); i++ )
       
   165     {
       
   166         resultArray[i]->SetFlags( resultArray[i]->GetFlags() & ~EUninstall );
       
   167         iCaStorageProxy.AddL( resultArray[i] );
       
   168     }
       
   169     CleanupStack::PopAndDestroy( &resultArray );
       
   170     
       
   171     CleanupStack::PopAndDestroy( uninstallQuery );    
   145     }
   172     }
   146 
   173 
   147 // ---------------------------------------------------------
   174 // ---------------------------------------------------------
   148 //
   175 //
   149 // ---------------------------------------------------------
   176 // ---------------------------------------------------------
   910     if( KErrNone == iSrvEngUtils.GetAppInfo( *aEntry, *info ) )
   937     if( KErrNone == iSrvEngUtils.GetAppInfo( *aEntry, *info ) )
   911         {
   938         {
   912         RBuf attrVal;
   939         RBuf attrVal;
   913         attrVal.CleanupClosePushL();
   940         attrVal.CleanupClosePushL();
   914         attrVal.CreateL( KCaMaxAttrValueLen );
   941         attrVal.CreateL( KCaMaxAttrValueLen );
   915         aEntry->FindAttribute( KCaAttrLongName, attrVal );
   942         aEntry->FindAttribute( KCaAttrShortName, attrVal );
   916         if( attrVal.Compare( info->iCaption ) != KErrNone
   943         if( attrVal.Compare( info->iShortCaption ) != KErrNone
   917                 || aEntry->GetText().Compare( info->iCaption )
   944                 || aEntry->GetText().Compare( info->iCaption )
   918                         != KErrNone )
   945                         != KErrNone )
   919             {
   946             {
   920             aEntry->SetTextL( info->iCaption );
   947             aEntry->SetTextL( info->iCaption );
   921             aEntry->AddAttributeL( KCaAttrLongName, info->iCaption );
   948             aEntry->AddAttributeL( KCaAttrShortName, info->iShortCaption );
   922             changed = ETrue;
   949             changed = ETrue;
   923             }
   950             }
   924         
   951         
   925         
   952         
   926         if ( UpdateComponentIdL( *aEntry ) )
   953         if ( UpdateComponentIdL( *aEntry ) )
   937             if( appTypeUid == KMidletApplicationTypeUid )
   964             if( appTypeUid == KMidletApplicationTypeUid )
   938                 {
   965                 {
   939                 aEntry->AddAttributeL(
   966                 aEntry->AddAttributeL(
   940                         KCaAttrAppType,
   967                         KCaAttrAppType,
   941                         KCaAttrAppTypeValueJava );
   968                         KCaAttrAppTypeValueJava );
   942                 aEntry->AddAttributeL(
   969                 
   943                         KCaAttrAppSettingsPlugin,
   970                 TComponentId compId = 
   944                         KCaAttrJavaAppSettingsPluginValue );
   971                         iSoftwareRegistry.GetComponentIdForAppL( info->iUid );
       
   972                 CPropertyEntry* propertyEntry = 
       
   973                     iSoftwareRegistry.GetComponentPropertyL( compId, KCaScrPropertyAppSettings );
       
   974                 CleanupStack::PushL( propertyEntry );
       
   975                 if ( propertyEntry && 
       
   976                         propertyEntry->PropertyType() == CPropertyEntry::ELocalizedProperty ) 
       
   977                     {
       
   978                     aEntry->AddAttributeL(
       
   979                             KCaAttrAppSettingsPlugin,
       
   980                             static_cast<CLocalizablePropertyEntry*>(propertyEntry)->StrValue() );
       
   981                     }
       
   982                 CleanupStack::PopAndDestroy( propertyEntry );
   945                 }
   983                 }
   946             else if ( appTypeUid == KCWRTApplicationTypeUid )
   984             else if ( appTypeUid == KCWRTApplicationTypeUid )
   947                 {
   985                 {
   948                 aEntry->AddAttributeL(
   986                 aEntry->AddAttributeL(
   949                         KCaAttrAppType,
   987                         KCaAttrAppType,
   996         if( aCaEntries[i]->FindAttribute( KCaAttrMmcId(), attrVal ) )
  1034         if( aCaEntries[i]->FindAttribute( KCaAttrMmcId(), attrVal ) )
   997             {
  1035             {
   998             TUint mmcId = 0;
  1036             TUint mmcId = 0;
   999             MenuUtils::GetTUint( attrVal, mmcId );
  1037             MenuUtils::GetTUint( attrVal, mmcId );
  1000             if( ( mmcId && KErrNotFound != iMmcHistory->Find( mmcId )
  1038             if( ( mmcId && KErrNotFound != iMmcHistory->Find( mmcId )
  1001                     && mmcId != CurrentMmcId() ) ||
  1039                         && mmcId != CurrentMmcId() ) 
  1002                     ( attrVal == KCaMassStorage() &&
  1040                     || ( attrVal == KCaMassStorage() 
  1003                     IsDriveInUse( DriveInfo::EDefaultMassStorage ) ) )
  1041                         && IsDriveInUse( DriveInfo::EDefaultMassStorage ) ) )
  1004                 {
  1042                 {
  1005                 // This item is on an MMC which is currently
  1043                 // This item is on an MMC which is currently
  1006                 // in the MMC history or on a mass storage in use.
  1044                 // in the MMC history or on a mass storage in use.
  1007                 // Set it "missing" but keep it.
  1045                 // Set it "missing" but keep it.
  1008                 SetMissingFlagL( aCaEntries[i] );
  1046                 SetMissingFlagL( aCaEntries[i] );
  1009                 }
  1047                 }
  1010             else
  1048             else
  1011                 {
  1049                 {
  1012                 aCaEntries[i]->RemoveAttributeL(KCaAttrMmcId());
  1050                 aCaEntries[i]->RemoveAttributeL( KCaAttrMmcId() );
  1013                 ClearVisibleFlagL( aCaEntries[i] );
  1051                 ClearVisibleFlagL( aCaEntries[i] );
  1014                 }
  1052                 }
  1015             }
  1053             }
  1016         else
  1054         else
  1017             {
  1055             {
  1023 
  1061 
  1024 // ---------------------------------------------------------
  1062 // ---------------------------------------------------------
  1025 //
  1063 //
  1026 // ---------------------------------------------------------
  1064 // ---------------------------------------------------------
  1027 //
  1065 //
  1028 void CCaSrvAppScanner::RemoveAppL( CCaInnerEntry* aAppEntry )
       
  1029     {
       
  1030     RArray<TInt> idsToRemove;
       
  1031     CleanupClosePushL( idsToRemove );
       
  1032     idsToRemove.AppendL( aAppEntry->GetId() );
       
  1033     iCaStorageProxy.RemoveL( idsToRemove );
       
  1034     CleanupStack::PopAndDestroy( &idsToRemove );
       
  1035     }
       
  1036 
       
  1037 // ---------------------------------------------------------
       
  1038 //
       
  1039 // ---------------------------------------------------------
       
  1040 //
       
  1041 void CCaSrvAppScanner::SetMissingFlagL( CCaInnerEntry* aEntry )
  1066 void CCaSrvAppScanner::SetMissingFlagL( CCaInnerEntry* aEntry )
  1042     {
  1067     {
  1043     if( !( aEntry->GetFlags() & EMissing ) )
  1068     if( !( aEntry->GetFlags() & EMissing ) )
  1044         {
  1069         {
  1045         aEntry->SetFlags( aEntry->GetFlags() | EMissing );
  1070         aEntry->SetFlags( ( aEntry->GetFlags() | EMissing ) & ~EUninstall );
  1046         iCaStorageProxy.AddL( aEntry, EFalse, EItemDisappeared );
  1071         iCaStorageProxy.AddL( aEntry, EFalse, EItemDisappeared );
  1047         }
  1072         }
  1048     }
  1073     }
  1049 
  1074 
  1050 // ---------------------------------------------------------
  1075 // ---------------------------------------------------------
  1055     {
  1080     {
  1056     if( aEntry->GetFlags() & EVisible )
  1081     if( aEntry->GetFlags() & EVisible )
  1057         {
  1082         {
  1058         aEntry->SetFlags(
  1083         aEntry->SetFlags(
  1059                 aEntry->GetFlags() &
  1084                 aEntry->GetFlags() &
       
  1085                 ~EUninstall &
  1060                 ~EVisible &
  1086                 ~EVisible &
  1061                 ~EMissing &
  1087                 ~EMissing &
  1062                 ~EUsed );
  1088                 ~EUsed );
  1063         iCaStorageProxy.AddL( aEntry, EFalse, EItemDisappeared );
  1089         iCaStorageProxy.AddL( aEntry, EFalse, EItemDisappeared );
  1064         }
  1090         }