Пример #1
0
//1. make a copy(A) of supported oids
//2. set supported oids to list from config
//3. reset supported oids
//4. get supported oids(B)
//5. iterate over B, find and remove first match in A.  if not found we error
//6. if A is not empty we error
void CPkixCertResetSupportedOidsStep::PerformTestL()
	{
	CPkixCertStepBase::PerformTestL();
	
	//1. make a copy(A) of supported oids
	const RPointerArray<TDesC>& suppOids = iCertChain->SupportedCriticalExtensions();	
	//CleanupClosePushL(suppOids);	//don't need to do this as a ref and done in stepbase destructor
	RPointerArray<HBufC> startSuppOids;
	CleanupResetAndDestroy<RPointerArray<HBufC> >::PushL(startSuppOids);
		
	HBufC* des;
	TInt i;
	for (i=0; i < suppOids.Count(); ++i)
		{
		des = (suppOids[i])->AllocLC();
		startSuppOids.AppendL(des);
		CleanupStack::Pop(des);
		}

	//2. set supported oids to list from config
	iCertChain->SetSupportedCriticalExtensionsL(iProcessedOids);
	//3. reset supported oids
	iCertChain->ResetSupportedCriticalExtsToDefaultL();
	//4. get supported oids(B)
	const RPointerArray<TDesC>& suppOids2 = iCertChain->SupportedCriticalExtensions();
	
	//5. iterate over B, find and remove first match in A.  if not found we error
	TBool found;
	for (i=0; i < suppOids2.Count(); ++i)
		{
		found = EFalse;
		for (TInt j=0; j < startSuppOids.Count(); ++j)
			{
			if ((*suppOids2[i]) == (*startSuppOids[j]))
				{
				found = ETrue;
				delete (startSuppOids[j]);
				startSuppOids.Remove(j);
				break;
				}
			}
		if (!found)	
			{
			ERR_PRINTF2(_L("ERROR: Extra OID found in result: %S"), suppOids2[i]);
			User::Leave(KErrGeneral);
			}
		}
		
	//6. if A is not empty we error
	if (startSuppOids.Count() != 0)
		{
		for (TInt j=0; j < startSuppOids.Count(); ++j)
			{	
			ERR_PRINTF2(_L("ERROR: OID missing from result: %S"), startSuppOids[j]);
			}
		User::Leave(KErrGeneral);
		}		
	
	CleanupStack::PopAndDestroy(2, iCertChain);	
	}
// -----------------------------------------------------------------------------
//  CUpnpHttpServerTransactionHandler::MatchType
//
// -----------------------------------------------------------------------------
//
CUpnpHttpServerTransactionHandler::TDescriptionType 
              CUpnpHttpServerTransactionHandler::MatchType( const TDesC8& aUri )
    {
    if ( aUri.CompareF( iDevice.DescriptionUrl() ) == 0 )
        {
        return EDevice;
        }

    //1st check if url is service url
    RPointerArray<CUpnpService> servList =
                 iDevice.ServiceList();
    TInt count = servList.Count();
    for( TInt index = 0; index < count; index++ )
        {
        if( servList[ index ]->ServiceDescriptionUrl().CompareF( aUri ) == 0 )
            {
            return EService;
            }
        }
    //next check icon list
    RPointerArray<CUpnpIcon> iconList =
                 iDevice.Icons();
    count = iconList.Count();
    for( TInt index2 = 0; index2 < count; index2++ )
        {
        if( iconList[ index2 ]->Url().CompareF( aUri ) == 0 )
            {
            return EIcon;
            }
        }
    return ENotFound;
    }
Пример #3
0
// ---------------------------------------------------------------------------
// CPresenceXDM::GetConditionChildNodeL()
// ---------------------------------------------------------------------------
//   
CXdmDocumentNode* CPresenceXDM::GetConditionChildNodeL(const TDesC& aRuleId,
                                     const TDesC& aCondChild, TBool aCreate)
    {
    OPENG_DP(D_OPENG_LIT( " CPresenceXDM::GetConditionChildNodeL()" ) );
    OPENG_DP(D_OPENG_LIT( "      aRuleId = %S, aCondChild = %S, aCreate = %d"),
                                               &aRuleId, &aCondChild, aCreate);
    
    CXdmDocumentNode* conditionNode = GetRuleChildNodeL(aRuleId, KXdmConditions, 
                                                                    aCreate);
    if (!conditionNode)
        return NULL;
    
    RPointerArray<CXdmDocumentNode> nodes;
    CXdmDocumentNode* condChildNode(NULL);


    // Finding condition child node
	conditionNode->Find(aCondChild, nodes);
    OPENG_DP(D_OPENG_LIT( "     GetcondChildNodeL nodeCount = %d"),nodes.Count());
	if(nodes.Count()) // if condition child node exist
	    {
	    condChildNode = nodes[0]; // only one condition child node can exist
	    }
	else if (aCreate) // if asked to create
	    {
	    condChildNode = conditionNode->CreateChileNodeL(aCondChild);
	    }

    nodes.Close();        
    return condChildNode;
    }
