コード例 #1
0
void CViewManager::GetDefinitionsOfExistingViewsL(RPointerArray<CContactDefaultViewDefinition>& aViewDefs)
	{
	__ASSERT_DEBUG(aViewDefs.Count() == 0, User::Leave(KErrArgument));

	TInt i;
	CContactDefaultViewDefinition* viewDef;
	
	// Anonymous views.
	for (i = 0; i < iLocalViews.Count(); i++)
		{
		CContactLocalView* view = iLocalViews[i].iLocalView;
		viewDef = CContactDefaultViewDefinition::NewLC(CContactDefaultViewDefinition::ERemoteView,
														KNullDesC, view->SortOrderL(), 
														view->ContactViewPreferences(), 
														KNullDesC8/*pluginName*/);
		aViewDefs.AppendL(viewDef);
		CleanupStack::Pop(viewDef);
		}
	
	// Named views.
	for (i = 0; i < iNamedLocalViews.Count(); i++)
		{
		CContactNamedLocalView* view = iNamedLocalViews[i];
		viewDef = CContactDefaultViewDefinition::NewLC(CContactDefaultViewDefinition::ENamedRemoteView,
														view->Name(), view->SortOrderL(), 
														view->ContactViewPreferences(), 
														KNullDesC8/*pluginName*/);
		aViewDefs.AppendL(viewDef);
		CleanupStack::Pop(viewDef);		
		}
	}
コード例 #2
0
void CTestResources::PrintReverseViewSortOrderL()
	{
	test.Printf(_L("View Sort reverse order is:\n"));
	TBuf<128> buf;
	for(TInt i=0; i<iLocalReverseView->CountL(); ++i)
		{
		TContactItemId id=iLocalReverseView->AtL(i);
		CContactItem* contact=iDb->ReadMinimalContactLC(id);
	 	CContactItemFieldSet& fieldSet=contact->CardFields();
	 	buf.Format(_L("Id %d : \""), id);
	 	TInt pos=fieldSet.Find(KUidContactFieldGivenName);
		if (pos!=KErrNotFound)
		 	buf.Append(fieldSet[pos].TextStorage()->Text());
		buf.Append(_L("\" "));
	 	pos=fieldSet.Find(KUidContactFieldFamilyName);
	 	buf.Append(_L("\""));
		if (pos!=KErrNotFound)
	 		buf.Append(fieldSet[pos].TextStorage()->Text());
		buf.Append(_L("\" "));
	 	pos=fieldSet.Find(KUidContactFieldCompanyName);
	 	buf.Append(_L("\""));
		if (pos!=KErrNotFound)
		 	buf.Append(fieldSet[pos].TextStorage()->Text());
		buf.Append(_L("\""));
		RDebug::Print(_L("%S\n"),&buf);

		CleanupStack::PopAndDestroy(contact);
		buf.Zero();
		}
	}
コード例 #3
0
void CTestResources::VerifyReverseSortOrderL()
	{
	const TInt count = iLocalReverseView->CountL();
	
	// explicit reverse orde to test?
	if (iIdsInViewReverseSortOrder.Count() > 0)
		{
		for(TInt i=0; i<count; ++i)
			{
			TInt viewId = iLocalReverseView->AtL(i);
			TInt expectedId=iIdsInViewReverseSortOrder[i];
			// diagnostic info
			if (viewId != expectedId)
				{
				test.Printf(_L("* line number %d fails\n"), i+1);
				}
			test (viewId == expectedId);
			}
		}
	else
		{
		// check for reverse of normal order
		for(TInt i=0; i<count; ++i)
			{
			TInt viewId = iLocalReverseView->AtL(i);
			TInt expectedId=iIdsInViewSortOrder[count - i - 1];
			// diagnostic info
			if (viewId != expectedId)
				{
				test.Printf(_L("* line number %d fails\n"), i+1);
				}
			test (viewId == expectedId);
			}
		}
	}
