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