QtMobility Reference Documentation

QOrganizerItem Class Reference

The QOrganizerItem class represents an event, todo, note, or journal entry More...

 #include <QOrganizerItem>

Inherited by: QOrganizerEvent, QOrganizerEventOccurrence, QOrganizerJournal, QOrganizerNote, QOrganizerTodo, and QOrganizerTodoOccurrence.

This class was introduced in Qt Mobility 1.1.

Public Functions

QOrganizerItem ()
QOrganizerItem ( const QOrganizerItem & other )
~QOrganizerItem ()
void addComment ( const QString & comment )
void addTag ( const QString & tag )
void clearComments ()
void clearDetails ()
void clearTags ()
QOrganizerCollectionId collectionId () const
QStringList comments () const
QString description () const
QOrganizerItemDetail detail ( const QString & definitionName ) const
QOrganizerItemDetail detail ( const QLatin1Constant & definitionName ) const
T detail () const
QList<QOrganizerItemDetail> details ( const QString & definitionName = QString() ) const
QList<QOrganizerItemDetail> details ( const QString & definitionName, const QString & fieldName, const QString & value ) const
QList<QOrganizerItemDetail> details ( const QLatin1Constant & definitionName ) const
QList<QOrganizerItemDetail> details ( const QLatin1Constant & definitionName, const QLatin1Constant & fieldName, const QString & value )
QList<T> details () const
QList<T> details ( const QString & fieldName, const QString & value ) const
QString displayLabel () const
QString guid () const
QOrganizerItemId id () const
bool isEmpty () const
bool removeDetail ( QOrganizerItemDetail * detail )
bool saveDetail ( QOrganizerItemDetail * detail )
void setCollectionId ( const QOrganizerCollectionId & collectionId )
void setComments ( const QStringList & comments )
void setDescription ( const QString & description )
void setDescription ( const QOrganizerItemDescription & description )
void setDisplayLabel ( const QString & label )
void setDisplayLabel ( const QOrganizerItemDisplayLabel & label )
void setGuid ( const QString & guid )
void setId ( const QOrganizerItemId & id )
void setTags ( const QStringList & tags )
void setType ( const QString & type )
void setType ( const QOrganizerItemType & type )
QStringList tags () const
QString type () const
bool operator!= ( const QOrganizerItem & other ) const
QOrganizerItem & operator= ( const QOrganizerItem & other )
bool operator== ( const QOrganizerItem & other ) const

Related Non-Members

uint qHash ( const QOrganizerItem & key )

Macros

Q_DECLARE_CUSTOM_ORGANIZER_ITEM

Detailed Description

The QOrganizerItem class represents an event, todo, note, or journal entry

A QOrganizerItem object has an id and a collection of details (like a start date and location), as well as a collection id which identifies which QOrganizerCollection the item is part of in a manager. Each detail (which can have multiple fields) is stored in an appropriate subclass of QOrganizerItemDetail, and the QOrganizerItem allows retrieving these details in various ways.

Most clients will want to use the convenient subclasses of QOrganizerItem (i.e., QOrganizerEvent (and QOrganizerEventOccurence), QOrganizerTodo (and QOrganizerTodoOccurence), QOrganizerJournal and QOrganizerNote) instead of manipulating instances of QOrganizerItem directly.

A QOrganizerItem instance represents the in-memory version of a calendar organizer item. It is possible for the contents of a QOrganizerItem to change independently of the contents that are stored persistently in a QOrganizerManager. A QOrganizerItem has an id associated with it when it is first retrieved from a QOrganizerManager, or after it has been first saved, and this allows clients to track changes using the signals in QOrganizerManager. When saved in a manager, every item is placed into a QOrganizerCollection in that manager, according to the collection id set in the item prior to save (or the default collection if no collection id was set in the item).

Different QOrganizerManagers may require an item to have certain details saved in it before it can be stored in that manager. By default, every item must have a QOrganizerItemType detail which identifies the type of the item. Different subclasses of QOrganizerItem (i.e., QOrganizerEvent (and QOrganizerEventOccurence), QOrganizerTodo (and QOrganizerTodoOccurence), QOrganizerJournal and QOrganizerNote) may have other mandatory details, depending on the manager.

