summaryrefslogtreecommitdiff
path: root/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp
Unidiff
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.cpp49
1 files changed, 40 insertions, 9 deletions
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp b/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp
index efb4c01..82b9c6d 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp
+++ b/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp
@@ -17,6 +17,22 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
17 const char* name, WFlags fl) 17 const char* name, WFlags fl)
18 : QWidget( parent, name, fl ) 18 : QWidget( parent, name, fl )
19{ 19{
20 childs.clear();
21 m_MainLayout = new QVBoxLayout( this );
22 setEvents(ev,d,onM);
23}
24
25void DateBookWeekLstView::setEvents(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM)
26{
27 QValueList<QObject*>::Iterator wIter;
28 for (wIter=childs.begin();wIter!=childs.end();++wIter) {
29 QObject*w = (*wIter);
30 delete w;
31 }
32 childs.clear();
33
34 setUpdatesEnabled(false);
35// m_MainLayout->deleteAllItems();
20 Config config("DateBook"); 36 Config config("DateBook");
21 config.setGroup("Main"); 37 config.setGroup("Main");
22 int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL); 38 int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL);
@@ -26,8 +42,6 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
26 setPalette(white); 42 setPalette(white);
27 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); 43 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
28 44
29 QVBoxLayout *layout = new QVBoxLayout( this );
30
31 qBubbleSort(ev); 45 qBubbleSort(ev);
32 QValueListIterator<EffectiveEvent> it; 46 QValueListIterator<EffectiveEvent> it;
33 it=ev.begin(); 47 it=ev.begin();
@@ -46,18 +60,23 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
46 else if( dayoffset == 7 ) dayoffset = 0; 60 else if( dayoffset == 7 ) dayoffset = 0;
47 61
48 for (int i=0; i<7; i++) { 62 for (int i=0; i<7; i++) {
63 QWidget*w = new QWidget(this);
64 w->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
65 w->setPalette(white);
66 QVBoxLayout * tlayout = new QVBoxLayout(w);
67 childs.append(w);
49 // Header 68 // Header
50 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this); 69 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,w);
51 connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); 70 connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
52 connect(hdr, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), 71 connect(hdr, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
53 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); 72 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
54 layout->addWidget(hdr); 73 tlayout->addWidget(hdr);
55 74
56 // Events 75 // Events
57 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { 76 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) {
58 if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) { // Skip events ending at 00:00 starting at another day. 77 if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) { // Skip events ending at 00:00 starting at another day.
59 DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this); 78 DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,w);
60 layout->addWidget(l); 79 tlayout->addWidget(l);
61 connect (l, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); 80 connect (l, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
62 connect (l, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); 81 connect (l, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
63 connect (l, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); 82 connect (l, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &)));
@@ -66,8 +85,20 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
66 } 85 }
67 it++; 86 it++;
68 } 87 }
69 layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); 88 tlayout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
89 m_MainLayout->addWidget(w);
90/*
91 QSpacerItem * tmp = new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding);
92 m_MainLayout->addItem(tmp);
93*/
70 } 94 }
95 setUpdatesEnabled(true);
96}
97
98DateBookWeekLstView::~DateBookWeekLstView()
99{}
100
101void DateBookWeekLstView::keyPressEvent(QKeyEvent *e)
102{
103 e->ignore();
71} 104}
72DateBookWeekLstView::~DateBookWeekLstView(){}
73void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();}