434 User::LeaveIfError(CallSessionFunction(EGetPluginUidWithComponentId, args)); |
434 User::LeaveIfError(CallSessionFunction(EGetPluginUidWithComponentId, args)); |
435 TUid pluginUid = TUid::Uid(uidNum); |
435 TUid pluginUid = TUid::Uid(uidNum); |
436 return pluginUid; |
436 return pluginUid; |
437 } |
437 } |
438 |
438 |
439 EXPORT_C void RSoftwareComponentRegistry::AddSoftwareTypeL(const TDesC& aUniqueSwTypeName, TUid aSifPluginUid, TSecureId aInstallerSecureId, TSecureId aExecutionLayerSecureId, const RPointerArray<HBufC>& aMimeTypes, const RPointerArray<CLocalizedSoftwareTypeName>* aLocalizedSwTypeNames) |
439 EXPORT_C void RSoftwareComponentRegistry::AddSoftwareTypeL(const CSoftwareTypeRegInfo& aSwTypeRegInfo) |
440 { |
440 { |
441 DEBUG_PRINTF2(_L("Sending add a new software type (%S) request."), &aUniqueSwTypeName); |
441 if(!aSwTypeRegInfo.MimeTypes().Count()) |
442 |
442 { |
443 if(!aMimeTypes.Count()) |
443 DEBUG_PRINTF(_L("MIME types list cannot be empty!")); |
444 { |
444 User::Leave(KErrArgument); |
445 DEBUG_PRINTF(_L("MIME types list cannot be empty!")); |
445 } |
446 User::Leave(KErrArgument); |
446 |
447 } |
447 RBuf8 buf; |
448 |
448 buf.CleanupClosePushL(); |
449 // Concatenate aSifPluginUid, aInstallerSecureId, and aExecutionLayerSecureId in order to gain spare slots to send other data |
449 ExternalizeRefObjectL(aSwTypeRegInfo, buf); |
450 RBuf8 uidString; |
450 |
451 uidString.CreateL(3*KUidStringLen); // 3 UIDs will be concatenated |
451 TIpcArgs swTypeArgs(&buf); |
452 uidString.CleanupClosePushL(); |
|
453 uidString.AppendNumFixedWidth(aSifPluginUid.iUid, EHex, KUidStringLen); |
|
454 uidString.AppendNumFixedWidth(aInstallerSecureId.iId, EHex, KUidStringLen); |
|
455 uidString.AppendNumFixedWidth(aExecutionLayerSecureId.iId, EHex, KUidStringLen); |
|
456 |
|
457 // Externalize the MIME types of the newly added software type |
|
458 HBufC8* mimeTypesBuf = ExternalizePointersArrayLC(aMimeTypes); |
|
459 |
|
460 // Externalize the unique and localizable names for the newly added software type |
|
461 const RPointerArray<CLocalizedSoftwareTypeName> *localCopyOfSwTypeNames(0); |
|
462 if(!aLocalizedSwTypeNames) |
|
463 {// if aLocalizedSwTypeNames is not supplied, then create an empty one. |
|
464 localCopyOfSwTypeNames = new(ELeave) RPointerArray<CLocalizedSoftwareTypeName>; |
|
465 CleanupStack::PushL(const_cast<RPointerArray<CLocalizedSoftwareTypeName>* >(localCopyOfSwTypeNames)); |
|
466 } |
|
467 else |
|
468 { |
|
469 localCopyOfSwTypeNames = aLocalizedSwTypeNames; |
|
470 } |
|
471 HBufC8* localizedNamesBuf = ExternalizePointersArrayLC(*localCopyOfSwTypeNames); |
|
472 |
|
473 TIpcArgs swTypeArgs(&aUniqueSwTypeName, &uidString, mimeTypesBuf, localizedNamesBuf); |
|
474 User::LeaveIfError(CallSessionFunction(EAddSoftwareType, swTypeArgs)); |
452 User::LeaveIfError(CallSessionFunction(EAddSoftwareType, swTypeArgs)); |
475 |
453 |
476 CleanupStack::PopAndDestroy(localizedNamesBuf); |
454 CleanupStack::PopAndDestroy();//buf, reginfo |
477 if(!aLocalizedSwTypeNames) |
|
478 {// destroy the localCopyOfSwTypeNames if created locally |
|
479 CleanupStack::PopAndDestroy(const_cast<RPointerArray<CLocalizedSoftwareTypeName>* >(localCopyOfSwTypeNames)); |
|
480 } |
|
481 CleanupStack::PopAndDestroy(2, &uidString); // uidString, mimeTypesBuf |
|
482 } |
455 } |
483 |
456 |
484 EXPORT_C void RSoftwareComponentRegistry::DeleteSoftwareTypeL(const TDesC& aUniqueSwTypeName, RPointerArray<HBufC>& aDeletedMimeTypes) |
457 EXPORT_C void RSoftwareComponentRegistry::DeleteSoftwareTypeL(const TDesC& aUniqueSwTypeName, RPointerArray<HBufC>& aDeletedMimeTypes) |
485 { |
458 { |
486 DEBUG_PRINTF2(_L("Sending a request to delete the software type (%S)."), &aUniqueSwTypeName); |
459 DEBUG_PRINTF2(_L("Sending a request to delete the software type (%S)."), &aUniqueSwTypeName); |