See also QOrganizerManager and QOrganizerItemDetail.

Member Function Documentation

QOrganizerItem::QOrganizerItem ()

Construct an empty organizer item.

The organizer item will have an empty display label, an empty id, and an empty description and have type QOrganizerItemType::TypeNote. The isEmpty() function will return true.

This function was introduced in Qt Mobility 1.1.

QOrganizerItem::QOrganizerItem ( const QOrganizerItem & other )

Initializes this QOrganizerItem from other

This function was introduced in Qt Mobility 1.1.

QOrganizerItem::~QOrganizerItem ()

Frees the memory used by this QOrganizerItem

void QOrganizerItem::addComment ( const QString & comment )

* Adds the comment comment to this item * *

This function was introduced in Qt Mobility 1.1.

See also QOrganizerItemComment.

void QOrganizerItem::addTag ( const QString & tag )

* Adds the tag to this item. * *

This function was introduced in Qt Mobility 1.2.

See also QOrganizerItemTag.

void QOrganizerItem::clearComments ()

* Removes all comments (arbitrary notes) about this item * *

This function was introduced in Qt Mobility 1.1.

See also QOrganizerItemComment.

void QOrganizerItem::clearDetails ()

* Removes all details of the organizer item. * This function does not modify the id or type of the organizer item. * Calling isEmpty() after calling this function will return true. * The empty item becomes a QOrganizerNote.

This function was introduced in Qt Mobility 1.1.

void QOrganizerItem::clearTags ()

* Removes all tags associated with the item. * *

This function was introduced in Qt Mobility 1.1.

See also QOrganizerItemTag.

QOrganizerCollectionId QOrganizerItem::collectionId () const

Returns the id of the collection which this item is part of, in the manager in which the item has been saved, if the item has previously been saved in a manager. If the item has not previously been saved in a manager, this function will return the id of the collection into which the client wishes the item to be saved when QOrganizerManager::saveItem() is called, which is set by calling setId(); otherwise, returns a null id.

An item always belongs to exactly one collection in a particular manager after it has been saved in the manager. If the item has previously been saved in the manager, in a particular collection, and the client sets the collection id of the item to the id of a different collection within that manager and then resaves the item, the item will be moved from its original collection into the specified collection if the move operation is supported by the manager; otherwise, the QOrganizerManager::saveItem() operation will fail and calling QOrganizerManager::error() will return QOrganizerManager::NotSupportedError.

This function was introduced in Qt Mobility 1.1.

See also setCollectionId().

QStringList QOrganizerItem::comments () const

* Returns the list of comments (or arbitrary notes about the item) * which pertain to this item. * *

This function was introduced in Qt Mobility 1.1.

See also setComments() and QOrganizerItemComment.

QString QOrganizerItem::description () const

* Returns the human-readable description of the item * *

This function was introduced in Qt Mobility 1.1.

See also setDescription() and QOrganizerItemDescription.

QOrganizerItemDetail QOrganizerItem::detail ( const QString & definitionName ) const

Returns the first detail stored in the organizer item with the given definitionName

This function was introduced in Qt Mobility 1.1.

QOrganizerItemDetail QOrganizerItem::detail ( const QLatin1Constant & definitionName ) const

Returns the first detail stored in the organizer item which with the given definitionName. The definitionName argument is typically the detail name constant provided by a specific subclass of QOrganizerItemDetail.

It would usually be more convenient to use the template version of this function.

This function was introduced in Qt Mobility 1.1.

T QOrganizerItem::detail () const

* * Returns the first detail of the template parameter type, as returned by the template details() function. * The type must be a subclass of QOrganizerItemDetail.

This function was introduced in Qt Mobility 1.1.

QList<QOrganizerItemDetail> QOrganizerItem::details ( const QString & definitionName = QString() ) const

Returns a list of details with the given definitionName The definitionName string can be determined by the DefinitionName attribute of defined objects (e.g. QOrganizerItemPhoneNumber::DefinitionName) or by requesting a list of all the definition names using detailDefinitions() or the asynchronous definitionNames().

This function was introduced in Qt Mobility 1.1.

QList<QOrganizerItemDetail> QOrganizerItem::details ( const QString & definitionName, const QString & fieldName, const QString & value ) const

