author | zecke <zecke> | 2002-06-25 19:55:53 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-06-25 19:55:53 (UTC) |
commit | af4a3940dd672423da28b54e5d955cc5d33cecda (patch) (unidiff) | |
tree | cb5fcfe4835c86353e9d54b1050c7dfb23898bf1 /core/pim/datebook/datebookday.cpp | |
parent | 8635f264c15b05152fc1a44f798c154472a4b227 (diff) | |
download | opie-af4a3940dd672423da28b54e5d955cc5d33cecda.zip opie-af4a3940dd672423da28b54e5d955cc5d33cecda.tar.gz opie-af4a3940dd672423da28b54e5d955cc5d33cecda.tar.bz2 |
All day events are not from 00:00 to 23:59 they're all day now.
Diffstat (limited to 'core/pim/datebook/datebookday.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook/datebookday.cpp | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index 9cc5fcd..5474cfc 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp | |||
@@ -563,13 +563,13 @@ void DateBookDay::keyPressEvent(QKeyEvent *e) | |||
563 | //=========================================================================== | 563 | //=========================================================================== |
564 | 564 | ||
565 | DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e, | 565 | DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e, |
566 | DateBookDay *db ) | 566 | DateBookDay *db ) |
567 | : QWidget( db->dayView()->viewport() ), ev( e ), dateBook( db ) | 567 | : QWidget( db->dayView()->viewport() ), ev( e ), dateBook( db ) |
568 | { | 568 | { |
569 | bool whichClock = db->dayView()->whichClock(); | 569 | |
570 | 570 | ||
571 | // why would someone use "<"? Oh well, fix it up... | 571 | // why would someone use "<"? Oh well, fix it up... |
572 | // I wonder what other things may be messed up... | 572 | // I wonder what other things may be messed up... |
573 | QString strDesc = ev.description(); | 573 | QString strDesc = ev.description(); |
574 | int where = strDesc.find( "<" ); | 574 | int where = strDesc.find( "<" ); |
575 | while ( where != -1 ) { | 575 | while ( where != -1 ) { |
@@ -594,33 +594,20 @@ DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e, | |||
594 | strNote.remove( where, 1 ); | 594 | strNote.remove( where, 1 ); |
595 | strNote.insert( where, "<" ); | 595 | strNote.insert( where, "<" ); |
596 | where = strNote.find( "<", where ); | 596 | where = strNote.find( "<", where ); |
597 | } | 597 | } |
598 | 598 | ||
599 | text = "<b>" + strDesc + "</b><br>" + "<i>" | 599 | text = "<b>" + strDesc + "</b><br>" + "<i>" |
600 | + strCat + "</i>" | 600 | + strCat + "</i><br>"; |
601 | + "<br><b>" + tr("Start") + "</b>: "; | 601 | if (ev.event().type() == Event::Normal ) |
602 | 602 | setEventText( text ); | |
603 | 603 | else | |
604 | if ( e.startDate() != ev.date() ) { | 604 | setAllDayText( text ); |
605 | // multi-day event. Show start date | ||
606 | text += TimeString::longDateString( e.startDate() ); | ||
607 | } else { | ||
608 | // Show start time. | ||
609 | text += TimeString::timeString( ev.start(), whichClock, FALSE ); | ||
610 | } | ||
611 | 605 | ||
612 | text += "<br><b>" + tr("End") + "</b>: "; | ||
613 | if ( e.endDate() != ev.date() ) { | ||
614 | // multi-day event. Show end date | ||
615 | text += TimeString::longDateString( e.endDate() ); | ||
616 | } else { | ||
617 | // Show end time. | ||
618 | text += TimeString::timeString( ev.end(), whichClock, FALSE ); | ||
619 | } | ||
620 | text += "<br><br>" + strNote; | 606 | text += "<br><br>" + strNote; |
607 | |||
621 | setBackgroundMode( PaletteBase ); | 608 | setBackgroundMode( PaletteBase ); |
622 | 609 | ||
623 | QTime start = ev.start(); | 610 | QTime start = ev.start(); |
624 | QTime end = ev.end(); | 611 | QTime end = ev.end(); |
625 | int y = start.hour()*60+start.minute(); | 612 | int y = start.hour()*60+start.minute(); |
626 | int h = end.hour()*60+end.minute()-y; | 613 | int h = end.hour()*60+end.minute()-y; |
@@ -632,12 +619,36 @@ DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e, | |||
632 | geom.setY( y ); | 619 | geom.setY( y ); |
633 | geom.setHeight( h ); | 620 | geom.setHeight( h ); |
634 | geom.setX( 0 ); | 621 | geom.setX( 0 ); |
635 | geom.setWidth(dateBook->dayView()->columnWidth(0)-1); | 622 | geom.setWidth(dateBook->dayView()->columnWidth(0)-1); |
636 | 623 | ||
637 | } | 624 | } |
625 | void DateBookDayWidget::setAllDayText( QString &text ) { | ||
626 | text += "<b>" + tr("This is an all day event.") + "</b><br>"; | ||
627 | } | ||
628 | void DateBookDayWidget::setEventText( QString& text ) { | ||
629 | bool whichClock = dateBook->dayView()->whichClock(); | ||
630 | text += "<b>" + tr("Start") + "</b>: "; | ||
631 | if ( ev.startDate() != ev.date() ) { | ||
632 | // multi-day event. Show start date | ||
633 | text += TimeString::longDateString( ev.startDate() ); | ||
634 | } else { | ||
635 | // Show start time. | ||
636 | text += TimeString::timeString( ev.start(), whichClock, FALSE ); | ||
637 | } | ||
638 | |||
639 | text += "<br><b>" + tr("End") + "</b>: "; | ||
640 | if ( ev.endDate() != ev.date() ) { | ||
641 | // multi-day event. Show end date | ||
642 | text += TimeString::longDateString( ev.endDate() ); | ||
643 | } else { | ||
644 | // Show end time. | ||
645 | text += TimeString::timeString( ev.end(), whichClock, FALSE ); | ||
646 | } | ||
647 | |||
648 | } | ||
638 | 649 | ||
639 | DateBookDayWidget::~DateBookDayWidget() | 650 | DateBookDayWidget::~DateBookDayWidget() |
640 | { | 651 | { |
641 | } | 652 | } |
642 | 653 | ||
643 | void DateBookDayWidget::paintEvent( QPaintEvent *e ) | 654 | void DateBookDayWidget::paintEvent( QPaintEvent *e ) |
@@ -686,12 +697,13 @@ void DateBookDayWidget::paintEvent( QPaintEvent *e ) | |||
686 | d = 20; | 697 | d = 20; |
687 | } | 698 | } |
688 | 699 | ||
689 | if ( ev.event().hasRepeat() ) { | 700 | if ( ev.event().hasRepeat() ) { |
690 | p.drawPixmap( width() - 16, y, Resource::loadPixmap( "repeat" ) ); | 701 | p.drawPixmap( width() - 16, y, Resource::loadPixmap( "repeat" ) ); |
691 | d = 20; | 702 | d = 20; |
703 | y += 20; | ||
692 | } | 704 | } |
693 | 705 | ||
694 | QSimpleRichText rt( text, font() ); | 706 | QSimpleRichText rt( text, font() ); |
695 | rt.setWidth( geom.width() - d - 6 ); | 707 | rt.setWidth( geom.width() - d - 6 ); |
696 | rt.draw( &p, 7, 0, e->region(), colorGroup() ); | 708 | rt.draw( &p, 7, 0, e->region(), colorGroup() ); |
697 | } | 709 | } |