summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 1cb4881..87a7970 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -327,257 +327,257 @@ void Today::getDates() {
327 // show only later appointments 327 // show only later appointments
328 DateBookEventLater *l=new DateBookEventLater(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES); 328 DateBookEventLater *l=new DateBookEventLater(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES);
329 layoutDates->addWidget(l); 329 layoutDates->addWidget(l);
330 connect (l, SIGNAL(editEvent(const Event &)), 330 connect (l, SIGNAL(editEvent(const Event &)),
331 this, SLOT(editEvent(const Event &))); 331 this, SLOT(editEvent(const Event &)));
332 } 332 }
333 } 333 }
334 } 334 }
335 if (ONLY_LATER && count==0) { 335 if (ONLY_LATER && count==0) {
336 QLabel* noMoreEvents = new QLabel(AllDateBookEvents); 336 QLabel* noMoreEvents = new QLabel(AllDateBookEvents);
337 noMoreEvents->setText(tr("No more appointments today")); 337 noMoreEvents->setText(tr("No more appointments today"));
338 layoutDates->addWidget(noMoreEvents); 338 layoutDates->addWidget(noMoreEvents);
339 } 339 }
340 } else { 340 } else {
341 QLabel* noEvents = new QLabel(AllDateBookEvents); 341 QLabel* noEvents = new QLabel(AllDateBookEvents);
342 noEvents->setText(tr("No appointments today")); 342 noEvents->setText(tr("No appointments today"));
343 layoutDates->addWidget(noEvents); 343 layoutDates->addWidget(noEvents);
344 } 344 }
345 345
346 layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); 346 layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
347 sv1->addChild(AllDateBookEvents); 347 sv1->addChild(AllDateBookEvents);
348 AllDateBookEvents->show(); 348 AllDateBookEvents->show();
349} 349}
350 350
351 351
352void Today::getMail() { 352void Today::getMail() {
353 Config cfg("opiemail"); 353 Config cfg("opiemail");
354 cfg.setGroup("today"); 354 cfg.setGroup("today");
355 355
356 // how many lines should be showed in the task section 356 // how many lines should be showed in the task section
357 int NEW_MAILS = cfg.readNumEntry("newmails",0); 357 int NEW_MAILS = cfg.readNumEntry("newmails",0);
358 int OUTGOING = cfg.readNumEntry("outgoing",0); 358 int OUTGOING = cfg.readNumEntry("outgoing",0);
359 359
360 QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); 360 QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING);
361 361
362 MailField->setText(output); 362 MailField->setText(output);
363} 363}
364 364
365 365
366/* 366/*
367 * Get the todos 367 * Get the todos
368 */ 368 */
369void Today::getTodo() { 369void Today::getTodo() {
370 370
371 QString output; 371 QString output;
372 QString tmpout; 372 QString tmpout;
373 int count = 0; 373 int count = 0;
374 int ammount = 0; 374 int ammount = 0;
375 375
376 // get overdue todos first 376 // get overdue todos first
377 QValueList<ToDoEvent> overDueList = todo->overDue(); 377 QValueList<ToDoEvent> overDueList = todo->overDue();
378 qBubbleSort(overDueList); 378 qBubbleSort(overDueList);
379 for ( QValueList<ToDoEvent>::Iterator it=overDueList.begin(); 379 for ( QValueList<ToDoEvent>::Iterator it=overDueList.begin();
380 it!=overDueList.end(); ++it ) { 380 it!=overDueList.end(); ++it ) {
381 if (!(*it).isCompleted() && ( ammount < MAX_LINES_TASK) ) { 381 if (!(*it).isCompleted() && ( ammount < MAX_LINES_TASK) ) {
382 tmpout += "<font color=#e00000><b>-" +((*it).description()).mid(0, MAX_CHAR_CLIP) + "</b></font><br>"; 382 tmpout += "<font color=#e00000><b>-" +((*it).description()).mid(0, MAX_CHAR_CLIP) + "</b></font><br>";
383 ammount++; 383 ammount++;
384 } 384 }
385 } 385 }
386 386
387 // get total number of still open todos 387 // get total number of still open todos
388 QValueList<ToDoEvent> open = todo->rawToDos(); 388 QValueList<ToDoEvent> open = todo->rawToDos();
389 qBubbleSort(open); 389 qBubbleSort(open);
390 for ( QValueList<ToDoEvent>::Iterator it=open.begin(); 390 for ( QValueList<ToDoEvent>::Iterator it=open.begin();
391 it!=open.end(); ++it ) { 391 it!=open.end(); ++it ) {
392 if (!(*it).isCompleted()){ 392 if (!(*it).isCompleted()){
393 count +=1; 393 count +=1;
394 // not the overdues, we allready got them, and not if we are 394 // not the overdues, we allready got them, and not if we are
395 // over the maxlines 395 // over the maxlines
396 if (!(*it).isOverdue() && ( ammount < MAX_LINES_TASK) ) { 396 if (!(*it).isOverdue() && ( ammount < MAX_LINES_TASK) ) {
397 tmpout += "<b>-</b>" + ((*it).description()).mid(0, MAX_CHAR_CLIP) + "<br>"; 397 tmpout += "<b>-</b>" + ((*it).description()).mid(0, MAX_CHAR_CLIP) + "<br>";
398 ammount++; 398 ammount++;
399 } 399 }
400 } 400 }
401 } 401 }
402 402
403 403
404 if (count > 0) { 404 if (count > 0) {
405 if( count == 1 ) { 405 if( count == 1 ) {
406 output = tr("There is <b> 1</b> active task: <br>" ); 406 output = tr("There is <b> 1</b> active task: <br>" );
407 } else { 407 } else {
408 output = tr("There are <b> %1</b> active tasks: <br>").arg(count); 408 output = tr("There are <b> %1</b> active tasks: <br>").arg(count);
409 } 409 }
410 output += tmpout; 410 output += tmpout;
411 } else { 411 } else {
412 output = tr("No active tasks"); 412 output = tr("No active tasks");
413 } 413 }
414 414
415 TodoField->setText(tr(output)); 415 TodoField->setText(tr(output));
416} 416}
417 417
418/* 418/*
419 * launches datebook 419 * launches datebook
420 */ 420 */
421void Today::startDatebook() { 421void Today::startDatebook() {
422 QCopEnvelope e("QPE/System", "execute(QString)"); 422 QCopEnvelope e("QPE/System", "execute(QString)");
423 e << QString("datebook"); 423 e << QString("datebook");
424} 424}
425 425
426/* 426/*
427 * starts the edit dialog as known from datebook 427 * starts the edit dialog as known from datebook
428 */ 428 */
429 429
430extern QPEApplication *todayApp; 430extern QPEApplication *todayApp;
431 431
432void Today::editEvent(const Event &e) { 432void Today::editEvent(const Event &e) {
433 startDatebook(); 433 startDatebook();
434 434
435 while(!QCopChannel::isRegistered("QPE/Datebook")) todayApp->processEvents(); 435 while(!QCopChannel::isRegistered("QPE/Datebook")) todayApp->processEvents();
436 QCopEnvelope env("QPE/Datebook", "editEvent(int)"); 436 QCopEnvelope env("QPE/Datebook", "editEvent(int)");
437 env << e.uid(); 437 env << e.uid();
438} 438}
439 439
440/* 440/*
441 * launches todolist 441 * launches todolist
442 */ 442 */
443void Today::startTodo() { 443void Today::startTodo() {
444 QCopEnvelope e("QPE/System", "execute(QString)"); 444 QCopEnvelope e("QPE/System", "execute(QString)");
445 e << QString("todolist"); 445 e << QString("todolist");
446} 446}
447 447
448/* 448/*
449 * launch opiemail 449 * launch opiemail
450 */ 450 */
451void Today::startMail() { 451void Today::startMail() {
452 QCopEnvelope e("QPE/System", "execute(QString)"); 452 QCopEnvelope e("QPE/System", "execute(QString)");
453 e << QString("opiemail"); 453 e << QString("opiemail");
454//Right now start both, maybe decide which to rum via config file .. 454//Right now start both, maybe decide which to rum via config file ..
455 QCopEnvelope e("QPE/System", "execute(QString)"); 455 QCopEnvelope f("QPE/System", "execute(QString)");
456 e << QString("qtmail"); 456 e << QString("qtmail");
457} 457}
458 458
459 459
460Today::~Today() { 460Today::~Today() {
461} 461}
462 462
463/* 463/*
464 * Gets the events for the current day, if it should get all dates 464 * Gets the events for the current day, if it should get all dates
465 */ 465 */
466DateBookEvent::DateBookEvent(const EffectiveEvent &ev, 466DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
467 QWidget* parent = 0, 467 QWidget* parent = 0,
468 int SHOW_LOCATION = 0, 468 int SHOW_LOCATION = 0,
469 int SHOW_NOTES = 0, 469 int SHOW_NOTES = 0,
470 const char* name = 0, 470 const char* name = 0,
471 WFlags fl = 0) : 471 WFlags fl = 0) :
472 ClickableLabel(parent,name,fl), event(ev) { 472 ClickableLabel(parent,name,fl), event(ev) {
473 473
474 QString msg; 474 QString msg;
475 //QTime time = QTime::currentTime(); 475 //QTime time = QTime::currentTime();
476 476
477 Config config( "qpe" ); 477 Config config( "qpe" );
478 // if 24 h format 478 // if 24 h format
479 ampm = config.readBoolEntry( "AMPM", TRUE ); 479 ampm = config.readBoolEntry( "AMPM", TRUE );
480 480
481 481
482 if (!ONLY_LATER) { 482 if (!ONLY_LATER) {
483 msg += "<B>" + (ev).description() + "</B>"; 483 msg += "<B>" + (ev).description() + "</B>";
484 if ( (ev).event().hasAlarm() ) { 484 if ( (ev).event().hasAlarm() ) {
485 msg += " <b>[with alarm]</b>"; 485 msg += " <b>[with alarm]</b>";
486 } 486 }
487 // include location or not 487 // include location or not
488 if (SHOW_LOCATION == 1) { 488 if (SHOW_LOCATION == 1) {
489 msg += "<BR><i>" + (ev).location() + "</i>"; 489 msg += "<BR><i>" + (ev).location() + "</i>";
490 } 490 }
491 491
492 if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { 492 if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) {
493 msg += "<br>All day"; 493 msg += "<br>All day";
494 } else { 494 } else {
495 // start time of event 495 // start time of event
496 msg += "<br>" + ampmTime(QTime((ev).event().start().time()) ) 496 msg += "<br>" + ampmTime(QTime((ev).event().start().time()) )
497 // end time of event 497 // end time of event
498 + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) ); 498 + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) );
499 } 499 }
500 500
501 // include possible note or not 501 // include possible note or not
502 if (SHOW_NOTES == 1) { 502 if (SHOW_NOTES == 1) {
503 msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); 503 msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP);
504 } 504 }
505 } 505 }
506 setText(msg); 506 setText(msg);
507 connect(this, SIGNAL(clicked()), this, SLOT(editMe())); 507 connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
508 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); 508 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
509} 509}
510 510
511 511
512QString DateBookEvent::ampmTime(QTime tm) { 512QString DateBookEvent::ampmTime(QTime tm) {
513 513
514 QString s; 514 QString s;
515 if( ampm ) { 515 if( ampm ) {
516 int hour = tm.hour(); 516 int hour = tm.hour();
517 if (hour == 0) 517 if (hour == 0)
518 hour = 12; 518 hour = 12;
519 if (hour > 12) 519 if (hour > 12)
520 hour -= 12; 520 hour -= 12;
521 s.sprintf( "%2d:%02d %s", hour, tm.minute(), 521 s.sprintf( "%2d:%02d %s", hour, tm.minute(),
522 (tm.hour() >= 12) ? "PM" : "AM" ); 522 (tm.hour() >= 12) ? "PM" : "AM" );
523 return s; 523 return s;
524 } else { 524 } else {
525 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); 525 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() );
526 return s; 526 return s;
527 } 527 }
528 528
529} 529}
530 530
531 531
532DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev, 532DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev,
533 QWidget* parent = 0, 533 QWidget* parent = 0,
534 int SHOW_LOCATION = 0, 534 int SHOW_LOCATION = 0,
535 int SHOW_NOTES = 0, 535 int SHOW_NOTES = 0,
536 const char* name = 0, 536 const char* name = 0,
537 WFlags fl = 0) : 537 WFlags fl = 0) :
538 ClickableLabel(parent,name,fl), event(ev) { 538 ClickableLabel(parent,name,fl), event(ev) {
539 539
540 QString msg; 540 QString msg;
541 QTime time = QTime::currentTime(); 541 QTime time = QTime::currentTime();
542 542
543 Config config( "qpe" ); 543 Config config( "qpe" );
544 // if 24 h format 544 // if 24 h format
545 ampm = config.readBoolEntry( "AMPM", TRUE ); 545 ampm = config.readBoolEntry( "AMPM", TRUE );
546 546
547 547
548 if ((time.toString() <= TimeString::dateString((ev).event().end())) ) { 548 if ((time.toString() <= TimeString::dateString((ev).event().end())) ) {
549 // show only later appointments 549 // show only later appointments
550 msg += "<B>" + (ev).description() + "</B>"; 550 msg += "<B>" + (ev).description() + "</B>";
551 if ( (ev).event().hasAlarm() ) { 551 if ( (ev).event().hasAlarm() ) {
552 msg += " <b>[with alarm]</b>"; 552 msg += " <b>[with alarm]</b>";
553 } 553 }
554 // include location or not 554 // include location or not
555 if (SHOW_LOCATION == 1) { 555 if (SHOW_LOCATION == 1) {
556 msg += "<BR><i>" + (ev).location() + "</i>"; 556 msg += "<BR><i>" + (ev).location() + "</i>";
557 } 557 }
558 558
559 if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { 559 if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) {
560 msg += "<br>All day"; 560 msg += "<br>All day";
561 } else { 561 } else {
562 // start time of event 562 // start time of event
563 msg += "<br>" + ampmTime(QTime((ev).event().start().time()) ) 563 msg += "<br>" + ampmTime(QTime((ev).event().start().time()) )
564 // end time of event 564 // end time of event
565 + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) ); 565 + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) );
566 } 566 }
567 // include possible note or not 567 // include possible note or not
568 if (SHOW_NOTES == 1) { 568 if (SHOW_NOTES == 1) {
569 msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); 569 msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP);
570 } 570 }
571 } 571 }
572 572
573 setText(msg); 573 setText(msg);
574 connect(this, SIGNAL(clicked()), this, SLOT(editMe())); 574 connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
575 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); 575 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
576} 576}
577 577
578 578
579QString DateBookEventLater::ampmTime(QTime tm) { 579QString DateBookEventLater::ampmTime(QTime tm) {
580 580
581 QString s; 581 QString s;
582 if( ampm ) { 582 if( ampm ) {
583 int hour = tm.hour(); 583 int hour = tm.hour();