Symbian
Symbian OS Library

SYMBIAN OS V9.3

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



Location: CNTFIELD.H
Link against: cntmodel.lib

Class CContactItemField

class CContactItemField : public CBase;

Description

A field in a contact item.

Fields are grouped into a field set (CContactItemFieldSet), which is owned by the contact item.

The contact item field stores the field data. The data may be text, a date/time value, or an agent, as indicated by the storage type (TStorageType). The storage type is also owned by the field. Note that numeric field data is not supported. All numbers, for instance telephone or fax numbers are stored as text.

Fields also have a content type, attributes and a label. The label is a string which identifies the field to a user e.g. First name, Last name.

The following attributes are supported:

These attributes can be set using member functions of this class, but they are normally set automatically by other functions, for instance when setting a speed dial field, CContactDatabase automatically sets the field's speed dial attribute.

Derivation

Members

Defined in CContactItemField:
AddFieldTypeL(), AgentStorage(), ContentType(), DateTimeStorage(), DoSynchronize(), HasExtraStream(), Id(), IsCustomFilterable(), IsDeleted(), IsDisabled(), IsHidden(), IsPrivate(), IsReadOnly(), IsSpeedDial(), IsTemplate(), IsTemplateLabelField(), IsValidLabel(), Label(), LabelUnspecified(), NewL(), NewL(), NewL(), NewL(), NewLC(), NewLC(), NewLC(), NewLC(), NewLC(), OverRidesLabel(), RemoveFieldType(), ResetStore(), RestoreHeaderL(), SetDisabled(), SetHidden(), SetHintType(), SetId(), SetLabel(), SetLabelL(), SetMapping(), SetPrivate(), SetReadOnly(), SetSpeedDial(), SetSynchronize(), SetTemplateField(), SetUserAddedField(), SetUserFlags(), Storage(), StorageType(), StoreStorage(), TextStorage(), UserAddedField(), UserFlags(), UsesTemplateTypes(), ~CContactItemField()

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


Construction and destruction


NewLC()

static IMPORT_C CContactItemField *NewLC();

Description

Allocates and constructs a new default contact item field.

The field's storage type, content type and label are unspecified. The ESynchronize attribute is set.

Return value

CContactItemField *

Pointer to the newly created contact item field.


NewL()

static IMPORT_C CContactItemField *NewL(TStorageType aType);

Description

Allocates and constructs a contact item field with a storage type.

The field's label and content type are unspecified.

Parameters

TStorageType aType

The field's storage type.

Return value

CContactItemField *

Pointer to the newly created contact item field.


NewLC()

static IMPORT_C CContactItemField *NewLC(TStorageType aType);

Description

Allocates and constructs a contact item field with a storage type.

The field's label and content type are unspecified.

Parameters

TStorageType aType

The field's storage type.

Return value

CContactItemField *

Pointer to the newly created contact item field. This is left on the cleanup stack.


NewL()

static IMPORT_C CContactItemField *NewL(TStorageType aType, TFieldType aFieldType);

Description

Allocates and constructs a contact item field with a storage type and a field type.

The field's content type is initialised with the field type, and its vCard mapping is set by default to KNullUid. The field's label is unspecified.

Parameters

TStorageType aType

The field's storage type.

TFieldType aFieldType

The field type as defined in cntdef.h.

Return value

CContactItemField *

Pointer to the newly created contact item field.


NewLC()

static IMPORT_C CContactItemField *NewLC(TStorageType aType, TFieldType aFieldType);

Description

Allocates and constructs a contact item field with a storage type and a field type.

The field's content type is initialised with the field type, and its vCard mapping is set by default to KNullUid. The field's label is unspecified.

Parameters

TStorageType aType

The field's storage type.

TFieldType aFieldType

The field type as defined in cntdef.h.

Return value

CContactItemField *

Pointer to the newly created contact item field. This is left on the cleanup stack.


NewL()

static IMPORT_C CContactItemField *NewL(const CContactItemField &aField);