CSenElement* CPolicyNormalizer::CopySenElementL(CSenElement* aSource, CSenElement* aDestination)
{
  TPtrC8 sourceContent = aSource->Content();
  if (sourceContent.Length() > 0)
      {
        aDestination->SetContentL(sourceContent);
        
      }
    aDestination->SetNamespaceL(aSource->NsPrefix(), aSource->NamespaceURI());

    RPointerArray<CSenBaseAttribute> sourceAttributes = aSource->AttributesL();
    if (sourceAttributes.Count() > 0)
        {
        for (TInt i=0;i<sourceAttributes.Count(); i++)
            {
            CSenBaseAttribute* pBaseAttribute = sourceAttributes[i];

            aDestination->AddAttributeL(pBaseAttribute->Name(),
                                        pBaseAttribute->Value());
            
            }
        }
//        sourceAttributes.Close();
        return aDestination;
}
/** Check the updated categories extended name
@param	aCalEntry Pointer to CCalEntry
@param	aCategories Expected category name
*/
void CTestCalInterimApiFetchEntryAndCheckData::CheckCategoriesL(CCalEntry* aCalEntry, const TDesC& aCategories)
	{
	RArray<TPtrC> categoryList;
	TokenizeStringL(aCategories, categoryList);
	RPointerArray<CCalCategory> entryCatList;
	CleanupStack::PushL(TCleanupItem(ResetAndDestroyCategoryArray, &entryCatList));
	entryCatList = aCalEntry->CategoryListL();

	for(TInt ii = 0; ii < categoryList.Count(); ++ii)
		{
		TInt jj = 0;
		for(; jj < entryCatList.Count(); ++jj)
			{
			if(entryCatList[jj]->ExtendedCategoryName() == categoryList[ii])
				{
				INFO_PRINTF2(KInfoCategoryExists, &(categoryList[ii]));
				break; // break jj
				}
			} // jj

		if(jj >= entryCatList.Count())
			{
			ERR_PRINTF2(KErrCategoryNotExists, &(categoryList[ii]));
			SetTestStepResult(EFail);
			}
		}// ii

	CleanupStack::PopAndDestroy(&entryCatList);
	}
/*
EXPORT_C TInt RDirectPrintClient::RegisterIdleObserver( TIdleGuardData& aData, TRequestStatus& aStatus )
	{ 
	LOG("RDirectPrintClient::RegisterIdleObserver EReserveEngine");
	TInt err = SendReceive( EReserveEngine );
	LOG1("RDirectPrintClient::RegisterIdleObserver EReserveEngine err: %d", err);
	if( !err )
		{
		LOG("RDirectPrintClient::RegisterIdleObserver ERegisterIdleObserver");
		iIdleDataPtr.Set(reinterpret_cast<TUint8*>(&aData), sizeof(aData), sizeof(aData));
		SendReceive( ERegisterIdleObserver, TIpcArgs( &iIdleDataPtr ), aStatus );
		}
	LOG1("RDirectPrintClient::RegisterIdleObserver end with: %d", err);
	return err;
	}

EXPORT_C TInt RDirectPrintClient::CancelRegisterIdleObserver() const 
	{
	LOG("RDirectPrintClient::CancelRegisterIdleObserver ECancelRegisterIdleObserver");
	TInt err = SendReceive( EReleaseEngine );
	LOG1("RDirectPrintClient::RegisterIdleObserver EReleaseEngine err: %d", err);

	err = SendReceive( ECancelRegisterIdleObserver );
	LOG1("RDirectPrintClient::RegisterIdleObserver ECancelRegisterIdleObserver err: %d", err);
	
	LOG1("RDirectPrintClient::CancelRegisterIdleObserver end with: %d", err);
	return err;
	}

EXPORT_C TInt RDirectPrintClient::StartDiscovery( TDiscoveryGuardData& aData, TUint aProtocols, TRequestStatus& aStatus )
	{ 
	LOG("RDirectPrintClient::StartDiscovery EReserveEngine");
	TInt err = SendReceive( EReserveEngine );
	LOG1("RDirectPrintClient::StartDiscovery EReserveEngine err: %d", err);
	if( !err )
		{ 
		LOG1("RDirectPrintClient::StartDiscovery EStartDiscovery aProtocols: %d", aProtocols);
		err = SendReceive( EStartDiscovery, TIpcArgs( aProtocols ) );
		LOG1("RDirectPrintClient::StartDiscovery EStartDiscovery err: %d", err);
		}
	if( !err )
		{
		LOG("RDirectPrintClient::StartDiscovery EContinueDiscovery");
		iDicsoveryDataPtr.Set(reinterpret_cast<TUint8*>(&aData), sizeof(aData), sizeof(aData));
		SendReceive( EContinueDiscovery, TIpcArgs( &iDicsoveryDataPtr ), aStatus );
		}
	LOG1("RDirectPrintClient::StartDiscovery end with: %d", err);
	return err;
	}

EXPORT_C TInt RDirectPrintClient::ContinueDiscovery( TDiscoveryGuardData& aData, TRequestStatus& aStatus )
	{
	LOG("RDirectPrintClient::ContinueDiscovery EReserveEngine");
	TInt err = SendReceive( EReserveEngine );
	LOG1("RDirectPrintClient::ContinueDiscovery EReserveEngine err: %d", err);
    if( !err )
    	{
    	LOG("RDirectPrintClient::ContinueDiscovery EContinueDiscovery");
	    iDicsoveryDataPtr.Set(reinterpret_cast<TUint8*>(&aData), sizeof(aData), sizeof(aData));
	    SendReceive( EContinueDiscovery, TIpcArgs( &iDicsoveryDataPtr ), aStatus );
    	}
    LOG1("RDirectPrintClient::ContinueDiscovery end with: %d", err);
    return err;
	}
*/
EXPORT_C TInt RDirectPrintClient::CreateJob( TInt aPrinterID, TDirectPrintJobGuardData& aData, RPointerArray<TDesC>& aImages, TRequestStatus& aStatus )
	{
	LOG("RDirectPrintClient::CreateJob EReserveEngine");
	TInt err = SendReceive( EReserveEngine );
	LOG1("RDirectPrintClient::CreateJob EReserveEngine err: %d", err);
	if( !err )
		{
		TInt count = aImages.Count();
		LOG1("RDirectPrintClient::CreateJob aImages.Count(): %d", aImages.Count());
		for( TInt i = 0; i < count && !err; i++ )
			{
			LOG("RDirectPrintClient::CreateJob EPrepareJob");
			err = SendReceive( EPrepareJob, TIpcArgs( aImages[i] ) );
			LOG1("RDirectPrintClient::CreateJob EPrepareJob err: %d", err);	
			}
		}
    if( !err )
    	{
    	LOG("RDirectPrintClient::CreateJob ECreateJob");
    	err = SendReceive( ECreateJob, TIpcArgs( aPrinterID ) );
    	LOG1("RDirectPrintClient::CreateJob ECreateJob err: %d", err);
    	}
    if( !err )
    	{ 
    	LOG("RDirectPrintClient::CreateJob EContinueCreateJob");
    	iJobDataPtr.Set(reinterpret_cast<TUint8*>(&aData), sizeof(aData), sizeof(aData));
	    SendReceive( EContinueCreateJob, TIpcArgs( &iJobDataPtr ), aStatus );
    	}
    LOG1("RDirectPrintClient::CreateJob end with: %d", err);
    return err;
	}		
