summaryrefslogtreecommitdiff
authorumopapisdn <umopapisdn>2003-03-22 00:39:44 (UTC)
committer umopapisdn <umopapisdn>2003-03-22 00:39:44 (UTC)
commit32458f9d70e8b13a7e8ff46c06af17860c218f23 (patch) (unidiff)
tree1b1585cf3f5da0cf28680936bae1773f830f2293
parent5d488108161a2dfe1377ac38226b5d8a3a438d11 (diff)
downloadopie-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.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookweek.cpp35
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
@@ -181,38 +181,41 @@ void DateBookWeekView::alterDay( int day )
181 } 181 }
182 emit showDay( day ); 182 emit showDay( day );
183} 183}
184 184
185void DateBookWeekView::positionItem( DateBookWeekItem *i ) 185void DateBookWeekView::positionItem( DateBookWeekItem *i )
186{ 186{
187 const int Width = 8; 187 const int Width = 8;
188 const EffectiveEvent ev = i->event(); 188 const EffectiveEvent ev = i->event();
189 189
190 // 30 minute intervals 190 // 30 minute intervals
191 int y = ev.start().hour() * 2; 191 int y = ev.start().hour() * 2;
192 y += db_round30min( ev.start().minute() ); 192 y += db_round30min( ev.start().minute() );
193 int y2 = ev.end().hour() * 2;
194 y2 += db_round30min( ev.end().minute() );
193 if ( y > 47 ) 195 if ( y > 47 )
194 y = 47; 196 y = 47;
197 if ( y2 > 48 )
198 y2 = 48;
195 y = y * rowHeight / 2; 199 y = y * rowHeight / 2;
200 y2 = y2 * rowHeight / 2;
196 201
197 int h; 202 int h;
198 if ( ev.event().type() == Event::AllDay ) { 203 if ( ev.event().type() == Event::AllDay ) {
199 h = 48; 204 h = 48 * rowHeight / 2;
200 y = 0; 205 y = 0;
201 } else { 206 } else {
202 h = ( ev.end().hour() - ev.start().hour() ) * 2; 207 h=y2-y;
203 h += db_round30min( ev.end().minute() - ev.start().minute() );
204 if ( h < 1 ) h = 1; 208 if ( h < 1 ) h = 1;
205 } 209 }
206 h = h * rowHeight / 2;
207 210
208 int dow = ev.date().dayOfWeek(); 211 int dow = ev.date().dayOfWeek();
209 if ( !bOnMonday ) { 212 if ( !bOnMonday ) {
210 if ( dow == 7 ) 213 if ( dow == 7 )
211 dow = 1; 214 dow = 1;
212 else 215 else
213 dow++; 216 dow++;
214 } 217 }
215 int x = header->sectionPos( dow ) - 1; 218 int x = header->sectionPos( dow ) - 1;
216 int xlim = header->sectionPos( dow ) + header->sectionSize( dow ); 219 int xlim = header->sectionPos( dow ) + header->sectionSize( dow );
217 DateBookWeekItem *isect = 0; 220 DateBookWeekItem *isect = 0;
218 do { 221 do {
@@ -459,41 +462,33 @@ void DateBookWeek::getEvents()
459 endWeek); 462 endWeek);
460 view->showEvents( eventList ); 463 view->showEvents( eventList );
461 view->moveToHour( startTime ); 464 view->moveToHour( startTime );
462} 465}
463 466
464void DateBookWeek::generateAllDayTooltext( QString& text ) { 467void DateBookWeek::generateAllDayTooltext( QString& text ) {
465 text += "<b>" + tr("This is an all day event.") + "</b><br>"; 468 text += "<b>" + tr("This is an all day event.") + "</b><br>";
466} 469}
467 470
468void DateBookWeek::generateNormalTooltext( QString& str, 471void DateBookWeek::generateNormalTooltext( QString& str,
469 const EffectiveEvent &ev ) { 472 const EffectiveEvent &ev ) {
470 str += "<b>" + QObject::tr("Start") + "</b>: "; 473 str += "<b>" + QObject::tr("Start") + "</b>: ";
471 474 str += TimeString::timeString( ev.event().start().time(), ampm, FALSE );
472 if ( ev.startDate() != ev.date() ) { 475 if( ev.startDate()!=ev.endDate() ) {
473 // multi-day event. Show start date 476 str += " <i>" + TimeString::longDateString( ev.startDate() )+"</i>";
474 str += TimeString::longDateString( ev.startDate() );
475 } else {
476 // Show start time.
477 str += TimeString::timeString(ev.start(), ampm, FALSE );
478 } 477 }
479 478 str += "<br>";
480 479 str += "<b>" + QObject::tr("End") + "</b>: ";
481 str += "<br><b>" + QObject::tr("End") + "</b>: "; 480 str += TimeString::timeString( ev.event().end().time(), ampm, FALSE );
482 if ( ev.endDate() != ev.date() ) { 481 if( ev.startDate()!=ev.endDate() ) {
483 // multi-day event. Show end date 482 str += " <i>" + TimeString::longDateString( ev.endDate() ) + "</i>";
484 str += TimeString::longDateString( ev.endDate() );
485 } else {
486 // Show end time.
487 str += TimeString::timeString( ev.end(), ampm, FALSE );
488 } 483 }
489} 484}
490 485
491void DateBookWeek::slotShowEvent( const EffectiveEvent &ev ) 486void DateBookWeek::slotShowEvent( const EffectiveEvent &ev )
492{ 487{
493 if ( tHide->isActive() ) 488 if ( tHide->isActive() )
494 tHide->stop(); 489 tHide->stop();
495 490
496 // why would someone use "<"? Oh well, fix it up... 491 // why would someone use "<"? Oh well, fix it up...
497 // I wonder what other things may be messed up... 492 // I wonder what other things may be messed up...
498 QString strDesc = ev.description(); 493 QString strDesc = ev.description();
499 int where = strDesc.find( "<" ); 494 int where = strDesc.find( "<" );