QtMobility Reference Documentation

QOrganizerItemDetail Class Reference

The QOrganizerItemDetail class represents a single, complete detail about an organizer item. More...

 #include <QOrganizerItemDetail>

Inherited by: QOrganizerEventTime, QOrganizerItemComment, QOrganizerItemDescription, QOrganizerItemDisplayLabel, QOrganizerItemGuid, QOrganizerItemLocation, QOrganizerItemParent, QOrganizerItemPriority, QOrganizerItemRecurrence, QOrganizerItemReminder, QOrganizerItemTag, QOrganizerItemTimestamp, QOrganizerItemType, QOrganizerJournalTime, QOrganizerTodoProgress, and QOrganizerTodoTime.

This class was introduced in Qt Mobility 1.1.

Public Types

enum AccessConstraint { NoConstraint, ReadOnly, Irremovable }
flags AccessConstraints

Public Functions

QOrganizerItemDetail ()
QOrganizerItemDetail ( const char * thisDefinitionId )
QOrganizerItemDetail ( const QString & thisDefinitionId )
QOrganizerItemDetail ( const QOrganizerItemDetail & other )
~QOrganizerItemDetail ()
AccessConstraints accessConstraints () const
QString definitionName () const
bool hasValue ( const QString & key ) const
bool hasValue ( const QLatin1Constant & key ) const
bool isEmpty () const
int key () const
bool removeValue ( const QString & key )
bool removeValue ( const QLatin1Constant & key )
void resetKey ()
bool setValue ( const QString & key, const QVariant & value )
bool setValue ( const QLatin1Constant & key, const QVariant & value )
T value ( const QString & key ) const
T value ( const QLatin1Constant & key ) const
QString value ( const QString & key ) const
QString value ( const QLatin1Constant & key ) const
QVariant variantValue ( const QString & key ) const
QVariant variantValue ( const QLatin1Constant & key ) const
QVariantMap variantValues () const
bool operator!= ( const QOrganizerItemDetail & other ) const
QOrganizerItemDetail & operator= ( const QOrganizerItemDetail & other )
bool operator== ( const QOrganizerItemDetail & other ) const

Macros

Q_DECLARE_CUSTOM_ORGANIZER_DETAIL

Detailed Description

The QOrganizerItemDetail class represents a single, complete detail about an organizer item.

All of the information for an organizer item is stored in one or more QOrganizerItemDetail objects.

A detail is a group of logically related bits of data - for example, a QOrganizerItemTimestamp is a single detail that has multiple fields (timestamp of creation, timestamp of last update, etc). Every QOrganizerItemDetail has the name of an associated QOrganizerItemDetailDefinition that describes the fields, their data type, and any restrictions on their values. Different organizer item managers might have different detail definitions for the same name, depending on their capabilities. For example, some managers might not support the last update timestamp field of the QOrganizerTimestamp detail, while a different manager may add an extra field for storing specific extra information not present in the default schema (e.g., a last accessed timestamp).

Both the names of all the fields, and the name of the associated QOrganizerItemDetailDefinition are stored as 8-bit strings encoded in Latin 1 for memory conservation. Note, however, that the values stored in each field are not constrained in this way, and full unicode QStrings or QVariant data can be stored.

When a QOrganizerItemDetail has been retrieved in a QOrganizerItem from a QOrganizerManager, it may have certain access constraints provided with it, like ReadOnly or Irremovable. This might mean that the supplied detail is calculated or otherwise not modifiable by the user. Also, some details may be marked Irremovable. These are typically things that an organizer item has to have - like a QOrganizerItemType.

It is possible to inherit from QOrganizerItemDetail to provide convenience or standardized access to values. For example, QOrganizerEventTime provides a convenient API for manipulating a QOrganizerItemDetail to describe the start and end time of an event, according to the schema.

In general, QOrganizerItemDetail and the built in subclasses (like QOrganizerEventTime) provide constants for the names of fields (like QOrganizerEventTime::FieldStartDateTime). Typically the constants for field names start with Field, and the constants for predefined values of a field start with the name of that field (e.g. TypeEvent is a predefined constant for FieldType).

If you wish to create your own, customized organizer item detail, you should use the Q_DECLARE_CUSTOM_ORGANIZER_DETAIL macro in order to ensure proper operation, and declare your own field constants with Q_DECLARE_LATIN1_CONSTANT. See the predefined detail subclasses (like QOrganizerEventTime, QOrganizerItemType) for more information.

