// -----------------------------------------------------------------------------
// MakeSortingItemsL
// Add/Make items to sorting item array and undefined items to
// undefined item array
// -----------------------------------------------------------------------------
//
void MakeSortingItemsL( RArray<TCLFSortingItem>& aSortingItemArray,
                        RPointerArray<MCLFItem>& aUndefinedItemArray,
                        const TArray<MCLFItem*>& aItemArray,
                        const TArray<TCLFFieldId> aSortFields,
                        TCLFItemDataType aSortingDataType )
{
    const TInt sortingFieldsCount( aSortFields.Count() );
    const TInt count( aItemArray.Count() );
    for( TInt i = 0 ; i < count ; ++i )
    {
        MCLFItem* seItem = aItemArray[i];
        TCLFSortingItem sortingItem;
        TInt fieldIdIndex( -1 );
        TInt error( KErrNone );
        do
        {
            ++fieldIdIndex;
            TCLFFieldId fieldId( aSortFields[fieldIdIndex] );
            switch( aSortingDataType )
            {
            case ECLFItemDataTypeDesC:
            {
                error = seItem->GetField( fieldId, sortingItem.iData );
                break;
            }
            case ECLFItemDataTypeTInt32:
            {
                error = seItem->GetField( fieldId, sortingItem.iIntData );
                break;
            }
            case ECLFItemDataTypeTTime:
            default:
            {
                error = seItem->GetField( fieldId, sortingItem.iTimeData );
                break;
            }
            }
        } while( ( error != KErrNone ) &&
                 ( fieldIdIndex < ( sortingFieldsCount - 1 ) ) );
        if( error == KErrNone )
        {
            sortingItem.iItem = seItem;
            aSortingItemArray.AppendL( sortingItem );
        }
        else
        {   // field not found -> undefined item
            aUndefinedItemArray.AppendL( seItem );
        }
    }
}
// -----------------------------------------------------------------------------
// CPIMAgnListAdapter::FetchNativeEntryL
// Fetches an entry according to a PIM item id.
// Returns: A calendar entry.
//          The ownership of the item is transferred to the caller.
// -----------------------------------------------------------------------------
//
CCalEntry* CPIMAgnListAdapter::FetchNativeEntryL(TPIMItemID aItemId,
        CCalEntry::TType aEntryType)
{
    JELOG2(EPim);
    EnsureOpenSessionL();
    __ASSERT_ALWAYS(aItemId != KPIMNullItemID, User::Leave(KErrArgument));

    RPointerArray<CCalEntry> entryArray;
    CleanupResetAndDestroyPushL(entryArray);
    iCalEntryView->FetchL(aItemId, entryArray);

    // Only one entry should be returned. NOTE that if there is no items
    // in the fetched array it means that the item might have been removed
    // so, we MUST NOT panic here as we did previously...
    __ASSERT_ALWAYS(entryArray.Count() > 0 && entryArray[0]->EntryTypeL()
                    == aEntryType, User::Leave(KErrNotFound));

    CCalEntry* entry = entryArray[0];
    // Take the ownership of the first item. Child instances are simply ignored
    entryArray.Remove(0);
    CleanupStack::PopAndDestroy(&entryArray);
    return entry;
}
Ejemplo n.º 3
0
EXPORT_C HBufC8* CEnvironment::ExternalizeLC() const
	{
	WaitLC();
	LtkUtils::RLtkBuf8 buf;
	CleanupClosePushL(buf);
	TDesWrite desWrite(buf);

	RPointerArray<HBufC> keys;
	LtkUtils::CleanupResetAndDestroyPushL(keys);
	GetKeysL(keys);
	desWrite.WriteL(keys.Count());
	for (TInt i = 0; i < keys.Count(); i++)
		{
		desWrite.WriteL(*keys[i]);
		desWrite.WriteL(GetAsDes(*keys[i]));
		}
	CleanupStack::PopAndDestroy(&keys);
	CleanupStack::Pop(&buf);
	CleanupStack::PopAndDestroy(); // Release lock
	HBufC8* res = buf.ToHBuf();
	CleanupStack::PushL(res);
	return res;
	}
void CIdWsfDsQueryResponse::GetAllServicesL(
        RPointerArray<CIdWsfServiceInstance>& aDest )
    {
    // Return all CIdWsfServiceInstance's
    for (TInt i = 0; i < iResourceOfferings.Count(); i++)
        {
        RPointerArray<CIdWsfServiceInstance>& services =
            iResourceOfferings[i]->ServicesL();
        for (TInt j = 0; j < services.Count(); j++)
            {
            User::LeaveIfError(aDest.Append(services[j]));
            }
        }
    }
