Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <cntview.h>
Link against: cntview.lib

Class CContactGroupView

class CContactGroupView : public CContactViewBase, public MContactViewObserver;

Description

Provides a view of a group of contact items.

The view uses an underlying view. For items to appear in the group view, they must exist in the underlying view.

The TGroupType enumeration defines whether the view displays items that belong to the group, items that do not belong to the group, or items that do not belong to any group.

The group view observes its underlying view so that it is kept up to date if the contents of the underlying view change.

The group can be identified by a contact item ID or by a label, e.g. "family", or "colleagues".

Derivation

Members

Defined in CContactGroupView:

Inherited from CBase:

Inherited from CContactViewBase:

See also:


Construction and destruction


NewL()

static IMPORT_C CContactGroupView *NewL(const CContactDatabase &aDb, CContactViewBase &aView, MContactViewObserver &aObserver, const TContactItemId aGroupId, const TGroupType aGroupType);

Description

Allocates and constructs a CContactGroupView version 1 object, identifying the group by its ID.

A group with the specified ID must exist in the database, otherwise when an attempt is made to update the view, a leave will occur with KErrNotFound. To create an unfiled view, the group id must be KNullContactId and the group type 'EShowContactsNotInAnyGroup'. In this case the group id isn't used and no leave will occur.

When adding contacts in the view, MContactViewObserver observer will receive TContactViewEvent events with iInt parameter set to KErrNone. When deleting contacts in the view, MContactViewObserver observer will receive TContactViewEvent events with iInt parameter set to index into the observed view of the deleted item

Parameters

const CContactDatabase &aDb

The database containing the contact group.

CContactViewBase &aView

The underlying view.

MContactViewObserver &aObserver

An observer that receives notifications when this view is ready for use and when changes take place in it. The observer receives a TContactViewEvent::EReady event when the view is ready. An attempt to use the view before this notification causes a panic.

const TContactItemId aGroupId

The ID of the contact group.

const TGroupType aGroupType

Controls whether the view displays items belonging to the group, items that do not belong to the group or items that do not belong to any group.

Return value

CContactGroupView *

The newly constructed group view object.


NewL()

static IMPORT_C CContactGroupView *NewL(const CContactDatabase &aDb, CContactViewBase &aView, MContactViewObserver &aObserver, const TDesC &aGroupName, const TGroupType aGroupType);

Description

Allocates and constructs a CContactGroupView version 1 object, identifying the group by its label.

A group with the specified label must exist in the database, otherwise when an attempt is made to update the view, a leave will occur with KErrNotFound.

When adding contacts in the view, MContactViewObserver observer will receive TContactViewEvent events with iInt parameter set to KErrNone. When deleting contacts in the view, MContactViewObserver observer will receive TContactViewEvent events with iInt parameter set to index into the observed view of the deleted item

Parameters

const CContactDatabase &aDb

The database containing the contact group.

CContactViewBase &aView

The underlying view.

MContactViewObserver &aObserver

An observer that receives notifications when this view is ready for use and when changes take place in it. The observer receives a TContactViewEvent::EReady event when the view is ready. An attempt to use the view before this notification causes a panic.

const TDesC &aGroupName

The group label.

const TGroupType aGroupType

Controls whether the view displays items belonging to the group, items that do not belong to the group or items that do not belong to any group.

Return value

CContactGroupView *

The newly constructed group view object.


NewL()

static IMPORT_C CContactGroupView *NewL(CContactViewBase &aView, const CContactDatabase &aDb, MContactViewObserver &aObserver, const TContactItemId aGroupId, const TGroupType aGroupType);

Description

Allocates and constructs a CContactGroupView version 2 object, identifying the group by its ID.

A group with the specified ID must exist in the database, otherwise when an attempt is made to update the view, a leave will occur with KErrNotFound. To create an unfiled view, the group id must be KNullContactId and the group type 'EShowContactsNotInAnyGroup'. In this case the group id isn't used and no leave will occur.

When adding/deleting contacts in the view, MContactViewObserver observer will receive TContactViewEvent events with iInt parameter set to index into the observed view of the added/deleted item

Parameters

CContactViewBase &aView

The underlying view.

const CContactDatabase &aDb

The database containing the contact group.

MContactViewObserver &aObserver

An observer that receives notifications when this view is ready for use and when changes take place in it. The observer receives a TContactViewEvent::EReady event when the view is ready. An attempt to use the view before this notification causes a panic.

const TContactItemId aGroupId

The ID of the contact group.

const TGroupType aGroupType

Controls whether the view displays items belonging to the group, items that do not belong to the group or items that do not belong to any group.

Return value

CContactGroupView *

The newly constructed group view object.


NewL()

