Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: cntitem.h
Link against: cntmodel.lib

Class CContactGroup

CContactGroup

Support

Supported from 6.0

Description

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.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CContactGroupContact group
CContactItemThe abstract base class for contact cards, templates and groups
CContactItemPlusGroupAbstract base class for CContactGroup, CContactCard and CContactOwnCard

Defined in CContactGroup:
ContainsItem(), GetGroupLabelL(), GroupsJoinedLC(), HasItemLabelField(), IsSystem(), ItemsContained(), ItemsContainedLC(), NewL(), NewLC(), SetGroupLabelL(), SetSystem(), Type(), ~CContactGroup()

Inherited from CBase:
operator new()

Inherited from CContactItem:
AccessCount(), AddFieldL(), CardFields(), DecAccessCount(), Id(), IncAccessCount(), InsertFieldL(), IsDeletable(), IsDeleted(), IsHidden(), LastModified(), RemoveField(), SetDeleteFlag(), SetDeleted(), SetHidden(), SetLastModified(), SetTemplateRefId(), SetUidStringL(), TemplateRefId(), UidStringL(), UpdateFieldSet()

Inherited from CContactItemPlusGroup:
GroupsJoined()


Construction and destruction


NewL()

static CContactGroup* NewL();

Description

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

Note

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

Return value

CContactGroup*

Pointer to the new contact card group.


NewLC()

static CContactGroup* NewLC();

Description

Allocates and constructs a new contact card group, leaving a pointer to the object on the cleanup stack. The group has no label and its list of members is NULL.

Note

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

Return value

CContactGroup*

Pointer to the new contact card group.


~CContactGroup()

~CContactGroup();

Description

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

[Top]


Type


Type()

TUid Type() const;

Description

Implements the pure virtual function inherited from the base class CContactItem. Returns KUidContactGroup.

Return value

TUid

KUidContactGroup.

[Top]


Group members


ItemsContainedLC()

CContactIdArray* ItemsContainedLC() const;

Description

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

Return value

CContactIdArray*

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


ItemsContained()

const CContactIdArray* ItemsContained() const;

Description

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

Return value

CContactIdArray*

Pointer to the group's list of members.


ContainsItem()

TBool ContainsItem(TContactItemId aContactId);

Description

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

Parameters

TContactItemId aContactId

The ID of the contact item to test.

Return value

TBool

ETrue if the item is a member of the group, EFalse if not.


GroupsJoinedLC()

CContactIdArray* GroupsJoinedLC() const;

Description

A contact item group can belong to other groups. This function returns a pointer to a list of contact item IDs which identify the groups to which the current group belongs.

Return value

CContactIdArray*

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.

[Top]


Attributes


IsSystem()

TBool IsSystem() const;

Description

Tests the value of the group's system attribute. Note that the system attribute is not currently used in the contacts model.

Return value

TBool

ETrue if system, EFalse if not.


SetSystem()

void SetSystem(TBool aSystem);

Description

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

Parameters

TBool aSystem

ETrue to set the system attribute, EFalse to unset it.

[Top]


Label


SetGroupLabelL()

void SetGroupLabelL(const TDesC& aLabel);

Description

Sets the group label. Any existing label is replaced.

Parameters

const TDesC& aLabel

The new group label.

Leave codes

 

Leaves with KErrNotFound if the group has no field of type KUidContactFieldTemplateLabel .


GetGroupLabelL()

TPtrC GetGroupLabelL();

Description

Gets the group label.

Return value

TPtrC

The new group label.

Leave codes

 

Leaves with KErrNotFound if the group has no field of type KUidContactFieldTemplateLabel .


HasItemLabelField()

TBool HasItemLabelField();

Description

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

Return value

TBool

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