author | harlekin <harlekin> | 2002-03-11 21:33:49 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-03-11 21:33:49 (UTC) |
commit | 3c5feb8676f75f4e218ea0278f02d225e8985301 (patch) (unidiff) | |
tree | a57765d4e72a73e3310eaa91fa9cce2e51a6710a | |
parent | 990d0ad3664c24e8909027ae4d3839f4e318ea00 (diff) | |
download | opie-3c5feb8676f75f4e218ea0278f02d225e8985301.zip opie-3c5feb8676f75f4e218ea0278f02d225e8985301.tar.gz opie-3c5feb8676f75f4e218ea0278f02d225e8985301.tar.bz2 |
brown paperbag I
-rw-r--r-- | core/pim/today/today.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 69bcb68..d10082f 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -310,169 +310,168 @@ QList<TodoItem> Today::loadTodo(const char *filename) { | |||
310 | return loadtodolist; | 310 | return loadtodolist; |
311 | } | 311 | } |
312 | 312 | ||
313 | 313 | ||
314 | void Today::getMail() { | 314 | void Today::getMail() { |
315 | Config cfg("opiemail"); | 315 | Config cfg("opiemail"); |
316 | cfg.setGroup("today"); | 316 | cfg.setGroup("today"); |
317 | 317 | ||
318 | // how many lines should be showed in the task section | 318 | // how many lines should be showed in the task section |
319 | int NEW_MAILS = cfg.readNumEntry("newmails",0); | 319 | int NEW_MAILS = cfg.readNumEntry("newmails",0); |
320 | int OUTGOING = cfg.readNumEntry("outgoing",0); | 320 | int OUTGOING = cfg.readNumEntry("outgoing",0); |
321 | 321 | ||
322 | 322 | ||
323 | QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); | 323 | QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); |
324 | 324 | ||
325 | 325 | ||
326 | MailField->setText(output); | 326 | MailField->setText(output); |
327 | } | 327 | } |
328 | 328 | ||
329 | 329 | ||
330 | /* | 330 | /* |
331 | * Get the todos | 331 | * Get the todos |
332 | * | 332 | * |
333 | */ | 333 | */ |
334 | void Today::getTodo() { | 334 | void Today::getTodo() { |
335 | 335 | ||
336 | // if the todolist.xml file was not modified in between, do not parse it. | 336 | // if the todolist.xml file was not modified in between, do not parse it. |
337 | if (!checkIfModified() && !NEW_START) { | 337 | if (!checkIfModified() && !NEW_START) { |
338 | return; | 338 | return; |
339 | } | 339 | } |
340 | NEW_START=0; | 340 | NEW_START=0; |
341 | 341 | ||
342 | QString output; | 342 | QString output; |
343 | QString tmpout; | 343 | QString tmpout; |
344 | int count = 0; | 344 | int count = 0; |
345 | 345 | ||
346 | QDir dir; | 346 | QDir dir; |
347 | QString homedir = dir.homeDirPath (); | 347 | QString homedir = dir.homeDirPath (); |
348 | // see if todolist.xml does exist. | 348 | // see if todolist.xml does exist. |
349 | QFile f(homedir +"/Applications/todolist/todolist.xml"); | 349 | QFile f(homedir +"/Applications/todolist/todolist.xml"); |
350 | if ( f.exists() ) { | 350 | if ( f.exists() ) { |
351 | QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml"); | 351 | QList<TodoItem> todolist = loadTodo(homedir +"/Applications/todolist/todolist.xml"); |
352 | 352 | ||
353 | TodoItem *item; | 353 | TodoItem *item; |
354 | for( item = todolist.first(); item; item = todolist.next()) { | 354 | for( item = todolist.first(); item; item = todolist.next()) { |
355 | if (!(item->getCompleted() == 1) ) { | 355 | if (!(item->getCompleted() == 1) ) { |
356 | count++; | 356 | count++; |
357 | if (count <= MAX_LINES_TASK) { | 357 | if (count <= MAX_LINES_TASK) { |
358 | tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>"))); | 358 | tmpout += "<b>- </b>" + QString(((item)->getDescription().mid(0, MAX_CHAR_CLIP) + ("<br>"))); |
359 | } | 359 | } |
360 | } | 360 | } |
361 | } | 361 | } |
362 | } | 362 | } |
363 | 363 | ||
364 | if (count > 0) { | 364 | if (count > 0) { |
365 | if( count == 1 ) { | 365 | if( count == 1 ) { |
366 | output = tr("There is <b> 1</b> active task: <br>" ); | 366 | output = tr("There is <b> 1</b> active task: <br>" ); |
367 | } else { | 367 | } else { |
368 | output = tr("There are <b> %1</b> active tasks: <br>").arg(count); | 368 | output = tr("There are <b> %1</b> active tasks: <br>").arg(count); |
369 | } | 369 | } |
370 | output += tmpout; | 370 | output += tmpout; |
371 | } else { | 371 | } else { |
372 | output = tr("No active tasks"); | 372 | output = tr("No active tasks"); |
373 | } | 373 | } |
374 | 374 | ||
375 | TodoField->setText(tr(output)); | 375 | TodoField->setText(tr(output)); |
376 | } | 376 | } |
377 | 377 | ||
378 | /* | 378 | /* |
379 | * launches datebook | 379 | * launches datebook |
380 | */ | 380 | */ |
381 | void Today::startDatebook() { | 381 | void Today::startDatebook() { |
382 | QCopEnvelope e("QPE/System", "execute(QString)"); | 382 | QCopEnvelope e("QPE/System", "execute(QString)"); |
383 | e << QString("datebook"); | 383 | e << QString("datebook"); |
384 | } | 384 | } |
385 | 385 | ||
386 | /* | 386 | /* |
387 | * launches todolist | 387 | * launches todolist |
388 | */ | 388 | */ |
389 | void Today::startTodo() { | 389 | void Today::startTodo() { |
390 | QCopEnvelope e("QPE/System", "execute(QString)"); | 390 | QCopEnvelope e("QPE/System", "execute(QString)"); |
391 | e << QString("todolist"); | 391 | e << QString("todolist"); |
392 | } | 392 | } |
393 | 393 | ||
394 | /* | 394 | /* |
395 | * launch opiemail | 395 | * launch opiemail |
396 | */ | 396 | */ |
397 | void Today::startMail() { | 397 | void Today::startMail() { |
398 | QCopEnvelope e("QPE/System", "execute(QString)"); | 398 | QCopEnvelope e("QPE/System", "execute(QString)"); |
399 | e << QString("opiemail"); | 399 | e << QString("opiemail"); |
400 | } | 400 | } |
401 | 401 | ||
402 | /* | 402 | /* |
403 | * Destroys the object and frees any allocated resources | 403 | * Destroys the object and frees any allocated resources |
404 | */ | 404 | */ |
405 | Today::~Today() { | 405 | Today::~Today() { |
406 | // no need to delete child widgets, Qt does it all for us | 406 | // no need to delete child widgets, Qt does it all for us |
407 | } | 407 | } |
408 | 408 | ||
409 | 409 | ||
410 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | 410 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, |
411 | QWidget* parent = 0, | 411 | QWidget* parent = 0, |
412 | const char* name = 0, | 412 | const char* name = 0, |
413 | WFlags fl = 0) : | 413 | WFlags fl = 0) : |
414 | ClickableLabel(parent,name,fl), event(ev) { | 414 | ClickableLabel(parent,name,fl), event(ev) { |
415 | 415 | ||
416 | QString msg; | 416 | QString msg; |
417 | QTime time = QTime::currentTime(); | 417 | QTime time = QTime::currentTime(); |
418 | 418 | ||
419 | if (!ONLY_LATER) { | 419 | if (!ONLY_LATER) { |
420 | msg += "<B>" + (ev).description() + "</B>"; | 420 | msg += "<B>" + (ev).description() + "</B>"; |
421 | if ( (ev).event().hasAlarm() ) { | 421 | if ( (ev).event().hasAlarm() ) { |
422 | msg += " <b>[with alarm]</b>"; | 422 | msg += " <b>[with alarm]</b>"; |
423 | } | 423 | } |
424 | // include location or not | 424 | // include location or not |
425 | if (SHOW_LOCATION == 1) { | 425 | if (SHOW_LOCATION == 1) { |
426 | msg += "<BR><i>" + (ev).location(); | 426 | msg += "<BR><i>" + (ev).location(); |
427 | msg += "</i>"; | 427 | msg += "</i>"; |
428 | } | 428 | } |
429 | 429 | ||
430 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { | 430 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { |
431 | msg += "<br>All day"; | 431 | msg += "<br>All day"; |
432 | } else { | 432 | } else { |
433 | // start time of event | 433 | // start time of event |
434 | msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) ) | 434 | msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) ) |
435 | // end time of event | 435 | // end time of event |
436 | + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) ); | 436 | + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) ); |
437 | } | 437 | } |
438 | msg += "<BR>"; | ||
439 | // include possible note or not | 438 | // include possible note or not |
440 | if (SHOW_NOTES == 1) { | 439 | if (SHOW_NOTES == 1) { |
441 | msg += " <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; | 440 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; |
442 | } | 441 | } |
443 | } else if ((time.toString() <= TimeString::dateString((ev).event().end())) ) { | 442 | } else if ((time.toString() <= TimeString::dateString((ev).event().end())) ) { |
444 | msg += "<B>" + (ev).description() + "</B>"; | 443 | msg += "<B>" + (ev).description() + "</B>"; |
445 | if ( (ev).event().hasAlarm() ) { | 444 | if ( (ev).event().hasAlarm() ) { |
446 | msg += " <b>[with alarm]</b>"; | 445 | msg += " <b>[with alarm]</b>"; |
447 | } | 446 | } |
448 | // include location or not | 447 | // include location or not |
449 | if (SHOW_LOCATION == 1) { | 448 | if (SHOW_LOCATION == 1) { |
450 | msg+= "<BR><i>" + (ev).location(); | 449 | msg += "<BR><i>" + (ev).location(); |
451 | msg += "</i>"; | 450 | msg += "</i>"; |
452 | } | 451 | } |
453 | 452 | ||
454 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { | 453 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { |
455 | msg += "<br>All day"; | 454 | msg += "<br>All day"; |
456 | } else { | 455 | } else { |
457 | // start time of event | 456 | // start time of event |
458 | msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) ) | 457 | msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) ) |
459 | // end time of event | 458 | // end time of event |
460 | + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) ); | 459 | + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) ); |
461 | } | 460 | } |
462 | // include possible note or not | 461 | // include possible note or not |
463 | if (SHOW_NOTES == 1) { | 462 | if (SHOW_NOTES == 1) { |
464 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; | 463 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; |
465 | } | 464 | } |
466 | } | 465 | } |
467 | 466 | ||
468 | setText(msg); | 467 | setText(msg); |
469 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 468 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
470 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 469 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
471 | } | 470 | } |
472 | 471 | ||
473 | void DateBookEvent::editMe() { | 472 | void DateBookEvent::editMe() { |
474 | emit editEvent(event.event()); | 473 | emit editEvent(event.event()); |
475 | } | 474 | } |
476 | 475 | ||
477 | 476 | ||
478 | 477 | ||