CContactItem Class Reference

#include <app/cntitem.h>

class CContactItem : public CBase, public CBase

Inherits from

Public Member Enumerations
enumanonymous { ESystem, EHidden, ECompressedGuid, EDeleted }
Public Member Functions
~CContactItem()
TInt AccessCount()
IMPORT_C voidAddFieldL(CContactItemField &)
voidAddLabelFieldL()
TContactItemId Agent()
IMPORT_C TUint32Attributes()
IMPORT_C CContactItemFieldSet &CardFields()
voidClearFieldContent()
voidDecAccessCount()
virtual voidExternalizeL(RWriteStream &)
TPtrC Guid()
IMPORT_C TContactItemIdId()
voidIncAccessCount()
IMPORT_C voidInsertFieldL(CContactItemField &, TInt)
virtual voidInternalizeL(RReadStream &)
TBool IsDeletable()
IMPORT_C TBoolIsDeleted()
IMPORT_C TBoolIsHidden()
IMPORT_C TBoolIsSystem()
IMPORT_C TTimeLastModified()
CContactItem *NewLC(RReadStream &)
IMPORT_C CContactItem *NewLC(TUid)
TStreamId PopulateStoreL(CStreamStore &, CArrayFix< TFieldHeader > &)
IMPORT_C voidRemoveField(TInt)
IMPORT_C voidRestoreTemplateFieldsL(const CContactItemFieldSet &, const CContactItemFieldSet &, const CContactItemViewDef &)
IMPORT_C voidSetAccessCount(TUint32)
IMPORT_C voidSetAttributes(TUint32)
IMPORT_C voidSetCreationDate(const TTime &)
IMPORT_C voidSetDeleted(TBool)
IMPORT_C voidSetHidden(TBool)
IMPORT_C voidSetId(TContactItemId)
IMPORT_C voidSetLastModified(const TTime &)
IMPORT_C voidSetSystem(TBool)
IMPORT_C voidSetTemplateRefId(TContactItemId)
IMPORT_C voidSetUidStringL(TDesC &)
IMPORT_C TContactItemIdTemplateRefId()
pure virtual TUid Type()
IMPORT_C TPtrCUidStringL(TInt64)
IMPORT_C voidUpdateFieldSet(CContactItemFieldSet *)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()

Detailed Description

The abstract base class for contact cards, templates and groups. All contact items are identified by a contact ID, (TContactItemId), have a last modified date/time and own one or more fields (the field set). Contact items also have an access count and attributes (e.g. hidden). Note that fields in a contact item also have attributes. Attribute values specified in the contact item override those in the contained fields. The access count is a record of the number of objects referencing a contact item. A contact item cannot be fully deleted until its access count is zero.

Member Enumeration Documentation

Enum anonymous

Contact item's attribute flags

These flags can be used to set the various attributes of a contact item.

EnumeratorValueDescription
ESystem0x01

To set the contact item's system attribute.

EHidden0x02

To set the contact item's hidden attribute.

ECompressedGuid0x04

To set the contact item's hidden attribute.

EDeleted0x08

To set the contact item's Is deleted attribute.

Constructor & Destructor Documentation

~CContactItem ( )

IMPORT_C~CContactItem()

The destructor frees all resources owned by the contact item, prior to its destruction.

Member Function Documentation

AccessCount ( )

TInt AccessCount()const [inline]

Gets the contact item's access count.

Return Value
The item's access count.

AddFieldL ( CContactItemField & )

IMPORT_C voidAddFieldL(CContactItemField &aField)

Appends a field to the contact item's field set. The contact item takes ownership of the field.

Parameters
aFieldThe field to append to the contact item's field set.

AddLabelFieldL ( )

voidAddLabelFieldL()

Agent ( )

Attributes ( )

IMPORT_C TUint32Attributes()const

Returns the contact item's attributes.

Return Value
contact item's attributes

CardFields ( )

