summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebookweek.cpp
Unidiff
Diffstat (limited to 'core/pim/datebook/datebookweek.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookweek.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp
index 933e191..7503751 100644
--- a/core/pim/datebook/datebookweek.cpp
+++ b/core/pim/datebook/datebookweek.cpp
@@ -317,100 +317,100 @@ void DateBookWeekView::resizeEvent( QResizeEvent *e )
317 int avail = visibleWidth(); 317 int avail = visibleWidth();
318 header->setGeometry( leftMargin()+frameWidth()+frameRect().left() , frameWidth(), 318 header->setGeometry( leftMargin()+frameWidth()+frameRect().left() , frameWidth(),
319 visibleWidth(), header->sizeHint().height() ); 319 visibleWidth(), header->sizeHint().height() );
320 setMargins( 0, header->sizeHint().height(), 0, 0 ); 320 setMargins( 0, header->sizeHint().height(), 0, 0 );
321 */ 321 */
322 //BRANCH_1_0 322 //BRANCH_1_0
323 int avail = width()-qApp->style().scrollBarExtent().width()-1; 323 int avail = width()-qApp->style().scrollBarExtent().width()-1;
324 header->setGeometry( 0, 0, avail, header->sizeHint().height() ); 324 header->setGeometry( 0, 0, avail, header->sizeHint().height() );
325 setMargins( 0, header->height(), 0, 0 ); 325 setMargins( 0, header->height(), 0, 0 );
326 326
327 327
328 header->resizeSection( 0, hourWidth ); 328 header->resizeSection( 0, hourWidth );
329 int sw = (avail - hourWidth) / 7; 329 int sw = (avail - hourWidth) / 7;
330 for ( int i = 1; i < 7; i++ ) 330 for ( int i = 1; i < 7; i++ )
331 header->resizeSection( i, sw ); 331 header->resizeSection( i, sw );
332 header->resizeSection( 7, avail - hourWidth - sw*6 ); 332 header->resizeSection( 7, avail - hourWidth - sw*6 );
333} 333}
334 334
335void DateBookWeekView::setStartOfWeek( bool bStartOnMonday ) 335void DateBookWeekView::setStartOfWeek( bool bStartOnMonday )
336{ 336{
337 bOnMonday = bStartOnMonday; 337 bOnMonday = bStartOnMonday;
338 initNames(); 338 initNames();
339} 339}
340 340
341//------------------------------------------------------------------- 341//-------------------------------------------------------------------
342 342
343DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDB *newDB, 343DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDB *newDB,
344 QWidget *parent, const char *name ) 344 QWidget *parent, const char *name )
345 : QWidget( parent, name ), 345 : QWidget( parent, name ),
346 db( newDB ), 346 db( newDB ),
347 startTime( 0 ), 347 startTime( 0 ),
348 ampm( ap ), 348 ampm( ap ),
349 bStartOnMonday( startOnMonday ) 349 bStartOnMonday( startOnMonday )
350{ 350{
351 setFocusPolicy(StrongFocus); 351 setFocusPolicy(StrongFocus);
352 QVBoxLayout *vb = new QVBoxLayout( this ); 352 QVBoxLayout *vb = new QVBoxLayout( this );
353 header = new DateBookWeekHeader( bStartOnMonday, this ); 353 header = new DateBookWeekHeader( bStartOnMonday, this );
354 view = new DateBookWeekView( ampm, startOnMonday, this ); 354 view = new DateBookWeekView( ampm, startOnMonday, this );
355 vb->addWidget( header ); 355 vb->addWidget( header );
356 vb->addWidget( view ); 356 vb->addWidget( view );
357 357
358 lblDesc = new QLabel( this, "event label" ); 358 lblDesc = new QLabel( this, "event label" );
359 lblDesc->setFrameStyle( QFrame::Plain | QFrame::Box ); 359 lblDesc->setFrameStyle( QFrame::Plain | QFrame::Box );
360 lblDesc->setBackgroundColor( yellow ); 360 lblDesc->setBackgroundColor( yellow );
361 lblDesc->hide(); 361 lblDesc->hide();
362 362
363 tHide = new QTimer( this ); 363 tHide = new QTimer( this );
364 364
365 connect( view, SIGNAL( showDay( int ) ), this, SLOT( showDay( int ) ) ); 365 connect( view, SIGNAL( showDay(int) ), this, SLOT( showDay(int) ) );
366 connect( view, SIGNAL(signalShowEvent(const EffectiveEvent&)), this, SLOT(slotShowEvent(const EffectiveEvent&)) ); 366 connect( view, SIGNAL(signalShowEvent(const EffectiveEvent&)), this, SLOT(slotShowEvent(const EffectiveEvent&)) );
367 connect( view, SIGNAL(signalHideEvent()), this, SLOT(slotHideEvent()) ); 367 connect( view, SIGNAL(signalHideEvent()), this, SLOT(slotHideEvent()) );
368 connect( header, SIGNAL( dateChanged( QDate &) ), this, SLOT( dateChanged( QDate &) ) ); 368 connect( header, SIGNAL( dateChanged(QDate&) ), this, SLOT( dateChanged(QDate&) ) );
369 connect( tHide, SIGNAL( timeout() ), lblDesc, SLOT( hide() ) ); 369 connect( tHide, SIGNAL( timeout() ), lblDesc, SLOT( hide() ) );
370 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) ); 370 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) );
371 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(slotClockChanged(bool))); 371 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(slotClockChanged(bool)));
372 setDate(QDate::currentDate()); 372 setDate(QDate::currentDate());
373} 373}
374 374
375void DateBookWeek::keyPressEvent(QKeyEvent *e) 375void DateBookWeek::keyPressEvent(QKeyEvent *e)
376{ 376{
377 switch(e->key()) { 377 switch(e->key()) {
378 case Key_Up: 378 case Key_Up:
379 view->scrollBy(0, -20); 379 view->scrollBy(0, -20);
380 break; 380 break;
381 case Key_Down: 381 case Key_Down:
382 view->scrollBy(0, 20); 382 view->scrollBy(0, 20);
383 break; 383 break;
384 case Key_Left: 384 case Key_Left:
385 setDate(date().addDays(-7)); 385 setDate(date().addDays(-7));
386 break; 386 break;
387 case Key_Right: 387 case Key_Right:
388 setDate(date().addDays(7)); 388 setDate(date().addDays(7));
389 break; 389 break;
390 default: 390 default:
391 e->ignore(); 391 e->ignore();
392 } 392 }
393} 393}
394 394
395void DateBookWeek::showDay( int day ) 395void DateBookWeek::showDay( int day )
396{ 396{
397 QDate d=bdate; 397 QDate d=bdate;
398 398
399 // Calculate offset to first day of week. 399 // Calculate offset to first day of week.
400 int dayoffset=d.dayOfWeek() % 7; 400 int dayoffset=d.dayOfWeek() % 7;
401 401
402 if(bStartOnMonday) dayoffset--; 402 if(bStartOnMonday) dayoffset--;
403 403
404 day--; 404 day--;
405 d=d.addDays(day-dayoffset); 405 d=d.addDays(day-dayoffset);
406 emit showDate( d.year(), d.month(), d.day() ); 406 emit showDate( d.year(), d.month(), d.day() );
407} 407}
408 408
409void DateBookWeek::setDate( int y, int m, int d ) 409void DateBookWeek::setDate( int y, int m, int d )
410{ 410{
411 setDate(QDate(y, m, d)); 411 setDate(QDate(y, m, d));
412} 412}
413 413
414void DateBookWeek::setDate(QDate newdate) 414void DateBookWeek::setDate(QDate newdate)
415{ 415{
416 bdate=newdate; 416 bdate=newdate;