EPOC   SDK Home Glossary Indexes Previous Next Up

CContactItemField class


Contents


CContactItemField class — Contact item field

Section Contents


Overview

Compatibility

Applications that use this class will not work correctly on a version of EPOC earlier than ER5.

Derivation

CBase

Abstract: CBase behaviour.

Defined in

cntfield.h

Link against

cntmodel.lib

Description

A single field in a contact item. Fields are owned by the contact item and are stored in a field set (class CContactItemFieldSet).

A contact item field has a storage type (TStorageType) which indicates what kind of field it is. The storage type can have one of the following values, defined in cntdef.hrh: —

Fields also have a content type, attributes and a label.

The following attributes are supported:


Allocation and construction


NewL() — Allocate and construct with a TStorageType

static CContactItemField* NewL(TStorageType aType);

static CContactItemField* NewLC(TStorageType aType);

Description

Creates a new CContactItemField with the storage type specified.

The field's label and content type are left unspecified.

If the new contact item field is successfully constructed, NewLC() leaves it on the cleanup stack.

Arguments

TStorageType aType

The field's storage type.

Return value

CContactItemField*

Pointer to the newly created contact item field.

Leave considerations

If the aType parameter has an invalid value, the function leaves with KErrNotSupported.


NewL() — Allocate and construct with a TStorageType and a TFieldType

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

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

Description

Creates a new CContactItemField with the storage type specified. The field's content type is initialised with the specified field type, and its vCard mapping is set by default to KNullUid.

The field's label is left unspecified.

If the new contact item field is successfully constructed, NewLC() leaves it on the cleanup stack.

Arguments

TStorageType aType

The field's storage type.

TFieldType aFieldType

The field type. Field types are defined in cntdef.h.

Return value

CContactItemField*

Pointer to the newly created contact item field.


NewL() — Allocate and construct with a CContactItemField

static CContactItemField* NewL(const CContactItemField& aField);

static CContactItemField* NewLC(const CContactItemField& aField);

Description

Creates a new CContactItemField copying all details (content type, storage type, attributes and label) from the specified field.

If the new contact item field is successfully constructed, NewLC() leaves it on the cleanup stack.

Arguments

const CContactItemField& aField

The contact field to copy.

Return value

CContactItemField*

Pointer to the newly created contact item field.


NewL() — Allocate and construct with a TStorageType and a CContentType

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

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

Description

Creates a new CContactItemField with the specified content type and storage type.

The field's label is left unspecified.

If the new contact item field is successfully constructed, NewLC() leaves it on the cleanup stack.

Arguments

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.


Field storage


StorageType() — Get the field storage type

TStorageType StorageType() const;

Description

Retrieves the field's storage type.

Return value

TStorageType

The field's storage type.


Storage() — Get field's base storage

CContactFieldStorage* Storage() const;

Description

Retrieves 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 almost always be used: — TextStorage(), StoreStorage(), AgentStorage(), or DateTimeStorage().

Return value

CContactFieldStorage*

The field's base storage type.


TextStorage() — Get text field's storage

CContactTextField* TextStorage() const;

Description

Returns a pointer to the field's storage as a CContactTextField*. If the field storage type is not KStorageTypeText, this function raises a panic.

Return value

CContactTextField*

Field's storage as a CContactTextField*.


StoreStorage() — Get generic field's storage

CContactStoreField* StoreStorage() const;

Description

Returns a pointer to the field's storage as a CContactStoreField*. This indicates generic field data. If the field storage type is not KStorageTypeStore, this function raises a panic.

Return value

CContactStoreField*

Field's storage as a CContactStoreField*.


AgentStorage() — Get agent field's storage

CContactAgentField* AgentStorage() const;

Description

Returns a pointer to the field's storage as a CContactAgentField*. An agent is a property in a vCard. If the field storage type is not KStorageTypeContactItemId, this function raises a panic.

Return value

CContactAgentField*

Field's storage as a CContactAgentField*.


DateTimeStorage() — Get date time field's storage

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


Field type and mapping


ContentType() — Get the field's content type

const CContentType& ContentType() const;

Description

Returns the field's content type.

Return value

CContentType&

Reference to the field's content type.


AddFieldTypeL() — Add a field type

void AddFieldTypeL(TFieldType aFieldType);

Description

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

Arguments

TFieldType aFieldType

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


RemoveFieldType() — Remove a field type

void RemoveFieldType(TFieldType aFieldType);

Description

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

Arguments

TFieldType aFieldType

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


SetMapping() — Set mapping

void SetMapping(TUid aMapping);

Description

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

Arguments

TUid aMapping

The new mapping for the field's content type.


Attributes


SetHidden() — Set hidden attribute

void SetHidden(TBool aHidden);

Description

Set the status of the hidden attribute.

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

Arguments

TBool aHidden

ETrue for hidden, EFalse for displayed.


IsHidden() — Is hidden ?

TBool IsHidden() const;

Description

Returns the field's hidden attribute.

Return value

TBool

ETrue if hidden attribute set, EFalse if not set.


SetReadOnly() — Set read only attribute

void SetReadOnly(TBool aReadOnly);

Description

Set the status of the field's read only attribute.

Arguments

TBool aReadOnly

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


IsReadOnly() — Is read only ?

TBool IsReadOnly() const;

Description

Returns the field's read only attribute.

Return value

TBool

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


SetSynchronize() — Set synchronize attribute

void SetSynchronize(TBool aSynchronize);

Description

Set the status of the field's synchronize attribute.

Arguments

TBool aSynchronize

ETrue to set synchronize attribute, EFalse to unset it.


DoSynchronize() — Get synchronize attribute

TBool DoSynchronize() const;

Description

Retrieves the status of the field's synchronize attribute.

Return value

TBool

ETrue if synchronize attribute set, EFalse if not set.


SetDisabled() — Set disabled attribute

void SetDisabled(TBool aDisabled);

Description

Set the status of the disabled attribute.

Arguments

TBool aDisabled

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


IsDisabled() — Is disabled ?

TBool IsDisabled() const;

Description

Retrieves the field's disabled attribute.

Return value

TBool

ETrue if disabled attribute set, EFalse if disabled attribute not set.


SetUserAddedField() — Set user added attribute

void SetUserAddedField(TBool aUserAddedField);

Description

Sets the user added field attribute.

Arguments

TBool aUserAddedField

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


UserAddedField() — Get user added attribute

TBool UserAddedField() const;

Description

Retrieves the value of the user added field attribute.

Return value

TBool

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


Field label


SetLabelL() — Allocate and set the label

void SetLabelL(const TDesC& aLabel);

Description

Sets the field label. This function allocates the label (using TDesC::AllocL()) and can leave. Any existing label is first deleted.

Arguments

const TDesC& aLabel

The new field label.


SetLabel() — Set the label

void SetLabel(HBufC* aLabel);

Description

Sets the field label. The CContactItemField takes ownership of aLabel and this function cannot leave.

Arguments

HBufC* aLabel

The new field label.


Label() — Get the label

TPtrC Label() const;

Description

Returns the field label.

Return value

TPtrC

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


IsValidLabel() — Is valid ?

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

Description

Tests whether a field label is valid.

Arguments

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.

Notes

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


User flags


UserFlags() — Get user flags value

TUint UserFlags() const;

Description

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

Return value

TUint

The user flags value.


SetUserFlags() — Set user flags value

void SetUserFlags(TUint aFlags);

Description

Sets the value of the user flags.

Arguments

TUint aFlags

The user flags value.

EPOC       SDK Home Glossary Indexes Previous Next Up