IMPORT_C CContactItemFieldSet &CardFields()const

Gets a reference to the contact item's field set.

Return Value
A reference to the contact item's field set.

ClearFieldContent ( )

voidClearFieldContent()

DecAccessCount ( )

voidDecAccessCount()[inline]

Decrements the contact item's access count.

ExternalizeL ( RWriteStream & )

voidExternalizeL(RWriteStream &aStream)const [virtual]

Externalises a CContactItem object to a write stream.

Parameters
aStreamStream to which the object should be externalised.

Guid ( )

TPtrC Guid()[inline]

Accessor function for Contact Guid. This is used to cache contact items that are added during a sync.

Return Value
Guid

Id ( )

IMPORT_C TContactItemIdId()const

Gets the contact item's ID.

Return Value
The contact item's ID.

IncAccessCount ( )

voidIncAccessCount()[inline]

Increments the contact item's access count.

InsertFieldL ( CContactItemField &, TInt )

IMPORT_C voidInsertFieldL(CContactItemField &aField,
TIntaFieldPos
)

Inserts a field into the contact item's field set. The contact item takes ownership of the field.

Parameters
aFieldThe field to insert into the contact item's field set.
aFieldPosThe position in the field set at which to insert the field. If this value is greater than the total number of fields, it is appended. The position is relative to zero, i.e. zero implies that the element is inserted at the beginning of the array.

InternalizeL ( RReadStream & )

voidInternalizeL(RReadStream &aStream)[virtual]

Internalises a CContactItem object from a read stream.

Parameters
aStreamStream from which the object should be internalised.

IsDeletable ( )

TBool IsDeletable()[inline]

Tests whether the contact item is deletable.

This is true if the item's access count is zero.

Return Value
ETrue if deletable, EFalse if not deletable.

IsDeleted ( )

IMPORT_C TBoolIsDeleted()const

Gets the value of the Is deleted attribute as set by SetDeleted().

Return Value
ETrue if deleted, EFalse if not.

IsHidden ( )

IMPORT_C TBoolIsHidden()

Gets the value of the contact item's hidden attribute. Hidden means that the item is not displayed if the view definition excludes hidden fields.

Return Value
ETrue if hidden, EFalse if not.

IsSystem ( )

IMPORT_C TBoolIsSystem()

Gets the value of the contact item's system attribute. Note that the system attribute is not currently used in the contacts model.

Return Value
ETrue if system, EFalse if not.

LastModified ( )

IMPORT_C TTimeLastModified()const

Gets the contact item's last modified date/time.

Return Value
The contact item's last modified date/time.

NewLC ( RReadStream & )

CContactItem *NewLC(RReadStream &aStream)[static]

Constructs a new contact item based on a RReadStream.

Parameters
aStreamRReadStream containing object to internalize.
Return Value
Pointer to the newly created CContactItem. This is left on the cleanup stack.

NewLC ( TUid )

IMPORT_C CContactItem *NewLC(TUidaType)[static]

Constructs a new contact item.

Return Value
Pointer to the newly created CContactItem. This is left on the cleanup stack.

PopulateStoreL ( CStreamStore &, CArrayFix< TFieldHeader > & )

TStreamId PopulateStoreL(CStreamStore &aStore,
CArrayFix< TFieldHeader > &aFieldHeaderArray
)const
Part of the system template update implementation. This could be used for a generic update method at a later stage.
Since
7.0

RemoveField ( TInt )

IMPORT_C voidRemoveField(TIntaFieldPos)

Removes a field from the contact item's field set. A panic occurs if the specified field does not exist in the field set.

Parameters
aFieldPosIndex within the field set of the field to remove.

RestoreTemplateFieldsL ( const CContactItemFieldSet &, const CContactItemFieldSet &, const CContactItemViewDef & )

