-rw-r--r-- | libkcal/todo.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libkcal/todo.h b/libkcal/todo.h index a22d4b7..fe43357 100644 --- a/libkcal/todo.h +++ b/libkcal/todo.h | |||
@@ -1,66 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | #ifndef TODO_H | 20 | #ifndef TODO_H |
21 | #define TODO_H | 21 | #define TODO_H |
22 | // | 22 | // |
23 | // Todo component, representing a VTODO object | 23 | // Todo component, representing a VTODO object |
24 | // | 24 | // |
25 | 25 | ||
26 | #include "incidence.h" | 26 | #include "incidence.h" |
27 | 27 | ||
28 | #include <qtimer.h> | ||
29 | |||
28 | namespace KCal { | 30 | namespace KCal { |
29 | 31 | ||
30 | /** | 32 | /** |
31 | This class provides a Todo in the sense of RFC2445. | 33 | This class provides a Todo in the sense of RFC2445. |
32 | */ | 34 | */ |
33 | class Todo : public Incidence | 35 | class Todo : public QObject,public Incidence |
34 | { | 36 | { |
37 | Q_OBJECT | ||
35 | public: | 38 | public: |
36 | Todo(); | 39 | Todo(); |
37 | Todo(const Todo &); | 40 | Todo(const Todo &); |
38 | ~Todo(); | 41 | ~Todo(); |
39 | typedef ListBase<Todo> List; | 42 | typedef ListBase<Todo> List; |
40 | QCString type() const { return "Todo"; } | 43 | QCString type() const { return "Todo"; } |
41 | 44 | ||
42 | /** Return an exact copy of this todo. */ | 45 | /** Return an exact copy of this todo. */ |
43 | Incidence *clone(); | 46 | Incidence *clone(); |
44 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; | 47 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; |
45 | 48 | ||
46 | /** for setting the todo's due date/time with a QDateTime. */ | 49 | /** for setting the todo's due date/time with a QDateTime. */ |
47 | void setDtDue(const QDateTime &dtDue); | 50 | void setDtDue(const QDateTime &dtDue); |
48 | /** returns an event's Due date/time as a QDateTime. */ | 51 | /** returns an event's Due date/time as a QDateTime. */ |
49 | QDateTime dtDue() const; | 52 | QDateTime dtDue() const; |
50 | /** returns an event's due time as a string formatted according to the | 53 | /** returns an event's due time as a string formatted according to the |
51 | users locale settings */ | 54 | users locale settings */ |
52 | QString dtDueTimeStr() const; | 55 | QString dtDueTimeStr() const; |
53 | /** returns an event's due date as a string formatted according to the | 56 | /** returns an event's due date as a string formatted according to the |
54 | users locale settings */ | 57 | users locale settings */ |
55 | QString dtDueDateStr(bool shortfmt=true) const; | 58 | QString dtDueDateStr(bool shortfmt=true) const; |
56 | /** returns an event's due date and time as a string formatted according | 59 | /** returns an event's due date and time as a string formatted according |
57 | to the users locale settings */ | 60 | to the users locale settings */ |
58 | QString dtDueStr(bool shortfmt=true) const; | 61 | QString dtDueStr(bool shortfmt=true) const; |
59 | 62 | ||
60 | /** returns TRUE or FALSE depending on whether the todo has a due date */ | 63 | /** returns TRUE or FALSE depending on whether the todo has a due date */ |
61 | bool hasDueDate() const; | 64 | bool hasDueDate() const; |
62 | /** sets the event's hasDueDate value. */ | 65 | /** sets the event's hasDueDate value. */ |
63 | void setHasDueDate(bool f); | 66 | void setHasDueDate(bool f); |
64 | 67 | ||
65 | /* | 68 | /* |
66 | Looks for a subtodo (including itself ) which is not complete and is | 69 | Looks for a subtodo (including itself ) which is not complete and is |
@@ -85,52 +88,61 @@ class Todo : public Incidence | |||
85 | /** return the event's status. */ | 88 | /** return the event's status. */ |
86 | // int status() const; | 89 | // int status() const; |
87 | /** return the event's status in string format. */ | 90 | /** return the event's status in string format. */ |
88 | // QString statusStr() const; | 91 | // QString statusStr() const; |
89 | 92 | ||
90 | /** return, if this todo is completed */ | 93 | /** return, if this todo is completed */ |
91 | bool isCompleted() const; | 94 | bool isCompleted() const; |
92 | /** set completed state of this todo */ | 95 | /** set completed state of this todo */ |
93 | void setCompleted(bool); | 96 | void setCompleted(bool); |
94 | 97 | ||
95 | /** | 98 | /** |
96 | Return how many percent of the task are completed. Returns a value | 99 | Return how many percent of the task are completed. Returns a value |
97 | between 0 and 100. | 100 | between 0 and 100. |
98 | */ | 101 | */ |
99 | int percentComplete() const; | 102 | int percentComplete() const; |
100 | /** | 103 | /** |
101 | Set how many percent of the task are completed. Valid values are in the | 104 | Set how many percent of the task are completed. Valid values are in the |
102 | range from 0 to 100. | 105 | range from 0 to 100. |
103 | */ | 106 | */ |
104 | void setPercentComplete(int); | 107 | void setPercentComplete(int); |
105 | 108 | ||
106 | /** return date and time when todo was completed */ | 109 | /** return date and time when todo was completed */ |
107 | QDateTime completed() const; | 110 | QDateTime completed() const; |
108 | QString completedStr(bool shortF = true) const; | 111 | QString completedStr(bool shortF = true) const; |
109 | /** set date and time of completion */ | 112 | /** set date and time of completion */ |
110 | void setCompleted(const QDateTime &completed); | 113 | void setCompleted(const QDateTime &completed); |
111 | 114 | ||
112 | /** Return true, if todo has a date associated with completion */ | 115 | /** Return true, if todo has a date associated with completion */ |
113 | bool hasCompletedDate() const; | 116 | bool hasCompletedDate() const; |
114 | bool contains ( Todo*); | 117 | bool contains ( Todo*); |
115 | void checkSetCompletedFalse(); | 118 | void checkSetCompletedFalse(); |
116 | bool setRecurDates(); | 119 | bool setRecurDates(); |
117 | 120 | bool isRunning() {return mRunning;} | |
121 | bool hasRunningSub(); | ||
122 | void setRunning( bool ); | ||
123 | int runTime(); | ||
124 | QDateTime runStart () const { return mRunStart;} | ||
125 | public slots: | ||
126 | void saveRunningInfoToFile(); | ||
118 | private: | 127 | private: |
128 | bool mRunning; | ||
129 | QTimer * mRunSaveTimer; | ||
130 | QDateTime mRunStart; | ||
119 | bool accept(Visitor &v) { return v.visit(this); } | 131 | bool accept(Visitor &v) { return v.visit(this); } |
120 | 132 | ||
121 | QDateTime mDtDue; // due date of todo | 133 | QDateTime mDtDue; // due date of todo |
122 | 134 | ||
123 | bool mHasDueDate; // if todo has associated due date | 135 | bool mHasDueDate; // if todo has associated due date |
124 | 136 | ||
125 | // int mStatus; // confirmed/delegated/tentative/etc | 137 | // int mStatus; // confirmed/delegated/tentative/etc |
126 | 138 | ||
127 | QDateTime mCompleted; | 139 | QDateTime mCompleted; |
128 | bool mHasCompletedDate; | 140 | bool mHasCompletedDate; |
129 | 141 | ||
130 | int mPercentComplete; | 142 | int mPercentComplete; |
131 | }; | 143 | }; |
132 | 144 | ||
133 | bool operator==( const Todo&, const Todo& ); | 145 | bool operator==( const Todo&, const Todo& ); |
134 | } | 146 | } |
135 | 147 | ||
136 | #endif | 148 | #endif |