Пример #7
0
EXPORT_C TBool T_LbsUtils::Compare_PosInfoArr(RPointerArray<TAny>& aPosInfoArrSideA, RPointerArray<TAny>& aPosInfoArrSideB, TComparisonAccuracyType aCmpAccuracy)
	{
	// Only compare items if the arrays are the same size.
	if (aPosInfoArrSideA.Count() == aPosInfoArrSideB.Count())
		{
		TPositionInfoBase* posInfoA;
		TPositionInfoBase* posInfoB;
		TBool res;
		
		for (TInt i = 0; i < aPosInfoArrSideA.Count(); ++i)
			{
			posInfoA = reinterpret_cast<TPositionInfoBase*>(aPosInfoArrSideA[i]);
			posInfoB = reinterpret_cast<TPositionInfoBase*>(aPosInfoArrSideB[i]);
			
			res = Compare_PosInfo(*posInfoA, *posInfoB, aCmpAccuracy);
			if (!res)
				return EFalse;
			}
		}
	
	else
		{
		TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfoArr() Failed because different number of positions in arrays being compared!");
		return EFalse;
		}
	return ETrue;
	}
void CScrGetComponentLocalizedStep::ImplTestStepL()
    {
    TComponentId expectedComponentId = GetComponentIdL();
    RPointerArray<Usif::CLocalizableComponentInfo> compLocalizedInfoArrayExpected;
    CleanupResetAndDestroyPushL(compLocalizedInfoArrayExpected);
    
    GetLocalisedComponentsFromConfigL(compLocalizedInfoArrayExpected);
    
    RPointerArray<Usif::CLocalizableComponentInfo> compLocalizedInfoArrayRetrieved;
    // Start timer just before invocation of SCR API
    StartTimer();
    CleanupResetAndDestroyPushL(compLocalizedInfoArrayRetrieved);
    iScrSession.GetComponentLocalizedInfoL(expectedComponentId, compLocalizedInfoArrayRetrieved);
    if(compLocalizedInfoArrayExpected.Count()!=compLocalizedInfoArrayRetrieved.Count())
        {
        ERR_PRINTF1(_L("Returned component entry count doesnt match the expected count")); 
        SetTestStepResult(EFail);
        }
    else
        {
        for(TInt i=0;i<compLocalizedInfoArrayExpected.Count();i++)
            {
            if((compLocalizedInfoArrayExpected[i]->NameL()!=compLocalizedInfoArrayExpected[i]->NameL())||(compLocalizedInfoArrayExpected[i]->VendorL()!=compLocalizedInfoArrayExpected[i]->VendorL())||(compLocalizedInfoArrayExpected[i]->Locale()!=compLocalizedInfoArrayExpected[i]->Locale()))
                {
                ERR_PRINTF7(_L("Returned component entry values(%S,%S,%d) don't match with the expected ones(%S,%S,%d)."),&(compLocalizedInfoArrayRetrieved[i]->NameL()),&(compLocalizedInfoArrayRetrieved[i]->VendorL()),compLocalizedInfoArrayRetrieved[i]->Locale(),&(compLocalizedInfoArrayExpected[i]->NameL()),&(compLocalizedInfoArrayExpected[i]->VendorL()),compLocalizedInfoArrayExpected[i]->Locale());
                SetTestStepResult(EFail);
                }
            }
        }           
        
    CleanupStack::Pop(2,&compLocalizedInfoArrayExpected); //compLocalizedInfoArrayExpected ,compLocalizedInfoArrayRetrieved 
    compLocalizedInfoArrayRetrieved.ResetAndDestroy();
    compLocalizedInfoArrayExpected.ResetAndDestroy();
    }
TInt CSenLayeredXmlProperties::PropertiesByTypeL(const TDesC8& aType,
                                                 RPointerArray<MSenProperty>& aArray)
    {
    TInt retVal(KErrNotFound);

    retVal = AllPropertiesByTypeL(aType, aArray);

    // Remove omitted values from the array.
    TInt propsCount = aArray.Count()-1;
    for (TInt i=propsCount; i>=0; i--)
        {
        CSenPropertiesElement* pElement = (CSenPropertiesElement*)aArray[i];
		const TDesC8* pAttrValue = pElement->AttrValue(KSenOmittedAttributeName);
		if ( pAttrValue )
            {
            if ( *pAttrValue == KSenOmittedTrueNoValue)
		        {
		        aArray.Remove(i);
                }
            else if ( *pAttrValue == KSenPropertyTrue)
                {
		        aArray.Remove(i);
                }
            }
        }
    
    if ( aArray.Count() > 0 )
        {
        retVal=KErrNone;
        }
    
    return retVal;
    }
TBool CPolicyNormalizer::CopySenElementWithoutOptionL(CSenElement* aSource,CSenElement* aDestination)
{
  
  TPtrC8 sourceContent = aSource->Content();
  TBool isTrue = EFalse;
  if (sourceContent.Length() > 0)
      {
        aDestination->SetContentL(sourceContent);
        
      }

    RPointerArray<CSenBaseAttribute> sourceAttributes = aSource->AttributesL();
    if (sourceAttributes.Count() > 0)
        {
        for (TInt i=0;i<sourceAttributes.Count(); i++)
            {
            CSenBaseAttribute* pBaseAttribute = sourceAttributes[i];
            if(pBaseAttribute->Name().Compare(WSPolicy::KWspOptinal) == 0)
            {
                if(pBaseAttribute->Value().Compare(WSPolicy::KWspOptinalTrue) == 0)
                    isTrue = ETrue;                    
            }
                
            else
                aDestination->AddAttributeL(pBaseAttribute->Name(),pBaseAttribute->Value());
            
            }
        }
//        sourceAttributes.Close();
        return isTrue;  
}
Пример #11
0
void CUnifiedCertStore::ListL(RMPointerArray<CCTCertInfo>& aCertInfos,
							  const CCertAttributeFilter& aFilter, 
							  RPointerArray<const TDesC8> aIssuers)
	{
	// Obscure special case: If aIssuers has no elements, we should
	// return nothing.
	if (aIssuers.Count() == 0)
		{
		Complete(KErrNone);
		return;
		}

	AllocWorkingVarsL();
	iWorkingVars->iCertInfos = &aCertInfos;
	iWorkingVars->iFilter = &aFilter;
	iWorkingVars->iCertIndex = aCertInfos.Count();
	
	TInt count = aIssuers.Count();
	for (TInt i = 0 ; i < count ; ++i)
		{
		User::LeaveIfError(iWorkingVars->iIssuerNames.Append(aIssuers[i]));
		}
	
	iIndex = -1;
	SetActive();
	TRequestStatus* status = &iStatus;
	User::RequestComplete(status, KErrNone);	
	}
