2454 aLhs.Reset(); |
2454 aLhs.Reset(); |
2455 CopyFixedLengthArrayL(aLhs, tmp); |
2455 CopyFixedLengthArrayL(aLhs, tmp); |
2456 CleanupStack::PopAndDestroy(&tmp); |
2456 CleanupStack::PopAndDestroy(&tmp); |
2457 } |
2457 } |
2458 |
2458 |
2459 void CScrRequestImpl::GetComponentIdsHavingThePropertiesL(RArray<TComponentId>& aComponentIds, RPointerArray<CPropertyEntry> aProperties, TBool aDoIntersect) const |
2459 void CScrRequestImpl::GetOperatorStringL(CComponentFilter::TDbOperator aOperator, HBufC*& aOperatorString) const |
2460 { |
2460 { |
2461 // GROUP BY is added at the end to avoid fetching twice components which have the same localizable values for different locales |
2461 _LIT(KEqualOperator, "="); |
2462 _LIT(KFindComponentsFromProperties, "SELECT ComponentId FROM ComponentProperties WHERE Name=? AND %S GROUP BY ComponentId;"); |
2462 _LIT(KLikeOperator, "LIKE"); |
2463 _LIT(KPropertyIntValue,"IntValue=?"); |
2463 |
2464 _LIT(KPropertyStrValue,"StrValue=?"); |
2464 switch(aOperator) |
2465 _LIT(KPropertyLocalizedValue,"StrValue=? AND Locale=?"); |
2465 { |
2466 |
2466 case CComponentFilter::EEqual: |
2467 TInt propCount = aProperties.Count(); |
2467 aOperatorString = KEqualOperator().AllocL(); |
2468 |
2468 break; |
2469 HBufC *statementStr(0); |
2469 |
2470 RArray<TComponentId> propCompIds; |
2470 case CComponentFilter::ELike: |
2471 CleanupClosePushL(propCompIds); |
2471 aOperatorString = KLikeOperator().AllocL(); |
2472 |
2472 break; |
2473 for(TInt i=0; i<propCount; ++i) |
2473 |
2474 { |
2474 default: |
2475 switch(aProperties[i]->PropertyType()) |
2475 User::Leave(KErrArgument); |
2476 { |
2476 |
2477 case CPropertyEntry::EIntProperty: |
2477 } |
2478 statementStr = FormatStatementLC(KFindComponentsFromProperties, KPropertyIntValue().Length(), &KPropertyIntValue()); |
2478 } |
2479 break; |
2479 |
2480 case CPropertyEntry::EBinaryProperty: |
2480 void CScrRequestImpl::GetComponentIdsHavingThePropertiesL(RArray<TComponentId>& aComponentIds, RPointerArray<CPropertyEntry>& aProperties, |
2481 statementStr = FormatStatementLC(KFindComponentsFromProperties, KPropertyStrValue().Length(), &KPropertyStrValue()); |
2481 RArray<CComponentFilter::TPropertyOperator>& aPropertyOperatorList, TBool aDoIntersect) const |
2482 break; |
2482 { |
2483 case CPropertyEntry::ELocalizedProperty: |
2483 // GROUP BY is added at the end to avoid fetching twice components which have the same localizable values for different locales |
2484 { |
2484 |
2485 CLocalizablePropertyEntry *localizedProp = static_cast<CLocalizablePropertyEntry *>(aProperties[i]); |
2485 _LIT(KFindComponentsFromProperties, "SELECT ComponentId FROM ComponentProperties WHERE NAME %S ? AND %S GROUP BY ComponentId;"); |
2486 if (localizedProp->LocaleL() == KUnspecifiedLocale) // If the locale was not specified, then we match across all locales |
2486 |
2487 statementStr = FormatStatementLC(KFindComponentsFromProperties, KPropertyStrValue().Length(), &KPropertyStrValue()); |
2487 _LIT(KPropertyIntValue, "IntValue %S ?"); |
2488 else // Otherwise we match for a specific locale |
2488 _LIT(KPropertyStrValue, "StrValue %S ?"); |
2489 statementStr = FormatStatementLC(KFindComponentsFromProperties, KPropertyLocalizedValue().Length(), &KPropertyLocalizedValue()); |
2489 _LIT(KPropertyLocalizedValue, "StrValue %S ? AND Locale = ?"); |
2490 } |
2490 |
2491 break; |
2491 TInt propCount = aProperties.Count(); |
2492 default: |
2492 |
2493 DEBUG_PRINTF(_L8("The property type couldn't be recognized.")); |
2493 RArray<TComponentId> propCompIds; |
2494 User::Leave(KErrAbort); |
2494 CleanupClosePushL(propCompIds); |
2495 } |
2495 |
2496 |
2496 for(TInt i=0; i<propCount; ++i) |
2497 CStatement *stmt = iDbHandle->PrepareStatementLC(*statementStr); |
2497 { |
2498 stmt->BindStrL(1, aProperties[i]->PropertyName()); |
2498 //Retrieve the operators to be used to form this query. |
2499 |
2499 CComponentFilter::TPropertyOperator propOperator = aPropertyOperatorList[i]; |
2500 switch(aProperties[i]->PropertyType()) |
2500 |
2501 { |
2501 // Get the name operator. |
2502 case CPropertyEntry::EIntProperty: |
2502 HBufC* nameOperator(0); |
2503 { |
2503 GetOperatorStringL(aPropertyOperatorList[i].NameOperator(), nameOperator); |
2504 CIntPropertyEntry *intProp = static_cast<CIntPropertyEntry *>(aProperties[i]); |
2504 CleanupStack::PushL(nameOperator); |
2505 stmt->BindInt64L(2, intProp->Int64Value()); |
2505 |
2506 break; |
2506 // Get the value operator. |
2507 } |
2507 HBufC* valueOperator(0); |
2508 case CPropertyEntry::EBinaryProperty: |
2508 GetOperatorStringL(aPropertyOperatorList[i].ValueOperator(), valueOperator); |
2509 { |
2509 CleanupStack::PushL(valueOperator); |
2510 CBinaryPropertyEntry *binaryProp = static_cast<CBinaryPropertyEntry *>(aProperties[i]); |
2510 |
2511 stmt->BindBinaryL(2, binaryProp->BinaryValue()); |
2511 // Create the value string based on the property type. |
2512 break; |
2512 HBufC* valueString(0); |
2513 } |
2513 switch(aProperties[i]->PropertyType()) |
2514 case CPropertyEntry::ELocalizedProperty: |
2514 { |
2515 { |
2515 case CPropertyEntry::EIntProperty: |
2516 CLocalizablePropertyEntry *localizedProp = static_cast<CLocalizablePropertyEntry *>(aProperties[i]); |
2516 { |
2517 stmt->BindStrL(2, localizedProp->StrValue()); |
2517 valueString = FormatStatementLC(KPropertyIntValue, valueOperator->Length(), valueOperator); |
2518 if (localizedProp->LocaleL() != KUnspecifiedLocale) |
2518 } |
2519 stmt->BindIntL(3, localizedProp->LocaleL()); |
2519 |
2520 break; |
2520 break; |
2521 } |
2521 |
2522 default: |
2522 case CPropertyEntry::EBinaryProperty: |
2523 DEBUG_PRINTF(_L8("The property type couldn't be recognized.")); |
2523 { |
2524 User::Leave(KErrAbort); |
2524 valueString = FormatStatementLC(KPropertyStrValue, valueOperator->Length(), valueOperator); |
2525 } |
2525 } |
2526 |
2526 |
2527 while(stmt->ProcessNextRowL()) |
2527 break; |
2528 { |
2528 case CPropertyEntry::ELocalizedProperty: |
2529 User::LeaveIfError(propCompIds.InsertInOrder(stmt->IntColumnL(0))); |
2529 { |
2530 } |
2530 CLocalizablePropertyEntry *localizedProp = static_cast<CLocalizablePropertyEntry *>(aProperties[i]); |
2531 |
2531 if (localizedProp->LocaleL() == KUnspecifiedLocale) // If the locale was not specified, then we match across all locales |
2532 CleanupStack::PopAndDestroy(2, statementStr); // stmt, statementStr |
2532 { |
2533 |
2533 valueString = FormatStatementLC(KPropertyStrValue, valueOperator->Length(), valueOperator); |
2534 if (aDoIntersect) |
2534 } |
2535 { |
2535 else |
2536 IntersectSortedArraysL(aComponentIds, propCompIds); |
2536 { |
2537 } |
2537 valueString = FormatStatementLC(KPropertyLocalizedValue, valueOperator->Length(), valueOperator); |
2538 else |
2538 } |
2539 { |
2539 } |
2540 CopyFixedLengthArrayL(aComponentIds, propCompIds); |
2540 break; |
2541 aDoIntersect = ETrue; // If many properties are present in the filter, we need to intersect the component Ids on further iterations |
2541 default: |
2542 } |
2542 DEBUG_PRINTF(_L8("The property type couldn't be recognized.")); |
2543 |
2543 User::Leave(KErrAbort); |
2544 propCompIds.Reset(); |
2544 } |
2545 } |
2545 |
2546 CleanupStack::PopAndDestroy(&propCompIds); |
2546 // Prepare full statement using the name operator and the value string. |
2547 } |
2547 HBufC *statementStr = FormatStatementLC(KFindComponentsFromProperties, nameOperator->Length()+ valueString->Length(), |
|
2548 nameOperator, valueString); |
|
2549 |
|
2550 // Create Sql statement. |
|
2551 CStatement *stmt = iDbHandle->PrepareStatementLC(*statementStr); |
|
2552 stmt->BindStrL(1, aProperties[i]->PropertyName()); |
|
2553 |
|
2554 switch(aProperties[i]->PropertyType()) |
|
2555 { |
|
2556 case CPropertyEntry::EIntProperty: |
|
2557 { |
|
2558 CIntPropertyEntry *intProp = static_cast<CIntPropertyEntry *>(aProperties[i]); |
|
2559 stmt->BindInt64L(2, intProp->Int64Value()); |
|
2560 break; |
|
2561 } |
|
2562 case CPropertyEntry::EBinaryProperty: |
|
2563 { |
|
2564 CBinaryPropertyEntry *binaryProp = static_cast<CBinaryPropertyEntry *>(aProperties[i]); |
|
2565 stmt->BindBinaryL(2, binaryProp->BinaryValue()); |
|
2566 break; |
|
2567 } |
|
2568 case CPropertyEntry::ELocalizedProperty: |
|
2569 { |
|
2570 CLocalizablePropertyEntry *localizedProp = static_cast<CLocalizablePropertyEntry *>(aProperties[i]); |
|
2571 stmt->BindStrL(2, localizedProp->StrValue()); |
|
2572 if (localizedProp->LocaleL() != KUnspecifiedLocale) |
|
2573 stmt->BindIntL(3, localizedProp->LocaleL()); |
|
2574 break; |
|
2575 } |
|
2576 default: |
|
2577 DEBUG_PRINTF(_L8("The property type couldn't be recognized.")); |
|
2578 User::Leave(KErrAbort); |
|
2579 } |
|
2580 |
|
2581 while(stmt->ProcessNextRowL()) |
|
2582 { |
|
2583 User::LeaveIfError(propCompIds.InsertInOrder(stmt->IntColumnL(0))); |
|
2584 } |
|
2585 |
|
2586 CleanupStack::PopAndDestroy(5, nameOperator); |
|
2587 |
|
2588 if (aDoIntersect) |
|
2589 { |
|
2590 IntersectSortedArraysL(aComponentIds, propCompIds); |
|
2591 } |
|
2592 else |
|
2593 { |
|
2594 CopyFixedLengthArrayL(aComponentIds, propCompIds); |
|
2595 aDoIntersect = ETrue; // If many properties are present in the filter, we need to intersect the component Ids on further iterations |
|
2596 } |
|
2597 |
|
2598 propCompIds.Reset(); |
|
2599 } |
|
2600 CleanupStack::PopAndDestroy(&propCompIds); |
|
2601 } |
|
2602 |
2548 |
2603 |
2549 void ReallocStatementIfNeededL(RBuf& aStatementStr, TInt aAddedLength) |
2604 void ReallocStatementIfNeededL(RBuf& aStatementStr, TInt aAddedLength) |
2550 { |
2605 { |
2551 TInt freeSpace = aStatementStr.MaxLength() - aStatementStr.Length(); |
2606 TInt freeSpace = aStatementStr.MaxLength() - aStatementStr.Length(); |
2552 TInt extraSpace = aAddedLength - freeSpace; |
2607 TInt extraSpace = aAddedLength - freeSpace; |
2896 |
2961 |
2897 TInt maxArraySize = aMessage.Int0(); |
2962 TInt maxArraySize = aMessage.Int0(); |
2898 TLanguage locale = TLanguage(aMessage.Int1()); |
2963 TLanguage locale = TLanguage(aMessage.Int1()); |
2899 |
2964 |
2900 aEntryList.ResetAndDestroy(); |
2965 aEntryList.ResetAndDestroy(); |
|
2966 CComponentEntry *entry(0); |
|
2967 TInt err(0); |
2901 for(TInt i=0; i<maxArraySize; ++i) |
2968 for(TInt i=0; i<maxArraySize; ++i) |
2902 { |
2969 { |
2903 CComponentEntry *entry = GetNextComponentEntryL(*aStmt, *aFilter, locale, aSubsessionContext); |
2970 do { |
|
2971 TRAP(err, entry = GetNextComponentEntryL(*aStmt, *aFilter, locale, aSubsessionContext)); |
|
2972 }while(err == KErrNotFound); |
|
2973 |
|
2974 if(KErrNone != err) |
|
2975 { |
|
2976 User::Leave(err); |
|
2977 } |
|
2978 |
2904 if(!entry) |
2979 if(!entry) |
2905 { |
2980 { |
2906 break; |
2981 break; |
2907 } |
2982 } |
2908 CleanupStack::PushL(entry); |
2983 CleanupStack::PushL(entry); |
2909 aEntryList.AppendL(entry); |
2984 aEntryList.AppendL(entry); |
2910 CleanupStack::Pop(entry); // Ownership is transferred |
2985 CleanupStack::Pop(entry); // Ownership is transferred |
2911 } |
2986 } |
2912 WriteArraySizeL(aMessage, 2, aEntryList); |
2987 WriteArraySizeL(aMessage, 2, aEntryList); |
2913 } |
2988 } |
|
2989 |
2914 |
2990 |
2915 void CScrRequestImpl::NextComponentSetDataL(const RMessage2& aMessage, RPointerArray<CComponentEntry>& aEntryList) const |
2991 void CScrRequestImpl::NextComponentSetDataL(const RMessage2& aMessage, RPointerArray<CComponentEntry>& aEntryList) const |
2916 { |
2992 { |
2917 DEBUG_PRINTF(_L8("Returning the next component entry set.")); |
2993 DEBUG_PRINTF(_L8("Returning the next component entry set.")); |
2918 WriteArrayDataL(aMessage, 0, aEntryList); |
2994 WriteArrayDataL(aMessage, 0, aEntryList); |
3139 if(aSifPluginUid != pluginUid) |
3217 if(aSifPluginUid != pluginUid) |
3140 { |
3218 { |
3141 DEBUG_PRINTF2(_L8("IsSoftwareTypeExistingL: SIF Plugin Uid doesn't match with the one in the SCR."), pluginUid); |
3219 DEBUG_PRINTF2(_L8("IsSoftwareTypeExistingL: SIF Plugin Uid doesn't match with the one in the SCR."), pluginUid); |
3142 return EFalse; |
3220 return EFalse; |
3143 } |
3221 } |
3144 |
3222 |
3145 TBool isInstallerSidPresent = EFalse; |
3223 //Check if launcher executable for the software type id is the same |
3146 TBool isExecutionLayerSidPresent = EFalse; |
3224 HBufC *launcherExe; |
|
3225 _LIT(KSelectLauncherExecutable, "SELECT LauncherExecutable FROM SoftwareTypes WHERE SoftwareTypeId=?;"); |
|
3226 CStatement* stmt = iDbHandle->PrepareStatementLC(KSelectLauncherExecutable); |
|
3227 stmt->BindIntL(1, aSwTypeId); |
|
3228 |
|
3229 if(stmt->ProcessNextRowL()) |
|
3230 { |
|
3231 launcherExe = stmt->StrColumnL(0).AllocLC(); |
|
3232 if(launcherExe->Compare(aLauncherExecutable) != 0) |
|
3233 { |
|
3234 DEBUG_PRINTF(_L8("IsSoftwareTypeExistingL: Launcher Executable doesn't match with the one in the SCR.")); |
|
3235 CleanupStack::PopAndDestroy(2, stmt); |
|
3236 return EFalse; |
|
3237 } |
|
3238 CleanupStack::PopAndDestroy(2, stmt); |
|
3239 } |
|
3240 else |
|
3241 { |
|
3242 DEBUG_PRINTF2(_L8("IsSoftwareTypeExistingL: Launcher Executable doesn't exist in the SCR for TypeId %d."), aSwTypeId); |
|
3243 CleanupStack::PopAndDestroy(stmt); |
|
3244 return EFalse; |
|
3245 } |
|
3246 |
|
3247 //Check if associated installer sid's for the software type id is the same |
|
3248 |
3147 RArray<TSecureId> installerSids; |
3249 RArray<TSecureId> installerSids; |
3148 CleanupClosePushL(installerSids); |
3250 CleanupClosePushL(installerSids); |
3149 if(GetSidsForSoftwareTypeIdL(aSwTypeId, installerSids)) |
3251 if(GetSidsForSoftwareTypeIdL(aSwTypeId, installerSids)) |
3150 { |
3252 { |
3151 TInt count = installerSids.Count(); |
3253 for(TInt i=0; i<aSidArray.Count(); ++i) |
3152 for (TInt i = 0; i < count; i++) |
|
3153 { |
3254 { |
3154 if (aInstallerSecureId == installerSids[i]) |
3255 if(KErrNotFound == installerSids.Find(aSidArray[i].SecureId())) |
3155 isInstallerSidPresent = ETrue; |
3256 { |
3156 if (aExecutionLayerSecureId == installerSids[i]) |
3257 DEBUG_PRINTF(_L8("IsSoftwareTypeExistingL: One of the Sid doesn't match with the one in the SCR.")); |
3157 isExecutionLayerSidPresent = ETrue; |
3258 CleanupStack::PopAndDestroy(&installerSids); |
3158 |
3259 return EFalse; |
3159 if(isInstallerSidPresent && isExecutionLayerSidPresent) |
3260 } |
3160 break; |
|
3161 } |
3261 } |
3162 } |
3262 } |
3163 CleanupStack::PopAndDestroy(&installerSids); |
3263 CleanupStack::PopAndDestroy(&installerSids); |
3164 |
3264 |
3165 if(!isInstallerSidPresent || !isExecutionLayerSidPresent) |
3265 //Check if localized software type name for the software type id is the same |
3166 { |
|
3167 DEBUG_PRINTF(_L8("IsSoftwareTypeExistingL: One of the UIDs is different from the one in the database.")); |
|
3168 return EFalse; |
|
3169 } |
|
3170 |
|
3171 _LIT(KSelectSwTypeNames, "SELECT Locale,Name FROM SoftwareTypeNames WHERE SoftwareTypeId=? AND Locale!=?;"); |
3266 _LIT(KSelectSwTypeNames, "SELECT Locale,Name FROM SoftwareTypeNames WHERE SoftwareTypeId=? AND Locale!=?;"); |
3172 CStatement* stmtNames = iDbHandle->PrepareStatementLC(KSelectSwTypeNames); |
3267 CStatement* stmtNames = iDbHandle->PrepareStatementLC(KSelectSwTypeNames); |
3173 stmtNames->BindIntL(1, aSwTypeId); |
3268 stmtNames->BindIntL(1, aSwTypeId); |
3174 stmtNames->BindIntL(2, KNonLocalized); |
3269 stmtNames->BindIntL(2, KNonLocalized); |
3175 TInt numOfFoundNames (0); |
3270 TInt numOfFoundNames (0); |
3233 // with the corresponding installer which had been re-installed. |
3329 // with the corresponding installer which had been re-installed. |
3234 // Another advantage of this approach is that it is not mandatory to query SoftwareTypes table in order to get |
3330 // Another advantage of this approach is that it is not mandatory to query SoftwareTypes table in order to get |
3235 // the software type id of an installer. If the uniqe software type name of the installer is known, its hash |
3331 // the software type id of an installer. If the uniqe software type name of the installer is known, its hash |
3236 // is simply calculated to obtain its software type id. |
3332 // is simply calculated to obtain its software type id. |
3237 |
3333 |
3238 // Slot-0 contains Unique Software Type Name |
3334 CSoftwareTypeRegInfo *regInfo = ReadObjectFromMessageLC<CSoftwareTypeRegInfo>(aMessage, 0); |
3239 HBufC *uniqueSwTypeName = ReadDescLC(aMessage, 0); |
3335 |
3240 TUint32 swTypeId = HashCaseSensitiveL(*uniqueSwTypeName); |
3336 HBufC* uniqueSwTypeName = HBufC::NewLC(regInfo->UniqueSoftwareTypeName().Length()); |
3241 |
3337 uniqueSwTypeName->Des().Copy(regInfo->UniqueSoftwareTypeName()); |
3242 // Slot-1 contains the concatenated values of SifPluginUid, InstallerSecureId and ExecutionLayerSecureId in turn. |
3338 |
3243 HBufC8 *uidString = ReadDesc8LC(aMessage, 1); |
3339 TUint32 swTypeId = HashCaseSensitiveL(regInfo->UniqueSoftwareTypeName()); |
|
3340 |
3244 TUint32 sifPluginUid (0); |
3341 TUint32 sifPluginUid (0); |
3245 TUint32 installerSecureId (0); |
3342 sifPluginUid = regInfo->SifPluginUid().iUid; |
3246 TUint32 executionLayerSecureId (0); |
3343 |
3247 ParseUidHexStringL(*uidString, sifPluginUid, installerSecureId, executionLayerSecureId); |
3344 RArray<TCustomAccessInfo> sidArray; |
3248 CleanupStack::PopAndDestroy(uidString); |
3345 sidArray = regInfo->CustomAccessList(); |
3249 |
3346 |
3250 // Slot-2 contains the list of MIME types |
3347 RPointerArray<HBufC> mimeTypesArray = regInfo->MimeTypes(); |
3251 RIpcReadStream mimeTypesReader; |
3348 |
3252 CleanupClosePushL(mimeTypesReader); |
3349 RPointerArray<CLocalizedSoftwareTypeName> localizedNamesArray = regInfo->LocalizedSoftwareTypeNames(); |
3253 mimeTypesReader.Open(aMessage, 2); |
3350 |
3254 |
3351 HBufC* launcherExecutable = HBufC::NewLC(regInfo->LauncherExecutable().Length()); |
3255 RPointerArray<HBufC> mimeTypesArray; |
3352 launcherExecutable->Des().Copy(regInfo->LauncherExecutable()); |
3256 CleanupResetAndDestroyPushL(mimeTypesArray); |
3353 |
3257 InternalizePointersArrayL(mimeTypesArray, mimeTypesReader); |
3354 if (IsSoftwareTypeExistingL(swTypeId, sifPluginUid, sidArray, mimeTypesArray, localizedNamesArray, *launcherExecutable)) |
3258 |
|
3259 // Slot-3 contains Localized Software Type Names |
|
3260 RIpcReadStream localizedNamesReader; |
|
3261 CleanupClosePushL(localizedNamesReader); |
|
3262 localizedNamesReader.Open(aMessage, 3); |
|
3263 |
|
3264 RPointerArray<CLocalizedSoftwareTypeName> localizedNamesArray; |
|
3265 CleanupResetAndDestroyPushL(localizedNamesArray); |
|
3266 InternalizePointersArrayL(localizedNamesArray, localizedNamesReader); |
|
3267 |
|
3268 if (IsSoftwareTypeExistingL(swTypeId, sifPluginUid, installerSecureId, executionLayerSecureId, mimeTypesArray, localizedNamesArray)) |
|
3269 { // If the software type exists, do nothing and return; |
3355 { // If the software type exists, do nothing and return; |
3270 CleanupStack::PopAndDestroy(5, uniqueSwTypeName); // uniqueSwTypeName, mimeTypesReader, mimeTypesArray, localizedNamesReader, localizedNamesArray |
3356 CleanupStack::PopAndDestroy(3, regInfo); // uniqueSwTypeName, launcherExecutable, regInfo |
3271 return; |
3357 return; |
3272 } |
3358 } |
3273 |
3359 |
3274 // First, insert the main record to SoftwareTypes table |
3360 // First, insert the main record to SoftwareTypes table |
3275 // TODO: Have to insert the Launcher Executable name here |
3361 _LIT(KInsertSwType, "INSERT INTO SoftwareTypes(SoftwareTypeId,SifPluginUid,LauncherExecutable) VALUES(?,?,?);"); |
3276 _LIT(KInsertSwType, "INSERT INTO SoftwareTypes(SoftwareTypeId,SifPluginUid) VALUES(?,?);"); |
3362 TInt numberOfValuesSwType = 3; |
3277 TInt numberOfValuesSwType = 2; |
3363 ExecuteStatementL(KInsertSwType(), numberOfValuesSwType, EValueInteger, swTypeId, EValueInteger, sifPluginUid, EValueString, launcherExecutable); |
3278 ExecuteStatementL(KInsertSwType(), numberOfValuesSwType, EValueInteger, swTypeId, EValueInteger, sifPluginUid); |
|
3279 |
3364 |
3280 _LIT(KInsertCustomAccess, "INSERT INTO CustomAccessList(SoftwareTypeId,SecureId,AccessMode) VALUES(?,?,?);"); |
3365 _LIT(KInsertCustomAccess, "INSERT INTO CustomAccessList(SoftwareTypeId,SecureId,AccessMode) VALUES(?,?,?);"); |
3281 TInt numberOfValuesCustomAccess = 3; |
3366 TInt numberOfValuesCustomAccess = 3; |
3282 // TODO: This should be modified to insert more than 2 Sids |
3367 for(TInt i=0; i<sidArray.Count(); ++i) |
3283 ExecuteStatementL(KInsertCustomAccess(), numberOfValuesCustomAccess, EValueInteger, swTypeId, EValueInteger, installerSecureId, EValueInteger, (TInt)ETransactionalSid); |
3368 { |
3284 ExecuteStatementL(KInsertCustomAccess(), numberOfValuesCustomAccess, EValueInteger, swTypeId, EValueInteger, executionLayerSecureId, EValueInteger, (TInt)ETransactionalSid); |
3369 TUint32 sid = sidArray[i].SecureId(); |
3285 |
3370 TAccessMode accessMode = sidArray[i].AccessMode(); |
|
3371 ExecuteStatementL(KInsertCustomAccess(), numberOfValuesCustomAccess, EValueInteger, swTypeId, EValueInteger, sid, EValueInteger, accessMode); |
|
3372 } |
|
3373 |
3286 // Then, insert MIME types of this software type into MimeTypes table |
3374 // Then, insert MIME types of this software type into MimeTypes table |
3287 _LIT(KInsertMimeType, "INSERT INTO MimeTypes(SoftwareTypeId,MimeType) VALUES(?,?);"); |
3375 _LIT(KInsertMimeType, "INSERT INTO MimeTypes(SoftwareTypeId,MimeType) VALUES(?,?);"); |
3288 TInt numberOfValuesMimeType = 2; |
3376 TInt numberOfValuesMimeType = 2; |
3289 TInt countMimeTypes = mimeTypesArray.Count(); |
3377 TInt countMimeTypes = mimeTypesArray.Count(); |
3290 for(TInt i=0; i<countMimeTypes; ++i) |
3378 for(TInt i=0; i<countMimeTypes; ++i) |
3578 } |
3666 } |
3579 |
3667 |
3580 void CScrRequestImpl::GetIsComponentPresentL(const RMessage2& aMessage) const |
3668 void CScrRequestImpl::GetIsComponentPresentL(const RMessage2& aMessage) const |
3581 { |
3669 { |
3582 TComponentId componentId = GetComponentIdFromMsgL(aMessage); |
3670 TComponentId componentId = GetComponentIdFromMsgL(aMessage); |
3583 DEBUG_PRINTF2(_L8("Checking if the component(%d) is available."), componentId); |
3671 TBool result = IsComponentPresentL(componentId); |
3584 |
|
3585 _LIT(KSelectCompPresent, "SELECT CompPresence FROM Components WHERE ComponentId=?;"); |
|
3586 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectCompPresent); |
|
3587 stmt->BindIntL(1, componentId); |
|
3588 if(!stmt->ProcessNextRowL()) |
|
3589 { |
|
3590 DEBUG_PRINTF2(_L8("Component (%d) couldn't be found in the SCR database."), componentId); |
|
3591 User::Leave(KErrNotFound); |
|
3592 } |
|
3593 TBool result = (stmt->IntColumnL(0) == 1); |
|
3594 CleanupStack::PopAndDestroy(stmt); |
|
3595 |
|
3596 // The default value for CompPresence is ETrue. So when we find that the SCR DB contains the |
|
3597 // default property value we check if the drives registered by the component are present. |
|
3598 if (result && !CheckForMediaPresenceL(componentId)) |
|
3599 { |
|
3600 result = EFalse; |
|
3601 } |
|
3602 |
3672 |
3603 TPckg<TBool> isCompPresent(result); |
3673 TPckg<TBool> isCompPresent(result); |
3604 aMessage.WriteL(1, isCompPresent); |
3674 aMessage.WriteL(1, isCompPresent); |
3605 } |
3675 } |
|
3676 |
|
3677 |
|
3678 TBool CScrRequestImpl::IsComponentPresentL(TComponentId componentId) const |
|
3679 { |
|
3680 DEBUG_PRINTF2(_L8("Checking if the component(%d) is available."), componentId); |
|
3681 |
|
3682 _LIT(KSelectCompPresent, "SELECT CompPresence FROM Components WHERE ComponentId=?;"); |
|
3683 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectCompPresent); |
|
3684 stmt->BindIntL(1, componentId); |
|
3685 if(!stmt->ProcessNextRowL()) |
|
3686 { |
|
3687 DEBUG_PRINTF2(_L8("Component (%d) couldn't be found in the SCR database."), componentId); |
|
3688 User::Leave(KErrNotFound); |
|
3689 } |
|
3690 TBool result = (stmt->IntColumnL(0) == 1); |
|
3691 CleanupStack::PopAndDestroy(stmt); |
|
3692 |
|
3693 // The default value for CompPresence is ETrue. So when we find that the SCR DB contains the |
|
3694 // default property value we check if the drives registered by the component are present. |
|
3695 if (result && !CheckForMediaPresenceL(componentId)) |
|
3696 { |
|
3697 result = EFalse; |
|
3698 } |
|
3699 return result; |
|
3700 } |
3606 |
3701 |
3607 void CScrRequestImpl::SetIsComponentPresentL(const RMessage2& aMessage) |
3702 void CScrRequestImpl::SetIsComponentPresentL(const RMessage2& aMessage) |
3608 { |
3703 { |
3609 DEBUG_PRINTF(_L8("Setting the component as present.")); |
3704 DEBUG_PRINTF(_L8("Setting the component as present.")); |
3610 _LIT(KColumnNameCompPresence, "CompPresence"); |
3705 _LIT(KColumnNameCompPresence, "CompPresence"); |
3919 |
4014 |
3920 } |
4015 } |
3921 |
4016 |
3922 void CScrRequestImpl::NextAppInfoSizeL(const RMessage2& aMessage, TAppRegInfo*& aAppInfo, CAppInfoViewSubsessionContext* aSubsessionContext) |
4017 void CScrRequestImpl::NextAppInfoSizeL(const RMessage2& aMessage, TAppRegInfo*& aAppInfo, CAppInfoViewSubsessionContext* aSubsessionContext) |
3923 { |
4018 { |
3924 if(aSubsessionContext->iAppInfoIndex < aSubsessionContext->iApps.Count()) |
4019 while(1) |
3925 { |
4020 { |
3926 TInt count1 = User::CountAllocCells(); |
4021 if(aSubsessionContext->iAppInfoIndex < aSubsessionContext->iApps.Count()) |
3927 aAppInfo = new(ELeave) TAppRegInfo; |
|
3928 TInt count2 = User::CountAllocCells(); |
|
3929 aAppInfo->iUid = (aSubsessionContext->iApps[aSubsessionContext->iAppInfoIndex]).iAppUid; |
|
3930 |
|
3931 _LIT(KSelectAppFilename, "SELECT AppFile FROM AppRegistrationInfo WHERE AppUid=?;"); |
|
3932 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectAppFilename); |
|
3933 stmt->BindIntL(1, aAppInfo->iUid.iUid); |
|
3934 stmt->ProcessNextRowL(); |
|
3935 aAppInfo->iFullName = stmt->StrColumnL(0); |
|
3936 CleanupStack::PopAndDestroy(stmt); |
|
3937 |
|
3938 if((aSubsessionContext->iApps[aSubsessionContext->iAppInfoIndex]).iLocale != KUnspecifiedLocale) |
|
3939 { |
4022 { |
3940 GetCaptionAndShortCaptionInfoForLocaleL(aAppInfo->iUid, aSubsessionContext->iApps[aSubsessionContext->iAppInfoIndex].iLocale, aAppInfo->iShortCaption, aAppInfo->iCaption); |
4023 TBool isPresent = EFalse; |
|
4024 aAppInfo = new(ELeave) TAppRegInfo; |
|
4025 aAppInfo->iUid = (aSubsessionContext->iApps[aSubsessionContext->iAppInfoIndex]).iAppUid; |
|
4026 |
|
4027 _LIT(KSelectAppFilename, "SELECT AppFile FROM AppRegistrationInfo WHERE AppUid=?;"); |
|
4028 CStatement *stmt = iDbHandle->PrepareStatementLC(KSelectAppFilename); |
|
4029 stmt->BindIntL(1, aAppInfo->iUid.iUid); |
|
4030 if(stmt->ProcessNextRowL()) |
|
4031 { |
|
4032 isPresent = ETrue; |
|
4033 aAppInfo->iFullName = stmt->StrColumnL(0); |
|
4034 } |
|
4035 CleanupStack::PopAndDestroy(stmt); |
|
4036 if(isPresent) |
|
4037 { |
|
4038 if((aSubsessionContext->iApps[aSubsessionContext->iAppInfoIndex]).iLocale != KUnspecifiedLocale) |
|
4039 { |
|
4040 GetCaptionAndShortCaptionInfoForLocaleL(aAppInfo->iUid, aSubsessionContext->iApps[aSubsessionContext->iAppInfoIndex].iLocale, aAppInfo->iShortCaption, aAppInfo->iCaption); |
|
4041 } |
|
4042 aSubsessionContext->iAppInfoIndex++; |
|
4043 WriteObjectSizeL(aMessage, 1, aAppInfo); |
|
4044 break; |
|
4045 } |
|
4046 else |
|
4047 { |
|
4048 DeleteObjectZ(aAppInfo); |
|
4049 aSubsessionContext->iAppInfoIndex++; |
|
4050 } |
3941 } |
4051 } |
3942 aSubsessionContext->iAppInfoIndex++; |
4052 else |
3943 } |
4053 { |
3944 else |
4054 break; |
3945 { |
4055 } |
3946 DEBUG_PRINTF(_L8("Reached the end of the view.")); |
4056 } |
3947 } |
|
3948 |
|
3949 WriteObjectSizeL(aMessage, 1, aAppInfo); |
|
3950 } |
4057 } |
3951 |
4058 |
3952 void CScrRequestImpl::NextAppInfoDataL(const RMessage2& aMessage, TAppRegInfo*& aAppInfo) |
4059 void CScrRequestImpl::NextAppInfoDataL(const RMessage2& aMessage, TAppRegInfo*& aAppInfo) |
3953 { |
4060 { |
3954 DEBUG_PRINTF(_L8("Returning the AppInfo data.")); |
4061 DEBUG_PRINTF(_L8("Returning the AppInfo data.")); |
4567 GetOpaqueDataArrayL(aAppUid, TUid::Null(), aApplicationRegistration.iOpaqueDataArray, aLanguage); |
4686 GetOpaqueDataArrayL(aAppUid, TUid::Null(), aApplicationRegistration.iOpaqueDataArray, aLanguage); |
4568 } |
4687 } |
4569 |
4688 |
4570 void CScrRequestImpl::NextApplicationRegistrationInfoSizeL(const RMessage2& aMessage, CApplicationRegistrationData*& aApplicationRegistration, CAppRegistrySubsessionContext* aSubsessionContext) |
4689 void CScrRequestImpl::NextApplicationRegistrationInfoSizeL(const RMessage2& aMessage, CApplicationRegistrationData*& aApplicationRegistration, CAppRegistrySubsessionContext* aSubsessionContext) |
4571 { |
4690 { |
4572 DeleteObjectZ(aApplicationRegistration); |
4691 while(1) |
4573 aApplicationRegistration = CApplicationRegistrationData::NewL(); |
4692 { |
4574 if((aSubsessionContext->iAppRegIndex < aSubsessionContext->iAppUids.Count())) |
4693 TBool dataFound = EFalse; |
4575 { |
4694 DeleteObjectZ(aApplicationRegistration); |
4576 TUid appUid = aSubsessionContext->iAppUids[aSubsessionContext->iAppRegIndex]; |
4695 aApplicationRegistration = CApplicationRegistrationData::NewL(); |
4577 |
4696 if((aSubsessionContext->iAppRegIndex < aSubsessionContext->iAppUids.Count())) |
4578 //Populate the Application Registration Info |
|
4579 if(GetApplicationRegistrationInfoL(*aApplicationRegistration,appUid)) |
|
4580 { |
4697 { |
4581 //Populate File ownership info |
4698 TUid appUid = aSubsessionContext->iAppUids[aSubsessionContext->iAppRegIndex]; |
4582 GetFileOwnershipInfoL(*aApplicationRegistration,appUid); |
4699 |
4583 |
4700 //Populate the Application Registration Info |
4584 //Populate service info |
4701 if(GetApplicationRegistrationInfoL(*aApplicationRegistration,appUid)) |
4585 GetServiceInfoL(*aApplicationRegistration, appUid, aSubsessionContext->iLanguage); |
4702 { |
4586 |
4703 //Populate File ownership info |
4587 //Populate localizable appinfo including caption and icon info |
4704 GetFileOwnershipInfoL(*aApplicationRegistration,appUid); |
4588 //and view data and its caption and icon info. |
4705 |
4589 GetLocalizableAppInfoL(*aApplicationRegistration,appUid, aSubsessionContext->iLanguage); |
4706 //Populate service info |
4590 |
4707 GetServiceInfoL(*aApplicationRegistration, appUid, aSubsessionContext->iLanguage); |
4591 GetAppRegOpaqueDataL(*aApplicationRegistration,appUid, aSubsessionContext->iLanguage); |
4708 |
4592 |
4709 //Populate localizable appinfo including caption and icon info |
4593 GetAppPropertiesInfoL(*aApplicationRegistration,appUid, aSubsessionContext->iLanguage); |
4710 //and view data and its caption and icon info. |
|
4711 GetLocalizableAppInfoL(*aApplicationRegistration,appUid, aSubsessionContext->iLanguage); |
|
4712 |
|
4713 GetAppRegOpaqueDataL(*aApplicationRegistration,appUid, aSubsessionContext->iLanguage); |
|
4714 |
|
4715 GetAppPropertiesInfoL(*aApplicationRegistration,appUid, aSubsessionContext->iLanguage); |
|
4716 dataFound = ETrue; |
|
4717 } |
|
4718 else |
|
4719 { |
|
4720 DeleteObjectZ(aApplicationRegistration); |
|
4721 } |
|
4722 |
|
4723 //Incrementing the index |
|
4724 aSubsessionContext->iAppRegIndex++; |
|
4725 |
|
4726 if(dataFound) |
|
4727 { |
|
4728 WriteObjectSizeL(aMessage, 1, aApplicationRegistration); |
|
4729 break; |
|
4730 } |
4594 } |
4731 } |
4595 else |
4732 else |
4596 { |
4733 { |
|
4734 DEBUG_PRINTF(_L8("Reached the end of the view.")); |
|
4735 WriteIntValueL(aMessage, 1, 0); |
4597 DeleteObjectZ(aApplicationRegistration); |
4736 DeleteObjectZ(aApplicationRegistration); |
|
4737 break; |
4598 } |
4738 } |
4599 |
|
4600 //Incrementing the index |
|
4601 aSubsessionContext->iAppRegIndex++; |
|
4602 WriteObjectSizeL(aMessage, 1, aApplicationRegistration); |
|
4603 } |
|
4604 else |
|
4605 { |
|
4606 DEBUG_PRINTF(_L8("Reached the end of the view.")); |
|
4607 WriteIntValueL(aMessage, 1, 0); |
|
4608 DeleteObjectZ(aApplicationRegistration); |
|
4609 } |
4739 } |
4610 } |
4740 } |
4611 |
4741 |
4612 void CScrRequestImpl::NextApplicationRegistrationInfoDataL(const RMessage2& aMessage, CApplicationRegistrationData*& aApplicationRegistration) |
4742 void CScrRequestImpl::NextApplicationRegistrationInfoDataL(const RMessage2& aMessage, CApplicationRegistrationData*& aApplicationRegistration) |
4613 { |
4743 { |