summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebookweek.cpp
authorumopapisdn <umopapisdn>2003-05-05 21:44:39 (UTC)
committer umopapisdn <umopapisdn>2003-05-05 21:44:39 (UTC)
commit3b193b852133a82b5c1708b68a7e460c63629768 (patch) (unidiff)
tree8cd0ff3adc14f0b937d24ab99fca327fb3f16875 /core/pim/datebook/datebookweek.cpp
parent12a700f8903eedeba03d3aba7990b9d660410045 (diff)
downloadopie-3b193b852133a82b5c1708b68a7e460c63629768.zip
opie-3b193b852133a82b5c1708b68a7e460c63629768.tar.gz
opie-3b193b852133a82b5c1708b68a7e460c63629768.tar.bz2
UI and code cleanup. Both UI and code is now more consistent. Also removed menus in favor of toolbuttons. (why were they even available as menus in the first place?)
Diffstat (limited to 'core/pim/datebook/datebookweek.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/datebookweek.cpp47
1 files changed, 10 insertions, 37 deletions
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp
index 8241655..3ae4610 100644
--- a/core/pim/datebook/datebookweek.cpp
+++ b/core/pim/datebook/datebookweek.cpp
@@ -367,24 +367,14 @@ DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDB *newDB,
367 367
368 tHide = new QTimer( this ); 368 tHide = new QTimer( this );
369 369
370 connect( view, SIGNAL( showDay( int ) ), 370 connect( view, SIGNAL( showDay( int ) ), this, SLOT( showDay( int ) ) );
371 this, SLOT( showDay( int ) ) ); 371 connect( view, SIGNAL(signalShowEvent(const EffectiveEvent&)), this, SLOT(slotShowEvent(const EffectiveEvent&)) );
372 connect( view, SIGNAL(signalShowEvent(const EffectiveEvent&)), 372 connect( view, SIGNAL(signalHideEvent()), this, SLOT(slotHideEvent()) );
373 this, SLOT(slotShowEvent(const EffectiveEvent&)) ); 373 connect( header, SIGNAL( dateChanged( int, int ) ), this, SLOT( dateChanged( int, int ) ) );
374 connect( view, SIGNAL(signalHideEvent()), 374 connect( tHide, SIGNAL( timeout() ), lblDesc, SLOT( hide() ) );
375 this, SLOT(slotHideEvent()) ); 375 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) );
376 connect( header, SIGNAL( dateChanged( int, int ) ), 376 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(slotClockChanged(bool)));
377 this, SLOT( dateChanged( int, int ) ) );
378 connect( tHide, SIGNAL( timeout() ),
379 lblDesc, SLOT( hide() ) );
380 connect( header->spinYear, SIGNAL(valueChanged(int)),
381 this, SLOT(slotYearChanged(int)) );
382 connect( qApp, SIGNAL(weekChanged(bool)),
383 this, SLOT(slotWeekChanged(bool)) );
384 connect( qApp, SIGNAL(clockChanged(bool)),
385 this, SLOT(slotClockChanged(bool)));
386 setDate(QDate::currentDate()); 377 setDate(QDate::currentDate());
387
388} 378}
389 379
390void DateBookWeek::keyPressEvent(QKeyEvent *e) 380void DateBookWeek::keyPressEvent(QKeyEvent *e)
@@ -418,8 +408,6 @@ void DateBookWeek::showDay( int day )
418 408
419void DateBookWeek::setDate( int y, int m, int d ) 409void DateBookWeek::setDate( int y, int m, int d )
420{ 410{
421 QDate date;
422 date.setYMD( y, m, d );
423 setDate(QDate(y, m, d)); 411 setDate(QDate(y, m, d));
424} 412}
425 413
@@ -428,7 +416,7 @@ void DateBookWeek::setDate(QDate date)
428 dow = date.dayOfWeek(); 416 dow = date.dayOfWeek();
429 int w, y; 417 int w, y;
430 calcWeek( date, w, y, bStartOnMonday ); 418 calcWeek( date, w, y, bStartOnMonday );
431 header->setDate( y, w ); 419 header->setDate( date );
432} 420}
433 421
434void DateBookWeek::dateChanged( int y, int w ) 422void DateBookWeek::dateChanged( int y, int w )
@@ -458,8 +446,7 @@ void DateBookWeek::getEvents()
458 QDate startWeek = weekDate(); 446 QDate startWeek = weekDate();
459 447
460 QDate endWeek = startWeek.addDays( 6 ); 448 QDate endWeek = startWeek.addDays( 6 );
461 QValueList<EffectiveEvent> eventList = db->getEffectiveEvents(startWeek, 449 QValueList<EffectiveEvent> eventList = db->getEffectiveEvents(startWeek, endWeek);
462 endWeek);
463 view->showEvents( eventList ); 450 view->showEvents( eventList );
464 view->moveToHour( startTime ); 451 view->moveToHour( startTime );
465} 452}
@@ -468,8 +455,7 @@ void DateBookWeek::generateAllDayTooltext( QString& text ) {
468 text += "<b>" + tr("This is an all day event.") + "</b><br>"; 455 text += "<b>" + tr("This is an all day event.") + "</b><br>";
469} 456}
470 457
471void DateBookWeek::generateNormalTooltext( QString& str, 458void DateBookWeek::generateNormalTooltext( QString& str, const EffectiveEvent &ev ) {
472 const EffectiveEvent &ev ) {
473 str += "<b>" + QObject::tr("Start") + "</b>: "; 459 str += "<b>" + QObject::tr("Start") + "</b>: ";
474 str += TimeString::timeString( ev.event().start().time(), ampm, FALSE ); 460 str += TimeString::timeString( ev.event().start().time(), ampm, FALSE );
475 if( ev.startDate()!=ev.endDate() ) { 461 if( ev.startDate()!=ev.endDate() ) {
@@ -574,19 +560,6 @@ void DateBookWeek::slotYearChanged( int y )
574 d = d.addDays( -1 ); 560 d = d.addDays( -1 );
575 calcWeek( d, totWeek, throwAway, bStartOnMonday ); 561 calcWeek( d, totWeek, throwAway, bStartOnMonday );
576 } 562 }
577 if ( totWeek != totalWeeks() )
578 setTotalWeeks( totWeek );
579}
580
581
582void DateBookWeek::setTotalWeeks( int numWeeks )
583{
584 header->spinWeek->setMaxValue( numWeeks );
585}
586
587int DateBookWeek::totalWeeks() const
588{
589 return header->spinWeek->maxValue();
590} 563}
591 564
592void DateBookWeek::slotWeekChanged( bool onMonday ) 565void DateBookWeek::slotWeekChanged( bool onMonday )