Пример #12
0
// ---------------------------------------------------------------------------
// TPresCondValidity::GetValidityNode()
// ---------------------------------------------------------------------------
//    
CXdmDocumentNode* TPresCondValidity::GetValidityNodeL(const TDesC& aRuleID, 
                                                        TBool aCreate)
    {
    OPENG_DP(D_OPENG_LIT( " TPresCondValidity::GetValidityNodeL()" ) );
    OPENG_DP(D_OPENG_LIT( "     GetValidityNodeL aRuleID = %S, aCreate = %d"),
                                                            &aRuleID, aCreate);
    
    __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));                                                        
    
    CXdmDocumentNode* conditionNode = iPresXDM->GetRuleChildNodeL(aRuleID, 
                                                    KXdmConditions, aCreate);
    if (conditionNode==NULL)
        return conditionNode;

    RPointerArray<CXdmDocumentNode> nodes;
    CXdmDocumentNode* validityNode(NULL);

    // Finding sphere node
	conditionNode->Find(KXdmValidity, nodes);
    OPENG_DP(D_OPENG_LIT( "     GetValidityNodeL nodeCount = %d"),nodes.Count());
	if(nodes.Count()) // if identity node exist
	    {
	    validityNode = nodes[0]; // only one sphere node can exist
	    }
	else if (aCreate) // if asked to create
	    {
	    validityNode = conditionNode->CreateChileNodeL(KXdmValidity);
	    }

    nodes.Close();        
    return validityNode;   
    }
Пример #13
0
// -----------------------------------------------------------------------------
// CSIPMessage::ReplaceHeadersL
// -----------------------------------------------------------------------------
//
EXPORT_C void 
CSIPMessage::ReplaceHeadersL (RPointerArray<CSIPHeaderBase>& aNewHeaders)
    {
    __ASSERT_ALWAYS (aNewHeaders.Count() > 0, User::Leave(KErrArgument));
    __ASSERT_ALWAYS (aNewHeaders[0] != 0, User::Leave(KErrArgument));
    
    RStringF name = aNewHeaders[0]->Name();
    for (TInt i=1; i < aNewHeaders.Count(); i++)
        {
        __ASSERT_ALWAYS (aNewHeaders[i] != 0, User::Leave(KErrArgument));
        __ASSERT_ALWAYS (name == aNewHeaders[i]->Name(),
                         User::Leave(KErrArgument));
        }

    TInt headerListIndex = FindHeaderListIndex (name);
    __ASSERT_ALWAYS (headerListIndex >= 0, User::Leave(KErrArgument));

    // Remove old headers
    TSglQueIter<CSIPHeaderBase> iter(iSIPHeaderListArray[headerListIndex]);
	while (iter)
		{
		CSIPHeaderBase* header = iter++;
		delete header;
		}
    iSIPHeaderListArray[headerListIndex].Reset();

    // Add new headers
    for (TInt j=0; j < aNewHeaders.Count(); j++)
        {
        iSIPHeaderListArray[headerListIndex].AddLast(*aNewHeaders[j]);
        }
    aNewHeaders.Reset();
    }
Пример #14
0
// ---------------------------------------------------------
// CRoapTrigger::ConstructL()
// ---------------------------------------------------------
//
void CRoapTrigger::ConstructL( const TTriggerType& aTriggerType,
                               const TDesC8& aRiId,
                               const TDesC8& aDomainId,
                               const TDesC8& aRoapUrl,
                               const RPointerArray<HBufC8>& aRoIdList,
                               const RPointerArray<HBufC8>& aContentIdList )
    {
    HBufC8* temp = NULL;
    
    iTriggerType = aTriggerType;
    iRiId.Copy( aRiId );
    iDomainId = aDomainId.AllocL();
    iRoapUrl = aRoapUrl.AllocL();
    
    for( TInt i = 0; i < aRoIdList.Count(); i++ )
        {
        temp = aRoIdList[i]->AllocLC();
        iRoIdList.AppendL( temp );
        CleanupStack::Pop(); //temp
        }
        
    for( TInt i = 0; i < aContentIdList.Count(); i++ )
        {
        temp = aContentIdList[i]->AllocLC();
        iContentIdList.AppendL( temp );
        CleanupStack::Pop(); //temp
        }    
    }
// -----------------------------------------------------------------------------
// CSIPParamContainerBase::ToTextLC
// -----------------------------------------------------------------------------
//
HBufC8* CSIPParamContainerBase::ToTextLC () const
	{
	TUint encodedLength = 0;

	RPointerArray<HBufC8> paramsAsText;
	CleanupStack::PushL (TCleanupItem(ResetAndDestroy,&paramsAsText));

	for (TInt i=0; i < iParams.Count(); i++)
		{
		HBufC8* paramAsText = iParams[i]->ToTextLC();
		encodedLength += paramAsText->Length();
		if (i < iParams.Count()-1) 
		    {
		    encodedLength += 1; // param separator
		    }
		paramsAsText.AppendL(paramAsText);
		CleanupStack::Pop(paramAsText);
		}
	
	HBufC8* encodedParams = HBufC8::NewL (encodedLength);
	TPtr8 encodedParamsPtr = encodedParams->Des();

	for (TInt j=0; j < paramsAsText.Count(); j++)
		{
		encodedParamsPtr.Append (*paramsAsText[j]);
		if (j < paramsAsText.Count()-1)
			{
			encodedParamsPtr.Append(iParamSeparator);
			}
		}

	CleanupStack::PopAndDestroy(1); // paramsAsText
	CleanupStack::PushL(encodedParams);
	return encodedParams;
	}