Ejemplo n.º 5
0
// -----------------------------------------------------------------------------
// 
// -----------------------------------------------------------------------------
TInt CEmailFolder::GetSubfoldersL( RFolderArray& aSubfolders ) const
    {
    User::LeaveIfNull( iFolder );

    RPointerArray<CFSMailFolder> folders;
    CleanupResetAndDestroy<RPointerArray<CFSMailFolder> >::PushL( folders );

    iFolder->GetSubFoldersL( folders );
    
    TInt res( folders.Count() );
    
    for ( TInt i = 0; i < res; i++ )
        {
        const CFSMailFolder* fsfolder = folders[i];
        const TEntryId id = fsfolder->GetFolderId().Id();
        const TFolderId folderId( id, iFolderId.iMailboxId.iId );
        MEmailFolder* folder = CEmailFolder::NewL( iPluginData, folderId, folders[i] );
        aSubfolders.AppendL( folder );
        }
    CleanupStack::Pop( &folders );
    folders.Close();
    return res;
    }
TInt CTestHistoryLog::AddNewPushMsgAndTaskEntryL( CStifItemParser& /*aItem*/ )
	{
	TInt arrayCount = iHistoryArray->Count() + 1;	
	
	CSyncMLHistoryPushMsg * entry = CSyncMLHistoryPushMsg::NewL();
	CleanupStack::PushL(entry);
	
	CSmlAlertInfo* info = CSmlAlertInfo::NewLC();
	info->TaskIds().Append(1);
	info->TaskIds().Append(KTwo);
	
	info->TaskSyncTypes().Append( (TSmlSyncType)0);
	info->TaskSyncTypes().Append( (TSmlSyncType)1);
	
	RPointerArray<CSmlAlertInfo> alertInfoArray;
	CleanupClosePushL(alertInfoArray);
	alertInfoArray.Append(info);
	entry->AddAlertsL(alertInfoArray);
	iHistoryArray->AppendEntryL(entry);
	
	//Given KOne constant in the below line just to pop one item 
	 //and not given 'alertInfoArray' as PushL doesnot take that
	CleanupStack::PopAndDestroy(KOne); //alertInfoArray
	CleanupStack::Pop(info);
		
	TL(iHistoryArray->Count() == arrayCount);	
	
	if (iOwnerShip)
		{
		CleanupStack::Pop(entry);
		}
	else
		{
		CleanupStack::PopAndDestroy(entry);
		}			
	return KErrNone;
	}
TInt CSenPropertiesElement::ValueTokensL(const TDesC8& aDelimiter,
                                         RPointerArray<TPtrC8>& aTokens)
    {
    TPtrC8 content = this->Content();
    TInt delim = content.Find(aDelimiter);
    while ( delim != KErrNotFound )
        {
        TPtrC8* piece = new (ELeave) TPtrC8();
        piece->Set(content.Mid(0,delim));
        aTokens.Append(piece);
        
        content.Set(content.Mid(delim+aDelimiter.Length(),
                                content.Length()-(delim+aDelimiter.Length())));

        delim = content.Find(aDelimiter);
        }

    if(!(this->Content()!=KNullDesC8 && content==KNullDesC8))
        {
        // If this property does NOT zero-length content
        // and the "last" (or first) token is KNullDesC8
        // it means that the string ends with delimiter;
        // Therefore, KNullDesC8 must NOT be added as a
        // result of "tailing delimiter".

        // Add all other tokens here; even KNullDesC8
        // gets added, if it is eiher first or 
        TPtrC8* token = new (ELeave) TPtrC8();
        token->Set(content);
        aTokens.Append(token);
        }    
    if (aTokens.Count() == 0)
        {
        return KErrNotFound;
        }
    return KErrNone;
    }
Ejemplo n.º 8
0
TCalLocalUid CDstIntUtils::ImportVCalL(RFs& aFs, CCalSession& aSession, CCalEntryView& aEntryView, const TDesC& aFileName)
	{
	RFileReadStream readStream;
	User::LeaveIfError(readStream.Open(aFs, aFileName, EFileRead));
	CleanupClosePushL(readStream);

	// Create ptr array for new entries
	RPointerArray<CCalEntry> entryArray;
	CleanupStack::PushL(TCleanupItem(ResetAndDestroyArrayOfEntries, &entryArray));

	CCalDataExchange* dataExchange = CCalDataExchange::NewL(aSession);
	CleanupStack::PushL(dataExchange);
	dataExchange->ImportL(KUidVCalendar, readStream, entryArray);

	TInt elements = entryArray.Count();
	TCalLocalUid id = 0;

	if(elements > 0)
		{
		CCalEntry* entry = entryArray[0];
		// add the first entry only
		while (entryArray.Count() > 1)
			{
			delete entryArray[1];
			entryArray.Remove(1);
			}
		TInt success = 0;
		aEntryView.StoreL(entryArray, success);
		id = entryArray[0]->LocalUidL();
		}

	CleanupStack::PopAndDestroy(dataExchange);
	CleanupStack::PopAndDestroy();	// ResetAndDestroyArrayOfEntries(entryArray)
	CleanupStack::PopAndDestroy();	// readStream.Close()

	return id;
	}
