CContactGroup Class Reference

class CContactGroup : public CContactItemPlusGroup

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.

Inherits from

Public Member Functions
~CContactGroup()
IMPORT_C voidAddContactL(TContactItemId)
IMPORT_C TBoolContainsItem(TContactItemId)
voidExternalizeL(RWriteStream &)
IMPORT_C TPtrCGetGroupLabelL()
IMPORT_C CContactIdArray *GroupsJoinedLC()
IMPORT_C TBoolHasItemLabelField()
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)
IMPORT_C TUidType()
Private Member Functions
CContactGroup()
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()
Inherited Enumerations
CContactItem:@64
Private Attributes
CContactIdArray *iItems

Constructor & Destructor Documentation

CContactGroup()

CContactGroup()[private]

~CContactGroup()

IMPORT_C~CContactGroup()

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

Member Functions 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.

leave
KErrAlreadyExists The contact is already a member of this group.

Parameters

TContactItemId aContactIdThe Id of the contact being added to the group.

ContainsItem(TContactItemId)

IMPORT_C TBoolContainsItem(TContactItemIdaContactId)

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

Parameters

TContactItemId aContactIdThe ID of the contact item to test.

ExternalizeL(RWriteStream &)

voidExternalizeL(RWriteStream &aStream)const [virtual]

Externalises a CContactGroup object to a write stream.

Parameters

RWriteStream & aStreamStream to which the object should be externalised.

GetGroupLabelL()

IMPORT_C TPtrCGetGroupLabelL()

Gets the group label.

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

GroupsJoinedLC()

IMPORT_C CContactIdArray *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).

HasItemLabelField()

IMPORT_C TBoolHasItemLabelField()

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

InternalizeL(RReadStream &)

voidInternalizeL(RReadStream &aStream)[virtual]

Internalises a CContactGroup object from a read stream.

Parameters

RReadStream & 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.

ItemsContained()

IMPORT_C const CContactIdArray *ItemsContained()const

Returns a constant 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.

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

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

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.

leave
KErrNotFound The contact is not a member of this group.

Parameters

TContactItemId aContactIdThe Id of the contact being removed from the group.

ResetItems()

IMPORT_C voidResetItems()

Resets items.

SetGroupLabelL(const TDesC &)

IMPORT_C voidSetGroupLabelL(const TDesC &aLabel)

Sets the group label, replacing any existing one.

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

Parameters

const TDesC & aLabelThe new group label.

SetItems(CContactIdArray *)

IMPORT_C voidSetItems(CContactIdArray *aItems)

Sets groups.

Parameters

CContactIdArray * aItems

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

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

Type()

IMPORT_C TUidType()const [virtual]

Implements CContactItem::Type().

Member Data Documentation

CContactIdArray * iItems

CContactIdArray *iItems[private]