QOrganizerItemDetail objects act like type checked values. In general, you can assign them to and fro and have reasonable behaviour, like the following example.

 QOrganizerItemDescription description;
 description.setDescription("Some descriptive text");
 // description.value(QOrganizerItemDescription::FieldDescription) == "Some descriptive text";
 // description.definitionName() == QOrganizerItemDescription::DefinitionName

 QOrganizerItemDetail detail = description;
 // detail.value(QOrganizerItemDescription::FieldDescription) == "Some descriptive text";
 // detail.definitionName() == QOrganizerItemDescription::DefinitionName

 QOrganizerItemDescription otherDescription = detail;
 // otherDescription.description() == "Some descriptive text";
 // otherDescription.definitionName() == QOrganizerItemDescription::DefinitionName

 QOrganizerItemDisplayLabel label = detail;
 // label is now a default constructed QOrganizerItemDisplayLabel
 // label.value(QOrganizerItemDescription::FieldDescription) is empty
 // label.definitionName() == QOrganizerItemDisplayLabel::DefinitionName

 QOrganizerItemDisplayLabel otherLabel = description;
 // otherLabel is now a default constructed QOrganizerItemDisplayLabel
 // otherLabel.value(QOrganizerItemDescription::FieldDescription) is empty
 // otherLabel.definitionName() == QOrganizerItemDisplayLabel::DefinitionName

See also QOrganizerItem, QOrganizerItemDetailDefinition, QOrganizerItemDetailFilter, QOrganizerItemDetailRangeFilter, and Q_DECLARE_CUSTOM_ORGANIZER_DETAIL.

Member Type Documentation

enum QOrganizerItemDetail::AccessConstraint
flags QOrganizerItemDetail::AccessConstraints

This enum defines the access constraints for a detail. This information is typically provided by the manager when an organizer item is retrieved.

ConstantValueDescription
QOrganizerItemDetail::NoConstraint0Users can read, write, and otherwise modify this detail in any manner.
QOrganizerItemDetail::ReadOnly0x01Users cannot write or modify values in this detail.
QOrganizerItemDetail::Irremovable0x02Users cannot remove this detail from an organizer item.

The AccessConstraints type is a typedef for QFlags<AccessConstraint>. It stores an OR combination of AccessConstraint values.

Member Function Documentation

QOrganizerItemDetail::QOrganizerItemDetail ()

Constructs a new, empty detail

QOrganizerItemDetail::QOrganizerItemDetail ( const char * thisDefinitionId )

Constructs a new, empty detail of the definition identified by thisDefinitionId

The supplied pointer must be valid for the lifetime of the program. In general this means it should be a constant, and not allocated on the stack. If you cannot meet this requirement, use the alternative constructor that takes a QString instead.

This function was introduced in Qt Mobility 1.1.

QOrganizerItemDetail::QOrganizerItemDetail ( const QString & thisDefinitionId )

Constructs a new, empty detail of the definition identified by thisDefinitionId. The definitionId must be restricted to the Latin 1 character set.

This function was introduced in Qt Mobility 1.1.

QOrganizerItemDetail::QOrganizerItemDetail ( const QOrganizerItemDetail & other )

Constructs a detail that is a copy of other

QOrganizerItemDetail::~QOrganizerItemDetail ()

Frees the memory used by this detail

AccessConstraints QOrganizerItemDetail::accessConstraints () const

Returns the access constraints associated with the detail.

Some details may not be written to, while other details may not be removed from an organizer item.

This function was introduced in Qt Mobility 1.1.

See also QOrganizerItemDetail::AccessConstraints.

QString QOrganizerItemDetail::definitionName () const

Returns the (unique) name of the definition which defines the semantics and structure of this detail. The actual QOrganizerItemDetailDefinition should be retrieved from the relevant QOrganizerManager using this name.

This function was introduced in Qt Mobility 1.1.

bool QOrganizerItemDetail::hasValue ( const QString & key ) const

Returns true if this detail has a field with the given key, or false otherwise.

This function was introduced in Qt Mobility 1.1.

bool QOrganizerItemDetail::hasValue ( const QLatin1Constant & key ) const

Returns true if this detail has a field with the given key, or false otherwise.

This function was introduced in Qt Mobility 1.1.

bool QOrganizerItemDetail::isEmpty () const

Returns true if no values are contained in this detail. Note that context is stored as a value; hence, if a context is set, this function will return false.

This function was introduced in Qt Mobility 1.1.