/** list all the child part to this part 
    /note This method leaves with KErrNotSupported if it is NOT multi-part.
*/
EXPORT_C void CMsgStoreMessagePart::ChildPartsL( RPointerArray<CMsgStoreMessagePart>& aParts )
{
	
	TPartsArray partsArray( iContext, iMailBoxId, aParts );
	
	iContext.iSession.ChildrenPropertiesL( iId,               // aId
	                                       iParentId,         // aParentId
	                                       EMsgStorePartBits, // aContainerType
	                                       EFalse,            // aQuickProperties
	                                       EFalse,            // aRecursive	                                        	                                        
	                                       partsArray );	
	
	// make sure body come before attachments
	TInt count = aParts.Count(); 
	if ( count > 1 )
		{
		for ( TInt i = 0 ; i < count; i++ )
			{
			CMsgStoreMessagePart* part = aParts[i];
			TUint index = 0;
			if ( part->FindProperty( KMsgStorePropertyContentType, index ) )
				{
				const TDesC& contentType = part->PropertyValueDesL( index );
				if ( contentType == KFSMailContentTypeMultipartAlternative )
					{
						if( i > 0 )  
							{
							//body is not the first child, move it to the first place
							aParts.Remove(i);
							aParts.InsertL( part, 0 );
							}
						break;
					}
				}
			}
		}
}
Ejemplo n.º 10
0
// -----------------------------------------------------------------------------
// CMceSdpCodec::Direction
// -----------------------------------------------------------------------------
//
TInt CMceSdpCodec::Direction( 
    CSdpMediaField& aMedia, 
    RPointerArray<CSdpAttributeField>& aSessionAttributes ) const
    {
    
    TInt direction = KErrNotFound;
    TInt index = 0;
    
    // look for the direction attribute, go through all attribute fields.
    while( direction == KErrNotFound && index < aSessionAttributes.Count() )
        {
        RStringF attribute = aSessionAttributes[index++]->Attribute();
        
        if ( attribute == SDP_STRING( SdpCodecStringConstants::EAttributeSendonly ) ||
             attribute == SDP_STRING( SdpCodecStringConstants::EAttributeRecvonly ) ||
             attribute == SDP_STRING( SdpCodecStringConstants::EAttributeInactive ) ||
             attribute == SDP_STRING( SdpCodecStringConstants::EAttributeSendrecv ) )
            {
            // downlink
            direction = attribute.Index( *iStringTable );
            }
        }
        
    if ( direction == KErrNotFound )
        {
        index = 0;
        
        RPointerArray<CSdpAttributeField>& attrfields = aMedia.AttributeFields();
        // look for the direction attribute, go through all attribute fields. if not
        // found then use the default sendrcv
        while( direction == KErrNotFound && index < attrfields.Count() )
            {
    
            RStringF attribute = attrfields[index++]->Attribute();
            if ( attribute == SDP_STRING( SdpCodecStringConstants::EAttributeSendonly ) ||
                 attribute == SDP_STRING( SdpCodecStringConstants::EAttributeRecvonly ) ||
                 attribute == SDP_STRING( SdpCodecStringConstants::EAttributeInactive ) ||
                 attribute == SDP_STRING( SdpCodecStringConstants::EAttributeSendrecv ) )
                {
                // downlink
                direction = attribute.Index( *iStringTable );
                }
            
            }
        }
         
    return direction;
    
    }
// ---------------------------------------------------------------------------
// CAccPolAudioUnitBase::GetAudioControlsL
// ---------------------------------------------------------------------------
//
EXPORT_C TBool CAccPolAudioUnitBase::GetPreviousAudioUnitL(
    CAccPolAudioUnitBase*& aAudioUnit ) const
    {
    API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolAudioUnitBase::GetPreviousAudioUnitL() - Enter" );
    TBool bFound = EFalse;
    RPointerArray<CAccPolAudioUnitBase> audioUnits;

    reinterpret_cast<CAccPolAudioTopologyObjectCon*> ( iObjectContainer )->GetAudioUnitsL(
        audioUnits );
    TInt count = audioUnits.Count();

    aAudioUnit = NULL;
    for( TInt i = 0; i < count; i++ )
        {
        if( PreviousUnitId() == audioUnits.operator[]( i )->UnitId() )
            {
            aAudioUnit = audioUnits.operator[]( i );
            bFound = ETrue;
            break;
            }
        }
    API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolAudioUnitBase::GetPreviousAudioUnitL() - Return=%d", bFound );
    return bFound;
    }
