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 | |||
@@ -13,5 +13,5 @@ DEPENDPATH += $(OPIEDIR)/include \ | |||
13 | ../ ../library | 13 | ../ ../library |
14 | 14 | ||
15 | LIBS+= -lqpe -lopiecore2 -lopieui2 -opiepim2 | 15 | LIBS+= -lqpe -lopiecore2 -lopieui2 -lopiepim2 |
16 | 16 | ||
17 | DESTDIR = $(OPIEDIR)/plugins/holidays | 17 | DESTDIR = $(OPIEDIR)/plugins/holidays |
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 | |||
@@ -28,4 +28,5 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB, | |||
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); |
@@ -40,5 +41,5 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB, | |||
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"); |
@@ -46,4 +47,5 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB, | |||
46 | header->dbl->setOn(dbl); | 47 | header->dbl->setOn(dbl); |
47 | } | 48 | } |
49 | |||
48 | DateBookWeekLst::~DateBookWeekLst(){ | 50 | DateBookWeekLst::~DateBookWeekLst(){ |
49 | Config config("DateBook"); | 51 | Config config("DateBook"); |
@@ -59,6 +61,13 @@ void DateBookWeekLst::setDate(const QDate &d) { | |||
59 | void DateBookWeekLst::setDbl(bool on) { | 61 | void 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 | |||
63 | void DateBookWeekLst::redraw() {getEvents();} | 72 | void DateBookWeekLst::redraw() {getEvents();} |
64 | 73 | ||
@@ -83,36 +92,48 @@ QDate DateBookWeekLst::weekDate() const | |||
83 | 92 | ||
84 | void DateBookWeekLst::getEvents() { | 93 | void 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 | ||
115 | void DateBookWeekLst::dateChanged(QDate &newdate) { | 134 | void DateBookWeekLst::dateChanged(QDate &newdate) { |
135 | dateset = true; | ||
116 | bdate=newdate; | 136 | bdate=newdate; |
137 | odebug << "Date changed " << oendl; | ||
117 | getEvents(); | 138 | getEvents(); |
118 | } | 139 | } |
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 | |||
@@ -11,5 +11,5 @@ class DateBookDBHoliday; | |||
11 | class DateBookWeekLstHeader; | 11 | class DateBookWeekLstHeader; |
12 | class DateBookWeekLstEvent; | 12 | class DateBookWeekLstEvent; |
13 | class DateBookWeekLstView; | 13 | class DateBookWeekLstDblView; |
14 | class QVBoxLayout; | 14 | class QVBoxLayout; |
15 | class QScrollView; | 15 | class QScrollView; |
@@ -56,7 +56,8 @@ private: | |||
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(); |
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 | |||
@@ -11,28 +11,118 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, | |||
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); | 20 | DateBookWeekLstDblView::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 */ | ||
34 | void 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 | |||
75 | void 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 | |||
99 | void 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 | |||
119 | bool 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 | ||
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 | |||
@@ -9,4 +9,7 @@ | |||
9 | #include <qstring.h> | 9 | #include <qstring.h> |
10 | 10 | ||
11 | class DateBookWeekLstView; | ||
12 | class QHBoxLayout; | ||
13 | |||
11 | class DateBookWeekLstDblView: public QWidget { | 14 | class DateBookWeekLstDblView: public QWidget { |
12 | Q_OBJECT | 15 | Q_OBJECT |
@@ -17,5 +20,15 @@ public: | |||
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 | |||
20 | signals: | 33 | signals: |
21 | void editEvent(const Event &e); | 34 | void editEvent(const Event &e); |
@@ -27,4 +40,8 @@ signals: | |||
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 | |||
43 | protected: | ||
44 | QHBoxLayout*m_MainLayout; | ||
45 | DateBookWeekLstView *leftView,*rightView; | ||
29 | }; | 46 | }; |
30 | 47 | ||
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 | |||
@@ -18,4 +18,20 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | |||
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 | |||
25 | void 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"); |
@@ -27,6 +43,4 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | |||
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; |
@@ -47,16 +61,21 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | |||
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 &))); |
@@ -67,7 +86,19 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | |||
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 | |||
98 | DateBookWeekLstView::~DateBookWeekLstView() | ||
99 | {} | ||
100 | |||
101 | void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) | ||
102 | { | ||
103 | e->ignore(); | ||
71 | } | 104 | } |
72 | DateBookWeekLstView::~DateBookWeekLstView(){} | ||
73 | void 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 | |||
@@ -10,4 +10,5 @@ | |||
10 | 10 | ||
11 | class QKeyEvent; | 11 | class QKeyEvent; |
12 | class QVBoxLayout; | ||
12 | 13 | ||
13 | class DateBookWeekLstView: public QWidget | 14 | class DateBookWeekLstView: public QWidget |
@@ -15,8 +16,10 @@ class DateBookWeekLstView: public QWidget | |||
15 | Q_OBJECT | 16 | Q_OBJECT |
16 | public: | 17 | public: |
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 | |||
21 | signals: | 24 | signals: |
22 | void editEvent(const Event &e); | 25 | void editEvent(const Event &e); |
@@ -28,6 +31,10 @@ signals: | |||
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); |
30 | private: | 33 | protected: |
31 | bool bStartOnMonday; | 34 | bool bStartOnMonday; |
35 | QValueList<QObject*> childs; | ||
36 | |||
37 | QVBoxLayout*m_MainLayout; | ||
38 | |||
32 | protected slots: | 39 | protected slots: |
33 | void keyPressEvent(QKeyEvent *); | 40 | void keyPressEvent(QKeyEvent *); |