-rw-r--r-- | core/pim/datebook/datebook.cpp | 59 | ||||
-rw-r--r-- | core/pim/datebook/datebook.h | 4 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 4 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.h | 4 |
4 files changed, 42 insertions, 29 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 @@ -170,3 +170,2 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) - Config config("DateBook"); @@ -314,7 +313,6 @@ QDate DateBook::currentDate() -void DateBook::viewDay() -{ +void DateBook::view(int v, const QDate &d) { + if (v==DAY) { initDay(); dayAction->setOn( TRUE ); - QDate d = currentDate(); dayView->setDate( d ); @@ -322,9 +320,5 @@ void DateBook::viewDay() dayView->redraw(); -} - -void DateBook::viewWeek() -{ + } else if (v==WEEK) { initWeek(); weekAction->setOn( TRUE ); - QDate d = currentDate(); weekView->setDate( d ); @@ -332,8 +326,5 @@ void DateBook::viewWeek() weekView->redraw(); -} - -void DateBook::viewWeekLst() { + } else if (v==WEEKLST) { initWeekLst(); weekLstAction->setOn( TRUE ); - QDate d=currentDate(); weekLstView->setDate(d); @@ -341,9 +332,5 @@ void DateBook::viewWeekLst() { weekLstView->redraw(); -} - -void DateBook::viewMonth() -{ + } else if (v==MONTH) { initMonth(); monthAction->setOn( TRUE ); - QDate d = currentDate(); monthView->setDate( d.year(), d.month(), d.day() ); @@ -352,2 +339,27 @@ void DateBook::viewMonth() } +} + +void DateBook::viewDefault(const QDate &d) { + Config config("DateBook"); + config.setGroup("Main"); + int current=config.readNumEntry("defaultview", DAY); + + view(current,d); +} + +void DateBook::viewDay() { + view(DAY,currentDate()); +} + +void DateBook::viewWeek() { + view(WEEK,currentDate()); +} + +void DateBook::viewWeekLst() { + view(WEEKLST,currentDate()); +} + +void DateBook::viewMonth() { + view(MONTH,currentDate()); +} @@ -420,6 +432,4 @@ void DateBook::showDay( int year, int month, int day ) { - initDay(); - dayView->setDate( year, month, day ); - views->raiseWidget( dayView ); - dayAction->setOn( TRUE ); + QDate d(year, month, day); + view(DAY,d); } @@ -691,5 +701,4 @@ void DateBook::slotToday() { - // we need to view today - QDate dt = QDate::currentDate(); - showDay( dt.year(), dt.month(), dt.day() ); + // we need to view today using default view + viewDefault(QDate::currentDate()); } diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h index fcdbfec..2ffcdbe 100644 --- a/core/pim/datebook/datebook.h +++ b/core/pim/datebook/datebook.h @@ -54,2 +54,4 @@ protected: + void view(int v, const QDate &d); + public slots: @@ -72,2 +74,4 @@ private slots: + void viewDefault(const QDate &d); + void viewDay(); diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index 05e36be..dc141c0 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp @@ -48,3 +48,3 @@ DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, DateBookWeekLstHeader::~DateBookWeekLstHeader(){} -void DateBookWeekLstHeader::setDate(QDate d) { +void DateBookWeekLstHeader::setDate(const QDate &d) { date=d; @@ -244,3 +244,3 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, -void DateBookWeekLst::setDate( QDate &d ) { +void DateBookWeekLst::setDate(const QDate &d) { int w,y; diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h index d2a07cc..39c956d 100644 --- a/core/pim/datebook/datebookweeklst.h +++ b/core/pim/datebook/datebookweeklst.h @@ -24,3 +24,3 @@ public: ~DateBookWeekLstHeader(); - void setDate(QDate d); + void setDate(const QDate &d); @@ -99,3 +99,3 @@ public: void setDate( int y, int w ); - void setDate( QDate &d ); + void setDate(const QDate &d ); int week() const { return _week; }; |