Ejemplo n.º 12
0
// -----------------------------------------------------------------------------
// CSifUiTest::GetTestCasesL()
// -----------------------------------------------------------------------------
//
TInt CSifUiTest::GetTestCasesL( const TFileName& /*aConfig*/,
        RPointerArray<TTestCaseInfo>& aTestCases )
    {
    for( TInt index = 0; Case( index ).iMethod != NULL; ++index )
        {
        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
        CleanupStack::PushL( newCase );
        newCase->iCaseNumber = index;
        newCase->iTitle.Copy( Case(index).iCaseName );
        aTestCases.AppendL( newCase );
        CleanupStack::Pop( newCase );
        }

    return KErrNone;
    }
Ejemplo n.º 13
0
TBool CTzUserDataTest::CompareArray(const RPointerArray<CTzId>& aIds1, const RPointerArray<CTzId>& aIds2)
	{
	TInt count1 = aIds1.Count();
	TInt count2 = aIds2.Count();
	test(count1 == count2);
	
	TBool isEqual = ETrue;
	TInt ii=0;
	
	while(ii<count1 && isEqual)
		{
		isEqual = EFalse;
		for (TInt jj=0; jj<count2; ++jj)
			{
			if(aIds1[ii]==aIds2[jj])
				{
				isEqual = ETrue;
				break;	
				}
			}
		++ii;
		}
	return isEqual;
	}
// ---------------------------------------------------------------------------
// TPresCondIdentityMany::GetIdentitiesFromManyExceptL()
// ---------------------------------------------------------------------------
//
EXPORT_C TInt TPresCondIdentityMany::GetIdentitiesFromManyExceptL(const TDesC& aRuleID,
        CDesCArray& aIds, const TDesC& aDomain)
{
    OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::GetIdentitiesFromManyExceptL()" ) );
    OPENG_DP(D_OPENG_LIT( "     aRuleID:%S,aDomain:%S"),&aRuleID, &aDomain);

    TInt ret(KErrNotFound);

    RPointerArray<CXdmDocumentNode> nodes;
    CXdmNodeAttribute* attrId(NULL);

    CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
    if(manyNode!=NULL)
    {
        TInt err = manyNode->Find(KXdmExcept, nodes);
        TInt exceptNodeCount = nodes.Count();

        // go through all 'except' nodes
        for(TInt i=0; i<exceptNodeCount; i++)
        {
            attrId = (nodes[i])->Attribute(KXdmId);

            // for now we are supposing that except has only 1 id
            if(attrId!=NULL)
            {
                aIds.AppendL(attrId->AttributeValue());
            }
            attrId = NULL;
        }
        ret = KErrNone;
    }

    OPENG_DP(D_OPENG_LIT( "     return: %d"),ret);
    nodes.Close();
    return ret;
}
// -----------------------------------------------------------------------
// CPreviouslyInstalledAppsCache::UpdateAllL
// -----------------------------------------------------------------------
//  
void CPreviouslyInstalledAppsCache::UpdateAllL()
	{
    FLOG( _L("Daemon: CPreviouslyInstalledAppsCache::UpdateAllL ") );
    
	RThread ourThread; // nb. Default constructor gives handle to current thread.
	
	if( !ourThread.HasCapability(ECapabilityReadUserData, 0) )
		{
		// Have not got ReadUserData - if we try and enumerate package
		// UIDs the registry server will panic us!
		User::Leave(KErrAccessDenied);
		}
	ourThread.Close();

	// Let's use SisRegistry in this case since in SCR there is no
	// simple way to retriev sisx pacakge UIDs in one call.
    RSisRegistrySession registrySession;
    User::LeaveIfError( registrySession.Connect() );
    CleanupClosePushL( registrySession );
    
    RPointerArray<CSisRegistryPackage> packages;
    registrySession.InstalledPackagesL( packages );
    CleanupResetAndDestroy< 
           RPointerArray<CSisRegistryPackage> >::PushL( packages );
    
    for ( TInt i = 0; i < packages.Count(); ++i )
        {
        (void)iPrevPkgUids.InsertInSignedKeyOrder( packages[i]->Uid() );
        
        FLOG_1( _L("Daemon: UpdateAllL: Add UID = 0x%x"), 
                packages[i]->Uid().iUid );
        }
    
    CleanupStack::PopAndDestroy( &packages );
    CleanupStack::PopAndDestroy( &registrySession );
	}
