1
/****************************************************************************
3
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
6
** This file is part of the QtOrganizer module of the Qt Toolkit.
8
** $QT_BEGIN_LICENSE:LGPL$
9
** Commercial License Usage
10
** Licensees holding valid commercial Qt licenses may use this file in
11
** accordance with the commercial license agreement provided with the
12
** Software or, alternatively, in accordance with the terms contained in
13
** a written agreement between you and Digia. For licensing terms and
14
** conditions see http://qt.digia.com/licensing. For further information
15
** use the contact form at http://qt.digia.com/contact-us.
17
** GNU Lesser General Public License Usage
18
** Alternatively, this file may be used under the terms of the GNU Lesser
19
** General Public License version 2.1 as published by the Free Software
20
** Foundation and appearing in the file LICENSE.LGPL included in the
21
** packaging of this file. Please review the following information to
22
** ensure the GNU Lesser General Public License version 2.1 requirements
23
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25
** In addition, as a special exception, Digia gives you certain additional
26
** rights. These rights are described in the Digia Qt LGPL Exception
27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29
** GNU General Public License Usage
30
** Alternatively, this file may be used under the terms of the GNU
31
** General Public License version 3.0 as published by the Free Software
32
** Foundation and appearing in the file LICENSE.GPL included in the
33
** packaging of this file. Please review the following information to
34
** ensure the GNU General Public License version 3.0 requirements will be
35
** met: http://www.gnu.org/copyleft/gpl.html.
40
****************************************************************************/
42
#include <qorganizertodooccurrence.h>
43
#include <qorganizertodotime.h>
44
#include <qorganizeritemparent.h>
45
#include <qorganizeritemid.h>
47
QT_BEGIN_NAMESPACE_ORGANIZER
50
\class QOrganizerTodoOccurrence
51
\brief The QOrganizerTodoOccurrence class provides an occurrence of a task which should be completed
53
\ingroup organizer-items
55
A todo occurrence is a specific instance of a todo item. An occurrence
56
which is retrieved from a manager may not actually be persisted in that
57
manager (for example, it may be generated automatically from the
58
recurrence rule of the parent todo stored in the manager), in which case
59
it will have a zero-id and differ from the parent todo only in its start
60
date. Alternatively, it may be persisted in the manager (that is, the
61
client has saved the occurrence previously) where it is stored as an exception
66
Sets the date time at which the task should be started to \a startDateTime. For all-day tasks,
67
the time part can be set to any valid value.
69
void QOrganizerTodoOccurrence::setStartDateTime(const QDateTime &startDateTime)
71
QOrganizerTodoTime ttr = detail(QOrganizerItemDetail::TypeTodoTime);
72
ttr.setStartDateTime(startDateTime);
77
Returns the date time at which the task should be started. For all-day tasks, the time part is
80
QDateTime QOrganizerTodoOccurrence::startDateTime() const
82
QOrganizerTodoTime ttr = detail(QOrganizerItemDetail::TypeTodoTime);
83
return ttr.startDateTime();
87
Sets the date time by which the task should be completed to \a dueDateTime. For all-day tasks,
88
the time part can be set to any valid value.
90
void QOrganizerTodoOccurrence::setDueDateTime(const QDateTime &dueDateTime)
92
QOrganizerTodoTime ttr = detail(QOrganizerItemDetail::TypeTodoTime);
93
ttr.setDueDateTime(dueDateTime);
98
Returns the date time by which the task should be completed. For all-day tasks, the time part is
101
QDateTime QOrganizerTodoOccurrence::dueDateTime() const
103
QOrganizerTodoTime ttr = detail(QOrganizerItemDetail::TypeTodoTime);
104
return ttr.dueDateTime();
108
Sets the todo occurrence's parent to be the todo identified by the
111
void QOrganizerTodoOccurrence::setParentId(const QOrganizerItemId &parentId)
113
QOrganizerItemParent origin = detail(QOrganizerItemDetail::TypeParent);
114
origin.setParentId(parentId);
119
Returns the id of the todo which is this occurrence's parent.
121
QOrganizerItemId QOrganizerTodoOccurrence::parentId() const
123
QOrganizerItemParent origin = detail(QOrganizerItemDetail::TypeParent);
124
return origin.parentId();
128
Sets the date at which this occurrence was originally going to occur,
129
to the given \a date.
131
void QOrganizerTodoOccurrence::setOriginalDate(const QDate &date)
133
QOrganizerItemParent origin = detail(QOrganizerItemDetail::TypeParent);
134
origin.setOriginalDate(date);
139
Returns the date at which the occurrence was originally going to occur.
141
QDate QOrganizerTodoOccurrence::originalDate() const
143
QOrganizerItemParent origin = detail(QOrganizerItemDetail::TypeParent);
144
return origin.originalDate();
148
Sets the priority of the todo occurrence to \a priority.
150
void QOrganizerTodoOccurrence::setPriority(QOrganizerItemPriority::Priority priority)
152
QOrganizerItemPriority pd = detail(QOrganizerItemDetail::TypePriority);
153
pd.setPriority(priority);
158
Returns the priority of the todo occurrence..
160
QOrganizerItemPriority::Priority QOrganizerTodoOccurrence::priority() const
162
QOrganizerItemPriority pd = detail(QOrganizerItemDetail::TypePriority);
163
return pd.priority();
167
Sets the percentage of progress completed on the task described
168
by the todo occurrence item to \a percentage. Note that the given
169
\a percentage must be between 0 and 100, otherwise ignored.
171
void QOrganizerTodoOccurrence::setProgressPercentage(int percentage)
173
if (percentage >= 0 && percentage <= 100) {
174
QOrganizerTodoProgress tp = detail(QOrganizerItemDetail::TypeTodoProgress);
175
tp.setPercentageComplete(percentage);
181
Returns the percentage of progress completed on the task described
182
by the todo occurrence.
184
int QOrganizerTodoOccurrence::progressPercentage() const
186
QOrganizerTodoProgress tp = detail(QOrganizerItemDetail::TypeTodoProgress);
187
return tp.percentageComplete();
191
Sets the progress status of the todo occurrence to \a status.
193
void QOrganizerTodoOccurrence::setStatus(QOrganizerTodoProgress::Status status)
195
QOrganizerTodoProgress tp = detail(QOrganizerItemDetail::TypeTodoProgress);
196
tp.setStatus(status);
201
Returns the progress status of the task described by the todo occurrence.
203
QOrganizerTodoProgress::Status QOrganizerTodoOccurrence::status() const
205
QOrganizerTodoProgress tp = detail(QOrganizerItemDetail::TypeTodoProgress);
210
Sets the date and time at which the task described by the todo occurrence was completed to \a finishedDateTime.
212
void QOrganizerTodoOccurrence::setFinishedDateTime(const QDateTime &finishedDateTime)
214
QOrganizerTodoProgress tp = detail(QOrganizerItemDetail::TypeTodoProgress);
215
tp.setFinishedDateTime(finishedDateTime);
220
Returns the date and time at which the task described by the todo occurrence was completed.
222
QDateTime QOrganizerTodoOccurrence::finishedDateTime() const
224
QOrganizerTodoProgress tp = detail(QOrganizerItemDetail::TypeTodoProgress);
225
return tp.finishedDateTime();
228
QT_END_NAMESPACE_ORGANIZER