summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/otodo.h
authorzecke <zecke>2002-09-20 12:59:29 (UTC)
committer zecke <zecke>2002-09-20 12:59:29 (UTC)
commita05c10c9744020be31c3038b2de3401b5cc673fb (patch) (unidiff)
tree20d059bf00fc1199c34a60a8be4cb842ebfe4d14 /libopie2/opiepim/otodo.h
parent7099778ab711f78cfd86dadad1b8af993e008f38 (diff)
downloadopie-a05c10c9744020be31c3038b2de3401b5cc673fb.zip
opie-a05c10c9744020be31c3038b2de3401b5cc673fb.tar.gz
opie-a05c10c9744020be31c3038b2de3401b5cc673fb.tar.bz2
Our new common template based start for Accessing and Manipulating
the Records The CROSS_REFERENCE branch will get ported to it. We use templates for several reasons They allow us to share code and to be easily extended I've to make them not inline to save memory... I've to port all DBs and Record related classes
Diffstat (limited to 'libopie2/opiepim/otodo.h') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/otodo.h205
1 files changed, 205 insertions, 0 deletions
diff --git a/libopie2/opiepim/otodo.h b/libopie2/opiepim/otodo.h
new file mode 100644
index 0000000..429108a
--- a/dev/null
+++ b/libopie2/opiepim/otodo.h
@@ -0,0 +1,205 @@
1
2#ifndef OPIE_TODO_EVENT_H
3#define OPIE_TODO_EVENT_H
4
5
6#include <qarray.h>
7#include <qmap.h>
8#include <qregexp.h>
9#include <qstringlist.h>
10#include <qdatetime.h>
11#include <qvaluelist.h>
12
13#include <qpe/recordfields.h>
14#include <qpe/palmtopuidgen.h>
15
16#include <opie/opimrecord.h>
17
18
19class OTodo : public OPimRecord {
20public:
21 typedef QValueList<ToDoEvent> ValueList;
22 enum RecordFields {
23 Uid = Qtopia::UID_ID,
24 Category = Qtopia::CATEGORY_ID,
25 HasDate,
26 Completed,
27 Description,
28 Summary,
29 Priority,
30 DateDay,
31 DateMonth,
32 DateYear,
33 Progress,
34 CrossReference,
35 HasAlarmDateTime,
36 AlarmDateTime
37 };
38 public:
39 // priorities from Very low to very high
40 enum TaskPriority { VeryHigh=1, High, Normal, Low, VeryLow };
41
42 /* Constructs a new ToDoEvent
43 @param completed Is the TodoEvent completed
44 @param priority What is the priority of this ToDoEvent
45 @param category Which category does it belong( uid )
46 @param summary A small summary of the todo
47 @param description What is this ToDoEvent about
48 @param hasDate Does this Event got a deadline
49 @param date what is the deadline?
50 @param uid what is the UUID of this Event
51 **/
52 OTodo( bool completed = false, int priority = Normal,
53 const QStringList &category = QStringList(),
54 const QString &summary = QString::null ,
55 const QString &description = QString::null,
56 ushort progress = 0,
57 bool hasDate = false, QDate date = QDate::currentDate(),
58 int uid = -1 );
59
60 /* Copy c'tor
61
62 **/
63 OTodo(const OTodo & );
64
65 /**
66 *destructor
67 */
68 ~OTodo();
69
70 /**
71 * Is this event completed?
72 */
73 bool isCompleted() const;
74
75 /**
76 * Does this Event have a deadline
77 */
78 bool hasDueDate() const;
79
80 /**
81 * Does this Event has an alarm time ?
82 */
83 bool hasAlarmDateTime() const;
84
85 /**
86 * What is the priority?
87 */
88 int priority()const ;
89
90 /**
91 * progress as ushort 0, 20, 40, 60, 80 or 100%
92 */
93 ushort progress() const;
94
95 /**
96 * The due Date
97 */
98 QDate dueDate()const;
99
100 /**
101 * Alarm Date and Time
102 */
103 QDateTime alarmDateTime()const;
104
105 /**
106 * The description of the todo
107 */
108 QString description()const;
109
110 /**
111 * A small summary of the todo
112 */
113 QString summary() const;
114
115 /**
116 * @reimplemented
117 * Return this todoevent in a RichText formatted QString
118 */
119 QString toRichText() const;
120
121
122 /**
123 * returns a list of apps which have related items
124 */
125 QStringList relatedApps()const;
126
127 /**
128 * returns all relations for one app
129 */
130 QArray<int> relations( const QString& app )const;
131
132 /**
133 * toMap puts all data into the map. int relates
134 * to ToDoEvent RecordFields enum
135 */
136 QMap<int, QString> toMap()const;
137
138 /**
139 * Set if this Todo is completed
140 */
141 void setCompleted(bool completed );
142
143 /**
144 * set if this todo got an end data
145 */
146 void setHasDueDate( bool hasDate );
147
148 /**
149 * set if this todo has an alarm time and date
150 */
151 void setHasAlarmDateTime ( bool hasAlarm );
152
153 /**
154 * Set the priority of the Todo
155 */
156 void setPriority(int priority );
157
158 /**
159 * Set the progress.
160 */
161 void setProgress( ushort progress );
162
163 /**
164 * set the end date
165 */
166 void setDueDate( QDate date );
167
168 /**
169 * set the alarm time
170 */
171 void setAlarmDateTime ( const QDateTime& alarm );
172
173 void setDescription(const QString& );
174 void setSummary(const QString& );
175 bool isOverdue();
176
177
178 bool match( const QRegExp &r )const;
179
180 bool operator<(const OTodo &toDoEvent )const;
181 bool operator<=(const OTodo &toDoEvent )const;
182 bool operator!=(const OTodo &toDoEvent )const;
183 bool operator>(const OTodo &toDoEvent )const;
184 bool operator>=(const OTodo &toDoEvent)const;
185 bool operator==(const OTodo &toDoEvent )const;
186 ToDoEvent &operator=(const OTodo &toDoEvent );
187
188 private:
189 class OTodoPrivate;
190 struct OTodoEventData;
191
192 void deref();
193 void changeOrModify();
194 void copy( OTodoData* src, OTodoData* dest );
195 ToDoEventPrivate *d;
196 ToDoEventData *data;
197
198 static Qtopia::UidGen m_gen;
199};
200 inline bool ToDoEvent::operator!=(const ToDoEvent &toDoEvent )const {
201 return !(*this == toDoEvent);
202 }
203};
204
205#endif