author | umopapisdn <umopapisdn> | 2003-03-22 00:39:44 (UTC) |
---|---|---|
committer | umopapisdn <umopapisdn> | 2003-03-22 00:39:44 (UTC) |
commit | 32458f9d70e8b13a7e8ff46c06af17860c218f23 (patch) (side-by-side diff) | |
tree | 1b1585cf3f5da0cf28680936bae1773f830f2293 | |
parent | 5d488108161a2dfe1377ac38226b5d8a3a438d11 (diff) | |
download | opie-32458f9d70e8b13a7e8ff46c06af17860c218f23.zip opie-32458f9d70e8b13a7e8ff46c06af17860c218f23.tar.gz opie-32458f9d70e8b13a7e8ff46c06af17860c218f23.tar.bz2 |
Bugfix:
Certain events were not correctly displayed, namely those with
"starting minutes" larger than "ending minutes" (for example an event
starting at 07.30 and ending at 18.00) was displayed as ending at 18.30.
Also added more informative text for events in the weekview.
Events starting and ending on the same day is mentioned with start
and end time.
Events that span across multiple days is also mentioned with start
and end dates.
-rw-r--r-- | core/pim/datebook/datebookweek.cpp | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp index ddd41af..e30c776 100644 --- a/core/pim/datebook/datebookweek.cpp +++ b/core/pim/datebook/datebookweek.cpp @@ -185,30 +185,33 @@ void DateBookWeekView::alterDay( int day ) void DateBookWeekView::positionItem( DateBookWeekItem *i ) { const int Width = 8; const EffectiveEvent ev = i->event(); // 30 minute intervals int y = ev.start().hour() * 2; y += db_round30min( ev.start().minute() ); + int y2 = ev.end().hour() * 2; + y2 += db_round30min( ev.end().minute() ); if ( y > 47 ) y = 47; + if ( y2 > 48 ) + y2 = 48; y = y * rowHeight / 2; + y2 = y2 * rowHeight / 2; int h; if ( ev.event().type() == Event::AllDay ) { - h = 48; + h = 48 * rowHeight / 2; y = 0; } else { - h = ( ev.end().hour() - ev.start().hour() ) * 2; - h += db_round30min( ev.end().minute() - ev.start().minute() ); + h=y2-y; if ( h < 1 ) h = 1; } - h = h * rowHeight / 2; int dow = ev.date().dayOfWeek(); if ( !bOnMonday ) { if ( dow == 7 ) dow = 1; else dow++; } @@ -463,33 +466,25 @@ void DateBookWeek::getEvents() void DateBookWeek::generateAllDayTooltext( QString& text ) { text += "<b>" + tr("This is an all day event.") + "</b><br>"; } void DateBookWeek::generateNormalTooltext( QString& str, const EffectiveEvent &ev ) { str += "<b>" + QObject::tr("Start") + "</b>: "; - - if ( ev.startDate() != ev.date() ) { - // multi-day event. Show start date - str += TimeString::longDateString( ev.startDate() ); - } else { - // Show start time. - str += TimeString::timeString(ev.start(), ampm, FALSE ); + str += TimeString::timeString( ev.event().start().time(), ampm, FALSE ); + if( ev.startDate()!=ev.endDate() ) { + str += " <i>" + TimeString::longDateString( ev.startDate() )+"</i>"; } - - - str += "<br><b>" + QObject::tr("End") + "</b>: "; - if ( ev.endDate() != ev.date() ) { - // multi-day event. Show end date - str += TimeString::longDateString( ev.endDate() ); - } else { - // Show end time. - str += TimeString::timeString( ev.end(), ampm, FALSE ); + str += "<br>"; + str += "<b>" + QObject::tr("End") + "</b>: "; + str += TimeString::timeString( ev.event().end().time(), ampm, FALSE ); + if( ev.startDate()!=ev.endDate() ) { + str += " <i>" + TimeString::longDateString( ev.endDate() ) + "</i>"; } } void DateBookWeek::slotShowEvent( const EffectiveEvent &ev ) { if ( tHide->isActive() ) tHide->stop(); |