Description

Allocates and constructs a contact item field based on another one.

All details (content type, storage type, attributes and label) are copied from the specified field.

Parameters

const CContactItemField &aField

The contact field to copy.

Return value

CContactItemField *

Pointer to the newly created contact item field.


NewLC()

static IMPORT_C CContactItemField *NewLC(const CContactItemField &aField);

Description

Allocates and constructs a contact item field based on another one.

All details (content type, storage type, attributes and label) are copied from the specified field.

Parameters

const CContactItemField &aField

The contact field to copy.

Return value

CContactItemField *

Pointer to the newly created contact item field. This is left on the cleanup stack.


NewL()

static IMPORT_C CContactItemField *NewL(TStorageType aType, const CContentType &aContentType);

Description

Allocates and constructs a contact item field with a content type and a storage type.

The field's label is unspecified.

Parameters

TStorageType aType

The field's storage type.

const CContentType &aContentType

The field's content type.

Return value

CContactItemField *

Pointer to the newly created contact item field.


NewLC()

static IMPORT_C CContactItemField *NewLC(TStorageType aType, const CContentType &aContentType);

Description

Allocates and constructs a contact item field with a content type and a storage type.

The field's label is unspecified.

Parameters

TStorageType aType

The field's storage type.

const CContentType &aContentType

The field's content type.

Return value

CContactItemField *

Pointer to the newly created contact item field. This is left on the cleanup stack.


~CContactItemField()

IMPORT_C ~CContactItemField();

Description

Frees all resources owned by the field (the label, the stored data and the content type), prior to its destruction.

[Top]


Member functions


StorageType()

IMPORT_C TStorageType StorageType() const;

Description

Gets the field's storage type.

Return value

TStorageType

The field's storage type.


ContentType()

IMPORT_C const CContentType &ContentType() const;

Description

Gets the field's content type.

Return value

const CContentType &

Reference to the field's content type.


IsHidden()

inline TBool IsHidden() const;

Description

Gets the value of the field's hidden attribute.

Return value

TBool

ETrue if hidden attribute is set, EFalse if not set.


IsReadOnly()

inline TBool IsReadOnly() const;

Description

Gets the value of the field's read only attribute.

Return value

TBool

ETrue if read only attribute set, EFalse if not set.


IsDisabled()

inline TBool IsDisabled() const;

Description

Gets the value of the field's disabled attribute.

Return value

TBool

ETrue if disabled attribute set, EFalse if not set.


IsTemplate()

inline TBool IsTemplate() const;

Description

Tests whether the field is in a template, as set by SetTemplateField().

Return value

TBool

ETrue if field is a template field. EFalse if not.


IsPrivate()

inline TBool IsPrivate() const;

Description

Tests whether the field's private attribute is set.

Return value

TBool

True if the field's private attribute is set, false if not.


IsSpeedDial()

inline TBool IsSpeedDial() const;

Description

Tests whether the field is a speed dial field.

Return value

TBool

True if the field is a speed dial field, false if not.


DoSynchronize()

inline TBool DoSynchronize() const;

Description

Gets the value of the field's synchronise attribute.

Return value

TBool

ETrue if synchronise attribute is set, EFalse if not set.


OverRidesLabel()

inline TBool OverRidesLabel() const;

Description

Tests whether the field's label (as set by SetLabel()) overrides the label specified in the field's template.

Return value

TBool

True if the field's label overrides the label specified in the template; false if not.


HasExtraStream()

inline TBool HasExtraStream() const;

Description

Tests whether the field needs an extra stream to store information not contained in the template. This is the case if the field's content type is not based on a template, or if the field has a label which overrides the label specified in the template.

Return value

TBool

True if the field uses an extra stream; false if not.


UsesTemplateTypes()

inline TBool UsesTemplateTypes() const;

Description

Tests whether or not the field's content type is based on a template.

Return value

TBool

True if the field's content type is based on a template; false if not.


LabelUnspecified()

inline TBool LabelUnspecified() const;

