summaryrefslogtreecommitdiff
path: root/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp
authoralwin <alwin>2005-03-19 13:44:30 (UTC)
committer alwin <alwin>2005-03-19 13:44:30 (UTC)
commit34e42590a8ef21c1377f89c7b82f25bcf0aec3cb (patch) (side-by-side diff)
treef5afdae31945ca2bac7339a339499fa87ece50d9 /core/pim/datebook/modules/weeklst/datebookweeklstview.cpp
parentd9e8b9e797e3162ab564bb3b0f04663ef1167541 (diff)
downloadopie-34e42590a8ef21c1377f89c7b82f25bcf0aec3cb.zip
opie-34e42590a8ef21c1377f89c7b82f25bcf0aec3cb.tar.gz
opie-34e42590a8ef21c1377f89c7b82f25bcf0aec3cb.tar.bz2
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.
Diffstat (limited to 'core/pim/datebook/modules/weeklst/datebookweeklstview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklstview.cpp73
1 files changed, 73 insertions, 0 deletions
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 <opie2/odebug.h>
+
+#include <qpe/config.h>
+
+#include <qlayout.h>
+#include <qtl.h>
+
+DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &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<EffectiveEvent> 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();}