QOrganizerItemDetail Class
The QOrganizerItemDetail class represents a single, complete detail about an organizer item. More...
Header: | #include <QOrganizerItemDetail> |
Inherited By: |
Public Types
enum | DetailType { TypeUndefined, TypeClassification, TypeComment, TypeDescription, ..., TypeTodoProgress } |
Public Functions
QOrganizerItemDetail(DetailType detailType = TypeUndefined) | |
QOrganizerItemDetail(const QOrganizerItemDetail & other) | |
~QOrganizerItemDetail() | |
bool | hasValue(int field) const |
bool | isEmpty() const |
int | key() const |
bool | removeValue(int field) |
void | resetKey() |
bool | setValue(int field, const QVariant & value) |
DetailType | type() const |
QVariant | value(int field) const |
T | value(int field) const |
QMap<int, QVariant> | values() const |
bool | operator!=(const QOrganizerItemDetail & other) const |
QOrganizerItemDetail & | operator=(const QOrganizerItemDetail & other) |
bool | operator==(const QOrganizerItemDetail & other) const |
Related Non-Members
Q_ORGANIZER_EXPORT | operator<<(QDebug dbg, const QOrganizerItemDetail & 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). Different organizer managers may support different details for different item types, e.g. certain manager may not support the timestamp, while others do.
In general, QOrganizerItemDetail and the built in subclasses (like QOrganizerEventTime) provide convenience and 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. Subclasses also 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
).
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.type() == QOrganizerItemDetail::TypeDescription QOrganizerItemDetail detail = description; // detail.value(QOrganizerItemDescription::FieldDescription) == "Some descriptive text"; // detail.type() == QOrganizerItemDetail::TypeDescription QOrganizerItemDescription otherDescription = detail; // otherDescription.description() == "Some descriptive text"; // otherDescription.type() == QOrganizerItemDetail::TypeDescription QOrganizerItemDisplayLabel label = detail; // label is now a default constructed QOrganizerItemDisplayLabel // label.value(QOrganizerItemDescription::FieldDescription) is empty // label.type() == QOrganizerItemDetail::TypeDisplayLabel QOrganizerItemDisplayLabel otherLabel = description; // otherLabel is now a default constructed QOrganizerItemDisplayLabel // otherLabel.value(QOrganizerItemDescription::FieldDescription) is empty // otherLabel.type() == QOrganizerItemDetail::TypeDisplayLabel
See also QOrganizerItem, QOrganizerItemDetailFilter, QOrganizerItemDetailFieldFilter, and QOrganizerItemDetailRangeFilter.
Member Type Documentation
enum QOrganizerItemDetail::DetailType
This enumeration describes the type of the organizer item detail.
Constant | Value | Description |
---|---|---|
QOrganizerItemDetail::TypeUndefined | 0 | This detail is of type undefined. |
QOrganizerItemDetail::TypeClassification | 100 | This detail is a classification. |
QOrganizerItemDetail::TypeComment | 200 | This detail is a comment |
QOrganizerItemDetail::TypeDescription | 300 | This detail is a description. |
QOrganizerItemDetail::TypeDisplayLabel | 400 | This detail is a display label. |
QOrganizerItemDetail::TypeItemType | 500 | This detail is an item type. |
QOrganizerItemDetail::TypeGuid | 600 | This detail is a GUID. |
QOrganizerItemDetail::TypeLocation | 700 | This detail is a location. |
QOrganizerItemDetail::TypeParent | 800 | This detail is a parent. Should not be used in parent items. |
QOrganizerItemDetail::TypePriority | 900 | This detail is a priority. |
QOrganizerItemDetail::TypeRecurrence | 1000 | This detail is a recurrence. Should not be used in occurrences. |
QOrganizerItemDetail::TypeTag | 1100 | This detail is a tag. |
QOrganizerItemDetail::TypeTimestamp | 1200 | This detail is a timestamp. |
QOrganizerItemDetail::TypeVersion | 1300 | This detail is a version. |
QOrganizerItemDetail::TypeReminder | 1400 | This detail is a reminder. Should not be directly used. |
QOrganizerItemDetail::TypeAudibleReminder | 1500 | This detail is an audible reminder. |
QOrganizerItemDetail::TypeEmailReminder | 1600 | This detail is an email reminder. |
QOrganizerItemDetail::TypeVisualReminder | 1700 | This detail is a visual reminder. |
QOrganizerItemDetail::TypeExtendedDetail | 1800 | This detail is an extended detail. |
QOrganizerItemDetail::TypeEventAttendee | 1900 | This detail is an event attendee. |
QOrganizerItemDetail::TypeEventRsvp | 2000 | This detail is an event RSVP. |
QOrganizerItemDetail::TypeEventTime | 2100 | This detail is an event time. |
QOrganizerItemDetail::TypeJournalTime | 2200 | This detail is a journal time. |
QOrganizerItemDetail::TypeTodoTime | 2400 | This detail is a TODO time. |
QOrganizerItemDetail::TypeTodoProgress | 2300 | This detail is a TODO progress. |
Member Function Documentation
QOrganizerItemDetail::QOrganizerItemDetail(DetailType detailType = TypeUndefined)
Constructs a new, empty detail of the detailType.
QOrganizerItemDetail::QOrganizerItemDetail(const QOrganizerItemDetail & other)
Constructs a detail that is a copy of other.
QOrganizerItemDetail::~QOrganizerItemDetail()
Frees the memory used by this detail.
bool QOrganizerItemDetail::hasValue(int field) const
Returns true if the value of the given field has been set, or false otherwise.
bool QOrganizerItemDetail::isEmpty() const
Returns true if no values are contained in this detail.
int QOrganizerItemDetail::key() const
Returns the key of this detail.
bool QOrganizerItemDetail::removeValue(int field)
Removes the value stored in this detail for the given field. Returns true if a value was stored for the given field and the removing succeeds, or false otherwise.
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.
bool QOrganizerItemDetail::setValue(int field, const QVariant & value)
Sets the value of the given field to be value. If the given value is invalid or null, removes the given field from the detail. Returns true on success, or false otherwise.
See also value().
DetailType QOrganizerItemDetail::type() const
Returns the detail type.
QVariant QOrganizerItemDetail::value(int field) const
Returns the value stored in this detail for the given field. An invalid QVariant is returned if the value of field is not set.
See also setValue().
T QOrganizerItemDetail::value(int field) const
QMap<int, QVariant> QOrganizerItemDetail::values() const
Returns the values stored in this detail as a field-to-value map.
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
QOrganizerItemDetail & QOrganizerItemDetail::operator=(const QOrganizerItemDetail & other)
Assigns this detail to other.
bool QOrganizerItemDetail::operator==(const QOrganizerItemDetail & other) const
Compares this detail to other. Returns true if the type 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.
Related Non-Members
Q_ORGANIZER_EXPORT operator<<(QDebug dbg, const QOrganizerItemDetail & detail)
Streams the detail to the given debug stream dbg, and returns the stream.