int QOrganizerItemDetail::key () const

Returns the key of this detail.

This function was introduced in Qt Mobility 1.1.

bool QOrganizerItemDetail::removeValue ( const QString & key )

Removes the value stored in this detail for the given key. Returns true if a value was stored for the given key and the operation succeeded, and false otherwise.

This function was introduced in Qt Mobility 1.1.

bool QOrganizerItemDetail::removeValue ( const QLatin1Constant & key )

Removes the value stored in this detail for the given key. Returns true if a value was stored for the given key and the operation succeeded, and false otherwise.

This function was introduced in Qt Mobility 1.1.

void QOrganizerItemDetail::resetKey ()

Causes the implicitly-shared detail to be detached from any other copies, and generates a new key for it. This ensures that calling QOrganizerItem::saveDetail() will result in a new detail being saved, rather than another detail being updated.

This function was introduced in Qt Mobility 1.1.

bool QOrganizerItemDetail::setValue ( const QString & key, const QVariant & value )

Inserts value into the detail for the given key if value is valid. If value is invalid, removes the field with the given key from the detail. Returns true if the given value was set for the key (if the value was valid), or if the given key was removed from detail (if the value was invalid), and returns false if the key was unable to be removed (and the value was invalid)

This function was introduced in Qt Mobility 1.1.

See also value().

bool QOrganizerItemDetail::setValue ( const QLatin1Constant & key, const QVariant & value )

Inserts value into the detail for the given key if value is valid. If value is invalid, removes the field with the given key from the detail. Returns true if the given value was set for the key (if the value was valid), or if the given key was removed from detail (if the value was invalid), and returns false if the key was unable to be removed (and the value was invalid)

This function was introduced in Qt Mobility 1.1.

T QOrganizerItemDetail::value ( const QString & key ) const

Returns the value of the template type associated with the given key

This function was introduced in Qt Mobility 1.1.

See also setValue().

T QOrganizerItemDetail::value ( const QLatin1Constant & key ) const

Returns the value stored in this detail for the given key as a QString, or an empty QString if no value for the given key exists

This function was introduced in Qt Mobility 1.1.

QString QOrganizerItemDetail::value ( const QString & key ) const

This is an overloaded function.

Returns the value stored in this detail for the given key as a QString, or an empty QString if no value for the given key exists

This function was introduced in Qt Mobility 1.1.

QString QOrganizerItemDetail::value ( const QLatin1Constant & key ) const

This is an overloaded function.

Returns the value of the template type associated with the given key

This function was introduced in Qt Mobility 1.1.

QVariant QOrganizerItemDetail::variantValue ( const QString & key ) const

Returns the value stored in this detail for the given key as a QVariant, or an invalid QVariant if no value for the given key exists

This function was introduced in Qt Mobility 1.1.

QVariant QOrganizerItemDetail::variantValue ( const QLatin1Constant & key ) const

Returns the value stored in this detail for the given key as a QVariant, or an invalid QVariant if no value for the given key exists

This function was introduced in Qt Mobility 1.1.

QVariantMap QOrganizerItemDetail::variantValues () const

Returns the values stored in this detail as a map from value key to value

This function was introduced in Qt Mobility 1.1.

bool QOrganizerItemDetail::operator!= ( const QOrganizerItemDetail & other ) const

Returns true if the values or id of this detail is different to those of the other detail

This function was introduced in Qt Mobility 1.1.

QOrganizerItemDetail & QOrganizerItemDetail::operator= ( const QOrganizerItemDetail & other )

Assigns this detail to other

This function was introduced in Qt Mobility 1.1.

bool QOrganizerItemDetail::operator== ( const QOrganizerItemDetail & other ) const

Compares this detail to other. Returns true if the definition, access constraints and values of other are equal to those of this detail. The keys of each detail are not considered during the comparison, in order to allow details from different organizer items to be compared according to their values.

This function was introduced in Qt Mobility 1.1.

Macro Documentation

Q_DECLARE_CUSTOM_ORGANIZER_DETAIL

Macro for simplifying declaring custom (leaf) detail classes.

The first argument is the name of the class, and the second argument is a Latin-1 string literal naming the detail type.

If you are creating a convenience class for a type of QOrganizerItemDetail, you should use this macro when declaring your class to ensure that it interoperates with other organizer item functionality.

Here is an example of a class (QOrganizerItemDescription) using this macro. Note that the class provides some predefined constants and some convenience methods that return values associated with schema fields.

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.