Пример #16
0
void CDummyCalendarApp::RepeatExceptedEntryEditInstancesL(
    RPointerArray<CCalInstance>& aInstances )
	{
	CleanupResetAndDestroyPushL(aInstances);	
	
	// Delete all entries.
	iEntries.ResetAndDestroy();
	
	TTime start(TDateTime(2006, EMarch, 6, 10, 0, 0, 0));
	TTime end(TDateTime(2006, EMarch, 6, 14, 0, 0, 0));	
	
	// Re-create all the entries that previously existed.
	CCalEntry* entry = NULL;
	for (TUint i = 0; i < aInstances.Count(); ++i)
		{
		HBufC8* guid = KGUIDInc081869().AllocLC();	
		entry = CCalEntry::NewL( CCalEntry::EAppt, guid, CCalEntry::EMethodAdd,
		    i, aInstances[i]->Time(), CalCommon::EThisOnly );
		CleanupStack::Pop( guid );
		iEntries.AppendL( entry );
		
		SetEntryStartAndEndTimeL(entry, start, end);		
		}
	
	CleanupStack::PopAndDestroy(&aInstances);
	
	// Store the entries again, there should be 2.
	TInt entriesStored = 0;
	SynCGetEntryViewL().StoreL(iEntries, entriesStored);
	test(entriesStored == iEntries.Count());
	}
Пример #17
0
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
void CCaUsifScanner::FindDeletedEntriesL(
        RPointerArray<CCaInnerEntry>& aCaArray, const RPointerArray<
                CComponentEntry>& aUsifArray )
    {
    for( TInt i( aCaArray.Count() - 1 ); i >= 0; i-- )
        {
        TBuf<KMaxUnits> compIdDes;
        if( aCaArray[i]->FindAttribute( KCaAttrComponentId, compIdDes ) )
            {
            TLex lex( compIdDes );
            TUint uint( 0 );
            User::LeaveIfError( lex.Val( uint ) );
            //for each usif entry check if entry has to be removed
            for( TInt k( 0 ); k < aUsifArray.Count(); k++ )
                {
                if( aUsifArray[k]->ComponentId() == uint)
                    {
                    delete aCaArray[i];
                    aCaArray.Remove( i );
                    break;
                    }
                }
            }
        }
    }
// -----------------------------------------------------------------------------
// CFSMailMessage::AttachmentListL
// -----------------------------------------------------------------------------
EXPORT_C void CFSMailMessage::AttachmentListL(
    RPointerArray<CFSMailMessagePart>& aParts )
    {
    // First list all message parts
    AppendAttachmentsL( aParts );
    
    NM_FUNCTION;
    
    // special case, if single part content type is not given,
    // default type is text/plain
    if ( aParts.Count() == 1 && aParts[0]->GetContentType().Length() == 0)
        {
        aParts.ResetAndDestroy();
        }
    else
        {
        // find plain text body part from the list
        CFSMailMessagePart* txtPart = FindBodyPartL(KFSMailContentTypeTextPlain);
        CleanupStack::PushL( txtPart );
        if ( txtPart
          && txtPart->AttachmentNameL().Length() == 0 ) // real attachments have names
            {
            // remove plain text body part from attachment list
            for ( TInt ii = aParts.Count() - 1; ii >= 0; --ii )
                {
                if ( aParts[ii]->GetPartId() == txtPart->GetPartId() )
                    {
                    delete aParts[ii];
                    aParts.Remove(ii);
                    break;
                    }
                }
            }
        CleanupStack::PopAndDestroy( txtPart );

        // find  html body part from the list
        CFSMailMessagePart* htmlPart = FindBodyPartL(KFSMailContentTypeTextHtml);
        CleanupStack::PushL( htmlPart );
        if ( htmlPart
          && htmlPart->AttachmentNameL().Length() == 0 ) // real attachments have names
            {
            // remove html body part from attachment list
            for ( TInt ii = aParts.Count() - 1; ii >= 0; --ii )
                {
                if ( aParts[ii]->GetPartId() == htmlPart->GetPartId() )
                    {
                    delete aParts[ii];
                    aParts.Remove(ii);
                    break;
                    }
                }
            }
        CleanupStack::PopAndDestroy( htmlPart );
        }

    iMessageParts.ResetAndDestroy();
    iReadMessageParts = ETrue;
    }
void CSenBaseIdentityManager::CleanupUnusedIdentityDBL()
	{
	TInt count(0);
	
	RPointerArray<CSenElement> elemList;
	CleanupClosePushL(elemList);
	
	CSenElement& element = iIdentity->AsElement();
	element.ElementsL(elemList, KIdentityProvider);
	count = elemList.Count(); 
	// There can be many Identity Provider elements within Identity element
	for(TInt i = 0; i < count; i++)
		{
		CSenElement* elem = elemList[i];
		
		const TDesC8* attrValue = elem->AttrValue(KTouch());
		if(attrValue != NULL)
			{
			TUint32 current_tick(0);
			TUint32 db_ticks(0);
			TUint32 diff_ticks(0);
					
			TLex8 lex;
            lex.Assign(*attrValue);
            lex.Val(db_ticks, EDecimal);
            
            current_tick = User::NTickCount();
            diff_ticks = current_tick - db_ticks;
            if(KMaxTicks <= diff_ticks || current_tick < db_ticks)
				{
				TInt endpointCount(0);
				_LIT8(KEndpoint, "Endpoint");
												
				RPointerArray<CSenElement> endpointElemList;
				CleanupClosePushL(endpointElemList);
				
				elem->ElementsL(endpointElemList, KEndpoint);
				endpointCount = endpointElemList.Count();
				
				if(endpointCount > 0)
					{
					CSenIdentityProvider* pMatch = NULL;
					
					CSenElement* endpointElem = endpointElemList[0];
					TPtrC8 endpoint = endpointElem->Content();
					pMatch = IdentityProviderL(endpoint);
					if(pMatch != NULL)
						{
						// Ownership ?
						UnregisterIdentityProviderL(*pMatch);
						}
					}
				CleanupStack::PopAndDestroy(&endpointElemList);
				}
			}
		}
	CleanupStack::PopAndDestroy(&elemList);
	}
