summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebook.cpp
authorhakan <hakan>2002-03-09 13:07:57 (UTC)
committer hakan <hakan>2002-03-09 13:07:57 (UTC)
commit62c21e8bdbb365a64f05dd363a98abd7fc1f0558 (patch) (unidiff)
treebde5aec77cc0c22a4240b16f0fc4acc41b2d162f /core/pim/datebook/datebook.cpp
parent603e969bb8cef91534a1785e27106ba71eb03ba6 (diff)
downloadopie-62c21e8bdbb365a64f05dd363a98abd7fc1f0558.zip
opie-62c21e8bdbb365a64f05dd363a98abd7fc1f0558.tar.gz
opie-62c21e8bdbb365a64f05dd363a98abd7fc1f0558.tar.bz2
Fixed today-button to show default view
Diffstat (limited to 'core/pim/datebook/datebook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp85
1 files changed, 47 insertions, 38 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index 9880e2d..92dbdc8 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -168,7 +168,6 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
168 settings->insertItem( tr( "Default View" ),default_view ); 168 settings->insertItem( tr( "Default View" ),default_view );
169 default_view->setCheckable(TRUE); 169 default_view->setCheckable(TRUE);
170 170
171
172 Config config("DateBook"); 171 Config config("DateBook");
173 config.setGroup("Main"); 172 config.setGroup("Main");
174 int current=config.readNumEntry("defaultview", DAY); 173 int current=config.readNumEntry("defaultview", DAY);
@@ -312,43 +311,56 @@ QDate DateBook::currentDate()
312 return d; 311 return d;
313} 312}
314 313
315void DateBook::viewDay() 314void DateBook::view(int v, const QDate &d) {
316{ 315 if (v==DAY) {
317 initDay(); 316 initDay();
318 dayAction->setOn( TRUE ); 317 dayAction->setOn( TRUE );
319 QDate d = currentDate(); 318 dayView->setDate( d );
320 dayView->setDate( d ); 319 views->raiseWidget( dayView );
321 views->raiseWidget( dayView ); 320 dayView->redraw();
322 dayView->redraw(); 321 } else if (v==WEEK) {
322 initWeek();
323 weekAction->setOn( TRUE );
324 weekView->setDate( d );
325 views->raiseWidget( weekView );
326 weekView->redraw();
327 } else if (v==WEEKLST) {
328 initWeekLst();
329 weekLstAction->setOn( TRUE );
330 weekLstView->setDate(d);
331 views->raiseWidget( weekLstView );
332 weekLstView->redraw();
333 } else if (v==MONTH) {
334 initMonth();
335 monthAction->setOn( TRUE );
336 monthView->setDate( d.year(), d.month(), d.day() );
337 views->raiseWidget( monthView );
338 monthView->redraw();
339 }
323} 340}
324 341
325void DateBook::viewWeek() 342void DateBook::viewDefault(const QDate &d) {
326{ 343 Config config("DateBook");
327 initWeek(); 344 config.setGroup("Main");
328 weekAction->setOn( TRUE ); 345 int current=config.readNumEntry("defaultview", DAY);
329 QDate d = currentDate(); 346
330 weekView->setDate( d ); 347 view(current,d);
331 views->raiseWidget( weekView ); 348}
332 weekView->redraw(); 349
350void DateBook::viewDay() {
351 view(DAY,currentDate());
352}
353
354void DateBook::viewWeek() {
355 view(WEEK,currentDate());
333} 356}
334 357
335void DateBook::viewWeekLst() { 358void DateBook::viewWeekLst() {
336 initWeekLst(); 359 view(WEEKLST,currentDate());
337 weekLstAction->setOn( TRUE );
338 QDate d=currentDate();
339 weekLstView->setDate(d);
340 views->raiseWidget( weekLstView );
341 weekLstView->redraw();
342} 360}
343 361
344void DateBook::viewMonth() 362void DateBook::viewMonth() {
345{ 363 view(MONTH,currentDate());
346 initMonth();
347 monthAction->setOn( TRUE );
348 QDate d = currentDate();
349 monthView->setDate( d.year(), d.month(), d.day() );
350 views->raiseWidget( monthView );
351 monthView->redraw();
352} 364}
353 365
354void DateBook::editEvent( const Event &e ) 366void DateBook::editEvent( const Event &e )
@@ -418,10 +430,8 @@ void DateBook::addEvent( const Event &e )
418 430
419void DateBook::showDay( int year, int month, int day ) 431void DateBook::showDay( int year, int month, int day )
420{ 432{
421 initDay(); 433 QDate d(year, month, day);
422 dayView->setDate( year, month, day ); 434 view(DAY,d);
423 views->raiseWidget( dayView );
424 dayAction->setOn( TRUE );
425} 435}
426 436
427void DateBook::initDay() 437void DateBook::initDay()
@@ -689,9 +699,8 @@ void DateBook::changeWeek( bool m )
689 699
690void DateBook::slotToday() 700void DateBook::slotToday()
691{ 701{
692 // we need to view today 702 // we need to view today using default view
693 QDate dt = QDate::currentDate(); 703 viewDefault(QDate::currentDate());
694 showDay( dt.year(), dt.month(), dt.day() );
695} 704}
696 705
697void DateBook::closeEvent( QCloseEvent *e ) 706void DateBook::closeEvent( QCloseEvent *e )