diff -r a36b1e19a461 -r 989d2f495d90 serviceproviders/sapi_contacts_vpbk/contactservice/src/singlecontactfield.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/src/singlecontactfield.cpp Fri Jul 03 15:51:24 2009 +0100 @@ -0,0 +1,168 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "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 +#include + +#include "singlecontact.h" +#include "singlecontactfield.h" + +/* +----------------------------------------------------------------------------- + CSingleContactField ::NewL() + Description : static method which creates the object and constructs it. + Return values : CSingleContactField* +----------------------------------------------------------------------------- +*/ +EXPORT_C CSingleContactField* CSingleContactField::NewL() + { + return new (ELeave) CSingleContactField(); + } + +/* +----------------------------------------------------------------------------- + CSingleContactField ::CSingleContactField(). + Description : Default Constructor. + Return values : None. +----------------------------------------------------------------------------- +*/ +CSingleContactField::CSingleContactField() + { + } + +/* +----------------------------------------------------------------------------- + CSingleContactField ::GetFieldDataL(TPtrC8& aFieldKey, + TPtrC& aLabel, + TPtrC& aValue). + Description : Gets the Field Data and returns them as output parameters. + : If one of the params is not there then leaves. + Return values : None. +----------------------------------------------------------------------------- +*/ +EXPORT_C void CSingleContactField::GetFieldDataL(TPtrC8& aFieldKey, + TPtrC& aLabel, + TPtrC& aValue) + { + if(iFieldKey && iLabel && iValue) + { + aFieldKey.Set(*iFieldKey); + aLabel.Set(*iLabel); + aValue.Set(*iValue); + } + else + { + User::Leave(KErrNotFound); + } + } + +/* +----------------------------------------------------------------------------- + CSingleContactField ::GetFieldDataL(TPtrC8& aFieldKey, + TPtrC& aLabel, + TPtrC& aValue). + Description : Gets the Field Data and returns them as output parameters. + : Can leave. + Return values : None. +----------------------------------------------------------------------------- +*/ +EXPORT_C void CSingleContactField:: + SetFieldParamsL(const TDesC8& aFieldKey, + const TDesC& aLabel, + const TDesC& aValue) + { + if(iFieldKey) + { + delete iFieldKey; + iFieldKey = NULL; + } + if( iLabel ) + { + delete iLabel; + iLabel = NULL; + } + if( iValue ) + { + delete iValue; + iValue = NULL; + } + iFieldKey= aFieldKey.AllocL(); + iLabel = aLabel.AllocL(); + iValue = aValue.AllocL(); + } + +//Gets the Group Data and returns them as output parameters +/* +----------------------------------------------------------------------------- + CSingleContactField ::CSingleContactField:: + GetFieldDataL(TPtrC& aGroupLabel, + RPointerArray& aArray) + Description : Gets the Field Data and returns them as output parameters. + : Can leave. + Return values : None. +----------------------------------------------------------------------------- +*/ +EXPORT_C void CSingleContactField:: + GetFieldDataL(TPtrC& aGroupLabel, + RPointerArray& aArray) + { + aGroupLabel.Set(*iGroupLabel); + + TInt count = iContactIdArray.Count(); + + for(TInt i=0;i& aArray) + { + if( iGroupLabel ) + { + delete iGroupLabel; + iGroupLabel = NULL; + } + iGroupLabel = aGroupLabel.AllocL(); + iContactIdArray.ResetAndDestroy(); + iContactIdArray = aArray; + } + +//Private method used to set TTime variable +EXPORT_C void CSingleContactField::SetDateTime(TTime aDateTime) + { + iDateAndTime = aDateTime; + } + +//Method to get the TTime variable +EXPORT_C TTime CSingleContactField::GetDateTime() + { + return iDateAndTime; + } + +CSingleContactField::~CSingleContactField() + { + delete iFieldKey; + delete iLabel; + delete iValue; + delete iGroupLabel; + iContactIdArray.ResetAndDestroy(); + }