本文整理汇总了C++中CContactDatabase::CreateContactGroupLC方法的典型用法代码示例。如果您正苦于以下问题:C++ CContactDatabase::CreateContactGroupLC方法的具体用法?C++ CContactDatabase::CreateContactGroupLC怎么用?C++ CContactDatabase::CreateContactGroupLC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContactDatabase
的用法示例。
在下文中一共展示了CContactDatabase::CreateContactGroupLC方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreatePhonebookGroupL
/**
* Create phonebook group
* @param aDb Contact database
*/
TContactItemId CreatePhonebookGroupL(CContactDatabase& aDb)
{
_LIT(KPhbkGroup,"ADN Phonebook");
CContactItem* group = aDb.CreateContactGroupLC(KPhbkGroup);
TContactItemId groupId = group->Id();
CleanupStack::PopAndDestroy(group);
return groupId;
}
示例2: CreateTestContactsL
void CTestResources::CreateTestContactsL()
{
const TInt KContacts = 4;
TInt i;
iContacts = CContactIdArray::NewL();
// Create contacts
for (i=1; i <= KContacts; ++i)
{
CContactCard* card = CContactCard::NewLC();
CContactItemField* field = CContactItemField::NewLC(KStorageTypeText, KUidContactFieldFamilyName);
TBuf<30> name;
name.Format(_L("Contact%02d"), i);
field->TextStorage()->SetTextL(name);
card->AddFieldL(*field);
CleanupStack::Pop(field);
const TContactItemId contactId = iDb->AddNewContactL(*card);
iContacts->AddL(contactId);
CleanupStack::PopAndDestroy(card);
// Eat away contact db events
TContactDbObserverEvent event;
test(iDbEventQueue->ListenForEvent(10,event));
}
// Create a group
CContactItem* group = iDb->CreateContactGroupLC(_L("TestGroup"));
iGroupId = group->Id();
CleanupStack::PopAndDestroy(group);
// Connect half of the contacts to the group
for (i=0; i < iContacts->Count(); ++i)
{
if (i%2 == 0)
{
iDb->AddContactToGroupL((*iContacts)[i], iGroupId);
}
}
}
示例3: CreateTestGroupsL
void CRemoteViewTestResources::CreateTestGroupsL()
{
test.Next(_L("Test for creating a remote view and validating that queued events are received in the correct order."));
TContactViewEvent event;
// Create A then "unnanmed", then rename "unnamed" to B
test.Next(_L("Test for Create group A, then create group B"));
CContactItem* group1 = iDb->CreateContactGroupLC(_L("A"));
iViewEventQueue->ListenForEvent(2,event);
CheckEvent(event, TContactViewEvent::EItemAdded, 0, group1->Id());
CContactItem* group0 = iDb->CreateContactGroupLC(_L(""));
iViewEventQueue->ListenForEvent(2,event);
CheckEvent(event, TContactViewEvent::EItemAdded, 1, group0->Id());
CContactItem *group00 = iDb->OpenContactL(group0->Id());
static_cast<CContactGroup*> (group00)->SetGroupLabelL(_L("B"));
iDb->CommitContactL(*group00);
// Received 3 events, grp changed, removed and added
iViewEventQueue->ListenForEvent(2,event);
CheckEvent(event, TContactViewEvent::EGroupChanged, 0, group00->Id());
iViewEventQueue->ListenForEvent(2,event);
CheckEvent(event, TContactViewEvent::EItemRemoved, 1, group00->Id());
iViewEventQueue->ListenForEvent(2,event);
CheckEvent(event, TContactViewEvent::EItemAdded, 1, group00->Id());
// Create D then "unnamed", then rename "unnamed" to C
test.Next(_L("Test for Create group D, then create group C"));
CContactItem* group2 = iDb->CreateContactGroupLC(_L("D"));
iViewEventQueue->ListenForEvent(2,event);
CheckEvent(event, TContactViewEvent::EItemAdded, 2, group2->Id());
CContactItem* group3 = iDb->CreateContactGroupLC(_L(""));
iViewEventQueue->ListenForEvent(2,event);
CheckEvent(event, TContactViewEvent::EItemAdded, 3, group3->Id());
CContactItem *group4 = iDb->OpenContactL(group3->Id());
static_cast<CContactGroup*> (group4)->SetGroupLabelL(_L("C"));
iDb->CommitContactL(*group4);
// Received 3 events, grp changed, removed and added
iViewEventQueue->ListenForEvent(2,event);
CheckEvent(event, TContactViewEvent::EGroupChanged, 0, group4->Id());
iViewEventQueue->ListenForEvent(2,event);
CheckEvent(event, TContactViewEvent::EItemRemoved, 3, group4->Id());
iViewEventQueue->ListenForEvent(2,event);
CheckEvent(event, TContactViewEvent::EItemAdded, 2, group4->Id());
// More complex set of add and deletes.
test.Next(_L("Test-Addgroup E, Addgroup F, Addgroup G , RemoveGroup G Addgroup H RenameGroup H as EA"));
CContactItem* group5 = iDb->CreateContactGroupLC(_L("E"));
CContactItem* group6 = iDb->CreateContactGroupLC(_L("F"));
CContactItem* group7 = iDb->CreateContactGroupLC(_L("G"));
iDb->DeleteContactL(group7->Id());
CContactItem* group8 = iDb->CreateContactGroupLC(_L("H"));
CContactItem *group01 = iDb->OpenContactL(group8->Id());
static_cast<CContactGroup*> (group01)->SetGroupLabelL(_L("EA"));
iDb->CommitContactL(*group01);
// Should receive events for operations above, order is not important
// Should receive events as add for E F EA(H) - In the order E EA(H) F
// (none for G as add, then remove)
iViewEventQueue->ListenForEvent( 2, event );
CheckEvent( event, TContactViewEvent::EItemAdded, 4, group5->Id() );
iViewEventQueue->ListenForEvent( 2, event );
CheckEvent( event, TContactViewEvent::EItemAdded, 5, group6->Id() );
iViewEventQueue->ListenForEvent( 2, event );
CheckEvent( event, TContactViewEvent::EItemAdded, 6, group8->Id() );
iViewEventQueue->ListenForEvent( 2, event );
CheckEvent( event, TContactViewEvent::EItemAdded, 7, group7->Id() );
iViewEventQueue->ListenForEvent( 2, event );
CheckEvent( event, TContactViewEvent::EItemRemoved, 7, group7->Id() );
iViewEventQueue->ListenForEvent( 2, event );
CheckEvent( event, TContactViewEvent::EGroupChanged, 0, group8->Id() );
// Cleanup
delete group01;
delete group00;
delete group4;
CleanupStack::PopAndDestroy(group8);
CleanupStack::PopAndDestroy(group7);
CleanupStack::PopAndDestroy(group6);
CleanupStack::PopAndDestroy(group5);
CleanupStack::PopAndDestroy(group3);
CleanupStack::PopAndDestroy(group2);
CleanupStack::PopAndDestroy(group0);
CleanupStack::PopAndDestroy(group1);
}