summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-17 20:56:54 (UTC)
committer alwin <alwin>2005-03-17 20:56:54 (UTC)
commit120694217c012e3c1c394db0598da41f2705e965 (patch) (unidiff)
tree6fa3d501c94aa2f6bfce7bc2c1a0556b69e75e20
parent7382ac56570e7be468c570de27d5f7a40735873f (diff)
downloadopie-120694217c012e3c1c394db0598da41f2705e965.zip
opie-120694217c012e3c1c394db0598da41f2705e965.tar.gz
opie-120694217c012e3c1c394db0598da41f2705e965.tar.bz2
fix error in thinking about date-diffs I made
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookweeklst.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index 0555bc7..b0e78f1 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -339,99 +339,99 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB,
339 scroll=new QScrollView(this); 339 scroll=new QScrollView(this);
340 scroll->setResizePolicy(QScrollView::AutoOneFit); 340 scroll->setResizePolicy(QScrollView::AutoOneFit);
341 layout->addWidget(scroll); 341 layout->addWidget(scroll);
342 342
343 view=NULL; 343 view=NULL;
344 Config config("DateBook"); 344 Config config("DateBook");
345 config.setGroup("Main"); 345 config.setGroup("Main");
346 dbl=config.readBoolEntry("weeklst_dbl", false); 346 dbl=config.readBoolEntry("weeklst_dbl", false);
347 header->dbl->setOn(dbl); 347 header->dbl->setOn(dbl);
348} 348}
349DateBookWeekLst::~DateBookWeekLst(){ 349DateBookWeekLst::~DateBookWeekLst(){
350 Config config("DateBook"); 350 Config config("DateBook");
351 config.setGroup("Main"); 351 config.setGroup("Main");
352 config.writeEntry("weeklst_dbl", dbl); 352 config.writeEntry("weeklst_dbl", dbl);
353} 353}
354 354
355void DateBookWeekLst::setDate(const QDate &d) { 355void DateBookWeekLst::setDate(const QDate &d) {
356 bdate=d; 356 bdate=d;
357 header->setDate(d); 357 header->setDate(d);
358} 358}
359 359
360void DateBookWeekLst::setDbl(bool on) { 360void DateBookWeekLst::setDbl(bool on) {
361 dbl=on; 361 dbl=on;
362 redraw(); 362 redraw();
363} 363}
364void DateBookWeekLst::redraw() {getEvents();} 364void DateBookWeekLst::redraw() {getEvents();}
365 365
366QDate DateBookWeekLst::date() { 366QDate DateBookWeekLst::date() {
367 return bdate; 367 return bdate;
368} 368}
369 369
370// return the date at the beginning of the week... 370// return the date at the beginning of the week...
371// copied from DateBookWeek 371// copied from DateBookWeek
372QDate DateBookWeekLst::weekDate() const 372QDate DateBookWeekLst::weekDate() const
373{ 373{
374 QDate d=bdate; 374 QDate d=bdate;
375 375
376 // Calculate offset to first day of week. 376 // Calculate offset to first day of week.
377 int dayoffset=d.dayOfWeek(); 377 int dayoffset=d.dayOfWeek();
378 if(bStartOnMonday) dayoffset--; 378 if(bStartOnMonday) dayoffset--;
379 else if( dayoffset == 7 ) 379 else if( dayoffset == 7 )
380 dayoffset = 0; 380 dayoffset = 0;
381 381
382 return d.addDays(-dayoffset); 382 return d.addDays(-dayoffset);
383} 383}
384 384
385void DateBookWeekLst::getEvents() { 385void DateBookWeekLst::getEvents() {
386 QDate start = weekDate(); //date(); 386 QDate start = weekDate(); //date();
387 QDate stop = start.addDays(7); 387 QDate stop = start.addDays(6);
388 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); 388 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop);
389 389
390 if (view) delete view; 390 if (view) delete view;
391 if (dbl) { 391 if (dbl) {
392 QDate start2=start.addDays(8); 392 QDate start2=start.addDays(7);
393 stop=start2.addDays(7); 393 stop=start2.addDays(6);
394 QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); 394 QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop);
395 view=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll); 395 view=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll);
396 } else { 396 } else {
397 view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll); 397 view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll);
398 } 398 }
399 399
400 connect (view, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); 400 connect (view, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
401 connect (view, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); 401 connect (view, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
402 connect (view, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); 402 connect (view, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &)));
403 connect (view, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); 403 connect (view, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &)));
404 connect (view, SIGNAL(redraw()), this, SLOT(redraw())); 404 connect (view, SIGNAL(redraw()), this, SLOT(redraw()));
405 connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); 405 connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
406 connect (view, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), 406 connect (view, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
407 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); 407 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
408 408
409 scroll->addChild(view); 409 scroll->addChild(view);
410 view->show(); 410 view->show();
411 scroll->updateScrollBars(); 411 scroll->updateScrollBars();
412} 412}
413 413
414void DateBookWeekLst::dateChanged(QDate &newdate) { 414void DateBookWeekLst::dateChanged(QDate &newdate) {
415 bdate=newdate; 415 bdate=newdate;
416 getEvents(); 416 getEvents();
417} 417}
418 418
419void DateBookWeekLst::keyPressEvent(QKeyEvent *e) 419void DateBookWeekLst::keyPressEvent(QKeyEvent *e)
420{ 420{
421 switch(e->key()) { 421 switch(e->key()) {
422 case Key_Up: 422 case Key_Up:
423 scroll->scrollBy(0, -20); 423 scroll->scrollBy(0, -20);
424 break; 424 break;
425 case Key_Down: 425 case Key_Down:
426 scroll->scrollBy(0, 20); 426 scroll->scrollBy(0, 20);
427 break; 427 break;
428 case Key_Left: 428 case Key_Left:
429 header->prevWeek(); 429 header->prevWeek();
430 break; 430 break;
431 case Key_Right: 431 case Key_Right:
432 header->nextWeek(); 432 header->nextWeek();
433 break; 433 break;
434 default: 434 default:
435 e->ignore(); 435 e->ignore();
436 } 436 }
437} 437}