当前位置: 首页>>代码示例>>C++>>正文


C++ CContactDatabase::DeleteContactL方法代码示例

本文整理汇总了C++中CContactDatabase::DeleteContactL方法的典型用法代码示例。如果您正苦于以下问题:C++ CContactDatabase::DeleteContactL方法的具体用法?C++ CContactDatabase::DeleteContactL怎么用?C++ CContactDatabase::DeleteContactL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CContactDatabase的用法示例。


在下文中一共展示了CContactDatabase::DeleteContactL方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TestDeleteL

/**
 * Verify that the synchroniser is called when deleting an icc entry, and that the 
 * deletion of an icc entry fails if the icc is locked.
 * @param aDb Contact database
 */
void TestDeleteL(CContactDatabase& aDb)
	{
	test.Next(_L("Test delete when ICC locked"));
	syncChecker->SetDeleteContactResponseL(KErrLocked);
	TContactItemId iccId=AddIccEntryL(aDb,KUidIccGlobalAdnPhonebook);
	syncChecker->ResetMethodCallCountsL();
	TRAPD(err,aDb.DeleteContactL(iccId));
	test(err==KErrLocked);
	test(syncChecker->ValidateMethodCallCountL() == 2);
	syncChecker->ResetMethodCallCountsL();
	CContactItem* item=aDb.ReadContactLC(iccId);
	test(syncChecker->ValidateMethodCallCountL() == 1);
	test(item!=NULL);
	CleanupStack::PopAndDestroy(item);
	item=NULL;

	test.Next(_L("Test successful delete of non-icc entry when ICC locked"));
	TContactItemId nonIccId=AddContactCardL(aDb);
	syncChecker->ResetMethodCallCountsL();
	TRAP(err,aDb.DeleteContactL(nonIccId));
	test(err==KErrNone);
	test(syncChecker->ValidateMethodCallCountL() == 0);

	test.Next(_L("Test successful delete"));
	syncChecker->SetDeleteContactResponseL(KErrNone);
	syncChecker->ResetMethodCallCountsL();
	TRAP(err,aDb.DeleteContactL(iccId));
	test(syncChecker->ValidateMethodCallCountL() == 2);
	test(err==KErrNone);
	syncChecker->ResetMethodCallCountsL();
	TRAP(err,aDb.ReadContactLC(iccId));
	test(syncChecker->ValidateMethodCallCountL() == 0);
	test(err==KErrNotFound);
	}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:39,代码来源:t_iccmultiplephonebook.cpp

示例2: TestReadL

/**
 * Verify that the synchroniser is called when reading an icc entry
 * @param aDb Contact database
 */
void TestReadL(CContactDatabase& aDb)
	{
	TContactItemId iccId=AddIccEntryL(aDb,KUidIccGlobalAdnPhonebook);
	SetNameField(aDb,iccId,KIccName);
	TContactItemId nonIccId = AddContactCardL(aDb);
	SetNameField(aDb,nonIccId,KNonIccName);
	TestReadMinimalContactL(aDb,iccId,nonIccId);
	TestReadContactL(aDb,iccId,nonIccId);
	TestReadTextDefinitionL(aDb,iccId,nonIccId);
	syncChecker->SetValidateResponseL(MContactSynchroniser::ERead,KErrNone);
	syncChecker->ResetMethodCallCountsL();
	aDb.DeleteContactL(iccId);
	aDb.DeleteContactL(nonIccId);
	test(syncChecker->ValidateMethodCallCountL() == 2);
	}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:19,代码来源:t_iccmultiplephonebook.cpp

示例3: DeleteContactsDescL

void CFilteredViewTester::DeleteContactsDescL(TInt aCount)
    {
    for (TInt i = aCount - 1; i >= 0; --i)
        {
        iContactDb->DeleteContactL((*iIdArray)[i]);
        }       
    }
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:7,代码来源:t_filteredviewevents.cpp

示例4: TestDeleteL