Description

Tests whether the field's label has been set, either by a call to SetLabel() or by inheriting a label specified in the template.

Return value

TBool

True if the field's label has been set, false if not.


UserAddedField()

inline TBool UserAddedField() const;

Description

Gets the value of the user added field attribute.

Return value

TBool

ETrue if the user added attribute is set, EFalse if not.


IsCustomFilterable()

inline TBool IsCustomFilterable() const;

Description

Tests the value of the user defined filter attribute.

Return value

TBool

ETrue if the user defined filter attribute is set, EFalse if not.


SetHintType()

IMPORT_C void SetHintType(TInt aType);

Description

Parameters

TInt aType


Label()

IMPORT_C TPtrC Label() const;

Description

Gets the field's label.

Return value

TPtrC

The field label. If no label has been set, its length is zero.


ResetStore()

IMPORT_C void ResetStore();

Description

Resets the field storage. The field's store is deleted, then re-allocated.


Storage()

IMPORT_C CContactFieldStorage *Storage() const;

Description

Gets a pointer to the field's base storage.

Rather than using this function and then casting to a specific storage class, one of the following functions should normally be used: TextStorage(), StoreStorage(), AgentStorage(), or DateTimeStorage().

Return value

CContactFieldStorage *

The field's base storage type.


TextStorage()

IMPORT_C CContactTextField *TextStorage() const;

Description

Gets a pointer to the field's storage as a CContactTextField.

If the field's storage type is not KStorageTypeText, this function raises a panic.

Return value

CContactTextField *

The field's storage as a CContactTextField*.


StoreStorage()

IMPORT_C CContactStoreField *StoreStorage() const;

Description

Gets a pointer to the field's storage as a CContactStoreField.

This indicates the field data is stored in a descriptor or descriptor array. If the field storage type is not KStorageTypeStore, this function raises a panic.

Return value

CContactStoreField *

Field's storage as a CContactStoreField*.


AgentStorage()

IMPORT_C CContactAgentField *AgentStorage() const;

Description

Gets a pointer to the field's storage as a CContactAgentField.

An agent is a property in a vCard which contains another person's contact details. If the field storage type is not KStorageTypeContactItemId, this function raises a panic.

Return value

CContactAgentField *

Field's storage as a CContactAgentField*.


DateTimeStorage()

IMPORT_C CContactDateField *DateTimeStorage() const;

Description

Returns a pointer to the field's storage as a CContactDateField.

If the field storage type is not KStorageTypeDateTime, this function raises a panic.

Return value

CContactDateField *

Field's storage as a CContactDateField*.


AddFieldTypeL()

IMPORT_C void AddFieldTypeL(TFieldType aFieldType);

Description

Appends a field type to the field's content type.

Note that certain combinations of field types are not valid and should not be used.

Parameters

TFieldType aFieldType

The field type to append to the field's content type.


RemoveFieldType()

IMPORT_C void RemoveFieldType(TFieldType aFieldType);

Description

Removes a field type from the field's content type.

Parameters

TFieldType aFieldType

The field type to remove from the field's content type.


SetMapping()

IMPORT_C void SetMapping(TUid aMapping);

Description

Sets the vCard mapping for the field's content type.

Parameters

TUid aMapping

The new mapping for the field's content type.


SetHidden()

IMPORT_C void SetHidden(TBool aHidden);

Description

Sets the value of the hidden attribute.

If hidden fields are included in the view definition, the field is displayed like other fields. If the view definition masks hidden fields, it is not displayed. See the TMode enumeration defined in class CContactItemViewDef.

Parameters

TBool aHidden

ETrue for hidden, EFalse for displayed.


SetReadOnly()

IMPORT_C void SetReadOnly(TBool aReadOnly);

Description

Sets the value of the field's read only attribute.

Parameters

TBool aReadOnly

ETrue to set the field's read only attribute, EFalse to unset the attribute.


SetSynchronize()

IMPORT_C void SetSynchronize(TBool aSynchronize);

