Detailed Description
The QOccurrenceModel class provides access to the Calendar data.
It is a descendant of QAbstractItemModel so is suitable for use with the Qt View classes such as QListView and QTableView, as well as any custom developer Views.
It differs from the QAppointmentModel in that it will show each occurrence of appointments as a separate item in the model. Since some appointments have infinite occurrences a date range must be specified to limit the total set of occurrences included in the model. Another important difference is that the values for the QAppointmentModel::Start and QAppointmentModel::End fields are converted to the current time zone of the device.
See also Pim Library.
Member Function Documentation
QOccurrenceModel::QOccurrenceModel ( const QDateTime & start, const QDateTime & end, QObject * parent = 0 )
Constructs an occurrence model with the given parent that contains only occurrences that end on or after the specified range start time and start before the specified range end time. Both start and end time specified should be in local time.
QOccurrenceModel::QOccurrenceModel ( const QDateTime & start, int count, QObject * parent = 0 )
Constructs an occurrence model with the given parent that contains only the first count occurrences that end on or after the specified range start time. The start time specified should be in local time.
QOccurrenceModel::~QOccurrenceModel () [virtual]
Destroys the occurrence model.
QAppointment QOccurrenceModel::appointment ( const QUniqueId & identifier ) const
Returns the appointment with the specified identifier. The appointment does not have to be in the current filter mode for it to be returned.
QAppointment QOccurrenceModel::appointment ( const QModelIndex & index ) const
This is an overloaded member function, provided for convenience.
Returns the appointment for the row specified by index. The column of index is ignored.
QAppointment QOccurrenceModel::appointment ( int row ) const
This is an overloaded member function, provided for convenience.
Returns the appointment for the given row.
QSet<QPimSource> QOccurrenceModel::availableSources () const
Returns the set of identifiers for storage sources that can be shown.
QCategoryFilter QOccurrenceModel::categoryFilter () const
Returns the category filter that occurrences are tested against for the current filter mode.
See also setCategoryFilter().
bool QOccurrenceModel::contains ( const QModelIndex & index ) const
Returns true if the current filter mode of the model contains index.
bool QOccurrenceModel::contains ( const QUniqueId & identifier ) const
This is an overloaded member function, provided for convenience.
Returns true if the current filter mode of the model contains an occurrence for the appointment with the specified identifier.
int QOccurrenceModel::count () const
Returns the number of occurrences visible in the current filter mode.
QVariant QOccurrenceModel::data ( const QModelIndex & index, int role ) const [virtual]
Returns the data stored under the given role for the item referred to by the index.
The row of the index specifies which appointment to access and the column of the index is treated as a QAppointmentModel::Field.
Reimplemented from QAbstractItemModel.
See also setData() and QAppointmentModel::appointmentField().
Returns the duration type of occurrences currently included in the model.
See also setDurationType().
bool QOccurrenceModel::editable ( const QModelIndex & index ) const
Returns true if the occurrence for index can be updated or removed.
bool QOccurrenceModel::editable ( const QUniqueId & identifier ) const
This is an overloaded member function, provided for convenience.
Returns true if the appointment with the specified identifier can be updated or removed.
QUniqueId QOccurrenceModel::id ( const QModelIndex & index ) const
Return the identifier for the appointment represented by the occurrence at the row specified by index. If index is null or out of the range of the model will return a null identifier.
QModelIndex QOccurrenceModel::index ( const QUniqueId & identifier ) const
Returns the index of the first occurrence in the model that represents an appointment with the specified identifier. If no occurrences are found returns a null index.
See also contains().
QModelIndex QOccurrenceModel::index ( const QOccurrence & occurrence ) const
This is an overloaded member function, provided for convenience.
If the model contains the occurrence returns the index of that occurrence. Otherwise returns a null index.
QMap<int, QVariant> QOccurrenceModel::itemData ( const QModelIndex & index ) const [virtual]
Returns a map with values for all predefined roles in the model for the item at the given index.
Reimplemented from QAbstractItemModel.
See also setItemData().
QOccurrence QOccurrenceModel::occurrence ( const QModelIndex & index ) const
Returns the occurrence for the row specified by index. The column of index is ignored.
QOccurrence QOccurrenceModel::occurrence ( const QUniqueId & identifier, const QDate & date ) const
This is an overloaded member function, provided for convenience.
Returns the occurrence of the appointment with the specified identifier which occurs on the specified date. If the appointment does not exists or does not occur on the date, returns a null occurrence.
QOccurrence QOccurrenceModel::occurrence ( int row ) const
This is an overloaded member function, provided for convenience.
Returns the occurrence at the row specified.
QDateTime QOccurrenceModel::rangeEnd () const
Returns the end of the range specified that occurrences must start before to be included in the model, in the local time zone.
If the range was specified by a start and a count, this will return a null date time.
QDateTime QOccurrenceModel::rangeStart () const
Returns the start of the range specified that occurrences must end at or after to be included in the model, in the local time zone.
void QOccurrenceModel::rebuildCache () const [slot]
Rebuilds the cache of repeating occurrences that fit within the range.
Ensures any recently updates to the model will be reflected in queries against the model.
This can be an expensive operation. As QOccurrenceModel automatically rebuilds the cache when required it is recommended not to call this function explicitly as this may lead to excessive processing and a subsequent loss in application performance.
void QOccurrenceModel::refresh ()
Forces a refresh of the Occurrence data.
int QOccurrenceModel::rowCount ( const QModelIndex & parent = QModelIndex() ) const [virtual]
Return the number of rows under the given parent.
Reimplemented from QAbstractItemModel.
void QOccurrenceModel::setCategoryFilter ( const QCategoryFilter & filter )
Set the model to only contain occurrences accepted by the specified filter.
See also categoryFilter().
bool QOccurrenceModel::setData ( const QModelIndex & index, const QVariant & value, int role ) [virtual]
Returns false since occurrence model does not allow editing. index, value and role are ignored.
Reimplemented from QAbstractItemModel.
See also data().
Sets the model to only contain occurrences of the specified duration type.
See also durationType().
bool QOccurrenceModel::setItemData ( const QModelIndex & index, const QMap<int, QVariant> & values ) [virtual]
Returns false since occurrence model does not allow editing. index and values are ignored
Reimplemented from QAbstractItemModel.
See also itemData().
void QOccurrenceModel::setRange ( const QDateTime & start, int count )
Sets the model to contain only the first count occurrences that end on or after the specified range start time. The start time specified should be in local time.
void QOccurrenceModel::setRange ( const QDateTime & start, const QDateTime & end )
This is an overloaded member function, provided for convenience.
Sets the model to only contain occurrences that start before the end of the range, and end at or after the start of the range. Both start and end should be in the local time zone.
void QOccurrenceModel::setVisibleSources ( const QSet<QPimSource> & list )
Sets the model to show only appointments contained in the storage sources specified by list.
Also refreshes the model.
See also visibleSources().
bool QOccurrenceModel::sourceExists ( const QPimSource & source, const QUniqueId & identifier ) const
Returns true if the appointment with the specified identifier is stored in the specified storage source.
QSet<QPimSource> QOccurrenceModel::visibleSources () const
Returns the list of sources of occurrence data that are currently shown by the occurrence model.
See also setVisibleSources().