TInt CDPOFPrintingDevice::CreatePrintJobL(TInt aDeviceID, RPointerArray<TDesC>& aImages, MProtPrintEventObserver& aObserver)
	{
  	LOG1("CDPOFPrintingDevice::CreatePrintJobL aDeviceID: %d", aDeviceID);
  	LOG1("CDPOFPrintingDevice::CreatePrintJobL aImages.Count(): %d", aImages.Count());

	iPrintEventObserver = &aObserver;
	iPrintJob->iState = PJSNone;  // Reset value until Job is fully setup in case of a leave.
	CPrinterElement *TargetPrinter = FindDeviceL( aDeviceID );
	if( TargetPrinter == NULL )
		{
		LOG("CDPOFPrintingDevice::CreatePrintJobL no device found, returning error");
		return KErrInvalidData;
		}

	iPrintJob->iTransport = DPOFTrans;
	iPrintJob->iPrinterID = aDeviceID;
	TInt NumImages = aImages.Count();
	iPrintJob->iImages.ResetAndDestroy();
	for (TInt i = 0 ; i < NumImages; i++)
		{
		HBufC* Image = aImages[i]->AllocLC();
		User::LeaveIfError( iPrintJob->iImages.Append( Image ) );
		CleanupStack::Pop(Image);
		}
	LOG("CDPOFPrintingDevice::CreatePrintJobL image names copied");

	// Now we can access the capabilities and fill in the printer settings.
	RArray<TInt> CapabilityIDs;
	CleanupClosePushL( CapabilityIDs );
	GetDeviceCapabilityIDsL( aDeviceID, CapabilityIDs );
	LOG1("CDPOFPrintingDevice::CreatePrintJobL capability ids count: %d", CapabilityIDs.Count());

	iPrintJob->iSettings.Reset();
	for (TInt i = 0; i < CapabilityIDs.Count(); i++)
		{
		TPrintCapability capability;
		GetDeviceCapabilityL(aDeviceID, CapabilityIDs[i], capability);
		TInt nCurrentValue;
		TBool bHasValue = TargetPrinter->iPrinterCapabilities->GetCurrentValue(CapabilityIDs[i], nCurrentValue);
		TSetting Setting;
		Setting.iCapabilityID = capability.iCapabilityID;
		if (bHasValue)
			Setting.iValue = nCurrentValue;
		else
			Setting.iValue = capability.iDefaultValue;

		User::LeaveIfError(iPrintJob->iSettings.Append(Setting));
		}
	LOG("CDPOFPrintingDevice::CreatePrintJobL capabilities copied");

	CleanupStack::PopAndDestroy(); // CapabilityIDs

	iPrintJob->iState = PJSCreated;
	LOG("CDPOFPrintingDevice::CreatePrintJobL end");
	return KErrNone;
	}
Пример #21
0
void CTestApp::RunTestL(const TDesC8& aVCalFile, TInt aNumberOfOccurences, TTime aEndTime, TBool aExpectedImport)
	{
	test.Next(_L("Import repeat rule test"));

	RPointerArray<CCalEntry> entryArray;
	CleanupResetAndDestroyPushL(entryArray);
	iCalTestLib->ImportL(aVCalFile, entryArray);//31 Jan, 31 Mar, 31 May, 31 July, 31 Jan 5 matched months but last 7 months to reach the end so agnmodel returns 7
	
	if (aExpectedImport)
		{
		test.Printf(_L("Impoted %d entries\n"), entryArray.Count());
		test(entryArray.Count() == 1);
		
		test.Printf(entryArray[0]->SummaryL());

		TCalRRule rRule;
		
		if (aNumberOfOccurences == 0)
			{
			test (entryArray[0]->GetRRuleL(rRule));
			test(rRule.Count() == 0);
			test(rRule.Until().TimeLocalL() == TCalTime::MaxTime());
			}
		else if (aNumberOfOccurences > 1)
			{	
			test (entryArray[0]->GetRRuleL(rRule));
			TInt instances = rRule.Count();

			test.Printf( _L("Instances found %d\n"), instances);
			test(instances == aNumberOfOccurences);
			
			TDateTime dt(rRule.Until().TimeLocalL().DateTime());
		
			test.Printf(_L("The end time of the repeat rule is %d:%d %d/%d/%d \n"), dt.Hour(), dt.Minute(), dt.Day(), dt.Month(), dt.Year());
				
			if(aEndTime != Time::NullTTime())
				{
				test(rRule.Until().TimeLocalL() == aEndTime);
				}
			}
		else
			{
			test(!entryArray[0]->GetRRuleL(rRule));
			test.Printf(_L("The repeat was not added because the second instance was passed max date.\n"));	
			}
			
		}
	else
		{
		test(entryArray.Count() == 0);
		}
	
	CleanupStack::PopAndDestroy(&entryArray);
	}