コード例 #4
0
/**
CContactLocalView contructor, used in the server
@internalTechnology 
*/
EXPORT_C CContactLocalView* CContactLocalView::NewL(MContactViewObserver& aObserver,const CContactDatabase& aDb,const RContactViewSortOrder& aSortOrder,TContactViewPreferences aContactTypes, MLplPersistenceLayerFactory* aFactory, const TDesC8& aSortPluginName)
	{
	CContactLocalView* self = new (ELeave) CContactLocalView(aDb, aContactTypes, aFactory);
	CleanupStack::PushL(self);
	self->ConstructL(aObserver, aSortOrder, ETrue, aSortPluginName);
	CleanupStack::Pop(self); 
	return self;
	}
コード例 #5
0
/**
Allocates and constructs the local view object.

The view is sorted according to the sort order and view preferences specified, 
using a low priority idle time active object. The specified view observer 
is notified when the view is sorted and ready for use.

@param aObserver An observer that receives notifications when this view is 
ready for use and when changes take place in it. The observer receives a TContactViewEvent::EReady 
event when the view is ready. Any attempt to use the view before this notification will Leave with KErrNotReady
@param aDb The underlying database that contains the contact items. The view 
observes the database, so that it handles change events sent from the database.
@param aSortOrder Specifies the fields to use to sort the items in the view.
@param aContactTypes Specifies which types of contact items should be included 
in the view and the behaviour for items that do not have content in any of 
the fields specified in the sort order.
@param aSortPluginName Specifies a plug-in that will be used to compare view contacts
when the the view is sorted. This name is used by ECOM to select the plugin, and is matched
with the "default_data" of all ECOM plugins that support the required interface.
@return The newly constructed local view object. 
*/
EXPORT_C CContactLocalView* CContactLocalView::NewL(MContactViewObserver& aObserver,const CContactDatabase& aDb, const RContactViewSortOrder& aSortOrder, TContactViewPreferences aContactTypes, const TDesC8& aSortPluginName)
	{
#ifdef CONTACTS_API_PROFILING
	TContactsApiProfile::CntViewMethodLog(TContactsApiProfile::ECntVwClassLocalView, TContactsApiProfile::ECntViewApiNewL, aSortOrder, aContactTypes, aSortPluginName);
#endif
	CContactLocalView* self = new(ELeave) CContactLocalView(aDb, aContactTypes);
	CleanupStack::PushL(self);
	self->ConstructL(aObserver, aSortOrder, ETrue, aSortPluginName);
	CleanupStack::Pop(self); 
	return self;
	}
コード例 #6
0
void CTestResources::VerifySortOrderL()
	{
	const TInt count = iLocalView->CountL();
	for(TInt i=0; i<count; ++i)
		{
		TInt viewId = iLocalView->AtL(i);
		TInt expectedId=iIdsInViewSortOrder[i];
		// diagnostic info
		if (viewId != expectedId)
			{
			test.Printf(_L("* line number %d fails\n"), i+1);
			}
		test (viewId == expectedId);
		}
	}
コード例 #7
0
LOCAL_C void TestOpenLocalViewL
        (CTestResources& aRes, TInt aCount)
    {
    // Create a local view on the DB
    CContactViewEventQueue* viewEvents = CContactViewEventQueue::NewL();
    CleanupStack::PushL(viewEvents);
    CContactLocalView* testView = CContactLocalView::NewL
        (*viewEvents, *aRes.iDb, aRes.iViewSortOrder, EContactsOnly);
    CleanupStack::PushL(testView);

    // Wait for the view to initialize
    TContactViewEvent event;
    test(viewEvents->ListenForEvent(10,event));
    test(event.iEventType == TContactViewEvent::EReady);

    // Check view count is correct
    test(testView->CountL() == aCount);

    // Check view doesn't contain any duplicates
    TestNoDuplicatesL(*testView);

    CleanupStack::PopAndDestroy(2,viewEvents);
    }