CContactGroup Class Reference

#include <app/cntitem.h>

class CContactGroup : public CContactItemPlusGroup, public CContactItemPlusGroup
Public Member Functions
~CContactGroup()
IMPORT_C voidAddContactL(TContactItemId)
IMPORT_C TBoolContainsItem(TContactItemId)
virtual voidExternalizeL(RWriteStream &)
IMPORT_C TPtrCGetGroupLabelL()
IMPORT_C CContactIdArray *GroupsJoinedLC()
IMPORT_C TBoolHasItemLabelField()
virtual voidInternalizeL(RReadStream &)
IMPORT_C TBoolIsSystem()
IMPORT_C const CContactIdArray *ItemsContained()
IMPORT_C CContactIdArray *ItemsContainedLC()
IMPORT_C CContactGroup *NewL()
IMPORT_C CContactGroup *NewLC()
IMPORT_C voidRemoveContactL(TContactItemId)
IMPORT_C voidResetItems()
IMPORT_C voidSetGroupLabelL(const TDesC &)
IMPORT_C voidSetItems(CContactIdArray *)
IMPORT_C voidSetSystem(TBool)
virtual IMPORT_C TUidType()
Inherited Enumerations
CContactItem:@19
CContactItem:@3
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()
CContactItem::AccessCount()const
CContactItem::AddFieldL(CContactItemField &)
CContactItem::AddLabelFieldL()
CContactItem::Agent()
CContactItem::Attributes()const
CContactItem::CardFields()const
CContactItem::ClearFieldContent()
CContactItem::DecAccessCount()
CContactItem::Guid()
CContactItem::Id()const
CContactItem::IncAccessCount()
CContactItem::InsertFieldL(CContactItemField &,TInt)
CContactItem::IsDeletable()
CContactItem::IsDeleted()const
CContactItem::IsHidden()
CContactItem::IsSystem()
CContactItem::LastModified()const
CContactItem::NewLC(RReadStream &)
CContactItem::NewLC(TUid)
CContactItem::PopulateStoreL(CStreamStore &,CArrayFix< TFieldHeader > &)const
CContactItem::RemoveField(TInt)
CContactItem::RestoreTemplateFieldsL(const CContactItemFieldSet &,const CContactItemFieldSet &,const CContactItemViewDef &)
CContactItem::SetAccessCount(TUint32)
CContactItem::SetAttributes(TUint32)
CContactItem::SetCreationDate(const TTime &)
CContactItem::SetDeleted(TBool)
CContactItem::SetHidden(TBool)
CContactItem::SetId(TContactItemId)
CContactItem::SetLastModified(const TTime &)
CContactItem::SetTemplateRefId(TContactItemId)
CContactItem::SetUidStringL(TDesC &)
CContactItem::TemplateRefId()const
CContactItem::UidStringL(TInt64)const
CContactItem::UpdateFieldSet(CContactItemFieldSet *)
CContactItem::~CContactItem()
CContactItemPlusGroup::CContactItemPlusGroup()
CContactItemPlusGroup::GroupsJoined()const
CContactItemPlusGroup::ResetGroups()
CContactItemPlusGroup::SetGroups(CContactIdArray *)
CContactItemPlusGroup::~CContactItemPlusGroup()

Detailed Description

A contact group.

A contact group is a contact item which holds a set of associated contact item IDs. The members of the group may be contact cards, own cards, or even other groups. The group has a label which identifies the group to users, e.g. "family", or "colleagues". The type of a contact group is KUidContactGroup, as returned by Type().

Objects of this class are constructed using CContactDatabase::CreateContactGroupL() or CreateContactGroupLC(). These functions create the group, optionally with a label, add it to the database, and return a pointer to it.

To create an association between a card and a group, use CContactDatabase::AddContactToGroupL() and to remove the association, use RemoveContactFromGroupL(). To find out which groups a card belongs to, use CContactCard::GroupsJoinedLC() or CContactOwnCard::GroupsJoinedLC().

The function CContactDatabase::GetGroupIdListL() may be used to retrieve a list of IDs for all groups in the database.

Constructor & Destructor Documentation

~CContactGroup ( )

IMPORT_C~CContactGroup()

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

Member Function Documentation

AddContactL ( TContactItemId )

IMPORT_C voidAddContactL(TContactItemIdaContactId)

Adds a contact with the given Id to the group. This method doesn't make any changes to the database. The change should be persisted by means of CContactDatabase::CommitContactL() API.

