Location:
cntfield.h
Link against: cntmodel.lib
CContactItemField
Supported from 5.0
A field in a contact item. Fields are stored in a field set
(CContactItemFieldSet
) and the field set 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 in text fields in the contact database.
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:
hidden — the field is not displayed if the view definition masks hidden fields
disabled — the field cannot be deleted from the original template and thus is marked as disabled
read only — the field cannot be written to
synchronise — used by Connectivity applications; set by default for all contact item fields
user added — the field was added by the user and was not taken from the template
template — indicates that the field is part of a template. Template fields differ from other fields in that they are persisted when they do not contain any data. This attribute was not present in EPOC Release 5.
speed dial — the field contains a telephone number which maps to one of the nine possible speed dial positions. This attribute was not present in EPOC Releases 5 or 5.1.
These attributes can be set using member functions of this class,
but they are normally set by higher level classes, e.g. when setting a speed
dial field, CContactDatabase
automatically sets the field's speed
dial attribute.
|
Defined in CContactItemField
:
AddFieldTypeL()
, AgentStorage()
, ContentType()
, DateTimeStorage()
, DoSynchronize()
, HasExtraStream()
, Id()
, IsDisabled()
, IsHidden()
, IsPrivate()
, IsReadOnly()
, IsSpeedDial()
, IsTemplate()
, IsTemplateLabelField()
, IsValidLabel()
, Label()
, LabelUnspecified()
, NewL()
, NewLC()
, NumberStorage()
, OverRidesLabel()
, RemoveFieldType()
, ResetStore()
, SetDisabled()
, SetHidden()
, SetId()
, SetLabel()
, SetLabelL()
, SetMapping()
, SetPrivate()
, SetReadOnly()
, SetSpeedDial()
, SetSynchronize()
, SetTemplateField()
, SetUserAddedField()
, SetUserFlags()
, Storage()
, StorageType()
, StoreStorage()
, TextStorage()
, UserAddedField()
, UserFlags()
, UsesTemplateTypes()
, ~CContactItemField()
Inherited from CBase
:
operator new()
static CContactItemField* NewL(TStorageType aType);
static CContactItemField* NewL(TStorageType aType, TFieldType aFieldType);
static CContactItemField* NewL(const CContactItemField& aField);
static CContactItemField* NewL(TStorageType aType, const CContentType& aContentType);
Allocates and constructs a contact item field — overloaded function. The field may be constructed with:
a storage type. In this case, the field's label and content type are unspecified.
a storage type and a field type. In this case, 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.
another CContactItemField
. In this case, all
details (content type, storage type, attributes and label) are copied from the
specified field.
a content type and a storage type. The field's label is unspecified.
|
|
|
static CContactItemField* NewLC();
static CContactItemField* NewLC(TStorageType aType);
static CContactItemField* NewLC(TStorageType aType, TFieldType aFieldType);
static CContactItemField* NewLC(const CContactItemField& aField);
static CContactItemField* NewLC(TStorageType aType, const CContentType& aContentType);
Allocates and constructs a contact item field, leaving the pointer to it on the cleanup stack — overloaded function. The field may be constructed with:
no parameters. The field's storage type, content type and
label are unspecified. The ESynchronize
attribute is set.
a storage type. In this case, the field's label and content type are unspecified.
a storage type and a field type. In this case, 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.
another CContactItemField
. In this case, all
details (content type, storage type, attributes and label) are copied from the
specified field.
a content type and a storage type. The field's label is unspecified.
|
|
|
~CContactItemField();
The destructor frees all resources owned by the field (the label, the stored data and the content type), prior to its destruction.
TStorageType StorageType() const;
Gets the field's storage type.
|
CContactFieldStorage* Storage() const;
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 almost always be used: —
TextStorage()
, StoreStorage()
,
AgentStorage()
, or
DateTimeStorage()
.
|
void ResetStore();
Supported from 6.0
Resets the field storage. The field's store is deleted, then re-allocated.
CContactTextField* TextStorage() const;
Gets a pointer to the field's storage as a
CContactTextField*
. If the field storage type is not
KStorageTypeText
, this function raises a
panic.
|
CContactStoreField* StoreStorage() const;
Gets a pointer to the field's storage as a
CContactStoreField*
. This indicates field data stored in a
descriptor or descriptor array. If the field storage type is not
KStorageTypeStore
, this function raises a
panic.
|
CContactAgentField* AgentStorage() const;
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.
|
CContactDateField* DateTimeStorage() const;
Returns a pointer to the field's storage as a
CContactDateField*
. If the field storage type is not
KStorageTypeDateTime
, this function raises a
panic.
|
CContactNumberField* NumberStorage() const;
This function is currently unsupported. Calling it will raise
an ECntPanicInvalidStorageType
panic.
const CContentType& ContentType() const;
Gets the field's content type.
|
void AddFieldTypeL(TFieldType aFieldType);
Appends a field type to the field's content type.
|
void RemoveFieldType(TFieldType aFieldType);
Removes a field type from the field's content type.
|
void SetMapping(TUid aMapping);
Sets the vCard mapping for the field's content type.
|
void SetHidden(TBool aHidden);
Sets the status 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
.
|
TBool IsHidden() const;
Gets the field's hidden attribute.
|
void SetReadOnly(TBool aReadOnly);
Sets the status of the field's read only attribute.
|
TBool IsReadOnly() const;
Gets the field's read only attribute.
|
void SetSynchronize(TBool aSynchronize);
Sets the status of the field's synchronise attribute.
|
TBool DoSynchronize() const;
Gets the status of the field's synchronise attribute.
|
void SetDisabled(TBool aDisabled);
Sets the status of the disabled attribute.
|
TBool IsDisabled() const;
Tests the field's disabled attribute.
|
void SetUserAddedField(TBool aUserAddedField);
Sets the user added field attribute.
|
TBool UserAddedField() const;
Tests the value of the user added field attribute.
|
TBool IsTemplate() const;
Supported from 6.0
Tests whether the field is in a template, as set by
SetTemplateField()
.
|
void SetTemplateField(TBool aTemplateField);
Supported from 6.0
Sets whether the field is a template field.
|
TBool IsPrivate() const;
Supported from 6.0
Tests whether the field's private attribute is set.
|
void SetPrivate(TBool aTemplateField);
Supported from 6.0
Sets 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.
|
TBool IsSpeedDial() const;
Supported from 6.0
Tests whether the field is a speed dial field.
|
void SetSpeedDial(TBool aSpeedDialField);
Supported from 6.0
Sets the value of the field's speed dial attribute.
|
void SetLabelL(const TDesC& aLabel);
Sets the field label — can leave. The label is
allocated using TDesC::AllocL()
. Any existing label is
replaced.
|
void SetLabel(HBufC* aLabel);
Sets the field label — cannot leave. The
CContactItemField
takes ownership of
aLabel
.
|
TPtrC Label() const;
Gets the field label.
|
static TBool IsValidLabel(const TDesC& aLabel,TInt& aInvalidPos);
Tests whether a field label is valid.
Notes:
The label is invalid if it contains any of the following characters: —
[] (left or right square bracket)
= (equals sign)
. (dot)
: (colon)
, (comma)
|
|
TBool OverRidesLabel() const;
Tests whether the field's label (as set by
SetLabel()
) overrides the label specified in the field's
template.
|
TBool LabelUnspecified() const;
Tests whether the field's label has been set, either by a call
to SetLabel()
or by inheriting a label specified in the
template.
|
TBool UsesTemplateTypes() const;
Indicates whether or not the field's content type is based on a template.
|
TBool HasExtraStream() const;
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.
|
TBool IsTemplateLabelField() const;
Supported from 6.0
Tests whether the field is a template label field (i.e. a field
which holds the label for a contact card template: see class
CContactCardTemplate
).
|
void SetId(TInt aId);
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 it should not
normally be changed.
|
TInt Id() const;
Retrieves the field ID, as set by
SetId()
.
|
TUint UserFlags() const;
Gets the value of the user flags, as set by
SetUserFlags()
.
|
void SetUserFlags(TUint aFlags);
Sets the value of the user flags.
|