Ejemplo n.º 16
0
// ------------------------------------------------
// NotifyRelationPresent
// ------------------------------------------------
//
void CMdSNotifier::NotifyRelationPresent(TBool aPresent, const RArray<TItemId>& aRelationIds)
    {
    if (aRelationIds.Count() == 0)
    	{
    	return;
    	}

    for( TInt i = iEntries.Count() - 1; i >=0; i-- )
        {
        TEntry& e = iEntries[i];

        // No condition matching, relation present changes
        // are always notified to relation present observers
        if( e.iType & ( ERelationNotifyPresent | ERelationNotifyNotPresent ) )
            {
            const TMdSObserverNotificationType relationState = 
            	aPresent ? ERelationNotifyPresent : ERelationNotifyNotPresent;

            RPointerArray<HBufC> nullArray; // For when uris are not needed
            if( e.IsPending() )
            	{
            	// match found. trigger notifier entry !
	            TRAPD( err, e.TriggerL( relationState, aRelationIds, nullArray ) );
	            if( err != KErrNone )
	            	{
	            	e.TriggerError( err );
	            	}
            	}
            else
            	{
            	TRAP_IGNORE( e.CacheL( relationState, aRelationIds, nullArray ) );
            	}
            nullArray.Close();
            }
        }
    }
Ejemplo n.º 17
0
// -----------------------------------------------------------------------------
// CUpnpDevice::ConstructL
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CUpnpDevice::ConstructL( const TUpnpDevice* aDevice,
    const RPointerArray<TUpnpService>& aServices )
    {
    Init();

    if ( aDevice )
        {
        iUUID = aDevice->iUUID.AllocL();
        iDeviceType = aDevice->iDeviceType.AllocL();
        iDescriptionURL = aDevice->iDescriptionURL.AllocL();
        iDomain = aDevice->iDomain.AllocL();
        iExpired = aDevice->iExpired;
        iAlive = aDevice->iAlive;

        if ( aDevice->iLocal )
            {
            iNetworkType = ELocalDevice;
            }
        else if ( aDevice->iRemote )
            {
            iNetworkType = ERemoteDevice;
            }
        else
            {
            iNetworkType = EHomeNetwork;
            }

        iServiceTypes = new (ELeave) CDesC8ArrayFlat( aServices.Count()
                == 0 ? 1 : aServices.Count() );

        for ( TInt i = 0; i < aServices.Count(); i++ )
            {
            iServiceTypes->AppendL( aServices[i]->iServiceType );
            }
        }
    }
Ejemplo n.º 18
0
/* 
 * Filter the results from ContactsMatchingCriteria/ContactsMatchingPrefix
 * removing contacts which are not in the current filtered view
 */
void CContactFilteredView::FilterResultsArray(RPointerArray<CViewContact>& aMatchedContacts)
	{
	TInt counter = 0;
	CViewContact* contactPtr;
	TContactIdWithMapping contactIdWithMapping;
	TInt max = aMatchedContacts.Count();
	// for each returned CContactFilteredView, check to
	// make sure that it is a contact which exists in
	// our list.

	// our list						: iFilteredIdArray
	// list to export is 			: aMatchedContacts
	while (counter < max)
		{
		contactPtr = aMatchedContacts[counter];
		contactIdWithMapping.iId = contactPtr->Id();

		// if the contact does not exist in our filtered list, then
		if ( iFilteredIdArray.Find(contactIdWithMapping, CompareMappings) == KErrNotFound )
			{
			// remove it from our list
			aMatchedContacts.Remove(counter); // does not delete pointer
			delete contactPtr;
			// we've removed an item from the array
			// this means that the item above, will drop to fill the hole left by
			// the item we've deleted.
			// so there is no need to increment the counter, but we do need to
			// decrement the max number of contacts we're parsing.
			max--;
			}
		else
			{
			counter++;
			}
		} 
	}
Ejemplo n.º 19
0
void CDrmFileContainer::ListAllContentL(RPointerArray <CDrmFileContent>& aContentArray)
	{
	TInt i;
	// add content from this container
	for(i = 0; i < iContents.Count(); i++)
		{
		User::LeaveIfError(aContentArray.Append(iContents[i]));		
		}
		
	// traverse embedded containers
	for(i = 0; i < iContainers.Count(); i++)
		{
		iContainers[i]->ListAllContentL(aContentArray);
		}
	}
Ejemplo n.º 20
0
void TServerStartupManager_StateAccessor::SetStateAwareObjectsState
		(CServerStartupMgr& aServerStartupMgr, TInt32 aState)
	{
	int i;
	const RPointerArray<MStartupStateObserver> observerList =
		aServerStartupMgr.iObserverList;

	for(i=0; i<observerList.Count(); i++)
		{
		CStartupStateObserver* observerObject =
			static_cast<CStartupStateObserver*>(observerList[i]);

		observerObject->SetState((CStartupStateObserver::TSsoState)aState);
		}
	}
