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.
enum | AccessConstraint { NoConstraint, ReadOnly, Irremovable } |
flags | AccessConstraints |
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 |
Q_DECLARE_CUSTOM_ORGANIZER_DETAIL |
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.
This enum defines the access constraints for a detail. This information is typically provided by the manager when an organizer item is retrieved.
Constant | Value | Description |
---|---|---|
QOrganizerItemDetail::NoConstraint | 0 | Users can read, write, and otherwise modify this detail in any manner. |
QOrganizerItemDetail::ReadOnly | 0x01 | Users cannot write or modify values in this detail. |
QOrganizerItemDetail::Irremovable | 0x02 | Users 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.
Constructs a new, empty detail
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.
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.
Constructs a detail that is a copy of other
Frees the memory used by this detail
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.
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.
Returns true if this detail has a field with the given key, or false otherwise.
This function was introduced in Qt Mobility 1.1.
Returns true if this detail has a field with the given key, or false otherwise.
This function was introduced in Qt Mobility 1.1.
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.
Returns the key of this detail.
This function was introduced in Qt Mobility 1.1.
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.
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.
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.
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().
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.
Returns the value of the template type associated with the given key
This function was introduced in Qt Mobility 1.1.
See also setValue().
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.
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.
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.
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.
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.
Returns the values stored in this detail as a map from value key to value
This function was introduced in Qt Mobility 1.1.
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.
Assigns this detail to other
This function was introduced in Qt Mobility 1.1.
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 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.
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.