-rw-r--r-- | core/pim/datebook/datebookday.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index 325b902..aaf3e16 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp | |||
@@ -568,105 +568,108 @@ DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e, | |||
568 | : QWidget( db->dayView()->viewport() ), ev( e ), dateBook( db ) | 568 | : QWidget( db->dayView()->viewport() ), ev( e ), dateBook( db ) |
569 | { | 569 | { |
570 | 570 | ||
571 | 571 | ||
572 | // why would someone use "<"? Oh well, fix it up... | 572 | // why would someone use "<"? Oh well, fix it up... |
573 | // I wonder what other things may be messed up... | 573 | // I wonder what other things may be messed up... |
574 | QString strDesc = ev.description(); | 574 | QString strDesc = ev.description(); |
575 | int where = strDesc.find( "<" ); | 575 | int where = strDesc.find( "<" ); |
576 | while ( where != -1 ) { | 576 | while ( where != -1 ) { |
577 | strDesc.remove( where, 1 ); | 577 | strDesc.remove( where, 1 ); |
578 | strDesc.insert( where, "<" ); | 578 | strDesc.insert( where, "<" ); |
579 | where = strDesc.find( "<", where ); | 579 | where = strDesc.find( "<", where ); |
580 | } | 580 | } |
581 | 581 | ||
582 | QString strCat; | 582 | QString strCat; |
583 | // ### Fix later... | 583 | // ### Fix later... |
584 | // QString strCat = ev.category(); | 584 | // QString strCat = ev.category(); |
585 | // where = strCat.find( "<" ); | 585 | // where = strCat.find( "<" ); |
586 | // while ( where != -1 ) { | 586 | // while ( where != -1 ) { |
587 | // strCat.remove( where, 1 ); | 587 | // strCat.remove( where, 1 ); |
588 | // strCat.insert( where, "<" ); | 588 | // strCat.insert( where, "<" ); |
589 | // where = strCat.find( "<", where ); | 589 | // where = strCat.find( "<", where ); |
590 | // } | 590 | // } |
591 | 591 | ||
592 | QString strNote = ev.notes(); | 592 | QString strNote = ev.notes(); |
593 | where = strNote.find( "<" ); | 593 | where = strNote.find( "<" ); |
594 | while ( where != -1 ) { | 594 | while ( where != -1 ) { |
595 | strNote.remove( where, 1 ); | 595 | strNote.remove( where, 1 ); |
596 | strNote.insert( where, "<" ); | 596 | strNote.insert( where, "<" ); |
597 | where = strNote.find( "<", where ); | 597 | where = strNote.find( "<", where ); |
598 | } | 598 | } |
599 | 599 | ||
600 | text = "<b>" + strDesc + "</b><br>" + "<i>" | 600 | text = "<b>" + strDesc + "</b><br>" + "<i>"; |
601 | + strCat + "</i><br>"; | 601 | if ( !strCat.isEmpty() ) { |
602 | text += strCat + "</i><br>"; | ||
603 | } | ||
602 | if (ev.event().type() == Event::Normal ) | 604 | if (ev.event().type() == Event::Normal ) |
603 | setEventText( text ); | 605 | setEventText( text ); |
604 | else | 606 | else |
605 | setAllDayText( text ); | 607 | setAllDayText( text ); |
606 | 608 | ||
607 | text += "<br><br>" + strNote; | 609 | text += "<br><br>" + strNote; |
608 | 610 | ||
609 | setBackgroundMode( PaletteBase ); | 611 | setBackgroundMode( PaletteBase ); |
610 | 612 | ||
611 | QTime start = ev.start(); | 613 | QTime start = ev.start(); |
612 | QTime end = ev.end(); | 614 | QTime end = ev.end(); |
613 | int y = start.hour()*60+start.minute(); | 615 | int y = start.hour()*60+start.minute(); |
614 | int h = end.hour()*60+end.minute()-y; | 616 | int h = end.hour()*60+end.minute()-y; |
615 | int rh = dateBook->dayView()->rowHeight(0); | 617 | int rh = dateBook->dayView()->rowHeight(0); |
616 | y = y*rh/60; | 618 | y = y*rh/60; |
617 | h = h*rh/60; | 619 | h = h*rh/60; |
618 | if ( h < 3 ) | 620 | if ( h < 3 ) { |
619 | h = 3; | 621 | h = 3; |
622 | } | ||
620 | geom.setY( y ); | 623 | geom.setY( y ); |
621 | geom.setHeight( h ); | 624 | geom.setHeight( h ); |
622 | geom.setX( 0 ); | 625 | geom.setX( 0 ); |
623 | geom.setWidth(dateBook->dayView()->columnWidth(0)-1); | 626 | geom.setWidth(dateBook->dayView()->columnWidth(0)-1); |
624 | 627 | ||
625 | } | 628 | } |
626 | void DateBookDayWidget::setAllDayText( QString &text ) { | 629 | void DateBookDayWidget::setAllDayText( QString &text ) { |
627 | text += "<b>" + tr("This is an all day event.") + "</b><br>"; | 630 | text += "<b>" + tr("This is an all day event.") + "</b><br>"; |
628 | } | 631 | } |
629 | void DateBookDayWidget::setEventText( QString& text ) { | 632 | void DateBookDayWidget::setEventText( QString& text ) { |
630 | bool whichClock = dateBook->dayView()->whichClock(); | 633 | bool whichClock = dateBook->dayView()->whichClock(); |
631 | text += "<b>" + tr("Start") + "</b>: "; | 634 | text += "<b>" + tr("Time") + "</b>: "; |
632 | if ( ev.startDate() != ev.date() ) { | 635 | if ( ev.startDate() != ev.date() ) { |
633 | // multi-day event. Show start date | 636 | // multi-day event. Show start date |
634 | text += TimeString::longDateString( ev.startDate() ); | 637 | text += TimeString::longDateString( ev.startDate() ); |
635 | } else { | 638 | } else { |
636 | // Show start time. | 639 | // Show start time. |
637 | text += TimeString::timeString( ev.start(), whichClock, FALSE ); | 640 | text += TimeString::timeString( ev.start(), whichClock, FALSE ); |
638 | } | 641 | } |
639 | 642 | ||
640 | text += "<br><b>" + tr("End") + "</b>: "; | 643 | text += "<b>" + tr(" - ") + "</b>"; |
641 | if ( ev.endDate() != ev.date() ) { | 644 | if ( ev.endDate() != ev.date() ) { |
642 | // multi-day event. Show end date | 645 | // multi-day event. Show end date |
643 | text += TimeString::longDateString( ev.endDate() ); | 646 | text += TimeString::longDateString( ev.endDate() ); |
644 | } else { | 647 | } else { |
645 | // Show end time. | 648 | // Show end time. |
646 | text += TimeString::timeString( ev.end(), whichClock, FALSE ); | 649 | text += TimeString::timeString( ev.end(), whichClock, FALSE ); |
647 | } | 650 | } |
648 | 651 | ||
649 | } | 652 | } |
650 | 653 | ||
651 | DateBookDayWidget::~DateBookDayWidget() | 654 | DateBookDayWidget::~DateBookDayWidget() |
652 | { | 655 | { |
653 | } | 656 | } |
654 | 657 | ||
655 | void DateBookDayWidget::paintEvent( QPaintEvent *e ) | 658 | void DateBookDayWidget::paintEvent( QPaintEvent *e ) |
656 | { | 659 | { |
657 | QPainter p( this ); | 660 | QPainter p( this ); |
658 | 661 | ||
659 | if (dateBook->getSelectedWidget() == this) | 662 | if (dateBook->getSelectedWidget() == this) |
660 | { | 663 | { |
661 | p.setBrush( QColor( 155, 240, 230 ) ); // selected item | 664 | p.setBrush( QColor( 155, 240, 230 ) ); // selected item |
662 | } else | 665 | } else |
663 | { | 666 | { |
664 | if (dateBook->date() == QDate::currentDate()) | 667 | if (dateBook->date() == QDate::currentDate()) |
665 | { | 668 | { |
666 | QTime curTime = QTime::currentTime(); | 669 | QTime curTime = QTime::currentTime(); |
667 | 670 | ||
668 | if (ev.end() < curTime) | 671 | if (ev.end() < curTime) |
669 | { | 672 | { |
670 | p.setBrush( QColor( 180, 180, 180 ) ); // grey, inactive | 673 | p.setBrush( QColor( 180, 180, 180 ) ); // grey, inactive |
671 | } else | 674 | } else |
672 | { | 675 | { |