QOrganizerItemDetail Class ReferenceThe 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. Public Types
Public Functions
Macros
Detailed DescriptionThe 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
flags QOrganizerItemDetail::AccessConstraints |
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.
Constructs a new, empty detail of the definition identified by thisDefinitionId. The definitionId must be restricted to the Latin 1 character set.
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.
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.
Returns true if this detail has a field with the given key, or false otherwise.
Returns true if this detail has a field with the given key, or false otherwise.
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.
Returns the key of this detail.
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.
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.
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.
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)
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)
Returns the value of the template type associated with the given key
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 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 is an overloaded function.
Returns the value of the template type associated with the given key
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
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
Returns the values stored in this detail as a map from value key to value
Returns true if the values or id of this detail is different to those of the other detail
Assigns this detail to other
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.
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.