summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-19 18:06:44 (UTC)
committer alwin <alwin>2005-03-19 18:06:44 (UTC)
commitff7fd64d755b2cc63f9944b1a17a6a2e186da0b6 (patch) (unidiff)
tree11c335300ae6e9dd55b62e5558e56a85222d3fb6
parent93d0e2c50c24c518323d7926df37827d3b562a28 (diff)
downloadopie-ff7fd64d755b2cc63f9944b1a17a6a2e186da0b6.zip
opie-ff7fd64d755b2cc63f9944b1a17a6a2e186da0b6.tar.gz
opie-ff7fd64d755b2cc63f9944b1a17a6a2e186da0b6.tar.bz2
hopefull speedup the weeklistview.
deleting the main widget 4 times when date changed isn't that usefull. After 1.2 OPIE this view should completly rewritten or removed.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/holiday/christian/christian-holidays.pro2
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklst.cpp65
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklst.h5
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp132
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklstdblview.h17
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklstview.cpp49
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklstview.h13
7 files changed, 225 insertions, 58 deletions
diff --git a/core/pim/datebook/holiday/christian/christian-holidays.pro b/core/pim/datebook/holiday/christian/christian-holidays.pro
index db3c777..c943510 100644
--- a/core/pim/datebook/holiday/christian/christian-holidays.pro
+++ b/core/pim/datebook/holiday/christian/christian-holidays.pro
@@ -12,7 +12,7 @@ INCLUDEPATH += $(OPIEDIR)/include \
12DEPENDPATH += $(OPIEDIR)/include \ 12DEPENDPATH += $(OPIEDIR)/include \
13 ../ ../library 13 ../ ../library
14 14
15LIBS+= -lqpe -lopiecore2 -lopieui2 -opiepim2 15LIBS+= -lqpe -lopiecore2 -lopieui2 -lopiepim2
16 16
17DESTDIR = $(OPIEDIR)/plugins/holidays 17DESTDIR = $(OPIEDIR)/plugins/holidays
18TARGET = chrisholidayplugin 18TARGET = chrisholidayplugin
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklst.cpp b/core/pim/datebook/modules/weeklst/datebookweeklst.cpp
index 47bc597..6556373 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklst.cpp
+++ b/core/pim/datebook/modules/weeklst/datebookweeklst.cpp
@@ -27,6 +27,7 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB,
27 bStartOnMonday(onM) 27 bStartOnMonday(onM)
28{ 28{
29 setFocusPolicy(StrongFocus); 29 setFocusPolicy(StrongFocus);
30 dateset = false;
30 layout = new QVBoxLayout( this ); 31 layout = new QVBoxLayout( this );
31 layout->setMargin(0); 32 layout->setMargin(0);
32 33
@@ -39,12 +40,13 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB,
39 scroll->setResizePolicy(QScrollView::AutoOneFit); 40 scroll->setResizePolicy(QScrollView::AutoOneFit);
40 layout->addWidget(scroll); 41 layout->addWidget(scroll);
41 42
42 view=NULL; 43 m_CurrentView=NULL;
43 Config config("DateBook"); 44 Config config("DateBook");
44 config.setGroup("Main"); 45 config.setGroup("Main");
45 dbl=config.readBoolEntry("weeklst_dbl", false); 46 dbl=config.readBoolEntry("weeklst_dbl", false);
46 header->dbl->setOn(dbl); 47 header->dbl->setOn(dbl);
47} 48}
49
48DateBookWeekLst::~DateBookWeekLst(){ 50DateBookWeekLst::~DateBookWeekLst(){
49 Config config("DateBook"); 51 Config config("DateBook");
50 config.setGroup("Main"); 52 config.setGroup("Main");
@@ -58,8 +60,15 @@ void DateBookWeekLst::setDate(const QDate &d) {
58 60
59void DateBookWeekLst::setDbl(bool on) { 61void DateBookWeekLst::setDbl(bool on) {
60 dbl=on; 62 dbl=on;
61 redraw(); 63 bool displayed = false;
64 if (m_CurrentView) {
65 displayed = m_CurrentView->toggleDoubleView(on);
66 }
67 if (!displayed||dbl) {
68 getEvents();
69 }
62} 70}
71
63void DateBookWeekLst::redraw() {getEvents();} 72void DateBookWeekLst::redraw() {getEvents();}
64 73
65QDate DateBookWeekLst::date() { 74QDate DateBookWeekLst::date() {
@@ -82,38 +91,50 @@ QDate DateBookWeekLst::weekDate() const
82} 91}
83 92
84void DateBookWeekLst::getEvents() { 93void DateBookWeekLst::getEvents() {
94 if (!dateset) return;
85 QDate start = weekDate(); //date(); 95 QDate start = weekDate(); //date();
86 QDate stop = start.addDays(6); 96 QDate stop = start.addDays(6);
97 QDate start2;
98
99
87 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); 100 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop);
101 QValueList<EffectiveEvent> el2;
88 102
89 setUpdatesEnabled(false);
90 if (view) delete view;
91 if (dbl) { 103 if (dbl) {
92 QDate start2=start.addDays(7); 104 start2 = start.addDays(7);
93 stop=start2.addDays(6); 105 stop = start2.addDays(6);
94 QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); 106 el2 = db->getEffectiveEvents(start2, stop);
95 view=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll); 107 }
108 if (!m_CurrentView) {
109 if (dbl) {
110 m_CurrentView=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll);
111 } else {
112 m_CurrentView=new DateBookWeekLstDblView(el,start,bStartOnMonday,scroll);
113 }
114 m_CurrentView->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
115 connect (m_CurrentView, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
116 connect (m_CurrentView, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
117 connect (m_CurrentView, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &)));
118 connect (m_CurrentView, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &)));
119 connect (m_CurrentView, SIGNAL(redraw()), this, SLOT(redraw()));
120 connect (m_CurrentView, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
121 connect (m_CurrentView, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
122 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
123 scroll->addChild(m_CurrentView);
96 } else { 124 } else {
97 view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll); 125 if (dbl) {
126 m_CurrentView->setEvents(el,el2,start,bStartOnMonday);
127 } else {
128 m_CurrentView->setEvents(el,start,bStartOnMonday);
129 }
98 } 130 }
99
100 connect (view, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
101 connect (view, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
102 connect (view, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &)));
103 connect (view, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &)));
104 connect (view, SIGNAL(redraw()), this, SLOT(redraw()));
105 connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
106 connect (view, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
107 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
108
109 scroll->addChild(view);
110 view->show();
111 scroll->updateScrollBars(); 131 scroll->updateScrollBars();
112 setUpdatesEnabled(true);
113} 132}
114 133
115void DateBookWeekLst::dateChanged(QDate &newdate) { 134void DateBookWeekLst::dateChanged(QDate &newdate) {
135 dateset = true;
116 bdate=newdate; 136 bdate=newdate;
137 odebug << "Date changed " << oendl;
117 getEvents(); 138 getEvents();
118} 139}
119 140
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklst.h b/core/pim/datebook/modules/weeklst/datebookweeklst.h
index 3922fa1..505810b 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklst.h
+++ b/core/pim/datebook/modules/weeklst/datebookweeklst.h
@@ -10,7 +10,7 @@ class DateBookDB;
10class DateBookDBHoliday; 10class DateBookDBHoliday;
11class DateBookWeekLstHeader; 11class DateBookWeekLstHeader;
12class DateBookWeekLstEvent; 12class DateBookWeekLstEvent;
13class DateBookWeekLstView; 13class DateBookWeekLstDblView;
14class QVBoxLayout; 14class QVBoxLayout;
15class QScrollView; 15class QScrollView;
16 16
@@ -55,9 +55,10 @@ private:
55 QDate bdate; 55 QDate bdate;
56 int year, _week,dow; 56 int year, _week,dow;
57 DateBookWeekLstHeader *header; 57 DateBookWeekLstHeader *header;
58 QWidget *view;
59 QVBoxLayout *layout; 58 QVBoxLayout *layout;
60 QScrollView *scroll; 59 QScrollView *scroll;
60 DateBookWeekLstDblView*m_CurrentView;
61 bool dateset:1;
61 62
62 void getEvents(); 63 void getEvents();
63}; 64};
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp b/core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp
index 1cea602..6389822 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp
+++ b/core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp
@@ -10,30 +10,120 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
10 const char* name, WFlags fl) 10 const char* name, WFlags fl)
11 : QWidget( parent, name, fl ) 11 : QWidget( parent, name, fl )
12{ 12{
13 QHBoxLayout *layout = new QHBoxLayout( this ); 13 m_MainLayout = new QHBoxLayout( this );
14
15 DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this);
16 layout->addWidget(w);
17 connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
18 connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
19 connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &)));
20 connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &)));
21 connect (w, SIGNAL(redraw()), this, SIGNAL(redraw()));
22 connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
23 connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
24 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
25 14
15 leftView = 0;
16 rightView = 0;
17 setEvents(ev1,ev2,d,onM);
18}
26 19
27 w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); 20DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
28 layout->addWidget(w); 21 QDate &d, bool onM,
29 connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); 22 QWidget* parent,
30 connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); 23 const char* name, WFlags fl)
31 connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); 24 : QWidget( parent, name, fl )
32 connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); 25{
33 connect (w, SIGNAL(redraw()), this, SIGNAL(redraw())); 26 m_MainLayout = new QHBoxLayout( this );
34 connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); 27
35 connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), 28 leftView = 0;
29 rightView = 0;
30 setEvents(ev1,d,onM);
31}
32
33/* setting the variant with both views */
34void DateBookWeekLstDblView::setEvents(QValueList<EffectiveEvent> &ev1,QValueList<EffectiveEvent> &ev2,QDate &d, bool onM)
35{
36 setUpdatesEnabled(false);
37 if (!leftView) {
38 leftView=new DateBookWeekLstView(ev1,d,onM,this);
39 m_MainLayout->addWidget(leftView);
40 connect (leftView, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
41 connect (leftView, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
42 connect (leftView, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &)));
43 connect (leftView, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &)));
44 connect (leftView, SIGNAL(redraw()), this, SIGNAL(redraw()));
45 connect (leftView, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
46 connect (leftView, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
36 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); 47 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
48
49 } else {
50 leftView->hide();
51 leftView->setEvents(ev1,d,onM);
52 }
53
54 if (!rightView) {
55 rightView=new DateBookWeekLstView(ev2,d.addDays(7),onM,this);
56 m_MainLayout->addWidget(rightView);
57 connect (rightView, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
58 connect (rightView, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
59 connect (rightView, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &)));
60 connect (rightView, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &)));
61 connect (rightView, SIGNAL(redraw()), this, SIGNAL(redraw()));
62 connect (rightView, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
63 connect (rightView, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
64 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
65 } else {
66 rightView->hide();
67 rightView->setEvents(ev2,d.addDays(7),onM);
68 }
69
70 leftView->show();
71 rightView->show();
72 setUpdatesEnabled(true);
73}
74
75void DateBookWeekLstDblView::setEvents(QValueList<EffectiveEvent> &ev1,QDate &d, bool onM)
76{
77 if (!leftView) {
78 leftView=new DateBookWeekLstView(ev1,d,onM,this);
79 m_MainLayout->addWidget(leftView);
80 connect (leftView, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
81 connect (leftView, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
82 connect (leftView, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &)));
83 connect (leftView, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &)));
84 connect (leftView, SIGNAL(redraw()), this, SIGNAL(redraw()));
85 connect (leftView, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
86 connect (leftView, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
87 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
88 } else {
89 leftView->hide();
90 leftView->setEvents(ev1,d,onM);
91 }
92 leftView->show();
93
94 if (rightView) {
95 rightView->hide();
96 }
97}
98
99void DateBookWeekLstDblView::setRightEvents(QValueList<EffectiveEvent> &ev1,QDate &d, bool onM)
100{
101 if (!rightView) {
102 rightView=new DateBookWeekLstView(ev1,d,onM,this);
103 m_MainLayout->addWidget(rightView);
104 connect (leftView, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
105 connect (leftView, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
106 connect (leftView, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &)));
107 connect (leftView, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &)));
108 connect (leftView, SIGNAL(redraw()), this, SIGNAL(redraw()));
109 connect (leftView, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
110 connect (leftView, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
111 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
112 } else {
113 rightView->hide();
114 rightView->setEvents(ev1,d,onM);
115 }
116 rightView->show();
117}
118
119bool DateBookWeekLstDblView::toggleDoubleView(bool how)
120{
121 if (rightView) {
122 if (how) rightView->show();
123 else rightView->hide();
124 return true;
125 }
126 return false;
37} 127}
38 128
39DateBookWeekLstDblView::~DateBookWeekLstDblView() 129DateBookWeekLstDblView::~DateBookWeekLstDblView()
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstdblview.h b/core/pim/datebook/modules/weeklst/datebookweeklstdblview.h
index 57e9690..808556e 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklstdblview.h
+++ b/core/pim/datebook/modules/weeklst/datebookweeklstdblview.h
@@ -8,6 +8,9 @@
8#include <qdatetime.h> 8#include <qdatetime.h>
9#include <qstring.h> 9#include <qstring.h>
10 10
11class DateBookWeekLstView;
12class QHBoxLayout;
13
11class DateBookWeekLstDblView: public QWidget { 14class DateBookWeekLstDblView: public QWidget {
12 Q_OBJECT 15 Q_OBJECT
13public: 16public:
@@ -16,7 +19,17 @@ public:
16 QDate &d, bool onM, 19 QDate &d, bool onM,
17 QWidget* parent = 0, const char* name = 0, 20 QWidget* parent = 0, const char* name = 0,
18 WFlags fl = 0 ); 21 WFlags fl = 0 );
22 DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
23 QDate &d, bool onM,
24 QWidget* parent = 0, const char* name = 0,
25 WFlags fl = 0 );
19 virtual ~DateBookWeekLstDblView(); 26 virtual ~DateBookWeekLstDblView();
27 void setEvents(QValueList<EffectiveEvent> &ev1,QValueList<EffectiveEvent> &ev2,QDate &d, bool onM);
28 void setEvents(QValueList<EffectiveEvent> &ev1,QDate &d, bool onM);
29 void setRightEvents(QValueList<EffectiveEvent> &ev1,QDate &d, bool onM);
30
31 bool toggleDoubleView(bool how);
32
20signals: 33signals:
21 void editEvent(const Event &e); 34 void editEvent(const Event &e);
22 void duplicateEvent(const Event &e); 35 void duplicateEvent(const Event &e);
@@ -26,6 +39,10 @@ signals:
26 void showDate(int y, int m, int d); 39 void showDate(int y, int m, int d);
27 void addEvent(const QDateTime &start, const QDateTime &stop, 40 void addEvent(const QDateTime &start, const QDateTime &stop,
28 const QString &str, const QString &location); 41 const QString &str, const QString &location);
42
43protected:
44 QHBoxLayout*m_MainLayout;
45 DateBookWeekLstView *leftView,*rightView;
29}; 46};
30 47
31#endif 48#endif
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();}
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstview.h b/core/pim/datebook/modules/weeklst/datebookweeklstview.h
index 2428f1f..3d47842 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklstview.h
+++ b/core/pim/datebook/modules/weeklst/datebookweeklstview.h
@@ -9,15 +9,18 @@
9#include <qdatetime.h> 9#include <qdatetime.h>
10 10
11class QKeyEvent; 11class QKeyEvent;
12class QVBoxLayout;
12 13
13class DateBookWeekLstView: public QWidget 14class DateBookWeekLstView: public QWidget
14{ 15{
15 Q_OBJECT 16 Q_OBJECT
16public: 17public:
17 DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM, 18 DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM, QWidget* parent = 0, const char* name = 0,
18 QWidget* parent = 0, const char* name = 0,
19 WFlags fl = 0 ); 19 WFlags fl = 0 );
20 ~DateBookWeekLstView(); 20 ~DateBookWeekLstView();
21
22 void setEvents(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM);
23
21signals: 24signals:
22 void editEvent(const Event &e); 25 void editEvent(const Event &e);
23 void duplicateEvent(const Event &e); 26 void duplicateEvent(const Event &e);
@@ -27,8 +30,12 @@ signals:
27 void showDate(int y, int m, int d); 30 void showDate(int y, int m, int d);
28 void addEvent(const QDateTime &start, const QDateTime &stop, 31 void addEvent(const QDateTime &start, const QDateTime &stop,
29 const QString &str, const QString &location); 32 const QString &str, const QString &location);
30private: 33protected:
31 bool bStartOnMonday; 34 bool bStartOnMonday;
35 QValueList<QObject*> childs;
36
37 QVBoxLayout*m_MainLayout;
38
32protected slots: 39protected slots:
33 void keyPressEvent(QKeyEvent *); 40 void keyPressEvent(QKeyEvent *);
34}; 41};