summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookday.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp
index a6a1be3..42f026a 100644
--- a/core/pim/datebook/datebookday.cpp
+++ b/core/pim/datebook/datebookday.cpp
@@ -290,46 +290,48 @@ void DateBookDay::dateChanged( int y, int m, int d )
290 } 290 }
291 291
292 dayView()->addSelection( ts ); 292 dayView()->addSelection( ts );
293 293
294 selectedWidget = 0; 294 selectedWidget = 0;
295 295
296} 296}
297 297
298void DateBookDay::redraw() 298void DateBookDay::redraw()
299{ 299{
300 if ( isUpdatesEnabled() ) 300 if ( isUpdatesEnabled() )
301 relayoutPage(); 301 relayoutPage();
302} 302}
303 303
304void DateBookDay::getEvents() 304void DateBookDay::getEvents()
305{ 305{
306 widgetList.clear(); 306 widgetList.clear();
307 307
308 QValueList<EffectiveEvent> eventList = db->getEffectiveEvents( currDate, 308 QValueList<EffectiveEvent> eventList = db->getEffectiveEvents( currDate, currDate );
309 currDate ); 309 QValueListIterator<EffectiveEvent> it;
310 QValueListIterator<EffectiveEvent> it; 310 for ( it = eventList.begin(); it != eventList.end(); ++it ) {
311 for ( it = eventList.begin(); it != eventList.end(); ++it ) { 311 EffectiveEvent ev=*it;
312 DateBookDayWidget* w = new DateBookDayWidget( *it, this ); 312 if(!(ev.end().hour()==ev.start().hour() && ev.end().minute()==ev.start().minute())) {// Skip effective events with no duration. (i.e ending at 00:00)
313 connect( w, SIGNAL( deleteMe( const Event & ) ), 313 DateBookDayWidget* w = new DateBookDayWidget( *it, this );
314 this, SIGNAL( removeEvent( const Event & ) ) ); 314 connect( w, SIGNAL( deleteMe( const Event & ) ),
315 connect( w, SIGNAL( editMe( const Event & ) ), 315 this, SIGNAL( removeEvent( const Event & ) ) );
316 this, SIGNAL( editEvent( const Event & ) ) ); 316 connect( w, SIGNAL( editMe( const Event & ) ),
317 connect( w, SIGNAL( beamMe( const Event & ) ), 317 this, SIGNAL( editEvent( const Event & ) ) );
318 this, SIGNAL( beamEvent( const Event & ) ) ); 318 connect( w, SIGNAL( beamMe( const Event & ) ),
319 widgetList.append( w ); 319 this, SIGNAL( beamEvent( const Event & ) ) );
320 widgetList.append( w );
321 }
320 } 322 }
321 323
322} 324}
323 325
324static int place( const DateBookDayWidget *item, bool *used, int maxn ) 326static int place( const DateBookDayWidget *item, bool *used, int maxn )
325{ 327{
326 int place = 0; 328 int place = 0;
327 int start = item->event().start().hour(); 329 int start = item->event().start().hour();
328 QTime e = item->event().end(); 330 QTime e = item->event().end();
329 int end = e.hour(); 331 int end = e.hour();
330 if ( e.minute() < 5 ) 332 if ( e.minute() < 5 )
331 end--; 333 end--;
332 if ( end < start ) 334 if ( end < start )
333 end = start; 335 end = start;
334 while ( place < maxn ) { 336 while ( place < maxn ) {
335 bool free = TRUE; 337 bool free = TRUE;
@@ -347,33 +349,33 @@ static int place( const DateBookDayWidget *item, bool *used, int maxn )
347 if ( place == maxn ) { 349 if ( place == maxn ) {
348 return -1; 350 return -1;
349 } 351 }
350 while( start <= end ) { 352 while( start <= end ) {
351 used[10*start+place] = TRUE; 353 used[10*start+place] = TRUE;
352 start++; 354 start++;
353 } 355 }
354 return place; 356 return place;
355} 357}
356 358
357 359
358void DateBookDay::relayoutPage( bool fromResize ) 360void DateBookDay::relayoutPage( bool fromResize )
359{ 361{
360 setUpdatesEnabled( FALSE ); 362 setUpdatesEnabled( FALSE );
361 if ( !fromResize ) 363 if ( !fromResize )
362 getEvents(); // no need we already have them! 364 getEvents(); // no need we already have them!
363 365
364 widgetList.sort(); 366 widgetList.sort();
365 //sorts the widgetList by the heights of the widget so that the tallest widgets are at the beginning 367 //sorts the widgetList by the heights of the widget so that the tallest widgets are at the beginning
366 //this is needed for the simple algo below to work correctly, otherwise some widgets would be drawn outside the view 368 //this is needed for the simple algo below to work correctly, otherwise some widgets would be drawn outside the view
367 369
368 int wCount = widgetList.count(); 370 int wCount = widgetList.count();
369 int wid = view->columnWidth(0)-1; 371 int wid = view->columnWidth(0)-1;
370 int wd; 372 int wd;
371 int n = 1; 373 int n = 1;
372 374
373 QArray<int> anzIntersect(wCount); //this stores the number of maximal intersections of each widget 375 QArray<int> anzIntersect(wCount); //this stores the number of maximal intersections of each widget
374 376
375 for (int i = 0; i<wCount; anzIntersect[i] = 1, i++); 377 for (int i = 0; i<wCount; anzIntersect[i] = 1, i++);
376 378
377 if ( wCount < 20 ) { 379 if ( wCount < 20 ) {
378 380
379 QArray<QRect> geometries(wCount); 381 QArray<QRect> geometries(wCount);