Returns a list of details of the given definitionName, with fields named fieldName and with value value. The definitionName string can be determined by the DefinitionName attribute of defined objects (e.g. QOrganizerItemPhoneNumber::DefinitionName) or by requesting a list of all the definition names using detailDefinitions() or the asynchronous definitionNames().

This function was introduced in Qt Mobility 1.1.

QList<QOrganizerItemDetail> QOrganizerItem::details ( const QLatin1Constant & definitionName ) const

Returns a list of details of the given definitionName.

The definitionName argument is typically the detail name constant provided by a specific subclass of QOrganizerItemDetail.

It would usually be more convenient to use the template version of this function.

This function was introduced in Qt Mobility 1.1.

QList<QOrganizerItemDetail> QOrganizerItem::details ( const QLatin1Constant & definitionName, const QLatin1Constant & fieldName, const QString & value )

Returns a list of details of the given definitionName, with fields named fieldName and with value value.

This function was introduced in Qt Mobility 1.1.

QList<T> QOrganizerItem::details () const

* * Returns a list of details of the template parameter type. The type must be * a subclass of QOrganizerItemDetail.

This function was introduced in Qt Mobility 1.1.

QList<T> QOrganizerItem::details ( const QString & fieldName, const QString & value ) const

* * Returns a list of details of the template parameter type which have field called fieldName, with matching value. * The type must be a subclass of QOrganizerItemDetail.

This function was introduced in Qt Mobility 1.1.

QString QOrganizerItem::displayLabel () const

* Returns the display label of the item

This function was introduced in Qt Mobility 1.1.

See also setDisplayLabel().

QString QOrganizerItem::guid () const

* Returns the globally unique identifier which identifies this item, * which is used for synchronization purposes.

This function was introduced in Qt Mobility 1.1.

See also setGuid().

QOrganizerItemId QOrganizerItem::id () const

Returns the QOrganizerItemId that identifies this organizer item.

This may have been set when the organizer item was retrieved from a particular manager, or when the organizer item was first saved in a manager. The QOrganizerItemId is only valid within a specific manager. See QOrganizerManager::saveItem() for more information.

This function was introduced in Qt Mobility 1.1.

See also setId().

bool QOrganizerItem::isEmpty () const

* Returns true if this QOrganizerItem is empty, false if not. * * An empty QOrganizerItem has an empty label and no extra details. * The type of the organizer item is irrelevant.

This function was introduced in Qt Mobility 1.1.

bool QOrganizerItem::removeDetail ( QOrganizerItemDetail * detail )

* Removes the detail from the organizer item. * * The detail in the organizer item which has the same key as that of the given detail * will be removed if it exists. Only the key is used for comparison - that is, the * information in the detail may be different. * * If the detail's access constraint includes QOrganizerItemDetail::Irremovable, * this function will return false. * * Returns true if the detail was removed successfully, false if an error occurred. * * Note that the caller retains ownership of the detail.

This function was introduced in Qt Mobility 1.1.

bool QOrganizerItem::saveDetail ( QOrganizerItemDetail * detail )

* Saves the given detail in the list of stored details, and sets the detail's id. * If another detail of the same type and id has been previously saved in * this organizer item, that detail is overwritten. Otherwise, a new id is generated * and set in the detail, and the detail is added to the organizer item. * * If the detail's access constraint includes QOrganizerItemDetail::ReadOnly, * this function will return true and save the detail in the organizer item, * however attempting to save the organizer item in a manager may fail (if that manager * decides that the read only detail should not be updated). * Details with the QOrganizerItemDetail::ReadOnly constraint set are typically provided * in a organizer item by the manager, and are usually information that is either * synthesized, or not intended to be changed by the user (e.g. presence information * for other organizer items). * * If detail is a QOrganizerItemType, the existing organizer item type will * be overwritten with detail. There is never more than one organizer item type * in a organizer item. * * Returns true if the detail was saved successfully, otherwise returns false. * * Note that the caller retains ownership of the detail.

This function was introduced in Qt Mobility 1.1.

void QOrganizerItem::setCollectionId ( const QOrganizerCollectionId & collectionId )

