#include <app/cntfield.h>
class CContactItemField : public CBase |
Protected Member Functions | |
---|---|
void | UsesTemplateData(TInt) |
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:
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.
speed dial: the field contains a telephone number which maps to one of the nine possible speed dial positions.
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.
IMPORT_C | ~CContactItemField | ( | ) |
Frees all resources owned by the field (the label, the stored data and the content type), prior to its destruction.
IMPORT_C void | AddFieldTypeL | ( | TFieldType | aFieldType | ) |
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.
Parameter | Description |
---|---|
aFieldType | The field type to append to the field's content type. |
IMPORT_C 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.
Returns: Field's storage as a CContactAgentField*.
IMPORT_C const CContentType & | ContentType | ( | ) | const |
Gets the field's content type.
Returns: Reference to the field's content type.
IMPORT_C 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.
Returns: Field's storage as a CContactDateField*.
TBool | DoSynchronize | ( | ) | const [inline] |
Gets the value of the field's synchronise attribute.
Returns: ETrue if synchronise attribute is set, EFalse if not set.
void | ExternalizeL | ( | RWriteStream & | aStream | ) | const |
Externalises a CContactItemField object to a write stream.
Parameter | Description |
---|---|
aStream | Stream to which the object should be externalised. |
IMPORT_C TBool | HasCustomFilter | ( | EContactFieldFlags & | contactFieldFlag | ) | const |
Determine if a custom filter exists. If it does, return the filter type.
Parameter | Description |
---|---|
contactFieldFlag | The custom filter type if one exists. |
Returns: ETrue if custom filter exists.
TBool | HasExtraStream | ( | ) | const [inline] |
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.
Returns: True if the field uses an extra stream; false if not.
void | InternalizeL | ( | RReadStream & | aStream | ) |
Internalises a CContactItemField object from a read stream.
Parameter | Description |
---|---|
aStream | Stream from which the object should be internalised. |
TBool | IsCustomFilterable | ( | ) | const [inline] |
Tests the value of the user defined filter attribute.
Returns: ETrue if the user defined filter attribute is set, EFalse if not.
TBool | IsDeleted | ( | ) | const [inline] |
Gets the value of the field's deleted attribute.
Returns: ETrue if the field is deleted, otherwise EFalse.
TBool | IsDisabled | ( | ) | const [inline] |
Gets the value of the field's disabled attribute.
Returns: ETrue if disabled attribute set, EFalse if not set.
TBool | IsHidden | ( | ) | const [inline] |
Gets the value of the field's hidden attribute.
Returns: ETrue if hidden attribute is set, EFalse if not set.
TBool | IsPrivate | ( | ) | const [inline] |
Tests whether the field's private attribute is set.
Returns: True if the field's private attribute is set, false if not.
TBool | IsReadOnly | ( | ) | const [inline] |
Gets the value of the field's read only attribute.
Returns: ETrue if read only attribute set, EFalse if not set.
TBool | IsSpeedDial | ( | ) | const [inline] |
Tests whether the field is a speed dial field.
Returns: True if the field is a speed dial field, false if not.
TBool | IsTemplate | ( | ) | const [inline] |
Tests whether the field is in a template, as set by SetTemplateField().
Returns: ETrue if field is a template field. EFalse if not.
IMPORT_C TBool | IsTemplateLabelField | ( | ) | const |
Tests whether the field is a template label field (a field which holds the label for a contact card template: see class CContactCardTemplate).
Returns: ETrue if the field is a template label field, EFalse if not.
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)
Parameter | Description |
---|---|
aLabel | The field label to test. |
aInvalidPos | On return, contains the character position within the label of the first invalid character. The first character position is zero. |
Returns: ETrue if valid, EFalse if invalid.
IMPORT_C TPtrC | Label | ( | ) | const |
Gets the field's label.
Returns: The field label. If no label has been set, its length is zero.
TBool | LabelUnspecified | ( | ) | const [inline] |
Tests whether the field's label has been set, either by a call to SetLabel() or by inheriting a label specified in the template.
Returns: True if the field's label has been set, false if not.
IMPORT_C CContactItemField * | NewL | ( | TStorageType | aType | ) | [static] |
Allocates and constructs a contact item field with a storage type.
The field's label and content type are unspecified.
Parameter | Description |
---|---|
aType | The field's storage type. |
Returns: Pointer to the newly created contact item field.
IMPORT_C CContactItemField * | NewL | ( | TStorageType | aType, |
TFieldType | aFieldType | |||
) | [static] |
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.
Parameter | Description |
---|---|
aType | The field's storage type. |
aFieldType | The field type as defined in cntdef.h. |
Returns: Pointer to the newly created contact item field.
IMPORT_C CContactItemField * | NewL | ( | const CContactItemField & | aField | ) | [static] |
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.
Parameter | Description |
---|---|
aField | The contact field to copy. |
Returns: Pointer to the newly created contact item field.
IMPORT_C CContactItemField * | NewL | ( | TStorageType | aType, |
const CContentType & | aContentType | |||
) | [static] |
Allocates and constructs a contact item field with a content type and a storage type.
The field's label is unspecified.
Parameter | Description |
---|---|
aType | The field's storage type. |
aContentType | The field's content type. |
Returns: Pointer to the newly created contact item field.
IMPORT_C CContactItemField * | NewLC | ( | ) | [static] |
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.
Returns: Pointer to the newly created contact item field.
IMPORT_C CContactItemField * | NewLC | ( | TStorageType | aType | ) | [static] |
Allocates and constructs a contact item field with a storage type.
The field's label and content type are unspecified.
Parameter | Description |
---|---|
aType | The field's storage type. |
Returns: Pointer to the newly created contact item field. This is left on the cleanup stack.
IMPORT_C CContactItemField * | NewLC | ( | TStorageType | aType, |
TFieldType | aFieldType | |||
) | [static] |
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.
Parameter | Description |
---|---|
aType | The field's storage type. |
aFieldType | The field type as defined in cntdef.h. |
Returns: Pointer to the newly created contact item field. This is left on the cleanup stack.
IMPORT_C CContactItemField * | NewLC | ( | const CContactItemField & | aField | ) | [static] |
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.
Parameter | Description |
---|---|
aField | The contact field to copy. |
Returns: Pointer to the newly created contact item field. This is left on the cleanup stack.
IMPORT_C CContactItemField * | NewLC | ( | TStorageType | aType, |
const CContentType & | aContentType | |||
) | [static] |
Allocates and constructs a contact item field with a content type and a storage type.
The field's label is unspecified.
Parameter | Description |
---|---|
aType | The field's storage type. |
aContentType | The field's content type. |
Returns: Pointer to the newly created contact item field. This is left on the cleanup stack.
TBool | OverRidesLabel | ( | ) | const [inline] |
Tests whether the field's label (as set by SetLabel()) overrides the label specified in the field's template.
Returns: True if the field's label overrides the label specified in the template; false if not.
void | PopulateStoreL | ( | RStoreWriteStream & | aRootStream, |
TInt | aCount, | |||
CArrayFix< TFieldHeader > & | aFieldHeaderArray | |||
) | const |
Part of the system template update implementation. This could be used for a generic update method at a later stage.
void | PrepareFieldAsTemplateL | ( | CContactItemFieldSet & | aSystemTemplateFieldSet | ) |
IMPORT_C void | RemoveFieldType | ( | TFieldType | aFieldType | ) |
Removes a field type from the field's content type.
Parameter | Description |
---|---|
aFieldType | The field type to remove from the field's content type. |
IMPORT_C void | ResetStore | ( | ) |
Resets the field storage. The field's store is deleted, then re-allocated.
IMPORT_C TStreamId | RestoreFieldTypesL | ( | RReadStream & | aRootStream, |
const CContactItemFieldSet * | aSystemTemplateFields | |||
) |
Decode given blob header stream into contact field relevent data.
Parameter | Description |
---|---|
aRootStream | reference to the blob header stream to be decoded. |
aSystemTemplateFields | cached template fields. |
Returns: the stream id of content data stored in data store
IMPORT_C void | RestoreHeaderL | ( | RReadStream & | aStream, |
const CContactItemFieldSet * | aSystemTemplateFields | |||
) |
IMPORT_C TBool | RestoreIfMatchL | ( | RReadStream & | aStream, |
const CContactItemFieldDef * | aFieldDef, | |||
const CContactItemFieldSet * | aSystemTemplateFields, | |||
HBufC * | aTextStream, | |||
TInt | aTextIndex | |||
) |
TBool | RestoreIfMatchL | ( | RReadStream & | aStream, |
TFieldType | aFieldType, | |||
const CContactItemFieldSet * | aSystemTemplateFields, | |||
HBufC * | aTextStream, | |||
TInt | aTextIndex | |||
) |
IMPORT_C void | SetCustomFilterable | ( | EContactFieldFlags | aContactFilterType | ) |
IMPORT_C void | SetDisabled | ( | TBool | aDisabled | ) |
Sets the value of the disabled attribute.
Parameter | Description |
---|---|
aDisabled | ETrue to set the disabled attribute, EFalse to unset the attribute. |
IMPORT_C void | SetHidden | ( | TBool | aHidden | ) |
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.
Parameter | Description |
---|---|
aHidden | ETrue for hidden, EFalse for displayed. |
IMPORT_C 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 should not normally be changed.
Parameter | Description |
---|---|
aId | The new field ID. |
IMPORT_C void | SetLabel | ( | HBufC * | aLabel | ) |
Sets the field label.
The field takes ownership of aLabel so the function cannot leave.
Parameter | Description |
---|---|
aLabel | The new field label. |
IMPORT_C void | SetLabelL | ( | const TDesC & | aLabel | ) |
Sets the field label.
The label is allocated using TDesC::AllocL(), so the function can leave. Any existing label is replaced.
Parameter | Description |
---|---|
aLabel | The new field label. |
IMPORT_C void | SetMapping | ( | TUid | aMapping | ) |
Sets the vCard mapping for the field's content type.
Parameter | Description |
---|---|
aMapping | The new mapping for the field's content type. |
IMPORT_C void | SetPrivate | ( | TBool | aTemplateField | ) |
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.
Parameter | Description |
---|---|
aTemplateField | ETrue to set the field's private attribute, EFalse to unset it. |
IMPORT_C void | SetReadOnly | ( | TBool | aReadOnly | ) |
Sets the value of the field's read only attribute.
Parameter | Description |
---|---|
aReadOnly | ETrue to set the field's read only attribute, EFalse to unset the attribute. |
IMPORT_C void | SetSpeedDial | ( | TBool | aSpeedDialField | ) |
Sets the value of the field's speed dial attribute.
Parameter | Description |
---|---|
aSpeedDialField | ETrue if the field should be a speed dial field, EFalse if not. |
IMPORT_C void | SetSynchronize | ( | TBool | aSynchronize | ) |
Sets the value of the field's synchronise attribute.
Parameter | Description |
---|---|
aSynchronize | ETrue to set synchronise attribute, EFalse to unset it. |
IMPORT_C void | SetTemplateField | ( | TBool | aTemplateField | ) |
Sets whether the field is a template field.
Parameter | Description |
---|---|
aTemplateField | ETrue to set the field's Is template attribute. EFalse to unset it. |
IMPORT_C void | SetUserAddedField | ( | TBool | aUserAddedField | ) |
Sets the user added field attribute.
Parameter | Description |
---|---|
aUserAddedField | ETrue to set the field's user added attribute, EFalse to unset it. |
IMPORT_C void | SetUserFlags | ( | TUint | aFlags | ) |
Sets the value of the user flags.
Parameter | Description |
---|---|
aFlags | The user flags value. |
IMPORT_C 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 normally be used: TextStorage(), StoreStorage(), AgentStorage(), or DateTimeStorage().
Returns: The field's base storage type.
IMPORT_C TStorageType | StorageType | ( | ) | const |
Gets the field's storage type.
Returns: The field's storage type.
IMPORT_C CContactStoreField * | StoreStorage | ( | ) | const |
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.
Returns: Field's storage as a CContactStoreField*.
IMPORT_C CContactTextField * | TextStorage | ( | ) | const |
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.
Returns: The field's storage as a CContactTextField*.
void | UpdateFieldFlags | ( | const CContactItemFieldSet & | aTemplateFieldSet | ) |
TBool | UserAddedField | ( | ) | const [inline] |
Gets the value of the user added field attribute.
Returns: ETrue if the user added attribute is set, EFalse if not.
IMPORT_C TUint | UserFlags | ( | ) | const |
Gets the value of the user flags, as set by SetUserFlags().
Returns: The user flags value.
TBool | UsesTemplateTypes | ( | ) | const [inline] |
Tests whether or not the field's content type is based on a template.
Returns: True if the field's content type is based on a template; false if not.