From 34e42590a8ef21c1377f89c7b82f25bcf0aec3cb Mon Sep 17 00:00:00 2001 From: alwin Date: Sat, 19 Mar 2005 13:44:30 +0000 Subject: so.... I looked for a problem. could not found due the kind of code structure. so I had reorganized the code into a more sensefull structure so every one should be able to find some code sequences when searching for a bug. yes - now I found the problem and can thinking about resolving it. --- (limited to 'core/pim/datebook/modules/weeklst/datebookweeklstview.cpp') diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp b/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp new file mode 100644 index 0000000..efb4c01 --- a/dev/null +++ b/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp @@ -0,0 +1,73 @@ +#include "datebookweeklstview.h" +#include "datebooktypes.h" +#include "datebookweeklstdayhdr.h" +#include "datebookweeklstheader.h" +#include "datebookweeklstevent.h" + +#include + +#include + +#include +#include + +DateBookWeekLstView::DateBookWeekLstView(QValueList &ev, + const QDate &d, bool onM, + QWidget* parent, + const char* name, WFlags fl) + : QWidget( parent, name, fl ) +{ + Config config("DateBook"); + config.setGroup("Main"); + int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL); + odebug << "weeklistviewconfig: " << weeklistviewconfig << oendl; + + bStartOnMonday=onM; + setPalette(white); + setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); + + QVBoxLayout *layout = new QVBoxLayout( this ); + + qBubbleSort(ev); + QValueListIterator it; + it=ev.begin(); + + int dayOrder[7]; + if (bStartOnMonday) { + for (int d=0; d<7; d++) dayOrder[d]=d+1; + } else { + for (int d=0; d<7; d++) dayOrder[d]=d; + dayOrder[0]=7; + } + + // Calculate offset to first day of week. + int dayoffset=d.dayOfWeek(); + if(bStartOnMonday) dayoffset--; + else if( dayoffset == 7 ) dayoffset = 0; + + for (int i=0; i<7; i++) { + // Header + DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this); + connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); + connect(hdr, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), + this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); + layout->addWidget(hdr); + + // Events + while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { + if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) { // Skip events ending at 00:00 starting at another day. + DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this); + layout->addWidget(l); + connect (l, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); + connect (l, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); + connect (l, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); + connect (l, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); + connect (l, SIGNAL(redraw()), this, SIGNAL(redraw())); + } + it++; + } + layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); + } +} +DateBookWeekLstView::~DateBookWeekLstView(){} +void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} -- cgit v0.9.0.2