Ejemplo n.º 21
0
// -----------------------------------------------------------------------------
// CSIPSecTlsPlugin::ProcessSecurityVerifyL
// After the framework has chosen security mechanism. it calls this function of
// the selected mechanism for all outgoing requests using the security
// agreement.
// Check that both Security-Server and Security-Verify header exist for this
// mechanism.
// -----------------------------------------------------------------------------
//
void CSIPSecTlsPlugin::ProcessSecurityVerifyL(
	TSIPTransportParams& aTransportParams,
	CSIPRequest& /*aRequest*/,
	TInetAddr& aNextHop,
	const CUri8& /*aRemoteTarget*/,
	const TDesC8& /*aOutboundProxy*/,
	MSIPSecUser* aUser,
	TRegistrationId /*aRegistrationId*/,
	RPointerArray<CSIPSecurityServerHeader>& aSecurityServer,
	RPointerArray<CSIPSecurityVerifyHeader>& aSecurityVerify )
	{
	__ASSERT_ALWAYS( aUser, User::Leave( KErrArgument ) );

	TInt i = 0;
	CSIPSecurityServerHeader* secServer = NULL;
	for ( i = 0; i < aSecurityServer.Count() && !secServer; ++i )
		{
		if ( aSecurityServer[i]->MechanismName().CompareF( Name() ) == 0 )
            {
            secServer = aSecurityServer[i];
            }
		}
	__ASSERT_ALWAYS( secServer, User::Leave( KErrArgument ) );

	CSIPSecurityVerifyHeader* secVerify = NULL;
	for ( i = 0; i < aSecurityVerify.Count() && !secVerify; ++i )
		{
		if ( aSecurityVerify[i]->MechanismName().CompareF( Name() ) == 0 )
            {
            secVerify = aSecurityVerify[i];
            }
		}
	__ASSERT_ALWAYS( secVerify, User::Leave( KErrArgument ) );

	ProcessRequestL( aTransportParams, aNextHop, *aUser );
	}
Ejemplo n.º 22
0
/**
 * This function manages the creation of uninstallation tree where each node 
 * corresponds to a package which may be uninstalled. 
 * 
 * @param aRootNode Root package to be uninstalled.
 */
void CPlanner::CreateUninstallationTreeL(CUninstallationNode& aRootNode)
	{
	RPointerArray<CUninstallationNode> unprocessedTreeNodes;
	CleanupClosePushL(unprocessedTreeNodes);
	
	CUninstallationNode* currentNode = &aRootNode;
	
	// PlannedPackages is used to avoid duplicate node in the uninstallation
	// tree.
	RPointerArray<CSisRegistryPackage> plannedPackages;
	CleanupResetAndDestroy<RPointerArray<CSisRegistryPackage> >::PushL(plannedPackages);

	// Add the root node in the planned packages, so that it is not added again (as a node in the tree)
	// in case of a cyclic dependency.	
	CSisRegistryPackage* rootPackage = CSisRegistryPackage::NewL(currentNode->PackageL());
	plannedPackages.AppendL(rootPackage);
	
	while(ETrue)
		{
		// plannedPackages is used to avoid creation of duplicate nodes in the tree
		CreateChildNodesL(*currentNode, plannedPackages);
		// After processing currentNode its child nodes should be processed.
		// Therefore append child nodes of currentNode to unprocessedTreeNodes
		AppendArrayL(unprocessedTreeNodes, currentNode->ChildNodes());
		TInt index = unprocessedTreeNodes.Count() - 1;
		if(index < 0)
			{
			break;
			}
		// Here we are processing the array from the end to make it a "Depth First Search"
		currentNode = unprocessedTreeNodes[index];
		unprocessedTreeNodes.Remove(index);
		}
	CleanupStack::PopAndDestroy(&plannedPackages);	
	CleanupStack::PopAndDestroy(&unprocessedTreeNodes);
	}
void CMultiThreadTestApp::SynchEntryL(CCalEntryView& aView)
	{
	FetchEntryL(aView, iEntries);
	if(iEntries.Count()>0)
		{
		_LIT(KExportFile,"Multithread_export");
		RFile outFile;
		TestRegister().CreateTempFileLC(outFile, KExportFile);
		RFileWriteStream writeStream(outFile);
		CleanupClosePushL(writeStream);
		DataExchangeL().ExportAsyncL(KUidVCalendar, writeStream, iEntries, *this);
		CActiveScheduler::Start();
		CleanupStack::PopAndDestroy(2, &outFile); // outFile.Close(), writeStream.Close()
		}
	}
