-rw-r--r-- | core/pim/today/today.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 0f6e598..7a2d0c9 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -1,400 +1,399 @@ | |||
1 | /* | 1 | /* |
2 | * today.cpp : main class | 2 | * today.cpp : main class |
3 | * | 3 | * |
4 | * --------------------- | 4 | * --------------------- |
5 | * | 5 | * |
6 | * begin : Sun 10 17:20:00 CEST 2002 | 6 | * begin : Sun 10 17:20:00 CEST 2002 |
7 | * copyright : (c) 2002 by Maximilian Reiß | 7 | * copyright : (c) 2002 by Maximilian Reiß |
8 | * email : max.reiss@gmx.de | 8 | * email : max.reiss@gmx.de |
9 | * | 9 | * |
10 | */ | 10 | */ |
11 | /*************************************************************************** | 11 | /*************************************************************************** |
12 | * * | 12 | * * |
13 | * This program is free software; you can redistribute it and/or modify * | 13 | * This program is free software; you can redistribute it and/or modify * |
14 | * it under the terms of the GNU General Public License as published by * | 14 | * it under the terms of the GNU General Public License as published by * |
15 | * the Free Software Foundation; either version 2 of the License, or * | 15 | * the Free Software Foundation; either version 2 of the License, or * |
16 | * (at your option) any later version. * | 16 | * (at your option) any later version. * |
17 | * * | 17 | * * |
18 | ***************************************************************************/ | 18 | ***************************************************************************/ |
19 | 19 | ||
20 | #include "today.h" | 20 | #include "today.h" |
21 | #include "minidom.h" | 21 | #include "minidom.h" |
22 | #include "TodoItem.h" | 22 | #include "TodoItem.h" |
23 | 23 | ||
24 | #include <qpe/datebookdb.h> | 24 | #include <qpe/datebookdb.h> |
25 | #include <qpe/timestring.h> | 25 | #include <qpe/timestring.h> |
26 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
27 | #include <qpe/qcopenvelope_qws.h> | 27 | #include <qpe/qcopenvelope_qws.h> |
28 | #include <qpe/qprocess.h> | 28 | #include <qpe/qprocess.h> |
29 | 29 | ||
30 | #include <qdir.h> | 30 | #include <qdir.h> |
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qdatetime.h> | 32 | #include <qdatetime.h> |
33 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
34 | #include <qcheckbox.h> | 34 | #include <qcheckbox.h> |
35 | #include <qspinbox.h> | 35 | #include <qspinbox.h> |
36 | #include <qpushbutton.h> | 36 | #include <qpushbutton.h> |
37 | #include <qlabel.h> | 37 | #include <qlabel.h> |
38 | #include <qtimer.h> | 38 | #include <qtimer.h> |
39 | 39 | ||
40 | //#include <iostream.h> | 40 | //#include <iostream.h> |
41 | //#include <unistd.h> | 41 | //#include <unistd.h> |
42 | #include <stdlib.h> | 42 | #include <stdlib.h> |
43 | 43 | ||
44 | int MAX_LINES_TASK; | 44 | int MAX_LINES_TASK; |
45 | int MAX_CHAR_CLIP; | 45 | int MAX_CHAR_CLIP; |
46 | int MAX_LINES_MEET; | 46 | int MAX_LINES_MEET; |
47 | int SHOW_LOCATION; | 47 | int SHOW_LOCATION; |
48 | int SHOW_NOTES; | 48 | int SHOW_NOTES; |
49 | // show only later dates | 49 | // show only later dates |
50 | int ONLY_LATER; | 50 | int ONLY_LATER; |
51 | /* | 51 | /* |
52 | * Constructs a Example which is a child of 'parent', with the | 52 | * Constructs a Example which is a child of 'parent', with the |
53 | * name 'name' and widget flags set to 'f' | 53 | * name 'name' and widget flags set to 'f' |
54 | */ | 54 | */ |
55 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 55 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
56 | : TodayBase( parent, name, fl ) | 56 | : TodayBase( parent, name, fl ) |
57 | { | 57 | { |
58 | QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); | 58 | QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); |
59 | QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); | 59 | QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); |
60 | QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); | 60 | QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); |
61 | QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); | 61 | QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); |
62 | 62 | ||
63 | QDate date = QDate::currentDate(); | 63 | QDate date = QDate::currentDate(); |
64 | QString time = (date.toString()); | 64 | QString time = (date.toString()); |
65 | TextLabel1->setText(time); | 65 | TextLabel1->setText(time); |
66 | db = new DateBookDB; | 66 | db = new DateBookDB; |
67 | 67 | ||
68 | draw(); | 68 | draw(); |
69 | } | 69 | } |
70 | 70 | ||
71 | 71 | ||
72 | void Today::draw() | 72 | void Today::draw() |
73 | { | 73 | { |
74 | init(); | 74 | init(); |
75 | getDates(); | 75 | getDates(); |
76 | getMail(); | 76 | getMail(); |
77 | getTodo(); | 77 | getTodo(); |
78 | // how often refresh | 78 | // how often refresh |
79 | QTimer::singleShot( 30*1000, this, SLOT(draw()) ); | 79 | QTimer::singleShot( 30*1000, this, SLOT(draw()) ); |
80 | 80 | ||
81 | } | 81 | } |
82 | 82 | ||
83 | void Today::init() | 83 | void Today::init() |
84 | { | 84 | { |
85 | // read config | 85 | // read config |
86 | Config cfg("today"); | 86 | Config cfg("today"); |
87 | cfg.setGroup("BaseConfig"); | 87 | cfg.setGroup("BaseConfig"); |
88 | 88 | ||
89 | // how many lines should be showed in the task section | 89 | // how many lines should be showed in the task section |
90 | MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5); | 90 | MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5); |
91 | // after how many chars should the be cut off on tasks and notes | 91 | // after how many chars should the be cut off on tasks and notes |
92 | MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",30); | 92 | MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",30); |
93 | // how many lines should be showed in the datebook section | 93 | // how many lines should be showed in the datebook section |
94 | MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); | 94 | MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); |
95 | // If location is to be showed too, 1 to activate it. | 95 | // If location is to be showed too, 1 to activate it. |
96 | SHOW_LOCATION = cfg.readNumEntry("showlocation",1); | 96 | SHOW_LOCATION = cfg.readNumEntry("showlocation",1); |
97 | // if notes should be shown | 97 | // if notes should be shown |
98 | SHOW_NOTES = cfg.readNumEntry("shownotes",0); | 98 | SHOW_NOTES = cfg.readNumEntry("shownotes",0); |
99 | ONLY_LATER = cfg.readNumEntry("onlylater",1); | 99 | ONLY_LATER = cfg.readNumEntry("onlylater",1); |
100 | 100 | ||
101 | } | 101 | } |
102 | 102 | ||
103 | void Today::startConfig() | 103 | void Today::startConfig() |
104 | { | 104 | { |
105 | conf = new todayconfig ( this, "", true ); | 105 | conf = new todayconfig ( this, "", true ); |
106 | 106 | ||
107 | 107 | ||
108 | //Config cfg = new Config("today"); | 108 | //Config cfg = new Config("today"); |
109 | 109 | ||
110 | // read the config | 110 | // read the config |
111 | Config cfg("today"); | 111 | Config cfg("today"); |
112 | cfg.setGroup("BaseConfig"); | 112 | cfg.setGroup("BaseConfig"); |
113 | 113 | ||
114 | //init(); | 114 | //init(); |
115 | 115 | ||
116 | conf->SpinBox1->setValue(MAX_LINES_MEET); | 116 | conf->SpinBox1->setValue(MAX_LINES_MEET); |
117 | // location show box | 117 | // location show box |
118 | conf->CheckBox1->setChecked(SHOW_LOCATION); | 118 | conf->CheckBox1->setChecked(SHOW_LOCATION); |
119 | // notes show box | 119 | // notes show box |
120 | conf->CheckBox2->setChecked(SHOW_NOTES); | 120 | conf->CheckBox2->setChecked(SHOW_NOTES); |
121 | // task lines | 121 | // task lines |
122 | conf->SpinBox2->setValue(MAX_LINES_TASK); | 122 | conf->SpinBox2->setValue(MAX_LINES_TASK); |
123 | // clip when? | 123 | // clip when? |
124 | conf->SpinBox7->setValue(MAX_CHAR_CLIP); | 124 | conf->SpinBox7->setValue(MAX_CHAR_CLIP); |
125 | // only later | 125 | // only later |
126 | conf->CheckBox3->setChecked(ONLY_LATER); | 126 | conf->CheckBox3->setChecked(ONLY_LATER); |
127 | 127 | ||
128 | conf->exec(); | 128 | conf->exec(); |
129 | 129 | ||
130 | int maxlinestask = conf->SpinBox2->value(); | 130 | int maxlinestask = conf->SpinBox2->value(); |
131 | int maxmeet = conf->SpinBox1->value(); | 131 | int maxmeet = conf->SpinBox1->value(); |
132 | int location = conf->CheckBox1->isChecked(); | 132 | int location = conf->CheckBox1->isChecked(); |
133 | int notes = conf->CheckBox2->isChecked(); | 133 | int notes = conf->CheckBox2->isChecked(); |
134 | int maxcharclip = conf->SpinBox7->value(); | 134 | int maxcharclip = conf->SpinBox7->value(); |
135 | int onlylater = conf->CheckBox3->isChecked(); | 135 | int onlylater = conf->CheckBox3->isChecked(); |
136 | 136 | ||
137 | cfg.writeEntry("maxlinestask",maxlinestask); | 137 | cfg.writeEntry("maxlinestask",maxlinestask); |
138 | cfg.writeEntry("maxcharclip", maxcharclip); | 138 | cfg.writeEntry("maxcharclip", maxcharclip); |
139 | cfg.writeEntry("maxlinesmeet",maxmeet); | 139 | cfg.writeEntry("maxlinesmeet",maxmeet); |
140 | cfg.writeEntry("showlocation",location); | 140 | cfg.writeEntry("showlocation",location); |
141 | cfg.writeEntry("shownotes", notes); | 141 | cfg.writeEntry("shownotes", notes); |
142 | cfg.writeEntry("onlylater", onlylater); | 142 | cfg.writeEntry("onlylater", onlylater); |
143 | // sync it to "disk" | 143 | // sync it to "disk" |
144 | cfg.write(); | 144 | cfg.write(); |
145 | 145 | ||
146 | draw(); | 146 | draw(); |
147 | } | 147 | } |
148 | 148 | ||
149 | 149 | ||
150 | /* | 150 | /* |
151 | * Get all events that are in the datebook xml file for today | 151 | * Get all events that are in the datebook xml file for today |
152 | */ | 152 | */ |
153 | void Today::getDates() | 153 | void Today::getDates() |
154 | { | 154 | { |
155 | QDate date = QDate::currentDate(); | 155 | QDate date = QDate::currentDate(); |
156 | QTime time = QTime::currentTime(); | 156 | QTime time = QTime::currentTime(); |
157 | QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); | 157 | QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); |
158 | 158 | ||
159 | Config config( "qpe" ); | 159 | Config config( "qpe" ); |
160 | // if 24 h format | 160 | // if 24 h format |
161 | // bool ampm = config.readBoolEntry( "AMPM", TRUE ); | 161 | // bool ampm = config.readBoolEntry( "AMPM", TRUE ); |
162 | 162 | ||
163 | int count=0; | 163 | int count=0; |
164 | 164 | ||
165 | if ( list.count() > 0 ) { | 165 | if ( list.count() > 0 ) { |
166 | QString msg; | 166 | QString msg; |
167 | 167 | ||
168 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); | 168 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); |
169 | it!=list.end(); ++it ) { | 169 | it!=list.end(); ++it ) { |
170 | 170 | ||
171 | count++; | 171 | count++; |
172 | 172 | ||
173 | if ( count <= MAX_LINES_MEET ) | 173 | if ( count <= MAX_LINES_MEET ) |
174 | { | 174 | { |
175 | //only get events past current time (start or end??) | 175 | //only get events past current time (start or end??) |
176 | //cout << time.toString() << endl; | 176 | //cout << time.toString() << endl; |
177 | //cout << TimeString::dateString((*it).event().end()) << endl; | 177 | //cout << TimeString::dateString((*it).event().end()) << endl; |
178 | // still some bug in here, 1 h off | 178 | // still some bug in here, 1 h off |
179 | 179 | ||
180 | // decide if to get all day or only later appointments | 180 | // decide if to get all day or only later appointments |
181 | if (!ONLY_LATER) | 181 | if (!ONLY_LATER) |
182 | { | 182 | { |
183 | msg += "<B>" + (*it).description() + "</B>"; | 183 | msg += "<B>" + (*it).description() + "</B>"; |
184 | // include location or not | 184 | // include location or not |
185 | if (SHOW_LOCATION == 1) | 185 | if (SHOW_LOCATION == 1) |
186 | { | 186 | { |
187 | msg+= "<BR>" + (*it).location(); | 187 | msg+= "<BR>" + (*it).location(); |
188 | } | 188 | } |
189 | msg += "<BR>" | 189 | msg += "<BR>" |
190 | // start time of event | 190 | // start time of event |
191 | + TimeString::timeString(QTime((*it).event().start().time()) ) | 191 | + TimeString::timeString(QTime((*it).event().start().time()) ) |
192 | // end time of event | 192 | // end time of event |
193 | + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ) | 193 | + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ) |
194 | + "<BR>"; | 194 | + "<BR>"; |
195 | // include possible note or not | 195 | // include possible note or not |
196 | if (SHOW_NOTES == 1) | 196 | if (SHOW_NOTES == 1) |
197 | { | 197 | { |
198 | msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; | 198 | msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; |
199 | } | 199 | } |
200 | } | 200 | } |
201 | else if ((time.toString() <= TimeString::dateString((*it).event().end())) && ONLY_LATER ) | 201 | else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) |
202 | { | 202 | { |
203 | msg += "<B>" + (*it).description() + "</B>"; | 203 | msg += "<B>" + (*it).description() + "</B>"; |
204 | // include location or not | 204 | // include location or not |
205 | if (SHOW_LOCATION == 1) | 205 | if (SHOW_LOCATION == 1) |
206 | { | 206 | { |
207 | msg+= "<BR>" + (*it).location(); | 207 | msg+= "<BR>" + (*it).location(); |
208 | } | 208 | } |
209 | msg += "<BR>" | 209 | msg += "<BR>" |
210 | // start time of event | 210 | // start time of event |
211 | + TimeString::timeString(QTime((*it).event().start().time()) ) | 211 | + TimeString::timeString(QTime((*it).event().start().time()) ) |
212 | // end time of event | 212 | // end time of event |
213 | + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ) | 213 | + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ) |
214 | + "<BR>"; | 214 | + "<BR>"; |
215 | // include possible note or not | 215 | // include possible note or not |
216 | if (SHOW_NOTES == 1) | 216 | if (SHOW_NOTES == 1) |
217 | { | 217 | { |
218 | msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; | 218 | msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; |
219 | } | 219 | } |
220 | } | 220 | } |
221 | } | 221 | } |
222 | |||
223 | if (msg.isEmpty()) | ||
224 | { | ||
225 | msg = "No more appointments today"; | ||
226 | } | ||
227 | } | 222 | } |
223 | if (msg.isEmpty()) | ||
224 | { | ||
225 | msg = "No more appointments today"; | ||
226 | } | ||
228 | DatesField->setText(msg); | 227 | DatesField->setText(msg); |
229 | } | 228 | } |
230 | } | 229 | } |
231 | 230 | ||
232 | /* | 231 | /* |
233 | * Parse in the todolist.xml | 232 | * Parse in the todolist.xml |
234 | * | 233 | * |
235 | */ | 234 | */ |
236 | QList<TodoItem> Today::loadTodo(const char *filename) | 235 | QList<TodoItem> Today::loadTodo(const char *filename) |
237 | { | 236 | { |
238 | DOM *todo; | 237 | DOM *todo; |
239 | ELE *tasks; | 238 | ELE *tasks; |
240 | ELE **tasklist; | 239 | ELE **tasklist; |
241 | ATT **attlist; | 240 | ATT **attlist; |
242 | int i, j; | 241 | int i, j; |
243 | char *description; | 242 | char *description; |
244 | int completed; | 243 | int completed; |
245 | int priority; | 244 | int priority; |
246 | TodoItem *tmp; | 245 | TodoItem *tmp; |
247 | QList<TodoItem> loadtodolist; | 246 | QList<TodoItem> loadtodolist; |
248 | 247 | ||
249 | todo = minidom_load(filename); | 248 | todo = minidom_load(filename); |
250 | 249 | ||
251 | tasks = todo->el; | 250 | tasks = todo->el; |
252 | tasks = tasks->el[0]; /*!DOCTYPE-quickhack*/ | 251 | tasks = tasks->el[0]; /*!DOCTYPE-quickhack*/ |
253 | if(tasks) | 252 | if(tasks) |
254 | { | 253 | { |
255 | tasklist = tasks->el; | 254 | tasklist = tasks->el; |
256 | i = 0; | 255 | i = 0; |
257 | while((tasklist) && (tasklist[i])) | 256 | while((tasklist) && (tasklist[i])) |
258 | { | 257 | { |
259 | attlist = tasklist[i]->at; | 258 | attlist = tasklist[i]->at; |
260 | j = 0; | 259 | j = 0; |
261 | description = NULL; | 260 | description = NULL; |
262 | priority = -1; | 261 | priority = -1; |
263 | completed = -1; | 262 | completed = -1; |
264 | while((attlist) && (attlist[j])) | 263 | while((attlist) && (attlist[j])) |
265 | { | 264 | { |
266 | if(!attlist[i]->name) continue; | 265 | if(!attlist[i]->name) continue; |
267 | if(!strcmp(attlist[j]->name, "Description")) | 266 | if(!strcmp(attlist[j]->name, "Description")) |
268 | { | 267 | { |
269 | description = attlist[j]->value; | 268 | description = attlist[j]->value; |
270 | } | 269 | } |
271 | // get Completed tag (0 or 1) | 270 | // get Completed tag (0 or 1) |
272 | if(!strcmp(attlist[j]->name, "Completed")) | 271 | if(!strcmp(attlist[j]->name, "Completed")) |
273 | { | 272 | { |
274 | QString s = attlist[j]->name; | 273 | QString s = attlist[j]->name; |
275 | if(s == "Completed") | 274 | if(s == "Completed") |
276 | { | 275 | { |
277 | completed = QString(attlist[j]->value).toInt(); | 276 | completed = QString(attlist[j]->value).toInt(); |
278 | } | 277 | } |
279 | } | 278 | } |
280 | // get Priority (1 to 5) | 279 | // get Priority (1 to 5) |
281 | if(!strcmp(attlist[j]->name, "Priority")) | 280 | if(!strcmp(attlist[j]->name, "Priority")) |
282 | { | 281 | { |
283 | QString s = attlist[j]->name; | 282 | QString s = attlist[j]->name; |
284 | if(s == "Priority") | 283 | if(s == "Priority") |
285 | { | 284 | { |
286 | priority = QString(attlist[j]->value).toInt(); | 285 | priority = QString(attlist[j]->value).toInt(); |
287 | } | 286 | } |
288 | } | 287 | } |
289 | j++; | 288 | j++; |
290 | } | 289 | } |
291 | if(description) | 290 | if(description) |
292 | { | 291 | { |
293 | tmp = new TodoItem(description, completed, priority); | 292 | tmp = new TodoItem(description, completed, priority); |
294 | loadtodolist.append(tmp); | 293 | loadtodolist.append(tmp); |
295 | } | 294 | } |
296 | i++; | 295 | i++; |
297 | } | 296 | } |
298 | } | 297 | } |
299 | 298 | ||
300 | minidom_free(todo); | 299 | minidom_free(todo); |
301 | 300 | ||
302 | return loadtodolist; | 301 | return loadtodolist; |
303 | } | 302 | } |
304 | 303 | ||
305 | 304 | ||
306 | void Today::getMail() | 305 | void Today::getMail() |
307 | { | 306 | { |
308 | Config cfg("opiemail"); | 307 | Config cfg("opiemail"); |
309 | cfg.setGroup("today"); | 308 | cfg.setGroup("today"); |
310 | 309 | ||
311 | // how many lines should be showed in the task section | 310 | // how many lines should be showed in the task section |
312 | int NEW_MAILS = cfg.readNumEntry("newmails",0); | 311 | int NEW_MAILS = cfg.readNumEntry("newmails",0); |
313 | int OUTGOING = cfg.readNumEntry("outgoing",0); | 312 | int OUTGOING = cfg.readNumEntry("outgoing",0); |
314 | 313 | ||
315 | QString output = tr("<b>%1</b> new mails, <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); | 314 | QString output = tr("<b>%1</b> new mails, <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); |
316 | 315 | ||
317 | 316 | ||
318 | MailField->setText(output); | 317 | MailField->setText(output); |
319 | } | 318 | } |
320 | 319 | ||
321 | 320 | ||
322 | /* | 321 | /* |
323 | * Get the todos | 322 | * Get the todos |
324 | * | 323 | * |
325 | */ | 324 | */ |
326 | void Today::getTodo() | 325 | void Today::getTodo() |
327 | { | 326 | { |
328 | QString output; | 327 | QString output; |
329 | QString tmpout; | 328 | QString tmpout; |
330 | int count = 0; | 329 | int count = 0; |
331 | 330 | ||
332 | QDir dir; | 331 | QDir dir; |
333 | QString homedir = dir.homeDirPath (); | 332 | QString homedir = dir.homeDirPath (); |
334 | // see if todolist.xml does exist. | 333 | // see if todolist.xml does exist. |
335 | QFile f(homedir +"/Applications/todolist/todolist.xml"); | 334 | QFile f(homedir +"/Applications/todolist/todolist.xml"); |
336 | if ( f.exists() ) | 335 | if ( f.exists() ) |
337 | { | 336 | { |
338 | QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml"); | 337 | QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml"); |
339 | 338 | ||
340 | TodoItem *item; | 339 | TodoItem *item; |
341 | for( item = todolist.first(); item; item = todolist.next()) | 340 | for( item = todolist.first(); item; item = todolist.next()) |
342 | { | 341 | { |
343 | if (!(item->getCompleted() == 1) ) | 342 | if (!(item->getCompleted() == 1) ) |
344 | { | 343 | { |
345 | count++; | 344 | count++; |
346 | if (count <= MAX_LINES_TASK) | 345 | if (count <= MAX_LINES_TASK) |
347 | { | 346 | { |
348 | tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>"))); | 347 | tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>"))); |
349 | } | 348 | } |
350 | } | 349 | } |
351 | } | 350 | } |
352 | } | 351 | } |
353 | 352 | ||
354 | if (count > 0) | 353 | if (count > 0) |
355 | { | 354 | { |
356 | output = QString("There are <b> %1</b> active tasks: <br>").arg(count); | 355 | output = QString("There are <b> %1</b> active tasks: <br>").arg(count); |
357 | output += tmpout; | 356 | output += tmpout; |
358 | } | 357 | } |
359 | else | 358 | else |
360 | { | 359 | { |
361 | output = ("No active tasks"); | 360 | output = ("No active tasks"); |
362 | } | 361 | } |
363 | 362 | ||
364 | TodoField->setText(output); | 363 | TodoField->setText(output); |
365 | } | 364 | } |
366 | 365 | ||
367 | /* | 366 | /* |
368 | * launches datebook | 367 | * launches datebook |
369 | */ | 368 | */ |
370 | void Today::startDatebook() | 369 | void Today::startDatebook() |
371 | { | 370 | { |
372 | QCopEnvelope e("QPE/System", "execute(QString)"); | 371 | QCopEnvelope e("QPE/System", "execute(QString)"); |
373 | e << QString("datebook"); | 372 | e << QString("datebook"); |
374 | } | 373 | } |
375 | 374 | ||
376 | /* | 375 | /* |
377 | * launches todolist | 376 | * launches todolist |
378 | */ | 377 | */ |
379 | void Today::startTodo() | 378 | void Today::startTodo() |
380 | { | 379 | { |
381 | QCopEnvelope e("QPE/System", "execute(QString)"); | 380 | QCopEnvelope e("QPE/System", "execute(QString)"); |
382 | e << QString("todolist"); | 381 | e << QString("todolist"); |
383 | } | 382 | } |
384 | 383 | ||
385 | /* | 384 | /* |
386 | * launch opiemail | 385 | * launch opiemail |
387 | */ | 386 | */ |
388 | void Today::startMail() | 387 | void Today::startMail() |
389 | { | 388 | { |
390 | QCopEnvelope e("QPE/System", "execute(QString)"); | 389 | QCopEnvelope e("QPE/System", "execute(QString)"); |
391 | e << QString("opiemail"); | 390 | e << QString("opiemail"); |
392 | } | 391 | } |
393 | 392 | ||
394 | /* | 393 | /* |
395 | * Destroys the object and frees any allocated resources | 394 | * Destroys the object and frees any allocated resources |
396 | */ | 395 | */ |
397 | Today::~Today() | 396 | Today::~Today() |
398 | { | 397 | { |
399 | // no need to delete child widgets, Qt does it all for us | 398 | // no need to delete child widgets, Qt does it all for us |
400 | } | 399 | } |