本文整理汇总了C++中CContactDatabase::ICCTemplateIdL方法的典型用法代码示例。如果您正苦于以下问题:C++ CContactDatabase::ICCTemplateIdL方法的具体用法?C++ CContactDatabase::ICCTemplateIdL怎么用?C++ CContactDatabase::ICCTemplateIdL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContactDatabase
的用法示例。
在下文中一共展示了CContactDatabase::ICCTemplateIdL方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VerifyPhonebookTemplateIdsL
/**
* Verify that the template id returned by CContactDatabase::ICCTemplateIdL is the
* same as that returned directly from the plugin
* @param aDb Contact database
*/
void VerifyPhonebookTemplateIdsL(CContactDatabase& aDb)
{
test.Next(_L("Verify template ids"));
syncChecker->ResetMethodCallCountsL();
test(aDb.ICCTemplateIdL() == syncChecker->ICCTemplateIdL(KUidIccGlobalAdnPhonebook));
test(aDb.ICCTemplateIdL(KUidIccGlobalAdnPhonebook) == syncChecker->ICCTemplateIdL(KUidIccGlobalAdnPhonebook));
test(aDb.ICCTemplateIdL(KUidIccGlobalSdnPhonebook) == syncChecker->ICCTemplateIdL(KUidIccGlobalSdnPhonebook));
test(aDb.ICCTemplateIdL(KUidIccGlobalLndPhonebook) == syncChecker->ICCTemplateIdL(KUidIccGlobalLndPhonebook));
test(aDb.ICCTemplateIdL(KUidUsimAppAdnPhonebook) == syncChecker->ICCTemplateIdL(KUidUsimAppAdnPhonebook));
test(aDb.ICCTemplateIdL(KNullUid) == KNullContactId);
test(syncChecker->ValidateMethodCallCountL() == 6);
}
示例2: doAddIccEntryL
/**
* Create an entry based on the template for this specific phonebook, and add
* the entry to the contact database
* @param aDb Contact database
* @param aPhonebookUid The phonebook uid
* @return TContactItemId Id of the newly created icc entry
*/
TContactItemId doAddIccEntryL(CContactDatabase& aDb,TUid aPhonebookUid)
{
syncChecker->ResetMethodCallCountsL();
TContactItemId templateId = aDb.ICCTemplateIdL(aPhonebookUid);
test(syncChecker->ValidateMethodCallCountL() == 1);
CContactItem* iccTemplate = aDb.ReadContactLC(templateId);
CContactICCEntry* entry = CContactICCEntry::NewL(*iccTemplate);
CleanupStack::PopAndDestroy(iccTemplate);
CleanupStack::PushL(entry);
// Add to the database
CheckPhonebookField(*entry,aPhonebookUid, EFalse);
syncChecker->ResetMethodCallCountsL();
TContactItemId id = aDb.AddNewContactL(*entry);
test(syncChecker->ValidateMethodCallCountL() == 3);
CleanupStack::PopAndDestroy(entry);
test(id!=KNullContactId);
// Check group membership
syncChecker->ResetMethodCallCountsL();
CContactICCEntry* fetchedItem = static_cast<CContactICCEntry*>(aDb.ReadContactL(id));
test(syncChecker->ValidateMethodCallCountL() == 1);
CleanupStack::PushL(fetchedItem);
const CContactIdArray* owned = fetchedItem->GroupsJoined();
test(owned!=NULL && owned->Count() == 1);
test((*owned)[0]==syncChecker->GroupIdL(aPhonebookUid));
test(fetchedItem->Type() == KUidContactICCEntry);
// Verify that the phonebook field has been set
CheckPhonebookField(*fetchedItem,aPhonebookUid, ETrue);
CleanupStack::PopAndDestroy(fetchedItem);
return id;
}
示例3: TestAddingWithoutGroupL
/**
* Test addition to database without adding to a group
* @param aDb Contact database
*/
void TestAddingWithoutGroupL(CContactDatabase& aDb)
{
TContactItemId templateId = aDb.ICCTemplateIdL(KUidIccGlobalAdnPhonebook);
CContactItem* iccTemplate = aDb.ReadContactLC(templateId);
CContactICCEntry* entry = CContactICCEntry::NewL(*iccTemplate);
CleanupStack::PopAndDestroy(iccTemplate);
CleanupStack::PushL(entry);
SetNameL(*entry,KUidContactFieldFamilyName,KUidContactFieldVCardMapUnusedN,KGivenName,EFalse);
SetNameL(*entry,KUidContactFieldPhoneNumber,KUidContactFieldVCardMapTEL,KTelephoneNum,EFalse);
syncChecker->ResetMethodCallCountsL();
syncChecker->SetValidateWriteResponseL(KErrNone);
TInt oldGroupId = syncChecker->GroupIdL(KUidIccGlobalAdnPhonebook);
test(KErrNone == syncChecker->UpdatePhonebookGroupIdL(KUidIccGlobalAdnPhonebook, KNullContactId));
TContactItemId id = aDb.AddNewContactL(*entry);
test(syncChecker->ValidateMethodCallCountL() == 3);
CleanupStack::PopAndDestroy(entry);
CContactICCEntry* fetchedItem = static_cast<CContactICCEntry*>(aDb.ReadContactL(id));
CleanupStack::PushL(fetchedItem);
//Check group membership
const CContactIdArray* owned = fetchedItem->GroupsJoined();
test(owned==NULL || owned->Count() == 0);
CleanupStack::PopAndDestroy(fetchedItem);
test(KErrNone == syncChecker->UpdatePhonebookGroupIdL(KUidIccGlobalAdnPhonebook, oldGroupId));
}
示例4: TestSuccessfulAddL
/**
* Test successful addition to database.
* @param aDb Contact database
*/
void TestSuccessfulAddL(CContactDatabase& aDb)
{
//Create group
TContactItemId groupId = CreatePhonebookGroupL(aDb);
test(KErrNone == syncChecker->UpdatePhonebookGroupIdL(KUidIccGlobalAdnPhonebook, groupId));
//Create item and add fields
TContactItemId templateId = aDb.ICCTemplateIdL(KUidIccGlobalAdnPhonebook);
CContactItem* iccTemplate = aDb.ReadContactLC(templateId);
CContactICCEntry* entry = CContactICCEntry::NewL(*iccTemplate);
CleanupStack::PopAndDestroy(iccTemplate);
CleanupStack::PushL(entry);
SetNameL(*entry,KUidContactFieldFamilyName,KUidContactFieldVCardMapUnusedN,KGivenName,EFalse);
SetNameL(*entry,KUidContactFieldPhoneNumber,KUidContactFieldVCardMapTEL,KTelephoneNum,EFalse);
//Add to database
syncChecker->ResetMethodCallCountsL();
syncChecker->SetValidateWriteResponseL(KErrNone);
syncChecker->SetValidateResponseL(MContactSynchroniser::ERead,KErrNone);
test(syncChecker->ValidateMethodCallCountL() == 0);
TContactItemId id = aDb.AddNewContactL(*entry);
CleanupStack::PopAndDestroy(entry);
test(syncChecker->ValidateMethodCallCountL() == 3);
test(id!=KNullContactId);
CContactICCEntry* fetchedItem = static_cast<CContactICCEntry*>(aDb.ReadContactL(id));
CleanupStack::PushL(fetchedItem);
//Check group membership
const CContactIdArray* owned = fetchedItem->GroupsJoined();
test(owned!=NULL && owned->Count() == 1);
test((*owned)[0]==groupId);
//Check number of fields and content
CContactItemFieldSet& fieldset = fetchedItem->CardFields();
TInt pos = fieldset.Find(KUidContactFieldTemplateLabel);
test(pos==KErrNotFound);
// test(fieldset.Count() == 3);
/* for (TInt i=0; i<fieldset.Count(); i++)
{
CContactItemField& field = fieldset[i];
TInt count = field.ContentType().FieldTypeCount();
for (TInt j=0; j<count; j++)
{
TFieldType ft= field.ContentType().FieldType(j);
}
TUid mapping = field.ContentType().Mapping();
}
*/
CheckFieldContentL(fieldset,KUidContactFieldFamilyName,KGivenName);
// CheckFieldContentL(fieldset,KUidContactFieldPhoneNumber,KTelephoneNum);
CleanupStack::PopAndDestroy(fetchedItem);
}
示例5: TestUnsuccessfulAddL
/**
* Test an unsuccessful addition to the database
* @param aDb Contact database
*/
void TestUnsuccessfulAddL(CContactDatabase& aDb)
{
TContactItemId templateId = aDb.ICCTemplateIdL(KUidIccGlobalAdnPhonebook);
CContactItem* iccTemplate = aDb.ReadContactLC(templateId);
CContactICCEntry* entry = CContactICCEntry::NewL(*iccTemplate);
CleanupStack::PopAndDestroy(iccTemplate);
CleanupStack::PushL(entry);
SetNameL(*entry,KUidContactFieldFamilyName,KUidContactFieldVCardMapUnusedN,KGivenName,EFalse);
SetNameL(*entry,KUidContactFieldPhoneNumber,KUidContactFieldVCardMapTEL,KTelephoneNum,EFalse);
syncChecker->ResetMethodCallCountsL();
syncChecker->SetValidateWriteResponseL(KErrAccessDenied);
TRAPD(error, aDb.AddNewContactL(*entry));
test(error==KErrAccessDenied);
test(syncChecker->ValidateMethodCallCountL() == 1);
CleanupStack::PopAndDestroy(entry);
}
示例6: TestCreationL
void TestCreationL(CContactDatabase& aDb)
{
_LIT(KTestCreation,"Create CContactICCEntry item");
test.Start(_L("@SYMTESTCaseID:PIM-T-ICCENTRY-0001 Create CContactICCEntry item"));
//System Template
TContactItemId systemTemplateId = aDb.TemplateId();
CContactItem* systemTemplate = aDb.ReadContactLC(systemTemplateId);
CContactICCEntry* entry = CContactICCEntry::NewL(*systemTemplate);
CleanupStack::PopAndDestroy(systemTemplate);
CleanupStack::PushL(entry);
//Test CContactICCEntry items can be identified from normal contact cards
test(entry->Type() == KUidContactICCEntry);
test(entry->TemplateRefId() == systemTemplateId);
CleanupStack::PopAndDestroy(entry);
//Create user defined template for ICC contacts
test.Next(_L("CContactDatabase::ICCTemplateL()"));
TContactItemId templateId = CreateICCTemplateL(aDb);
test(KErrNone == syncChecker->UpdatePhonebookEntryL(KUidIccGlobalAdnPhonebook, templateId, KNullContactId));
//Check that contacts model calls the plug-in when asked for the
//template ID.
TInt callCount = syncChecker->ValidateMethodCallCountL();
test(callCount==0);
TContactItemId templateIdFromCntmodel;
templateIdFromCntmodel = aDb.ICCTemplateIdL(KUidIccGlobalAdnPhonebook);
test(syncChecker->ValidateMethodCallCountL() == 1);
test(templateId == templateIdFromCntmodel);
CContactItem* iccTemplate = aDb.ReadContactLC(templateId);
CheckTemplateL(*iccTemplate);
//create ICC contact
CContactICCEntry* iccentry = CContactICCEntry::NewL(*iccTemplate);
CleanupStack::PopAndDestroy(iccTemplate);
CleanupStack::PushL(iccentry);
test(iccentry->Type() == KUidContactICCEntry);
test(iccentry->TemplateRefId() == templateId);
CleanupStack::PopAndDestroy(iccentry);
test.End();
}
示例7: CreateTestICCEntryL
/**
* Create example ICC Entry
* @param aDb Contact database
*/
TContactItemId CreateTestICCEntryL(CContactDatabase& aDb)
{
TContactItemId templateId = aDb.ICCTemplateIdL(KUidIccGlobalAdnPhonebook);
CContactItem* iccTemplate = aDb.ReadContactLC(templateId);
CContactICCEntry* entry = CContactICCEntry::NewL(*iccTemplate);
CleanupStack::PopAndDestroy(iccTemplate);
CleanupStack::PushL(entry);
SetNameL(*entry,KUidContactFieldFamilyName,KUidContactFieldVCardMapUnusedN,KGivenName,EFalse);
SetNameL(*entry,KUidContactFieldPhoneNumber,KUidContactFieldVCardMapTEL,KTelephoneNum,EFalse);
//Add to database
syncChecker->SetValidateWriteResponseL(KErrNone);
syncChecker->SetValidateResponseL(MContactSynchroniser::ERead,KErrNone);
syncChecker->SetDeleteContactResponseL(KErrNone);
TContactItemId id = aDb.AddNewContactL(*entry);
CleanupStack::PopAndDestroy(entry);
test(id!=KNullContactId);
return id;
}