// ---------------------------------------------------------------------------
// CAccPolAudioUnitBase::GetAudioControlsL
// ---------------------------------------------------------------------------
//
EXPORT_C void CAccPolAudioUnitBase::GetAudioControlsL( TUint32 aChannel,
    RPointerArray<CAccPolAudioControlBase>& aAudioControls ) const
    {
    API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolAudioUnitBase::GetAudioControlsL() - Channel number=%d", aChannel );
    TInt count = iAudioControls.Count();
    API_TRACE_1( "[AccFW: ACCPOLICY] CAccPolAudioUnitBase::GetAudioControlsL() - count=%d", count );
    for( TInt i = 0; i < count; i++ )
        {
        if( iAudioControls.operator[]( i )->Channel() == aChannel )
            {
            aAudioControls.AppendL( iAudioControls.operator[]( i ) );
            }
        }
    API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolAudioUnitBase::GetAudioControlL() Return" );
    }
Ejemplo n.º 25
0
void CRhodesAppView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
{
    if (iBrCtlInterface && aResourceId == R_MENUBAR )
    {
        iBrCtlInterface->AddOptionMenuItemsL(*aMenuPane, aResourceId);
        RPointerArray<TBrCtlWmlServiceOption>* options;
        options = iBrCtlInterface->WMLOptionMenuItemsL();
        TInt i;
        TInt count = options->Count();
        for (i = 0; i < count; i++)
    	{
            TBrCtlWmlServiceOption* option = (*options)[i];
            if (option != NULL)
            {
                CEikMenuPaneItem::SData item;
                item.iText.Copy(option->Text());
                item.iCommandId = option->ElemID();
                item.iFlags = 0;
                item.iCascadeId = 0;
                aMenuPane->InsertMenuItemL(item, 0);
            }
        }
    }
}
Ejemplo n.º 26
0
void CmsUtils::AddCertificateL(RPointerArray<CCmsCertificateChoice>& aCertList, const CX509Certificate& aCert)
	{
	
	TInt found(EFalse);
	TInt count=aCertList.Count();
	for (TInt i=0;i<count;i++)
		{
		if (aCertList[i]->CertificateType()==CCmsCertificateChoice::ECertificateX509
				&& aCert.IsEqualL(aCertList[i]->Certificate()))
			{
			found=ETrue;
			break;
			}
		}
	
	if (!found)
		{
		CCmsCertificateChoice* cert=CCmsCertificateChoice::NewL(aCert);
		CleanupStack::PushL(cert);
		aCertList.AppendL(cert);
		CleanupStack::Pop(cert);					
		}
		
	}
void CCalAlarmAttachTest::TestDeleteAlarmWithAlarmContentL()
    {
    test.Printf(_L("Test deleting alarm from an entry \n"));
    _LIT8(KEntryUidDeleteAlarm, "DeleteAlarmUid");
    CCalAlarm* alarm = StoreEntryWithAlarmContentLC(KEntryUidDeleteAlarm());
    RPointerArray<CCalEntry> entries;
    CleanupResetAndDestroyPushL(entries);

    //Update the entry by deleting its alarm
    iTestLib->SynCGetEntryViewL().FetchL(KEntryUidDeleteAlarm(), entries);
    CCalEntry* entry = entries[0];
    entry->SetAlarmL(NULL);
    TInt entriesStored = 0;
    iTestLib->SynCGetEntryViewL().StoreL(entries, entriesStored);
    
    //Update the entry by adding an alarm but without alarm content
    entries.ResetAndDestroy();
    iTestLib->SynCGetEntryViewL().FetchL(KEntryUidDeleteAlarm(), entries);
    alarm->SetAlarmAction(NULL);
    entry = entries[0];
    entry->SetAlarmL(alarm);
    iTestLib->SynCGetEntryViewL().StoreL(entries, entriesStored);
    entries.ResetAndDestroy();

    //Fetch the entry and test the entry has an alarm but not alarm content
    iTestLib->SynCGetEntryViewL().FetchL(KEntryUidDeleteAlarm(), entries);
    CCalAlarm* almEntry = entries[0]->AlarmL();
    CleanupStack::PushL(almEntry);
    test( almEntry != NULL );

    CCalContent* alarmcontent = almEntry->AlarmAction();
    test( alarmcontent == NULL );
    CleanupStack::PopAndDestroy(almEntry);
    CleanupStack::PopAndDestroy(&entries);
    CleanupStack::PopAndDestroy(alarm);
    }
Ejemplo n.º 28
0
// -----------------------------------------------------------------------------
// MceSip::FindHeadersL
// -----------------------------------------------------------------------------
// 
void MceSip::FindHeadersL( const CSIPMessageElements& aMessage,
                           RStringF aHeaderName,
                           RPointerArray<CSIPHeaderBase>& aHeaders )
    {
    const RPointerArray<CSIPHeaderBase>& headers = aMessage.UserHeaders();
    CSIPHeaderBase* header = NULL;
    
    for ( TInt i=0; i < headers.Count(); i++ )
        {
        header = headers[i];
        if ( header->Name() == aHeaderName )
            {
            aHeaders.AppendL( header );
            }
        }
    }
