phoneengine/phonecntfinder2/tsrc/mocks/qcontactmanager_moc.cpp
changeset 21 92ab7f8d0eab
equal deleted inserted replaced
4:c84cf270c54f 21:92ab7f8d0eab
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include <QDebug>
       
    19 #include "qcontactmanager_moc.h"
       
    20 
       
    21 
       
    22 QContactManager_Moc::QContactManager_Moc()
       
    23 {   
       
    24 
       
    25     mExpectedResult = -1;
       
    26     qDebug()<<"QContactManager_Moc constructed";
       
    27 }
       
    28 
       
    29 QContactManager_Moc::~QContactManager_Moc()
       
    30 {
       
    31     mList.clear();
       
    32 }
       
    33 
       
    34 /* get the contact*/
       
    35 QContact QContactManager_Moc::contact(const QContactLocalId& contactId) const
       
    36 {
       
    37 	Q_UNUSED(contactId)
       
    38 	return mContact;
       
    39 }
       
    40 
       
    41 /* match */
       
    42 QList<QContactLocalId> QContactManager_Moc::contacts(const QContactFilter& filter, 
       
    43 									 const QList<QContactSortOrder>& sortOrders) const
       
    44 {
       
    45 Q_UNUSED(filter)
       
    46 Q_UNUSED(sortOrders)
       
    47 
       
    48 	mList.clear();
       
    49 	qDebug()<<"Moc - mExpectedResult is: " << mExpectedResult;
       
    50 	if (mExpectedResult == 1)
       
    51 		{
       
    52 		mList << cnt1;
       
    53 		qDebug()<<"Moc - match == 1 - list count is: " << mList.count();
       
    54 		}
       
    55 	else if (mExpectedResult == 2)
       
    56 		{
       
    57 		mList << cnt1;
       
    58 		mList << cnt2;
       
    59 		}
       
    60 	return mList;
       
    61 }
       
    62 
       
    63 //--- moc functions
       
    64 
       
    65 void QContactManager_Moc::setExpectedResult(int matchNumber)
       
    66     {
       
    67     mExpectedResult = matchNumber;
       
    68     qDebug()<<"Moc - mExpectedResult is: " << mExpectedResult;
       
    69     }