contentstorage/casrv/caappscanner/src/casrvappscanner.cpp
changeset 96 5d243a69bdda
parent 94 dbb8300717f7
child 98 d2f833ab7940
equal deleted inserted replaced
95:c739008478cc 96:5d243a69bdda
    19 #include <bautils.h>
    19 #include <bautils.h>
    20 #include <swi/sisregistrysession.h>
    20 #include <swi/sisregistrysession.h>
    21 #include <swi/sisregistryentry.h>
    21 #include <swi/sisregistryentry.h>
    22 #include <swi/sisregistrypackage.h>
    22 #include <swi/sisregistrypackage.h>
    23 #include <usif/scr/screntries.h>
    23 #include <usif/scr/screntries.h>
    24 #include <WidgetRegistryClient.h>
       
    25 
    24 
    26 #include "cadef.h"
    25 #include "cadef.h"
    27 #include "casrvappscanner.h"
    26 #include "casrvappscanner.h"
    28 #include "cautils.h"
    27 #include "cautils.h"
    29 #include "casrvmmchistory.h"
    28 #include "casrvmmchistory.h"
   922             aEntry->AddAttributeL( KCaAttrLongName, info->iCaption );
   921             aEntry->AddAttributeL( KCaAttrLongName, info->iCaption );
   923             changed = ETrue;
   922             changed = ETrue;
   924             }
   923             }
   925         
   924         
   926         
   925         
   927         if ( UpdateComponentIdL( *info, *aEntry ) )
   926         if ( UpdateComponentIdL( *aEntry ) )
   928             {
   927             {
   929             changed = ETrue;
   928             changed = ETrue;
   930             }
   929             }
   931         
   930         
   932         CleanupStack::PopAndDestroy( &attrVal );
   931         CleanupStack::PopAndDestroy( &attrVal );
   942                         KCaAttrAppTypeValueJava );
   941                         KCaAttrAppTypeValueJava );
   943                 aEntry->AddAttributeL(
   942                 aEntry->AddAttributeL(
   944                         KCaAttrAppSettingsPlugin,
   943                         KCaAttrAppSettingsPlugin,
   945                         KCaAttrJavaAppSettingsPluginValue );
   944                         KCaAttrJavaAppSettingsPluginValue );
   946                 }
   945                 }
   947             else if (appTypeUid == KCWRTApplicationTypeUid)
   946             else if ( appTypeUid == KCWRTApplicationTypeUid )
   948                 {
   947                 {
   949                 aEntry->AddAttributeL(
   948                 aEntry->AddAttributeL(
   950                         KCaAttrAppType,
   949                         KCaAttrAppType,
   951                         KCaAttrAppTypeValueCWRT );
   950                         KCaAttrAppTypeValueCWRT );
   952                 aEntry->AddAttributeL(
   951                 TComponentId compId = 
   953                         KCaAttrAppWidgetUri,
   952                         iSoftwareRegistry.GetComponentIdForAppL( info->iUid );
   954                         KCaAttrAppWidgetUriCWRTValue );
   953                 CPropertyEntry* isMiniview = 
   955                 // web id should be taken from SCR when supported
   954                                         iSoftwareRegistry.GetComponentPropertyL( compId,
   956                 RWidgetRegistryClientSession wrtSession;
   955                                                 KCaScrPropertyIsMiniviewSupported );
   957                 CleanupClosePushL(wrtSession);
   956                 CleanupStack::PushL( isMiniview );
   958                 User::LeaveIfError( wrtSession.Connect());
   957                 // check first if we support mini view
   959                 TFileName bundleId;
   958                 if (isMiniview && isMiniview->PropertyType() == CPropertyEntry::EIntProperty &&
   960                 wrtSession.GetWidgetBundleId(info->iUid, bundleId);
   959                         static_cast<CIntPropertyEntry*>(isMiniview)->IntValue())
   961                 aEntry->AddAttributeL(
   960                     {
   962                         KCaAttrAppWidgetParamWebAppId,
   961                     CPropertyEntry* appId = 
   963                         bundleId );
   962                         iSoftwareRegistry.GetComponentPropertyL( compId, KCaScrPropertyAppId );
   964                 CleanupStack::PopAndDestroy(&wrtSession);
   963                     CleanupStack::PushL( appId );
       
   964                     if ( appId && 
       
   965                          appId->PropertyType() == CPropertyEntry::ELocalizedProperty ) 
       
   966                         {
       
   967                         aEntry->AddAttributeL(
       
   968                                             KCaAttrAppWidgetUri,
       
   969                                             KCaAttrAppWidgetUriCWRTValue );
       
   970                         aEntry->AddAttributeL(
       
   971                                             KCaAttrAppWidgetParamWebAppId,
       
   972                                             static_cast<CLocalizablePropertyEntry*>(appId)->StrValue() );
       
   973                         }
       
   974                     CleanupStack::PopAndDestroy( appId );
       
   975                     }                
       
   976                 CleanupStack::PopAndDestroy( isMiniview );
   965                 }
   977                 }
   966             }
   978             }
   967         }
   979         }
   968     CleanupStack::PopAndDestroy( info );
   980     CleanupStack::PopAndDestroy( info );
   969     return changed;
   981     return changed;
  1243     }
  1255     }
  1244 
  1256 
  1245 // ---------------------------------------------------------
  1257 // ---------------------------------------------------------
  1246 //
  1258 //
  1247 // ---------------------------------------------------------//
  1259 // ---------------------------------------------------------//
  1248 TBool CCaSrvAppScanner::UpdateComponentIdL( TApaAppInfo& appInfo, 
  1260 TBool CCaSrvAppScanner::UpdateComponentIdL( CCaInnerEntry& aEntry ) const
  1249     CCaInnerEntry& aEntry ) const
       
  1250     {
  1261     {
  1251     TBool updated( EFalse );
  1262     TBool updated( EFalse );
  1252     
  1263     
  1253     CComponentFilter* const fileNameFilter = CComponentFilter::NewLC();
  1264     TUid uid;
  1254 
  1265     TInt err(KErrNone);
  1255     fileNameFilter->SetFileL( appInfo.iFullName );
  1266     TComponentId componentId( 0 );
  1256 
  1267     TRAP(err, componentId = 
  1257     RArray<TComponentId> componentIds;
  1268             iSoftwareRegistry.GetComponentIdForAppL(
  1258     CleanupClosePushL( componentIds );
  1269             uid.Uid( aEntry.GetUid() ) ) )
  1259     iSoftwareRegistry.GetComponentIdsL( componentIds, fileNameFilter );
       
  1260     
  1270     
  1261     if ( componentIds.Count() == 0 )
  1271     if ( componentId > 0 && err == KErrNone )
  1262     {
       
  1263         CComponentFilter* const uidFilter = CComponentFilter::NewLC();
       
  1264         uidFilter->AddPropertyL(_L("Uid"), aEntry.GetUid());
       
  1265         iSoftwareRegistry.GetComponentIdsL( componentIds, uidFilter );
       
  1266         CleanupStack::PopAndDestroy( uidFilter );
       
  1267     }
       
  1268     
       
  1269     if ( componentIds.Count() == 1 )
       
  1270         {
  1272         {
  1271         RBuf newComponentId;
  1273         RBuf newComponentId;
  1272         newComponentId.CleanupClosePushL();
  1274         newComponentId.CleanupClosePushL();
  1273         newComponentId.CreateL( sizeof(TComponentId) + 1 );
  1275         newComponentId.CreateL( sizeof(TComponentId) + 1 );
  1274         newComponentId.AppendNum( componentIds[0] );
  1276         newComponentId.AppendNum( componentId );
  1275         
  1277         
  1276         RBuf oldComponentId;
  1278         RBuf oldComponentId;
  1277         oldComponentId.CleanupClosePushL();
  1279         oldComponentId.CleanupClosePushL();
  1278         oldComponentId.CreateL( KCaMaxAttrValueLen );
  1280         oldComponentId.CreateL( KCaMaxAttrValueLen );
  1279         
  1281         
  1291             }
  1293             }
  1292         
  1294         
  1293         CleanupStack::PopAndDestroy( &oldComponentId );
  1295         CleanupStack::PopAndDestroy( &oldComponentId );
  1294         CleanupStack::PopAndDestroy( &newComponentId );
  1296         CleanupStack::PopAndDestroy( &newComponentId );
  1295         }
  1297         }
  1296 
       
  1297     CleanupStack::PopAndDestroy( &componentIds );
       
  1298     CleanupStack::PopAndDestroy( fileNameFilter );
       
  1299     
       
  1300     return updated;
  1298     return updated;
  1301     }
  1299     }