IMPORT_C voidRestoreTemplateFieldsL(const CContactItemFieldSet &aSystemTemplateFields,
const CContactItemFieldSet &aTemplateFields,
const CContactItemViewDef &aViewDef
)

Restore fields from the template to the contact item.

Parameters
aTemplateFieldsFields to add
aViewDefView definition to use

SetAccessCount ( TUint32 )

IMPORT_C voidSetAccessCount(TUint32aAccessCount)

Sest the contact item's access count.

SetAttributes ( TUint32 )

IMPORT_C voidSetAttributes(TUint32aAttributes)

Sest the contact item's attributes.

SetCreationDate ( const TTime & )

IMPORT_C voidSetCreationDate(const TTime &aTime)

Sest the contact item's creation time.

SetDeleted ( TBool )

IMPORT_C voidSetDeleted(TBoolaDeleted)

Sets the value of the contact item's Is deleted attribute.

If the attribute is set, this means that an attempt has been made to delete the contact item, but because the item's access count is greater than zero, its data persists and the item is just marked as deleted.

Parameters
aDeletedETrue to set the Is deleted attribute. EFalse to unset it.

SetHidden ( TBool )

IMPORT_C voidSetHidden(TBoolaHidden)

Sets the contact item's hidden attribute. Hidden means that the item is not displayed if the view definition excludes hidden fields.

Parameters
aHiddenETrue to set the hidden attribute for the item, EFalse to unset it.

SetId ( TContactItemId )

IMPORT_C voidSetId(TContactItemIdaId)

Sets the contact item's ID.

SetLastModified ( const TTime & )

IMPORT_C voidSetLastModified(const TTime &aLastModified)

Sets the last modified date/time value stored in the local copy of the contact item. This value is returned by LastModified() for this copy of the item.

This function has no effect on the item's last modified date/time which is stored in the database; this is always the date/time the contact was last committed.

This function is provided for use when synchronising contact items.

Parameters
aLastModifiedThe contact item's last modified date/time.

SetSystem ( TBool )

IMPORT_C voidSetSystem(TBoolaSystem)

Sets the contact item's system attribute. Note that the system attribute is not currently used in the contacts model.

Parameters
aSystemETrue to set the system attribute, EFalse to unset it.

SetTemplateRefId ( TContactItemId )

IMPORT_C voidSetTemplateRefId(TContactItemIdaUid)

Sets the ID of the template on which this contact item is based.

Parameters
aUidThe ID of the template on which this item is based.

SetUidStringL ( TDesC & )

IMPORT_C voidSetUidStringL(TDesC &aString)

Sets the item's UID string. This replaces any existing string. Contact items have a globally unique identifier, stored as a descriptor which is provided for vCard support. It is a combination of the database's unique identifier (see CContactDatabase::MachineId()), the contact item ID and the date/time of the contact item's creation.

Parameters
aStringThe contact item's UID string.

TemplateRefId ( )

IMPORT_C TContactItemIdTemplateRefId()const

Gets the ID of the template which was used to create this contact item.

Return Value
The ID of the template on which this item is based. KNullContactId if the item is not based on a template.

Type ( )

TUid Type()const [pure virtual]

Gets the contact item's type.

Return Value
The contact item's type.

UidStringL ( TInt64 )

IMPORT_C TPtrCUidStringL(TInt64aMachineUniqueId)const

Returns a descriptor which contains the item's UID string. Contact items have a globally unique identifier, stored as a descriptor. This is provided for vCard support. It is a combination of the database's unique identifier, the contact item ID and the date/time of the contact item's creation.

Parameters
aMachineUniqueIdThe database's unique identifier. This can be retrieved using CContactDatabase::MachineId().
Return Value
The item's UID string.

UpdateFieldSet ( CContactItemFieldSet * )

IMPORT_C voidUpdateFieldSet(CContactItemFieldSet *aNewFieldSet)

Replaces the contact item's field set.

Parameters
aNewFieldSetThe new field set with which to replace the existing one.