void CContactsRamTest::AddContactsL(const TInt aNumber)
/**
Add number of contacts to db, using the system template.
@return None
@param aNumber number of contacts to be added
@pre None
@post database now contains aNumber of empty contacts
*/
	{
	

	//viewdef that loads all fields 	
	CContactItemViewDef *viewAll = CContactItemViewDef::NewLC(CContactItemViewDef::EIncludeFields,CContactItemViewDef::EIncludeHiddenFields);
	viewAll->AddL(KUidContactFieldMatchAll);
	CContactTemplate *ttemplate = static_cast< CContactTemplate* >(
	iContactsDatabase->ReadContactLC( iContactsDatabase->TemplateId(), *viewAll ) );

	CContactCard* contact = CContactCard::NewLC(ttemplate);
	SetManyFieldsL(KFieldValue, KManyFields, contact->CardFields());
	for(TInt k = 0; k<aNumber; k++)
		{		
		iContactsDatabase->AddNewContactL(*contact);
		}	
	CleanupStack::PopAndDestroy(contact);
	CleanupStack::PopAndDestroy(ttemplate);
	CleanupStack::PopAndDestroy(viewAll);
	}
Esempio n. 2
0
/**
populates all contacts either moderately, fully, or not at all
*/
void CTransactionsStep::ModifyContactsL(const FieldFullness aField)
	{
	if(aField == EEmpty)
		{
		return;
		}
	iIterate->Reset();
	TInt j = 0;
	for(; j < iContacts; ++j)
		{
		OpenL(iIterate->NextL());
		if(aField == EFull)
			{
			SetAllFieldsL( GetFieldL(KStringFields, KField, 2) );
			}
		else
			{
			SetManyFieldsL(GetFieldL(KStringFields, KField, 4) , KMediumFields);
			}
		CommitL(EFalse);
		}
	}
/**
sets all the fields of a currently read / open item to aText
*/
void CPerformanceFunctionalityBase::SetAllFieldsL(const TDesC& aText)
	{
	const TInt count = iFields->Count();
	SetManyFieldsL(aText, count);
	}