void TestDeleteL(CContactDatabase& aDb)
	{
	test.Next(_L("Test successful delete"));

	TContactItemId id = CreateTestICCEntryL(aDb);
	syncChecker->ResetMethodCallCountsL();
	aDb.DeleteContactL(id);
	test(syncChecker->ValidateMethodCallCountL() == 2);
	test.Next(_L("Test unsuccessful delete"));

	TestUnsuccessfulDeleteL(aDb);
	}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:12,代码来源:t_iccentry.cpp

示例5: TestAsyncOpenDbAndDeleteContactL

LOCAL_C void TestAsyncOpenDbAndDeleteContactL() 
	{
	//test if necesary sanity check was made
	test.Next( _L("Open async database and simulate a template delete event"));
	
	TRequestStatus requestStatus(0);
	CContactOpenOperation* op = CContactDatabase::Open(KDatabaseFileName, requestStatus); 
	// note: op doesn't have to be on CS
	User::WaitForRequest(requestStatus);
	CContactDatabase* database = op->TakeDatabase();
	CleanupStack::PushL(database);
	
	TContactItemId contactId = 1; //anything but not system template
	database->DeleteContactL(contactId); //aim is to check if it's safe to delete from template
	
	CleanupStack::PopAndDestroy(database);
	}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例6: TestUnsuccessfulDeleteL

/** 
 * Test an unsuccessful delete
 * @param aDb Contact database
 */
void TestUnsuccessfulDeleteL(CContactDatabase& aDb)
	{
	syncChecker->SetValidateResponseL(MContactSynchroniser::ERead,KErrNone);
	syncChecker->SetValidateResponseL(MContactSynchroniser::EEdit, KErrNone);
	TContactItemId id = CreateTestICCEntryL(aDb);
	// Creating the contact sets the delete error to KErrNone, so must do this afterwards
	syncChecker->SetDeleteContactResponseL(KErrCorrupt);
	syncChecker->ResetMethodCallCountsL();
	TRAPD(err, aDb.DeleteContactL(id));
	test(syncChecker->ValidateMethodCallCountL() == 2);
	test(err==KErrCorrupt);
	//Read contact to check it wasn't deleted anyway
	CContactItem* item = NULL;
	TRAP(err,item = aDb.ReadContactL(id));
	test(err==KErrNone);
	delete item;
	}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:21,代码来源:t_iccentry.cpp

示例7: DeleteContactsL

void CTestContactOperations::DeleteContactsL()
	{
	// existing database
   	TPtrC databaseFile(_L("C:contactDB.cdb"));
   	
   	TContactItemId itemId = KErrNotFound;
	CContactDatabase* dBase = NULL;
	CContactIdArray* idArray = NULL;
	
	dBase = CContactDatabase::OpenL(databaseFile);
	CleanupStack::PushL(dBase);
	
	// Set the filter to select all the contact items in the database
	CCntFilter* exportFilter = CCntFilter::NewL();
	CleanupStack::PushL(exportFilter);
	exportFilter->SetContactFilterTypeCard(ETrue);
	dBase->FilterDatabaseL(*exportFilter);
	idArray = exportFilter->iIds;	
	CleanupStack::PushL(idArray);
	
	TInt numberOfContacts;
   	GetIntFromConfig(ConfigSection(), KNumberOfCont, numberOfContacts);
	
	INFO_PRINTF1(_L("Deleting Contacts....."));

	// Delete the contacts one at a time
	for(TInt i=(idArray->Count()-1);i>=0;i--)
		{
		dBase->DeleteContactL((*idArray)[i]);
		}
			
	_LIT(KCount, "The number of contacts in the database is %d \n");
	INFO_PRINTF2(KCount, dBase->CountL());
	
	// Close the contacts
    dBase->CloseContactL(itemId);
	
	// Cleanup
	CleanupStack::Pop(idArray);
    CleanupStack::PopAndDestroy(exportFilter);
    CleanupStack::PopAndDestroy(dBase);
    }
开发者ID:,项目名称:,代码行数:42,代码来源:

示例8: 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);
    }    
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:95,代码来源:t_groupviewpanic.cpp


注:本文中的CContactDatabase::DeleteContactL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。