// ==========================================================================
// FUNCTION: FetchPropertiesL
// ==========================================================================
EXPORT_C void CMsgStoreMailBox::FetchPropertiesL( const RArray<TMsgStoreId>&                 aIds, 
                                                  const RPointerArray<TDesC8>&               aPropertyNames, 
                                                  RPointerArray<CMsgStorePropertyContainer>& aProperties )
    {
    if( aIds.Count() == 0 || aPropertyNames.Count() == 0 )
        {
    	__LOG_STATIC_ENTER( "MsgClient", "FetchPropertiesL" )
    	__LOG_WRITE_ERROR( "empty input array" )
   		__LOG_STATIC_EXIT
   		User::Leave( KErrArgument );
        } // end if
    
	TMsgStorePropertyContainersArray containersArray( aProperties );
	
    iContext.iSession.PropertiesL( aIds, aPropertyNames, containersArray );
    } // end FetchPropertiesL
/** Checks the start, end and time of an entry
@param	aFetchInstanceArray Array of instances 
@test
*/
void CTestCalInterimApiTZChange::CheckEntryTimesL(RPointerArray<CCalInstance>& aFetchInstanceArray)
	{
	CCalEntry& entry = aFetchInstanceArray[0]->Entry();
	
	const TDesC8& entryUid = entry.UidL();
	
	for ( TInt index = 0; index < aFetchInstanceArray.Count(); index++ )
		{
		const TDesC8& entryUid1 = aFetchInstanceArray[index]->Entry().UidL();
		TESTL(!entryUid.Compare(entryUid1));
		}
		
	GetEntryDataFromIniFileL();
	
	TDateTime startTime;
	TDateTime endTime;
	
	if (iIsFloating)
		{
		startTime = entry.StartTimeL().TimeLocalL().DateTime();
		INFO_PRINTF7(_L("Entry Start Date Year: %d, Month: %d, Day: %d, Imported Time Hr: %d, Min: %d, Sec: %d "), startTime.Year(), startTime.Month(), startTime.Day(), startTime.Hour(), startTime.Minute(), startTime.Second());
		TESTL(FormatDateTime(iPtrExpectedEntryStart) == entry.StartTimeL().TimeLocalL());
		endTime = entry.EndTimeL().TimeLocalL().DateTime();
		INFO_PRINTF7(_L("Entry End Date Year: %d, Month: %d, Day: %d, Imported Time Hr: %d, Min: %d, Sec: %d "), endTime.Year(), endTime.Month(), endTime.Day(), endTime.Hour(), endTime.Minute(), endTime.Second());
		TESTL(FormatDateTime(iPtrExpectedEntryEnd) == entry.EndTimeL().TimeLocalL());
		TESTL(entry.StartTimeL().TimeMode() == TCalTime::EFloating);
		TESTL(entry.EndTimeL().TimeMode() == TCalTime::EFloating);
		}
	else
		{
		startTime = entry.StartTimeL().TimeUtcL().DateTime();
		INFO_PRINTF7(_L("Entry Start Date Year: %d, Month: %d, Day: %d, Imported Time Hr: %d, Min: %d, Sec: %d "), startTime.Year(), startTime.Month(), startTime.Day(), startTime.Hour(), startTime.Minute(), startTime.Second());
		TESTL(FormatDateTime(iPtrExpectedEntryStart) == entry.StartTimeL().TimeUtcL());
		endTime = entry.EndTimeL().TimeUtcL().DateTime();
		INFO_PRINTF7(_L("Entry End Date Year: %d, Month: %d, Day: %d, Imported Time Hr: %d, Min: %d, Sec: %d "), endTime.Year(), endTime.Month(), endTime.Day(), endTime.Hour(), endTime.Minute(), endTime.Second());
		TESTL(FormatDateTime(iPtrExpectedEntryEnd) == entry.EndTimeL().TimeUtcL());
		TESTL(entry.StartTimeL().TimeMode() == TCalTime::EFixedUtc);
		TESTL(entry.EndTimeL().TimeMode() == TCalTime::EFixedUtc);
		}
		
	INFO_PRINTF1(KEntryTimesCorrect);	
	
	CCalAlarm* alarm1 = entry.AlarmL();
	TESTL(alarm1->TimeOffset().Int() == iIntAlarmOffset);
	delete alarm1;
	INFO_PRINTF1(KAlarmOffsetTZ);	
	}