Detailed Description
The QOrganizerCollection class represents a collection of items in a manager.
A collection has an id and optionally some metadata, and contains zero or more items. Each different manager will have different requirements before a collection may be saved in it. Some managers do not allow collections to be saved at all, while others may require a collection to have some minimal amount of meta data defined in it prior to save. For example, most managers require a valid value for the QOrganizerCollection::KeyName meta data key to be set prior to save.
Every QOrganizerItem is contained within a collection when stored in a manager. To save an item in a collection, the client should call QOrganizerItem::setCollectionId() on the item, passing in the id of the destination collection as the argument, and then save the item in the manager. To move an item from one collection to another, the client must fetch the item from the manager, set the collection id in the item to the id of the collection to which the client wishes the item to be moved, and then resave the item in the manager. That is, the collection which an item is part of is treated as a property of the item.
Member Function Documentation
QOrganizerCollection::QOrganizerCollection ()
Constructs a new collection
QOrganizerCollection::QOrganizerCollection ( const QOrganizerCollection & other )
Constructs a new copy of the other collection
QOrganizerCollection::~QOrganizerCollection ()
Cleans up any memory in use by the collection
Returns the complete id of the collection, which includes the manager uri and the manager id of the collection
See also setId().
QVariantMap QOrganizerCollection::metaData () const
Returns the meta data of the collection
See also setMetaData().
QVariant QOrganizerCollection::metaData ( const QString & key ) const
Returns the meta data of the collection for the given key
void QOrganizerCollection::setId ( const QOrganizerCollectionId & id )
Sets the id of the collection to id. If the id is set to a null (default-constructed) id, saving the collection will cause the manager to save the collection as a new collection (if it supports that operation).
See also id().
void QOrganizerCollection::setMetaData ( const QVariantMap & metaData )
Sets the meta data of the collection to metaData. Not all managers support arbitrary meta data for collections. You can see whether the meta data is compatible with the manager by calling QOrganizerManager::compatibleCollection(). Attempting to save a collection with unsupported meta data in a manager will cause an error in the operation.
See also metaData().
void QOrganizerCollection::setMetaData ( const QString & key, const QVariant & value )
Sets the meta data of the collection for the given key to the given value. Not all managers support all of the standard meta data keys (see QOrganizerCollection), and some will support extra or even arbitrary keys. Similarly, not all managers support all possible data types for the meta data value. Attempting to save a collection with unsupported meta data in a manager will cause an error in the operation.
bool QOrganizerCollection::operator!= ( const QOrganizerCollection & other ) const
Returns true if the id of the collection is different to that of the other collection.
QOrganizerCollection & QOrganizerCollection::operator= ( const QOrganizerCollection & other )
Assigns this collection to be equal to the other collection
bool QOrganizerCollection::operator== ( const QOrganizerCollection & other ) const
Returns true if the id of the collection is the same as that of the other collection. Does not check that the metadata of the collections is equal.
Member Variable Documentation
const QLatin1Constant QOrganizerCollection::KeyColor
The constant key value which identifies the color meta data of a collection.
const QLatin1Constant QOrganizerCollection::KeyDescription
The constant key value which identifies the description meta data of a collection.
const QLatin1Constant QOrganizerCollection::KeyImage
The constant key value which identifies the image meta data of a collection.
const QLatin1Constant QOrganizerCollection::KeyName
The constant key value which identifies the name meta data of a collection.