本文整理汇总了C++中CContactDatabase::SetDbViewContactType方法的典型用法代码示例。如果您正苦于以下问题:C++ CContactDatabase::SetDbViewContactType方法的具体用法?C++ CContactDatabase::SetDbViewContactType怎么用?C++ CContactDatabase::SetDbViewContactType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContactDatabase
的用法示例。
在下文中一共展示了CContactDatabase::SetDbViewContactType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetValidUIDFromContactsDbL
/**
* To return a valid contact item id.
*/
TContactItemId CSyncTestStep::GetValidUIDFromContactsDbL()
{
TContactItemId firstId(KNullContactId);
CContactDatabase *iDb = NULL;
TRAPD(err,iDb = CContactDatabase::OpenL()); // open existing database
CleanupStack::PushL(iDb);
if (err != KErrNone)
{
CleanupStack::PopAndDestroy(); // iDb
return firstId;
}
iDb->SetDbViewContactType(KUidContactICCEntry);
// to get the unique groupId for the phonebook
TContactItemId groupId(KNullContactId);
User::LeaveIfError(iSession.GetPhoneBookId(groupId, RPhoneBookSession::ESyncGroupId));
TESTCHECKCONDITIONL(groupId != KNullContactId);
// based on the groupId, get an item belonging to the phonebook
CContactGroup* group = static_cast<CContactGroup*>(iDb->ReadContactLC(groupId));
const CContactIdArray* array = group->ItemsContained();
TInt count(array->Count());
if (count > 0)
firstId = (*array)[0];
CleanupStack::PopAndDestroy(group);
CleanupStack::PopAndDestroy(); // iDb
return firstId;
}
示例2: TestPhoneMatchingL
void TestPhoneMatchingL(CContactDatabase& aDb)
{
test.Next(_L("Test phone match"));
CContactIdArray* array = aDb.MatchPhoneNumberL(KTelephoneNum,KMaxPhoneMatchLength);
test(array->Count() == 4);
delete array;
syncChecker->SetValidateResponseL(MContactSynchroniser::ERead,KErrNone);
syncChecker->SetValidateResponseL(MContactSynchroniser::EEdit, KErrNone);
syncChecker->SetValidateWriteResponseL(KErrNone);
aDb.SetDbViewContactType(KUidContactICCEntry);
TContactItemId id = (*aDb.SortedItemsL())[0];
CContactItem* item = aDb.OpenContactLX(id);
CleanupStack::PushL(item);
CContactItemFieldSet& fieldset = item->CardFields();
const TInt pos = fieldset.Find(KUidContactFieldPhoneNumber);
CContactItemField& field = fieldset[pos];
CContactTextField* textfield = field.TextStorage();
textfield->SetTextL(KTelephoneNumModified);
aDb.CommitContactL(*item);
CleanupStack::PopAndDestroy(2); //item, lock record
CContactIdArray* array2 = aDb.MatchPhoneNumberL(KTelephoneNumModified,KMaxPhoneMatchLength);
test(array2->Count() == 1);
delete array2;
}
示例3: TestDatabaseIterationL
void TestDatabaseIterationL(CContactDatabase& aDb)
{
test.Next(_L("Test database iteration"));
aDb.SetDbViewContactType(KUidContactICCEntry);
TContactIter iterator(aDb);
TContactItemId id = iterator.FirstL();
while (id!=KNullContactId)
{
CContactItem* item = aDb.ReadContactLC(id);
test(item->Type() == KUidContactICCEntry);
CleanupStack::PopAndDestroy(item);
id = iterator.NextL();
}
}