author | umopapisdn <umopapisdn> | 2003-05-13 22:58:18 (UTC) |
---|---|---|
committer | umopapisdn <umopapisdn> | 2003-05-13 22:58:18 (UTC) |
commit | 1e0e2f57472538bd880967ebe061c8f39a7e270b (patch) (side-by-side diff) | |
tree | fcc070d53148385f93c0dc6ab5443d5100be0d26 /core/pim/datebook/datebookweeklst.cpp | |
parent | 45c0386de12b107e54e4d020d54eb05517a9efac (diff) | |
download | opie-1e0e2f57472538bd880967ebe061c8f39a7e270b.zip opie-1e0e2f57472538bd880967ebe061c8f39a7e270b.tar.gz opie-1e0e2f57472538bd880967ebe061c8f39a7e270b.tar.bz2 |
Bugfix: (Bug #0000902) Adding events in weekview shouldn't create them as events on the first day of the week but rather the last visited day.
Diffstat (limited to 'core/pim/datebook/datebookweeklst.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 42 |
1 files changed, 15 insertions, 27 deletions
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 @@ -74,3 +74,3 @@ void DateBookWeekLstHeader::setDate(const QDate &d) { tr("w")+":"+QString::number( week ) +")"); - emit dateChanged(year,week); + emit dateChanged(date); } @@ -119,3 +119,3 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/, - static const char *wdays={"MTWTFSS"}; + static const char *wdays={"MTWTFSSM"}; char day=wdays[d.dayOfWeek()-1]; @@ -236,5 +236,9 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, + // Calculate offset to first day of week. + int dayoffset=d.dayOfWeek(); + if(bStartOnMonday) dayoffset--; + for (int i=0; i<7; i++) { // Header - DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), bStartOnMonday,this); + DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this); connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); @@ -253,3 +257,2 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, } - layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); @@ -300,3 +303,3 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, layout->addWidget( header ); - connect(header, SIGNAL(dateChanged(int,int)), this, SLOT(dateChanged(int,int))); + connect(header, SIGNAL(dateChanged(QDate &)), this, SLOT(dateChanged(QDate &))); connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool))); @@ -320,8 +323,6 @@ DateBookWeekLst::~DateBookWeekLst(){ void DateBookWeekLst::setDate(const QDate &d) { - int w,y; - calcWeek(d,w,y,bStartOnMonday); - year=y; - _week=w; - header->setDate(date()); + bdate=d; + header->setDate(d); } + void DateBookWeekLst::setDbl(bool on) { @@ -332,16 +333,4 @@ void DateBookWeekLst::redraw() {getEvents();} -QDate DateBookWeekLst::date() const { - QDate d; - d.setYMD(year,1,1); - - int dow= d.dayOfWeek(); - if (!bStartOnMonday) - if (dow==7) { - dow=1; - } else { - dow++; - } - - d=d.addDays( (_week-1)*7 - dow + 1 ); - return d; +QDate DateBookWeekLst::date() { + return bdate; } @@ -373,5 +362,4 @@ void DateBookWeekLst::getEvents() { -void DateBookWeekLst::dateChanged(int y, int w) { - year=y; - _week=w; +void DateBookWeekLst::dateChanged(QDate &newdate) { + bdate=newdate; getEvents(); |