QOrganizerItemDetail Class Reference
The QOrganizerItemDetail class represents a single, complete detail about a organizeritem. More...
#include <QOrganizerItemDetail>
Inherited by QOrganizerEventTimeRange, QOrganizerItemComment, QOrganizerItemDescription, QOrganizerItemDisplayLabel, QOrganizerItemGuid, QOrganizerItemInstanceOrigin, QOrganizerItemLocation, QOrganizerItemPriority, QOrganizerItemRecurrence, QOrganizerItemTimestamp, QOrganizerItemType, QOrganizerJournalTimeRange, QOrganizerTodoProgress, and QOrganizerTodoTimeRange.
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 a organizeritem.
All of the information for a organizeritem is stored in one or more QOrganizerItemDetail objects.
A detail is a group of logically related bits of data - for example, a street address is a single detail that has multiple fields (number, region, country etc). Every QOrganizerItemDetail has the name of an associated QOrganizerItemDetailDefinition that describes the fields, their data type, and any restrictions on their values. Different organizeritem managers might have different detail definitions for the same name, depending on their capabilities. For example, for the QOrganizerItemGeoLocation definition name, one manager might not support the altitude field, while a different manager may add an extra field for specific extra information not present in the default schema.
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 QOrganizerItemManager, 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 a organizeritem has to have - like a QOrganizerItemType.
It is possible to inherit from QOrganizerItemDetail to provide convenience or standardized access to values. For example, QOrganizerEventTimeRange 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 QOrganizerEventTimeRange) provide constants for the names of fields (like QOrganizerEventTimeRange::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 organizeritem 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 QOrganizerEventTimeRange, 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