/** Fetch the entry and check the properties that are set.
@param	aGuid Data for fetching the entry.
@param	aEntryProperties Structure containing the entry properties
*/
void CTestCalInterimApiFetchEntryAndCheckData::FetchAndCheckDataL(const TPtrC& aGuid, const TInt& aExpectedCount,
															   const TEntryProperties& aEntryProperties, const TPtrC& aTimeMode)
	{
	RPointerArray<CCalEntry>	entriesFetched;
	CleanupStack::PushL(TCleanupItem(ResetAndDestroyEntryArray, &entriesFetched));
	HBufC8*		entryId = HBufC8::NewLC(aGuid.Length());
	entryId->Des().Copy(aGuid);
	iCalEntryView->FetchL(entryId->Des(), entriesFetched);
	CleanupStack::PopAndDestroy(entryId);
	TBool	matchInRecurrenceId = EFalse;
	if ( entriesFetched.Count() == aExpectedCount )
		{
		for ( TInt i = 0; i < entriesFetched.Count(); i++ )
			{
			CCalEntry*	calEntry = entriesFetched[i];
			if ( aEntryProperties.iRecurrenceId == KNullDesC16() ) // Parent Entry
				{
				if ( calEntry->RecurrenceIdL().TimeUtcL() == Time::NullTTime() )
					{
					// Checks the data for the parent entry
					CheckDataL(calEntry, aEntryProperties);
					}
				}
			else // Child Entry
				{
				TTime		recurrenceIdValue;
				recurrenceIdValue.Set(aEntryProperties.iRecurrenceId);
				TCalTime	recurrenceId;
				// Sets the time mode to floating or Utc based on the time mode given
				SetCalTimeL(recurrenceIdValue, iRecurrenceId, SetTimeMode(aTimeMode));
				if (iRecurrenceId.TimeUtcL() == (calEntry->RecurrenceIdL().TimeUtcL()) )
					{
					matchInRecurrenceId = ETrue;
					// Checks the data for the child entry
					CheckDataL(calEntry, aEntryProperties);
					}
				}
			}
		INFO_PRINTF3(KInfoEntryFetched, entriesFetched.Count(), aExpectedCount)	;
		}
	else
		{
		ERR_PRINTF3(KErrExpectedCount, entriesFetched.Count(), aExpectedCount);
		SetTestStepResult(EFail);
		}
	/* If the recurrence Id doesn't match with the recurrenceId of the child entry
	then, print a warning message */
	if (aEntryProperties.iRecurrenceId != KNullDesC16() && matchInRecurrenceId == 0)
		{
		WARN_PRINTF1(KWarnNoMatchInRecurrenceId);
		}
	CleanupStack::PopAndDestroy(&entriesFetched);
	}
Пример #23
0
// -----------------------------------------------------------------------------
// MceSip::HasHeaderValueL
// -----------------------------------------------------------------------------
// 
TBool MceSip::HasHeaderValueL( const RPointerArray<CSIPHeaderBase>& aHeaders,
                              TInt aHeaderName,
                              const TDesC8& aHeaderValue )
    {
    TBool found = EFalse;
    CSIPHeaderBase* header = NULL;
    
    for ( TInt i=0; i < aHeaders.Count() && !found; i++ )
        {
        header = aHeaders[i];
        if ( header->Name() == SIPStrings::StringF( aHeaderName ) )
            {
            HBufC8* value = header->ToTextValueL();
            if ( value->CompareF( aHeaderValue ) == 0 )
                {
                found = ETrue;
                }
            delete value;
            }
            
        if ( !found )
            {
            header = NULL;
            }
        }
    return found;
    }    
Пример #24
0
// ---------------------------------------------------------------------------
// CPresenceXDM::IsRuleExistInt()
// ---------------------------------------------------------------------------
//	
CXdmDocumentNode* CPresenceXDM::IsRuleExistInt(const TDesC& aRuleId)
    {
	OPENG_DP(D_OPENG_LIT( " CPresenceXDM::IsRuleExistInt(%S)" ),&aRuleId );
    CXdmDocumentNode* myRootNode = iPresDocument->DocumentRoot();
    if (!myRootNode)
        return NULL;
    
    RPointerArray<CXdmDocumentNode> nodes;
    CXdmDocumentNode* desiredNode(NULL);
    CXdmNodeAttribute* idAttribute(NULL);
    
    // Find all rules under  root Node
    if ((myRootNode->Find(KXdmRule, nodes)) == KErrNone)
        { // go through all found rules
        TInt ruleCountInNode = nodes.Count();
        OPENG_DP(D_OPENG_LIT( "     ruleCountInNode = %d" ),ruleCountInNode );
        for (TInt k=0;k<ruleCountInNode;k++)
            { // get the id attribute
            idAttribute = (nodes[k])->Attribute(KXdmId);
            // match it with given attr
            if (idAttribute->AttributeValue() == aRuleId)
                {
                desiredNode = nodes[k];
                break;
                }
            }
        }
    nodes.Close();
    return desiredNode;        
    }
Пример #25
0
// ---------------------------------------------------------------------------
// CPresenceXDM::DeleteEmptyRules()
// ---------------------------------------------------------------------------
//    
EXPORT_C void CPresenceXDM::DeleteEmptyRulesL()
    {
	OPENG_DP(D_OPENG_LIT( "CPresenceXDM::DeleteEmptyRules" ));
    CXdmDocumentNode* myRootNode = iPresDocument->DocumentRoot();
    if (!myRootNode)
        return; // return if no rule exists
        
    RPointerArray<CXdmDocumentNode> nodes;

    // Find all rules under  root Node
    if ((myRootNode->Find(KXdmRule, nodes)) == KErrNone)
        { // go through all found rules
        TInt ruleCountInNode = nodes.Count();
        OPENG_DP(D_OPENG_LIT( "     ruleCountInNode = %d" ),ruleCountInNode );
        
        for (TInt i=0;i<ruleCountInNode;i++)
            {
            if ( ((nodes[i])->NodeCount()) == 0)// if rule is empty
                {
                iPresDocument->RemoveFromModelL(nodes[i]);
                OPENG_DP(D_OPENG_LIT( "     delete at i = %d" ), i);
                }
            }
        }
    nodes.Close();
    }
