phoneengine/phonecntfinder2/tsrc/mocks/qcontactmanager_moc.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 19 Mar 2010 09:28:42 +0200
changeset 21 92ab7f8d0eab
permissions -rw-r--r--
Revision: 201007 Kit: 201011

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/

#include <QDebug>
#include "qcontactmanager_moc.h"


QContactManager_Moc::QContactManager_Moc()
{   

    mExpectedResult = -1;
    qDebug()<<"QContactManager_Moc constructed";
}

QContactManager_Moc::~QContactManager_Moc()
{
    mList.clear();
}

/* get the contact*/
QContact QContactManager_Moc::contact(const QContactLocalId& contactId) const
{
	Q_UNUSED(contactId)
	return mContact;
}

/* match */
QList<QContactLocalId> QContactManager_Moc::contacts(const QContactFilter& filter, 
									 const QList<QContactSortOrder>& sortOrders) const
{
Q_UNUSED(filter)
Q_UNUSED(sortOrders)

	mList.clear();
	qDebug()<<"Moc - mExpectedResult is: " << mExpectedResult;
	if (mExpectedResult == 1)
		{
		mList << cnt1;
		qDebug()<<"Moc - match == 1 - list count is: " << mList.count();
		}
	else if (mExpectedResult == 2)
		{
		mList << cnt1;
		mList << cnt2;
		}
	return mList;
}

//--- moc functions

void QContactManager_Moc::setExpectedResult(int matchNumber)
    {
    mExpectedResult = matchNumber;
    qDebug()<<"Moc - mExpectedResult is: " << mExpectedResult;
    }