static IMPORT_C CContactGroupView *NewL(CContactViewBase &aView, const CContactDatabase &aDb, MContactViewObserver &aObserver, const TDesC &aGroupName, const TGroupType aGroupType);

Description

Allocates and constructs a CContactGroupView version 2 object, identifying the group by its label.

A group with the specified label must exist in the database, otherwise when an attempt is made to update the view, a leave will occur with KErrNotFound.

When adding/deleting contacts in the view, MContactViewObserver observer will receive TContactViewEvent events with iInt parameter set to index into the observed view of the added/deleted item

Parameters

CContactViewBase &aView

The underlying view.

const CContactDatabase &aDb

The database containing the contact group.

MContactViewObserver &aObserver

An observer that receives notifications when this view is ready for use and when changes take place in it. The observer receives a TContactViewEvent::EReady event when the view is ready. An attempt to use the view before this notification causes a panic.

const TDesC &aGroupName

The group label.

const TGroupType aGroupType

Controls whether the view displays items belonging to the group, items that do not belong to the group or items that do not belong to any group.

Return value

CContactGroupView *

The newly constructed group view object.

[Top]


Member functions


CContactViewBase_Reserved_1()

Capability: ReadUserData

virtual TAny *CContactViewBase_Reserved_1(TFunction aFunction, TAny *aParams);

Description

This is a reserved virtual exported function that is used for BC proofing against addition of new exported virtual functions. This function now aids addition of new exported virtual methods without having to break BC,by simply having those virtual methods as non-virtual and helper methods, called from this one and only reserved virtual exported method.A public enumeration type that is defined in the base class CContactViewBase identifies which of the helper 'virtual' methods are being called. All derived classes of CContactViewBase that are public should mandatorily implement this method.

Returns any return values of the helper methods called from this function.

Parameters

TFunction aFunction

an enum value that identifies which helper method is called.

TAny *aParams

parameters to the helper method being called.

Return value

TAny *

Any return values of the helper methods called from this function or NULL.


AtL()

virtual TContactItemId AtL(TInt aIndex) const;

Description

Gets the contact item ID at the specified view index.

Parameters

TInt aIndex

Index into the group view.

Return value

TContactItemId

The contact item ID.

Leave codes

KErrNotFound

aIndex is outside the bounds of the array.


CountL()

virtual TInt CountL() const;

Description

Gets the number of contact item IDs in the group view.

Return value

TInt

The number of contact items in the group view.


FindL()

virtual TInt FindL(TContactItemId aId) const;

Description

Finds the index into the group view of the specified contact item.

Parameters

TContactItemId aId

The contact item ID to search for.

Return value

TInt

The index of the first matching item in the view or KErrNotFound if no matching item can be found.

Leave codes

KErrNotReady

The view is not ready for use.


AllFieldsLC()

virtual HBufC *AllFieldsLC(TInt aIndex, const TDesC &aSeparator) const;

Description

Gets a descriptor containing the contents of all fields in an item in the view.

The fields are separated by aSeparator.

Parameters

TInt aIndex

The index into the view of the contact item.

const TDesC &aSeparator

The string to use to separate the fields.

Return value

HBufC *

Pointer to the contact item descriptor.


ContactAtL()

virtual const CViewContact &ContactAtL(TInt aIndex) const;

Description

Gets the contact item at the specified view index.

Parameters

TInt aIndex

Index into the view of the required item.

Return value

const CViewContact &

The contact item.

Leave codes

KErrNotFound

aIndex is outside the bounds of the array.


ContactViewPreferences()

virtual TContactViewPreferences ContactViewPreferences();

Description

Gets the underlying view's view preferences.

Return value

TContactViewPreferences

The view preferences.


SortOrderL()

virtual const RContactViewSortOrder &SortOrderL() const;

Description

Gets the underlying view's sort order.

Return value

const RContactViewSortOrder &

The sort order.


UpdateGroupViewL()

protected: virtual IMPORT_C void UpdateGroupViewL();

Description

Populates the group view.

Removes any existing items from the group view then searches the underlying view. The group view is repopulated with those items, maintaining the order in which they occur in the underlying view.

Leave codes

KErrNotFound

The group, identified by the label or ID specified during construction, does not exist in the database.


HandleContactViewEvent()

private: virtual void HandleContactViewEvent(const CContactViewBase &aView, const TContactViewEvent &aEvent);

Description

Handles an event in an observed contact view.

Parameters

const CContactViewBase &aView

The contact view causing the notification.

const TContactViewEvent &aEvent

The event.

[Top]


Member enumerations


Enum TGroupType

TGroupType

Description

Defines the types of contact group view.

EShowContactsInGroup

The view contains contact items in the group.

EShowContactsNotInGroup

The view contains contact items not in the group.

EShowContactsNotInAnyGroup

The view contains contact items not in any group.