summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookweek.cpp47
-rw-r--r--core/pim/datebook/datebookweek.h6
-rw-r--r--core/pim/datebook/datebookweekheaderimpl.cpp26
-rw-r--r--core/pim/datebook/datebookweekheaderimpl.h4
-rw-r--r--core/pim/datebook/datebookweeklst.cpp76
-rw-r--r--core/pim/datebook/datebookweeklst.h11
6 files changed, 66 insertions, 104 deletions
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp
index 3ae4610..12f57a0 100644
--- a/core/pim/datebook/datebookweek.cpp
+++ b/core/pim/datebook/datebookweek.cpp
@@ -365,17 +365,17 @@ DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDB *newDB,
365 lblDesc->setBackgroundColor( yellow ); 365 lblDesc->setBackgroundColor( yellow );
366 lblDesc->hide(); 366 lblDesc->hide();
367 367
368 tHide = new QTimer( this ); 368 tHide = new QTimer( this );
369 369
370 connect( view, SIGNAL( showDay( int ) ), this, SLOT( showDay( int ) ) ); 370 connect( view, SIGNAL( showDay( int ) ), this, SLOT( showDay( int ) ) );
371 connect( view, SIGNAL(signalShowEvent(const EffectiveEvent&)), this, SLOT(slotShowEvent(const EffectiveEvent&)) ); 371 connect( view, SIGNAL(signalShowEvent(const EffectiveEvent&)), this, SLOT(slotShowEvent(const EffectiveEvent&)) );
372 connect( view, SIGNAL(signalHideEvent()), this, SLOT(slotHideEvent()) ); 372 connect( view, SIGNAL(signalHideEvent()), this, SLOT(slotHideEvent()) );
373 connect( header, SIGNAL( dateChanged( int, int ) ), this, SLOT( dateChanged( int, int ) ) ); 373 connect( header, SIGNAL( dateChanged( QDate &) ), this, SLOT( dateChanged( QDate &) ) );
374 connect( tHide, SIGNAL( timeout() ), lblDesc, SLOT( hide() ) ); 374 connect( tHide, SIGNAL( timeout() ), lblDesc, SLOT( hide() ) );
375 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) ); 375 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) );
376 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(slotClockChanged(bool))); 376 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(slotClockChanged(bool)));
377 setDate(QDate::currentDate()); 377 setDate(QDate::currentDate());
378} 378}
379 379
380void DateBookWeek::keyPressEvent(QKeyEvent *e) 380void DateBookWeek::keyPressEvent(QKeyEvent *e)
381{ 381{
@@ -394,56 +394,49 @@ void DateBookWeek::keyPressEvent(QKeyEvent *e)
394 break; 394 break;
395 default: 395 default:
396 e->ignore(); 396 e->ignore();
397 } 397 }
398} 398}
399 399
400void DateBookWeek::showDay( int day ) 400void DateBookWeek::showDay( int day )
401{ 401{
402 QDate d; 402 QDate d=bdate;
403 d = dateFromWeek( _week, year, bStartOnMonday ); 403
404 // Calculate offset to first day of week.
405 int dayoffset=d.dayOfWeek();
406 if(bStartOnMonday) dayoffset--;
407
404 day--; 408 day--;
405 d = d.addDays( day ); 409 d=d.addDays(day-dayoffset);
406 emit showDate( d.year(), d.month(), d.day() ); 410 emit showDate( d.year(), d.month(), d.day() );
411 qDebug("%4d-%02d-%02d / Day %d\n",d.year(),d.month(),d.day(),day);
407} 412}
408 413
409void DateBookWeek::setDate( int y, int m, int d ) 414void DateBookWeek::setDate( int y, int m, int d )
410{ 415{
411 setDate(QDate(y, m, d)); 416 setDate(QDate(y, m, d));
412} 417}
413 418
414void DateBookWeek::setDate(QDate date) 419void DateBookWeek::setDate(QDate newdate)
415{ 420{
416 dow = date.dayOfWeek(); 421 bdate=newdate;
417 int w, y; 422 dow = newdate.dayOfWeek();
418 calcWeek( date, w, y, bStartOnMonday ); 423 header->setDate( newdate );
419 header->setDate( date );
420} 424}
421 425
422void DateBookWeek::dateChanged( int y, int w ) 426void DateBookWeek::dateChanged( QDate &newdate )
423{ 427{
424 year = y; 428 bdate=newdate;
425 _week = w;
426 getEvents(); 429 getEvents();
427} 430}
428 431
429QDate DateBookWeek::date() const 432QDate DateBookWeek::date() const
430{ 433{
431 QDate d; 434 return bdate;
432 d = dateFromWeek( _week - 1, year, bStartOnMonday );
433 if ( bStartOnMonday )
434 d = d.addDays( 7 + dow - 1 );
435 else {
436 if ( dow == 7 )
437 d = d.addDays( dow );
438 else
439 d = d.addDays( 7 + dow );
440 }
441 return d;
442} 435}
443 436
444void DateBookWeek::getEvents() 437void DateBookWeek::getEvents()
445{ 438{
446 QDate startWeek = weekDate(); 439 QDate startWeek = weekDate();
447 440
448 QDate endWeek = startWeek.addDays( 6 ); 441 QDate endWeek = startWeek.addDays( 6 );
449 QValueList<EffectiveEvent> eventList = db->getEffectiveEvents(startWeek, endWeek); 442 QValueList<EffectiveEvent> eventList = db->getEffectiveEvents(startWeek, endWeek);
@@ -573,17 +566,23 @@ void DateBookWeek::slotWeekChanged( bool onMonday )
573void DateBookWeek::slotClockChanged( bool ap ) 566void DateBookWeek::slotClockChanged( bool ap )
574{ 567{
575 ampm = ap; 568 ampm = ap;
576} 569}
577 570
578// return the date at the beginning of the week... 571// return the date at the beginning of the week...
579QDate DateBookWeek::weekDate() const 572QDate DateBookWeek::weekDate() const
580{ 573{
581 return dateFromWeek( _week, year, bStartOnMonday ); 574 QDate d=bdate;
575
576 // Calculate offset to first day of week.
577 int dayoffset=d.dayOfWeek();
578 if(bStartOnMonday) dayoffset--;
579
580 return d.addDays(-dayoffset);
582} 581}
583 582
584// this used to only be needed by datebook.cpp, but now we need it inside 583// this used to only be needed by datebook.cpp, but now we need it inside
585// week view since 584// week view since
586// we need to be able to figure out our total number of weeks on the fly... 585// we need to be able to figure out our total number of weeks on the fly...
587// this is probably the best place to put it.. 586// this is probably the best place to put it..
588 587
589// For Weeks that start on Monday... (EASY!) 588// For Weeks that start on Monday... (EASY!)
diff --git a/core/pim/datebook/datebookweek.h b/core/pim/datebook/datebookweek.h
index 8c5e06d..c273e30 100644
--- a/core/pim/datebook/datebookweek.h
+++ b/core/pim/datebook/datebookweek.h
@@ -119,17 +119,17 @@ public slots:
119signals: 119signals:
120 void showDate( int y, int m, int d ); 120 void showDate( int y, int m, int d );
121 121
122protected slots: 122protected slots:
123 void keyPressEvent(QKeyEvent *); 123 void keyPressEvent(QKeyEvent *);
124 124
125private slots: 125private slots:
126 void showDay( int day ); 126 void showDay( int day );
127 void dateChanged( int y, int w ); 127 void dateChanged( QDate &newdate );
128 void slotShowEvent( const EffectiveEvent & ); 128 void slotShowEvent( const EffectiveEvent & );
129 void slotHideEvent(); 129 void slotHideEvent();
130 void slotYearChanged( int ); 130 void slotYearChanged( int );
131 131
132private: 132private:
133 void getEvents(); 133 void getEvents();
134 134
135 /** 135 /**
@@ -145,22 +145,22 @@ private:
145 * This will add the times to the text 145 * This will add the times to the text
146 * It will be shown in the Tooltip bubble 146 * It will be shown in the Tooltip bubble
147 */ 147 */
148 void generateNormalTooltext( QString& text, 148 void generateNormalTooltext( QString& text,
149 const EffectiveEvent &ev); 149 const EffectiveEvent &ev);
150 int year; 150 int year;
151 int _week; 151 int _week;
152 int dow; 152 int dow;
153 QDate bdate;
153 DateBookWeekHeader *header; 154 DateBookWeekHeader *header;
154 DateBookWeekView *view; 155 DateBookWeekView *view;
155 DateBookDB *db; 156 DateBookDB *db;
156 QLabel *lblDesc; 157 QLabel *lblDesc;
157 QTimer *tHide; 158 QTimer *tHide;
158 int startTime; 159 int startTime;
159 bool ampm; 160 bool ampm;
160 bool bStartOnMonday; 161 bool bStartOnMonday;
161}; 162};
162 163
163 164
164bool calcWeek( const QDate &d, int &week, int &year, 165bool calcWeek( const QDate &d, int &week, int &year, bool startOnMonday = false );
165 bool startOnMonday = false );
166#endif 166#endif
diff --git a/core/pim/datebook/datebookweekheaderimpl.cpp b/core/pim/datebook/datebookweekheaderimpl.cpp
index fd792e2..ff7626f 100644
--- a/core/pim/datebook/datebookweekheaderimpl.cpp
+++ b/core/pim/datebook/datebookweekheaderimpl.cpp
@@ -100,40 +100,16 @@ void DateBookWeekHeader::setDate(const QDate &d) {
100 calcWeek(date,week,year,bStartOnMonday); 100 calcWeek(date,week,year,bStartOnMonday);
101 QDate start=date; 101 QDate start=date;
102 QDate stop=start.addDays(6); 102 QDate stop=start.addDays(6);
103 labelDate->setText( QString::number(start.day()) + "." + 103 labelDate->setText( QString::number(start.day()) + "." +
104 start.monthName(start.month()) + "-" + 104 start.monthName(start.month()) + "-" +
105 QString::number(stop.day()) + "." + 105 QString::number(stop.day()) + "." +
106 start.monthName(stop.month()) +" ("+ 106 start.monthName(stop.month()) +" ("+
107 tr("w")+":"+QString::number( week ) +")"); 107 tr("w")+":"+QString::number( week ) +")");
108 emit dateChanged(year,week); 108 emit dateChanged(date);
109} 109}
110 110
111void DateBookWeekHeader::setStartOfWeek( bool onMonday ) 111void DateBookWeekHeader::setStartOfWeek( bool onMonday )
112{ 112{
113 bStartOnMonday = onMonday; 113 bStartOnMonday = onMonday;
114 setDate( date ); 114 setDate( date );
115} 115}
116
117// dateFromWeek
118// compute the date from the week in the year
119QDate dateFromWeek( int week, int year, bool startOnMonday )
120{
121 QDate d;
122 d.setYMD( year, 1, 1 );
123 int dayOfWeek = d.dayOfWeek();
124 if ( startOnMonday ) {
125 if ( dayOfWeek <= 4 ) {
126 d = d.addDays( ( week - 1 ) * 7 - dayOfWeek + 1 );
127 } else {
128 d = d.addDays( (week) * 7 - dayOfWeek + 1 );
129 }
130 } else {
131 if ( dayOfWeek <= 4 || dayOfWeek == 7) {
132 d = d.addDays( ( week - 1 ) * 7 - dayOfWeek % 7 );
133 } else {
134 d = d.addDays( ( week ) * 7 - dayOfWeek % 7 );
135 }
136 }
137 return d;
138}
139
diff --git a/core/pim/datebook/datebookweekheaderimpl.h b/core/pim/datebook/datebookweekheaderimpl.h
index 1ab1d52..d8dce90 100644
--- a/core/pim/datebook/datebookweekheaderimpl.h
+++ b/core/pim/datebook/datebookweekheaderimpl.h
@@ -31,17 +31,17 @@ public:
31 DateBookWeekHeader( bool startOnMonday, QWidget* parent = 0, 31 DateBookWeekHeader( bool startOnMonday, QWidget* parent = 0,
32 const char* name = 0, WFlags fl = 0 ); 32 const char* name = 0, WFlags fl = 0 );
33 ~DateBookWeekHeader(); 33 ~DateBookWeekHeader();
34 34
35 void setDate(const QDate &d); 35 void setDate(const QDate &d);
36 void setStartOfWeek( bool onMonday ); 36 void setStartOfWeek( bool onMonday );
37 37
38signals: 38signals:
39 void dateChanged( int y, int w ); 39 void dateChanged( QDate &date );
40 40
41public slots: 41public slots:
42 void pickDate(); 42 void pickDate();
43 void nextMonth(); 43 void nextMonth();
44 void prevMonth(); 44 void prevMonth();
45 void nextWeek(); 45 void nextWeek();
46 void prevWeek(); 46 void prevWeek();
47 void setDate( int y, int m, int d); 47 void setDate( int y, int m, int d);
@@ -49,11 +49,9 @@ public slots:
49protected slots: 49protected slots:
50 void keyPressEvent(QKeyEvent *e) { e->ignore(); } 50 void keyPressEvent(QKeyEvent *e) { e->ignore(); }
51 51
52private: 52private:
53 QDate date; 53 QDate date;
54 bool bStartOnMonday; 54 bool bStartOnMonday;
55}; 55};
56 56
57QDate dateFromWeek( int week, int year, bool startOnMonday );
58
59#endif // DATEBOOKDAYHEADER_H 57#endif // DATEBOOKDAYHEADER_H
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index a39ff40..7817042 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -67,17 +67,17 @@ void DateBookWeekLstHeader::setDate(const QDate &d) {
67 calcWeek(date,week,year,bStartOnMonday); 67 calcWeek(date,week,year,bStartOnMonday);
68 QDate start=date; 68 QDate start=date;
69 QDate stop=start.addDays(6); 69 QDate stop=start.addDays(6);
70 labelDate->setText( QString::number(start.day()) + "." + 70 labelDate->setText( QString::number(start.day()) + "." +
71 start.monthName(start.month()) + "-" + 71 start.monthName(start.month()) + "-" +
72 QString::number(stop.day()) + "." + 72 QString::number(stop.day()) + "." +
73 start.monthName(stop.month()) +" ("+ 73 start.monthName(stop.month()) +" ("+
74 tr("w")+":"+QString::number( week ) +")"); 74 tr("w")+":"+QString::number( week ) +")");
75 emit dateChanged(year,week); 75 emit dateChanged(date);
76} 76}
77 77
78void DateBookWeekLstHeader::pickDate() { 78void DateBookWeekLstHeader::pickDate() {
79 static QPopupMenu *m1 = 0; 79 static QPopupMenu *m1 = 0;
80 static DateBookMonth *picker = 0; 80 static DateBookMonth *picker = 0;
81 if ( !m1 ) { 81 if ( !m1 ) {
82 m1 = new QPopupMenu( this ); 82 m1 = new QPopupMenu( this );
83 picker = new DateBookMonth( m1, 0, TRUE ); 83 picker = new DateBookMonth( m1, 0, TRUE );
@@ -104,25 +104,25 @@ void DateBookWeekLstHeader::nextMonth()
104{ 104{
105 setDate(date.addDays(28)); 105 setDate(date.addDays(28));
106} 106}
107void DateBookWeekLstHeader::prevMonth() 107void DateBookWeekLstHeader::prevMonth()
108{ 108{
109 setDate(date.addDays(-28)); 109 setDate(date.addDays(-28));
110} 110}
111 111
112DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/, 112DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */,
113 QWidget* parent, 113 QWidget* parent,
114 const char* name, 114 const char* name,
115 WFlags fl ) 115 WFlags fl )
116 : DateBookWeekLstDayHdrBase(parent, name, fl) { 116 : DateBookWeekLstDayHdrBase(parent, name, fl) {
117 117
118 date=d; 118 date=d;
119 119
120 static const char *wdays={"MTWTFSS"}; 120 static const char *wdays={"MTWTFSSM"};
121 char day=wdays[d.dayOfWeek()-1]; 121 char day=wdays[d.dayOfWeek()-1];
122 122
123 label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) ); 123 label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) );
124 add->setText("+"); 124 add->setText("+");
125 125
126 if (d == QDate::currentDate()) { 126 if (d == QDate::currentDate()) {
127 QPalette pal=label->palette(); 127 QPalette pal=label->palette();
128 pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); 128 pal.setColor(QColorGroup::Foreground, QColor(0,0,255));
@@ -229,35 +229,38 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
229 int dayOrder[7]; 229 int dayOrder[7];
230 if (bStartOnMonday) { 230 if (bStartOnMonday) {
231 for (int d=0; d<7; d++) dayOrder[d]=d+1; 231 for (int d=0; d<7; d++) dayOrder[d]=d+1;
232 } else { 232 } else {
233 for (int d=0; d<7; d++) dayOrder[d]=d; 233 for (int d=0; d<7; d++) dayOrder[d]=d;
234 dayOrder[0]=7; 234 dayOrder[0]=7;
235 } 235 }
236 236
237 for (int i=0; i<7; i++) { 237 // Calculate offset to first day of week.
238 int dayoffset=d.dayOfWeek();
239 if(bStartOnMonday) dayoffset--;
240
241 for (int i=0; i<7; i++) {
238 // Header 242 // Header
239 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), bStartOnMonday,this); 243 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this);
240 connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); 244 connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
241 connect(hdr, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)), 245 connect(hdr, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)),
242 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &))); 246 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)));
243 layout->addWidget(hdr); 247 layout->addWidget(hdr);
244 248
245 // Events 249 // Events
246 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { 250 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) {
247 if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) {// Skip events ending at 00:00 starting at another day. 251 if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) {// Skip events ending at 00:00 starting at another day.
248 DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this); 252 DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this);
249 layout->addWidget(l); 253 layout->addWidget(l);
250 connect (l, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &))); 254 connect (l, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &)));
255 }
256 it++;
251 } 257 }
252 it++; 258 layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
253 }
254
255 layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
256 } 259 }
257} 260}
258DateBookWeekLstView::~DateBookWeekLstView(){} 261DateBookWeekLstView::~DateBookWeekLstView(){}
259void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} 262void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();}
260 263
261DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, 264DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
262 QValueList<EffectiveEvent> &ev2, 265 QValueList<EffectiveEvent> &ev2,
263 QDate &d, bool onM, 266 QDate &d, bool onM,
@@ -293,17 +296,17 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
293 bStartOnMonday(onM) 296 bStartOnMonday(onM)
294{ 297{
295 setFocusPolicy(StrongFocus); 298 setFocusPolicy(StrongFocus);
296 layout = new QVBoxLayout( this ); 299 layout = new QVBoxLayout( this );
297 layout->setMargin(0); 300 layout->setMargin(0);
298 301
299 header=new DateBookWeekLstHeader(onM, this); 302 header=new DateBookWeekLstHeader(onM, this);
300 layout->addWidget( header ); 303 layout->addWidget( header );
301 connect(header, SIGNAL(dateChanged(int,int)), this, SLOT(dateChanged(int,int))); 304 connect(header, SIGNAL(dateChanged(QDate &)), this, SLOT(dateChanged(QDate &)));
302 connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool))); 305 connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool)));
303 306
304 scroll=new QScrollView(this); 307 scroll=new QScrollView(this);
305 scroll->setResizePolicy(QScrollView::AutoOneFit); 308 scroll->setResizePolicy(QScrollView::AutoOneFit);
306 layout->addWidget(scroll); 309 layout->addWidget(scroll);
307 310
308 view=NULL; 311 view=NULL;
309 Config config("DateBook"); 312 Config config("DateBook");
@@ -313,42 +316,28 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
313} 316}
314DateBookWeekLst::~DateBookWeekLst(){ 317DateBookWeekLst::~DateBookWeekLst(){
315 Config config("DateBook"); 318 Config config("DateBook");
316 config.setGroup("Main"); 319 config.setGroup("Main");
317 config.writeEntry("weeklst_dbl", dbl); 320 config.writeEntry("weeklst_dbl", dbl);
318} 321}
319 322
320void DateBookWeekLst::setDate(const QDate &d) { 323void DateBookWeekLst::setDate(const QDate &d) {
321 int w,y; 324 bdate=d;
322 calcWeek(d,w,y,bStartOnMonday); 325 header->setDate(d);
323 year=y;
324 _week=w;
325 header->setDate(date());
326} 326}
327
327void DateBookWeekLst::setDbl(bool on) { 328void DateBookWeekLst::setDbl(bool on) {
328 dbl=on; 329 dbl=on;
329 redraw(); 330 redraw();
330} 331}
331void DateBookWeekLst::redraw() {getEvents();} 332void DateBookWeekLst::redraw() {getEvents();}
332 333
333QDate DateBookWeekLst::date() const { 334QDate DateBookWeekLst::date() {
334 QDate d; 335 return bdate;
335 d.setYMD(year,1,1);
336
337 int dow= d.dayOfWeek();
338 if (!bStartOnMonday)
339 if (dow==7) {
340 dow=1;
341 } else {
342 dow++;
343 }
344
345 d=d.addDays( (_week-1)*7 - dow + 1 );
346 return d;
347} 336}
348 337
349void DateBookWeekLst::getEvents() { 338void DateBookWeekLst::getEvents() {
350 QDate start = date(); 339 QDate start = date();
351 QDate stop = start.addDays(6); 340 QDate stop = start.addDays(6);
352 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); 341 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop);
353 342
354 if (view) delete view; 343 if (view) delete view;
@@ -366,19 +355,18 @@ void DateBookWeekLst::getEvents() {
366 connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)), 355 connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)),
367 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &))); 356 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)));
368 357
369 scroll->addChild(view); 358 scroll->addChild(view);
370 view->show(); 359 view->show();
371 scroll->updateScrollBars(); 360 scroll->updateScrollBars();
372} 361}
373 362
374void DateBookWeekLst::dateChanged(int y, int w) { 363void DateBookWeekLst::dateChanged(QDate &newdate) {
375 year=y; 364 bdate=newdate;
376 _week=w;
377 getEvents(); 365 getEvents();
378} 366}
379 367
380void DateBookWeekLst::keyPressEvent(QKeyEvent *e) 368void DateBookWeekLst::keyPressEvent(QKeyEvent *e)
381{ 369{
382 switch(e->key()) { 370 switch(e->key()) {
383 case Key_Up: 371 case Key_Up:
384 scroll->scrollBy(0, -20); 372 scroll->scrollBy(0, -20);
@@ -390,9 +378,9 @@ void DateBookWeekLst::keyPressEvent(QKeyEvent *e)
390 header->prevWeek(); 378 header->prevWeek();
391 break; 379 break;
392 case Key_Right: 380 case Key_Right:
393 header->nextWeek(); 381 header->nextWeek();
394 break; 382 break;
395 default: 383 default:
396 e->ignore(); 384 e->ignore();
397 } 385 }
398} \ No newline at end of file 386}
diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h
index f858c4f..0bfbcda 100644
--- a/core/pim/datebook/datebookweeklst.h
+++ b/core/pim/datebook/datebookweeklst.h
@@ -27,17 +27,17 @@ public:
27public slots: 27public slots:
28 void nextWeek(); 28 void nextWeek();
29 void prevWeek(); 29 void prevWeek();
30 void nextMonth(); 30 void nextMonth();
31 void prevMonth(); 31 void prevMonth();
32 void pickDate(); 32 void pickDate();
33 void setDate(int y, int m, int d); 33 void setDate(int y, int m, int d);
34signals: 34signals:
35 void dateChanged(int y, int w); 35 void dateChanged(QDate &newdate);
36 void setDbl(bool on); 36 void setDbl(bool on);
37private: 37private:
38 QDate date; 38 QDate date;
39 //bool onMonday; 39 //bool onMonday;
40 bool bStartOnMonday; 40 bool bStartOnMonday;
41}; 41};
42 42
43class DateBookWeekLstDayHdr: public DateBookWeekLstDayHdrBase 43class DateBookWeekLstDayHdr: public DateBookWeekLstDayHdrBase
@@ -114,21 +114,21 @@ class DateBookWeekLst : public QWidget
114public: 114public:
115 DateBookWeekLst( bool ampm, bool onM, DateBookDB *newDB, 115 DateBookWeekLst( bool ampm, bool onM, DateBookDB *newDB,
116 QWidget *parent = 0, 116 QWidget *parent = 0,
117 const char *name = 0 ); 117 const char *name = 0 );
118 ~DateBookWeekLst(); 118 ~DateBookWeekLst();
119 void setDate( int y, int w ); 119 void setDate( int y, int w );
120 void setDate(const QDate &d ); 120 void setDate(const QDate &d );
121 int week() const { return _week; }; 121 int week() const { return _week; };
122 QDate date() const; 122 QDate date();
123 123
124public slots: 124public slots:
125 void redraw(); 125 void redraw();
126 void dateChanged(int y, int w); 126 void dateChanged(QDate &date);
127 127
128protected slots: 128protected slots:
129 void keyPressEvent(QKeyEvent *); 129 void keyPressEvent(QKeyEvent *);
130 void setDbl(bool on); 130 void setDbl(bool on);
131 131
132signals: 132signals:
133 void showDate(int y, int m, int d); 133 void showDate(int y, int m, int d);
134 void addEvent(const QDateTime &start, const QDateTime &stop, 134 void addEvent(const QDateTime &start, const QDateTime &stop,
@@ -136,19 +136,20 @@ signals:
136 void editEvent(const Event &e); 136 void editEvent(const Event &e);
137 137
138private: 138private:
139 DateBookDB *db; 139 DateBookDB *db;
140 int startTime; 140 int startTime;
141 bool ampm; 141 bool ampm;
142 bool bStartOnMonday; 142 bool bStartOnMonday;
143 bool dbl; 143 bool dbl;
144 int year, _week; 144 QDate bdate;
145 int year, _week,dow;
145 DateBookWeekLstHeader *header; 146 DateBookWeekLstHeader *header;
146 QWidget *view; 147 QWidget *view;
147 QVBoxLayout *layout; 148 QVBoxLayout *layout;
148 QScrollView *scroll; 149 QScrollView *scroll;
149 150
150 void getEvents(); 151 void getEvents();
151}; 152};
152 153
153#endif 154#endif
154 155