Sets the id of the collection into which the client wishes the item to be saved to the given collectionId.

If the given collectionId is the null collection id, the client is specifying that the item should be saved into the collection in which the item is already saved (if the item has previously been saved in the manager, without having been removed since), or into the default collection of the manager (if the item has not previously been saved in the manager, or has been removed since the last time it was saved).

If the item has previously been saved in a particular manager, and the given collectionId is the id of a different collection than the one which the item is currently a part of in that manager, saving the item with QOrganizerManager::saveItem() will move the item from its original collection to the collection whose id is collectionId, if collectionId identifies a valid collection and the operation is supported by the manager.

This function was introduced in Qt Mobility 1.1.

See also collectionId().

void QOrganizerItem::setComments ( const QStringList & comments )

* Sets the list of comments associated with the item to comments. * *

This function was introduced in Qt Mobility 1.2.

See also comments() and QOrganizerItemTag.

void QOrganizerItem::setDescription ( const QString & description )

* Sets the human-readable description of the item to description * *

This function was introduced in Qt Mobility 1.1.

See also description() and QOrganizerItemDescription.

void QOrganizerItem::setDescription ( const QOrganizerItemDescription & description )

* Sets the human-readable description of the item to description

This function was introduced in Qt Mobility 1.1.

void QOrganizerItem::setDisplayLabel ( const QString & label )

* Sets the display label of the item to label * *

This function was introduced in Qt Mobility 1.1.

See also displayLabel() and QOrganizerItemDisplayLabel.

void QOrganizerItem::setDisplayLabel ( const QOrganizerItemDisplayLabel & label )

* Sets the display label of the item to label

This function was introduced in Qt Mobility 1.1.

void QOrganizerItem::setGuid ( const QString & guid )

* Sets the item's globally unique identifier to guid

This function was introduced in Qt Mobility 1.1.

See also guid().

void QOrganizerItem::setId ( const QOrganizerItemId & id )

* Sets the id of this organizer item to id. * * Note that this only affects this object, not any corresponding structures stored * by a QOrganizerManager. * * If you change the id of a organizer item and save the organizer item * in a manager, the previously existing organizer item will still * exist. You can do this to create copies (possibly modified) * of an existing organizer item, or to save a organizer item in a different manager. * *

This function was introduced in Qt Mobility 1.1.

See also id() and QOrganizerManager::saveItem().

void QOrganizerItem::setTags ( const QStringList & tags )

* Sets the list of tags associated with the item to tags. * *

This function was introduced in Qt Mobility 1.2.

See also tags() and QOrganizerItemTag.

void QOrganizerItem::setType ( const QString & type )

* Sets the type of the organizer item to the given type. * *

This function was introduced in Qt Mobility 1.1.

See also type() and QOrganizerItemType.

void QOrganizerItem::setType ( const QOrganizerItemType & type )

* Sets the type of the organizer item to the given type detail.

This function was introduced in Qt Mobility 1.1.

QStringList QOrganizerItem::tags () const

* Returns the list of tags for this item. Tags are used for non-exclusive categorization. * *

This function was introduced in Qt Mobility 1.2.

See also setTags() and QOrganizerItemTag.

QString QOrganizerItem::type () const

* Returns the type of the organizer item. Every organizer item has exactly one type which * is either set manually (by saving a modified copy of the QOrganizerItemType * in the organizer item, or by calling setType()) or synthesized automatically. * *

This function was introduced in Qt Mobility 1.1.

See also setType() and QOrganizerItemType.

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

* * Returns true if this organizer item's id or details are different to those of the other organizer item.

This function was introduced in Qt Mobility 1.1.

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

Replace the contents of this QOrganizerItem with other

This function was introduced in Qt Mobility 1.1.

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

Returns true if this organizer item is equal to the other organizer item, false if either the id, collection id or stored details are not the same

This function was introduced in Qt Mobility 1.1.

Related Non-Members

uint qHash ( const QOrganizerItem & key )

Returns the hash value for key.

This function was introduced in Qt Mobility 1.1.

Macro Documentation

Q_DECLARE_CUSTOM_ORGANIZER_ITEM

Macro for simplifying declaring convenience leaf classes for QOrganizerItem.

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

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

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.