summaryrefslogtreecommitdiff
path: root/core/pim/datebook
Unidiff
Diffstat (limited to 'core/pim/datebook') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp59
-rw-r--r--core/pim/datebook/datebook.h4
-rw-r--r--core/pim/datebook/datebookweeklst.cpp4
-rw-r--r--core/pim/datebook/datebookweeklst.h4
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
@@ -169,5 +169,4 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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");
@@ -313,42 +312,55 @@ QDate DateBook::currentDate()
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();
320 dayView->setDate( d ); 318 dayView->setDate( d );
321 views->raiseWidget( dayView ); 319 views->raiseWidget( dayView );
322 dayView->redraw(); 320 dayView->redraw();
323} 321 } else if (v==WEEK) {
324
325void DateBook::viewWeek()
326{
327 initWeek(); 322 initWeek();
328 weekAction->setOn( TRUE ); 323 weekAction->setOn( TRUE );
329 QDate d = currentDate();
330 weekView->setDate( d ); 324 weekView->setDate( d );
331 views->raiseWidget( weekView ); 325 views->raiseWidget( weekView );
332 weekView->redraw(); 326 weekView->redraw();
333} 327 } else if (v==WEEKLST) {
334
335void DateBook::viewWeekLst() {
336 initWeekLst(); 328 initWeekLst();
337 weekLstAction->setOn( TRUE ); 329 weekLstAction->setOn( TRUE );
338 QDate d=currentDate();
339 weekLstView->setDate(d); 330 weekLstView->setDate(d);
340 views->raiseWidget( weekLstView ); 331 views->raiseWidget( weekLstView );
341 weekLstView->redraw(); 332 weekLstView->redraw();
342} 333 } else if (v==MONTH) {
343
344void DateBook::viewMonth()
345{
346 initMonth(); 334 initMonth();
347 monthAction->setOn( TRUE ); 335 monthAction->setOn( TRUE );
348 QDate d = currentDate();
349 monthView->setDate( d.year(), d.month(), d.day() ); 336 monthView->setDate( d.year(), d.month(), d.day() );
350 views->raiseWidget( monthView ); 337 views->raiseWidget( monthView );
351 monthView->redraw(); 338 monthView->redraw();
352} 339}
340}
341
342void DateBook::viewDefault(const QDate &d) {
343 Config config("DateBook");
344 config.setGroup("Main");
345 int current=config.readNumEntry("defaultview", DAY);
346
347 view(current,d);
348}
349
350void DateBook::viewDay() {
351 view(DAY,currentDate());
352}
353
354void DateBook::viewWeek() {
355 view(WEEK,currentDate());
356}
357
358void DateBook::viewWeekLst() {
359 view(WEEKLST,currentDate());
360}
361
362void DateBook::viewMonth() {
363 view(MONTH,currentDate());
364}
353 365
354void DateBook::editEvent( const Event &e ) 366void DateBook::editEvent( const Event &e )
@@ -419,8 +431,6 @@ void DateBook::addEvent( const Event &e )
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
@@ -690,7 +700,6 @@ void DateBook::changeWeek( bool m )
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
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
@@ -53,4 +53,6 @@ protected:
53 void closeEvent( QCloseEvent *e ); 53 void closeEvent( QCloseEvent *e );
54 54
55 void view(int v, const QDate &d);
56
55public slots: 57public slots:
56 void flush(); 58 void flush();
@@ -71,4 +73,6 @@ private slots:
71 void slotDoFind( const QString &, const QDate &, bool, bool, int ); 73 void slotDoFind( const QString &, const QDate &, bool, bool, int );
72 74
75 void viewDefault(const QDate &d);
76
73 void viewDay(); 77 void viewDay();
74 void viewWeek(); 78 void viewWeek();
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
@@ -47,5 +47,5 @@ DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent,
47} 47}
48DateBookWeekLstHeader::~DateBookWeekLstHeader(){} 48DateBookWeekLstHeader::~DateBookWeekLstHeader(){}
49void DateBookWeekLstHeader::setDate(QDate d) { 49void DateBookWeekLstHeader::setDate(const QDate &d) {
50 date=d; 50 date=d;
51 51
@@ -243,5 +243,5 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
243 243
244 244
245void DateBookWeekLst::setDate( QDate &d ) { 245void DateBookWeekLst::setDate(const QDate &d) {
246 int w,y; 246 int w,y;
247 calcWeek(d,w,y,onMonday); 247 calcWeek(d,w,y,onMonday);
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
@@ -23,5 +23,5 @@ public:
23 WFlags fl = 0 ); 23 WFlags fl = 0 );
24 ~DateBookWeekLstHeader(); 24 ~DateBookWeekLstHeader();
25 void setDate(QDate d); 25 void setDate(const QDate &d);
26 26
27public slots: 27public slots:
@@ -98,5 +98,5 @@ public:
98 const char *name = 0 ); 98 const char *name = 0 );
99 void setDate( int y, int w ); 99 void setDate( int y, int w );
100 void setDate( QDate &d ); 100 void setDate(const QDate &d );
101 int week() const { return _week; }; 101 int week() const { return _week; };
102 QDate date() const; 102 QDate date() const;