Description

Sets the value of the field's synchronise attribute.

Parameters

TBool aSynchronize

ETrue to set synchronise attribute, EFalse to unset it.


SetDisabled()

IMPORT_C void SetDisabled(TBool aDisabled);

Description

Sets the value of the disabled attribute.

Parameters

TBool aDisabled

ETrue to set the disabled attribute, EFalse to unset the attribute.


SetLabelL()

IMPORT_C void SetLabelL(const TDesC &aLabel);

Description

Sets the field label.

The label is allocated using TDesC::AllocL(), so the function can leave. Any existing label is replaced.

Parameters

const TDesC &aLabel

The new field label.


SetLabel()

IMPORT_C void SetLabel(HBufC *aLabel);

Description

Sets the field label.

The field takes ownership of aLabel so the function cannot leave.

Parameters

HBufC *aLabel

The new field label.


SetUserAddedField()

IMPORT_C void SetUserAddedField(TBool aUserAddedField);

Description

Sets the user added field attribute.

Parameters

TBool aUserAddedField

ETrue to set the field's user added attribute, EFalse to unset it.


SetTemplateField()

IMPORT_C void SetTemplateField(TBool aTemplateField);

Description

Sets whether the field is a template field.

Parameters

TBool aTemplateField

ETrue to set the field's Is template attribute. EFalse to unset it.


SetPrivate()

IMPORT_C void SetPrivate(TBool aTemplateField);

Description

Sets the value of the field's private attribute.

This is used by the contact database when exporting a contact item as a vCard, to identify fields which should not be exported.

Parameters

TBool aTemplateField

ETrue to set the field's private attribute, EFalse to unset it.


SetSpeedDial()

IMPORT_C void SetSpeedDial(TBool aSpeedDialField);

Description

Sets the value of the field's speed dial attribute.

Parameters

TBool aSpeedDialField

ETrue if the field should be a speed dial field, EFalse if not.


SetId()

IMPORT_C void SetId(TInt aId);

Description

Sets the ID which uniquely identifies a field within a field set..

Note that the field ID value is initialised when the field is added to the field set (using CContactItemFieldSet::AddL()). It is equivalent to the field's index within the field set array, and should not normally be changed.

Parameters

TInt aId

The new field ID.


Id()

IMPORT_C TInt Id() const;

Description

Gets the field ID.

Return value

TInt

The field ID.


UserFlags()

IMPORT_C TUint UserFlags() const;

Description

Gets the value of the user flags, as set by SetUserFlags().

Return value

TUint

The user flags value.


SetUserFlags()

IMPORT_C void SetUserFlags(TUint aFlags);

Description

Sets the value of the user flags.

Parameters

TUint aFlags

The user flags value.


IsValidLabel()

static IMPORT_C TBool IsValidLabel(const TDesC &aLabel, TInt &aInvalidPos);

Description

Tests whether a field label is valid.

Note: the label is invalid if it contains any of the following characters:

[] (left or right square bracket)

= (equals sign)

. (dot)

: (colon)

, (comma)

Parameters

const TDesC &aLabel

The field label to test.

TInt &aInvalidPos

On return, contains the character position within the label of the first invalid character. The first character position is zero.

Return value

TBool

ETrue if valid, EFalse if invalid.


IsTemplateLabelField()

IMPORT_C TBool IsTemplateLabelField() const;

Description

Tests whether the field is a template label field (a field which holds the label for a contact card template: see class CContactCardTemplate).

Return value

TBool

ETrue if the field is a template label field, EFalse if not.


RestoreHeaderL()

IMPORT_C void RestoreHeaderL(RReadStream &aStream, const CContactItemFieldSet *aSystemTemplateFields);

Description

Parameters

RReadStream &aStream

const CContactItemFieldSet *aSystemTemplateFields


IsDeleted()

inline TBool IsDeleted() const;

Description

Gets the value of the field's deleted attribute.

Return value

TBool

ETrue if the field is deleted, otherwise EFalse.