Пример #26
0
// ---------------------------------------------------------------------------
// CPresenceXDM::GetAllRulesL()
// ---------------------------------------------------------------------------
//
EXPORT_C void CPresenceXDM::GetAllRulesL(CDesCArray& aRuleIds)
	{
    OPENG_DP(D_OPENG_LIT( "CPresenceXDM::GetAllRulesL" ) );
    CXdmDocumentNode* myRootNode = iPresDocument->DocumentRoot();
    if (!myRootNode)
        return;
    
    RPointerArray<CXdmDocumentNode> nodes;
    CXdmNodeAttribute* idAttribute(NULL);
    
    // Find all rules under root
    if ((myRootNode->Find(KXdmRule, nodes)) == KErrNone)
        { // go through all found rules
        TInt ruleCountInNode = nodes.Count();
        OPENG_DP(D_OPENG_LIT( "     ruleCountInNode = %d" ),ruleCountInNode );
        for (TInt i=0;i<ruleCountInNode;i++)
            { // get the id attribute
            idAttribute = (nodes[i])->Attribute(KXdmId);
            // push it to given discriptor array
            aRuleIds.AppendL(idAttribute->AttributeValue());
            }
        }
    nodes.Close();
    return;
	}
// ---------------------------------------------------------
// CPosLmLocalDatabaseManager::ListDatabasesL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosLmLocalDatabaseManager::ListDatabasesL(
    RPointerArray<HPosLmDatabaseInfo>& aDatabaseInfoArray)
    {
    // list URIs
    CDesCArray* dbUriArray = ListDatabasesLC();
    // list registered databases
    Session().ListDatabasesL(aDatabaseInfoArray, KFileProtocol);
    // delete from URI list those databases that are registered
    for (TInt i = aDatabaseInfoArray.Count() - 1; i >= 0; i--)
        {
        TInt index;
        if (dbUriArray->Find(aDatabaseInfoArray[i]->DatabaseUri(), index) == 0)
            {
            dbUriArray->Delete(index);
            }
        }

    // for each remaining URI in the list, fill in database info
    // and add to list
    TInt count = dbUriArray->Count();
    for (TInt i = 0; i < count; i++)
        {
        HPosLmDatabaseInfo* info = HPosLmDatabaseInfo::NewLC((*dbUriArray)[i]);
        aDatabaseInfoArray.AppendL(info);
        CleanupStack::Pop(info); // transfer of ownership to array
        }

    CleanupStack::PopAndDestroy(dbUriArray);
    // database drive, database media and default flag
    // will be filled in by database management provider.
    }
/**
 * Add .jad files in the directories specified in aDirs to iJadFiles.
 *
 * Goes  all directories in iDirs one by one and adds the
 * valid .jad files in alphabetical order to iJadFiles.
 *
 * @param aDirs - An array of directories to be scanned.
 * @exception Unable to alloc memory for the internal buffers.
 * @exception Unable to get directory's contents.
 */
void CSilentMIDletInstall::GetMIDletFilesL(RPointerArray<HBufC>& aDirs)
{
    JELOG2(EJavaPreinstaller);

    const TInt num = aDirs.Count();

    // Read JAD files.
    for (TInt i = 0; i < num; i++)
    {
        const TPtrC& dir = ((HBufC *)(aDirs[i]))->Des();

        HBufC* mask= NULL;
        TPtr maskPtr(NULL,0,0);

        // Create JAD mask, e.g., "z:\resource\java\preinstall\*.jad".
        // Reserve space also for terminating zero for logging the info
        mask = HBufC::NewLC(dir.Length() + KJadExtension().Length() + 1);
        maskPtr.Set(mask->Des());
        maskPtr.Append(dir);
        maskPtr.Append(KJadExtension);
        LOG1WSTR(EJavaPreinstaller, EInfo,
                 "CSilentMIDletInstall::GetMIDletFilesL Looking for jad files from directory %s",
                 (wchar_t *)(maskPtr.PtrZ()));
        GetDirEntriesL(dir, *mask, iJadFiles);
        CleanupStack::PopAndDestroy(mask);
    }

    if (iJadFiles.Count() == 0)
    {
        ILOG(EJavaPreinstaller,
             "CSilentMIDletInstall:GetMIDletFilesL No MIDlets to preinstall");
    }
}
Пример #29
0
// ---------------------------------------------------------------------------
// From MDunTransporterUtilityAux.
// Notifies when serious read/write error is detected on a connection
// ---------------------------------------------------------------------------
//
TInt CDunTransUtils::DoNotifyConnectionNotOk(
    RComm* aComm,
    RSocket* aSocket,
    TDunConnectionReason& aConnReason,
    RPointerArray<MDunConnMon>& aCallbacks )
    {
    FTRACE(FPrint( _L("CDunTransUtils::DoNotifyConnectionNotOk()" )));
    TConnId localId = NULL;
    if ( aComm )
        {
        localId = aComm;
        }
    else if ( aSocket )
        {
        localId = aSocket;
        }
    TInt i;
    TInt count = aCallbacks.Count();
    for ( i=0; i<count; i++ )
        {
        if ( !aCallbacks[i] )
            {
            FTRACE(FPrint( _L("CDunTransUtils::DoNotifyConnectionNotOk() (iCallbacks[%d]) not initialized!" ), i));
            return KErrGeneral;
            }
        TRAP_IGNORE(
            aCallbacks[i]->NotifyProgressChangeL( localId, aConnReason ) );
        }
    FTRACE(FPrint( _L("CDunTransUtils::DoNotifyConnectionNotOk() complete" )));
    return KErrNone;
    }
Пример #30
0
void CPlaylistMgr::EventOpenPlaylist(const TDesC& aFileName)
{
    CMusicListMgr* mgr = CMusicListMgr::NewL();
    mgr->SetList(iDataMgr->GetCleanList());
    mgr->ReadFile(aFileName);
    delete mgr;

    iControlMgr->CleanList();

    //返回
    iBackIndex = KPlaylistBackStateFavorite;
    AddBackItem();

    RPointerArray<CMusicInfoBean>* files = iDataMgr->GetList();

    for (TInt i=0; i<files->Count(); i++)
    {
        CMusicInfoBean* info = (*files)[i];

        pListItemStruct back = new (ELeave) ListItemStruct;
        back->iIconIndex = 0;
        back->iShowName
            = CCommonUtils::ConvertToUnicodeFromUTF8(info->getFileName());
        back->iHideInfo
            = CCommonUtils::ConvertToUnicodeFromUTF8(info->getFileName());
        back->iType = KPlaylistItemTypeFile;
        iControlMgr->AddListItem(back);
    }
}