Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: CNTITEM.H
Link against: cntmodel.lib

Class CContactGroup

class CContactGroup : public CContactItemPlusGroup;

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.

Derivation

Members

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

Inherited from CBase:
Delete(), Extension_(), operator new()

Inherited from CContactItem:
AccessCount(), AddFieldL(), CardFields(), DecAccessCount(), ECompressedGuid, EDeleted, EHidden, ESystem, Guid(), Id(), IncAccessCount(), InsertFieldL(), IsDeletable(), IsDeleted(), IsHidden(), LastModified(), RemoveField(), SetDeleted(), SetHidden(), SetLastModified(), SetTemplateRefId(), SetUidStringL(), TemplateRefId(), UidStringL(), UpdateFieldSet(), anonymous

Inherited from CContactItemPlusGroup:
GroupsJoined()


Construction and destruction


NewL()

static IMPORT_C CContactGroup *NewL();

Description

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

CContactGroup *

Pointer to the new contact card group.


NewLC()

static IMPORT_C CContactGroup *NewLC();

Description

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

CContactGroup *

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


~CContactGroup()

IMPORT_C ~CContactGroup();

Description

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

[Top]


Member functions


Type()

virtual IMPORT_C TUid Type() const;

Description

Implements CContactItem::Type().

Return value

TUid

KUidContactGroup.


ItemsContainedLC()

IMPORT_C 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()

IMPORT_C const CContactIdArray *ItemsContained() const;

Description

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

Return value

const CContactIdArray *

Pointer to the group's list of members.


IsSystem()

IMPORT_C TBool IsSystem() const;

Description

Tests the value of the group's system attribute.

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

Return value

TBool

ETrue if system, EFalse if not.


SetSystem()

IMPORT_C void SetSystem(TBool aSystem);

Description

Sets the value of the group's system attribute.

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

Parameters

TBool aSystem

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


ContainsItem()

IMPORT_C 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.


SetGroupLabelL()

IMPORT_C void SetGroupLabelL(const TDesC &aLabel);

Description

Sets the group label, replacing any existing one.

Parameters

const TDesC &aLabel

The new group label.

Leave codes

KErrNotFound

The group has no label field (of type KUidContactFieldTemplateLabel).


GetGroupLabelL()

IMPORT_C TPtrC GetGroupLabelL();

Description

Gets the group label.

Return value

TPtrC

The new group label.

Leave codes

KErrNotFound

The group has no label field (of type KUidContactFieldTemplateLabel).


HasItemLabelField()

IMPORT_C TBool HasItemLabelField();

Description

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

Return value

TBool

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


GroupsJoinedLC()

IMPORT_C CContactIdArray *GroupsJoinedLC() const;

Description

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

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.


ExternalizeL()

virtual void ExternalizeL(RWriteStream &aStream) const;

Description

Externalises a CContactGroup object to a write stream.

Parameters

RWriteStream &aStream

Stream to which the object should be externalised.


InternalizeL()

virtual void InternalizeL(RReadStream &aStream);

Description

Internalises a CContactGroup object from a read stream.

Parameters

RReadStream &aStream

Stream from which the object should be internalised.