Parameters
aContactIdThe Id of the contact being added to the group.
Leave Codes
KErrAlreadyExistsThe contact is already a member of this group.

ContainsItem ( TContactItemId )

IMPORT_C TBoolContainsItem(TContactItemIdaContactId)

Tests whether a contact item is a member of the group.

Parameters
aContactIdThe ID of the contact item to test.
Return Value
ETrue if the item is a member of the group, EFalse if not.

ExternalizeL ( RWriteStream & )

voidExternalizeL(RWriteStream &aStream)const [virtual]

Reimplemented from CContactItemPlusGroup::ExternalizeL(RWriteStream &)const

Externalises a CContactGroup object to a write stream.

Parameters
aStreamStream to which the object should be externalised.

GetGroupLabelL ( )

IMPORT_C TPtrCGetGroupLabelL()

Gets the group label.

Return Value
The new group label.
Leave Codes
KErrNotFoundThe group has no label field (of type KUidContactFieldTemplateLabel).

GroupsJoinedLC ( )

IMPORT_C CContactIdArray *GroupsJoinedLC()const

Reimplemented from CContactItemPlusGroup::GroupsJoinedLC()const

Returns a pointer to a list of contact groups to which the current group belongs (a contact group can belong to other groups).

Return Value
A pointer to a copy of the array of groups IDs to which this group belongs. This array is empty if the group is not a member of any other groups. The caller takes ownership of this object, so is responsible for its deletion.

HasItemLabelField ( )

IMPORT_C TBoolHasItemLabelField()

Tests whether the group has a label field (of type KUidContactFieldTemplateLabel).

Return Value
ETrue if the group has a label field. EFalse if not.

InternalizeL ( RReadStream & )

voidInternalizeL(RReadStream &aStream)[virtual]

Reimplemented from CContactItemPlusGroup::InternalizeL(RReadStream &)

Internalises a CContactGroup object from a read stream.

Parameters
aStreamStream from which the object should be internalised.

IsSystem ( )

IMPORT_C TBoolIsSystem()const

Tests the value of the group's system attribute.

The system attribute is not currently used in the Contacts Model API.

Return Value
ETrue if system, EFalse if not.

ItemsContained ( )

IMPORT_C const CContactIdArray *ItemsContained()const

Returns a constant pointer to the group's list of members.

Return Value
Pointer to the group's list of members.

ItemsContainedLC ( )

IMPORT_C CContactIdArray *ItemsContainedLC()const

Returns a pointer to a copy of the group's list of members.

Return Value
Pointer to a copy of the group's list of members. This is left on the cleanup stack.

NewL ( )

IMPORT_C CContactGroup *NewL()[static]

Allocates and constructs a new default contact card group. The group has no label and its list of members is NULL.

Contact groups should be constructed using the factory functions provided in class CContactDatabase, for example CreateContactGroupL().

Return Value
Pointer to the new contact card group.

NewLC ( )

IMPORT_C CContactGroup *NewLC()[static]

Allocates and constructs a new default contact card group.

The group has no label and its list of members is NULL.

Contact groups should be constructed using the factory functions provided in class CContactDatabase, for example CreateContactGroupLC().

Return Value
Pointer to the new contact card group. This is left on the cleanup stack.

RemoveContactL ( TContactItemId )

IMPORT_C voidRemoveContactL(TContactItemIdaContactId)

Removes a contact with the given Id from the group. This method doesn't make any changes to the database. The change should be persisted by means of CContactDatabase::CommitContactL() API.

Parameters
aContactIdThe Id of the contact being removed from the group.
Leave Codes
KErrNotFoundThe contact is not a member of this group.

ResetItems ( )

IMPORT_C voidResetItems()

Resets items.

SetGroupLabelL ( const TDesC & )

IMPORT_C voidSetGroupLabelL(const TDesC &aLabel)

Sets the group label, replacing any existing one.

Parameters
aLabelThe new group label.
Leave Codes
KErrNotFoundThe group has no label field (of type KUidContactFieldTemplateLabel).

SetItems ( CContactIdArray * )

IMPORT_C voidSetItems(CContactIdArray *aItems)

Sets groups.

SetSystem ( TBool )

IMPORT_C voidSetSystem(TBoolaSystem)

Sets the value of the group's system attribute.

The system attribute is not currently used in the Contacts Model API.

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

Type ( )

IMPORT_C TUidType()const [virtual]

Reimplemented from CContactItem::Type()const

Implements CContactItem::Type().

Return Value
KUidContactGroup.