author | umopapisdn <umopapisdn> | 2003-03-24 10:09:47 (UTC) |
---|---|---|
committer | umopapisdn <umopapisdn> | 2003-03-24 10:09:47 (UTC) |
commit | 4ddc90a51f8a4d248ece9a86d01ef636fe8c95e2 (patch) (unidiff) | |
tree | 3342092adf744b90b0da3be25bd35267d0610044 /core/pim/datebook/datebookweeklst.cpp | |
parent | 90eeb65c389f3c5deab32e3cc9ee084e89770563 (diff) | |
download | opie-4ddc90a51f8a4d248ece9a86d01ef636fe8c95e2.zip opie-4ddc90a51f8a4d248ece9a86d01ef636fe8c95e2.tar.gz opie-4ddc90a51f8a4d248ece9a86d01ef636fe8c95e2.tar.bz2 |
Bugfix: Duplicating events introduced a bug making it impossible to add events Week List view. This fixes it.
Diffstat (limited to 'core/pim/datebook/datebookweeklst.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index e8e12ba..5334a16 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp | |||
@@ -128,25 +128,25 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/, | |||
128 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); | 128 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); |
129 | } | 129 | } |
130 | 130 | ||
131 | void DateBookWeekLstDayHdr::showDay() { | 131 | void DateBookWeekLstDayHdr::showDay() { |
132 | emit showDate(date.year(), date.month(), date.day()); | 132 | emit showDate(date.year(), date.month(), date.day()); |
133 | } | 133 | } |
134 | void DateBookWeekLstDayHdr::newEvent() { | 134 | void DateBookWeekLstDayHdr::newEvent() { |
135 | QDateTime start, stop; | 135 | QDateTime start, stop; |
136 | start=stop=date; | 136 | start=stop=date; |
137 | start.setTime(QTime(10,0)); | 137 | start.setTime(QTime(10,0)); |
138 | stop.setTime(QTime(12,0)); | 138 | stop.setTime(QTime(12,0)); |
139 | 139 | ||
140 | emit addEvent(start,stop,""); | 140 | emit addEvent(start,stop,"",0); |
141 | } | 141 | } |
142 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, | 142 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, |
143 | QWidget* parent, | 143 | QWidget* parent, |
144 | const char* name, | 144 | const char* name, |
145 | WFlags fl) : | 145 | WFlags fl) : |
146 | OClickableLabel(parent,name,fl), | 146 | OClickableLabel(parent,name,fl), |
147 | event(ev) | 147 | event(ev) |
148 | { | 148 | { |
149 | char s[10]; | 149 | char s[10]; |
150 | if ( ev.startDate() != ev.date() ) { // multiday event (not first day) | 150 | if ( ev.startDate() != ev.date() ) { // multiday event (not first day) |
151 | if ( ev.endDate() == ev.date() ) { // last day | 151 | if ( ev.endDate() == ev.date() ) { // last day |
152 | strcpy(s, "__|__"); | 152 | strcpy(s, "__|__"); |
@@ -191,28 +191,28 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | |||
191 | for (int d=0; d<7; d++) dayOrder[d]=d; | 191 | for (int d=0; d<7; d++) dayOrder[d]=d; |
192 | dayOrder[0]=7; | 192 | dayOrder[0]=7; |
193 | } | 193 | } |
194 | 194 | ||
195 | for (int i=0; i<7; i++) { | 195 | for (int i=0; i<7; i++) { |
196 | // Header | 196 | // Header |
197 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), | 197 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), |
198 | onMonday,this); | 198 | onMonday,this); |
199 | connect(hdr, SIGNAL(showDate(int,int,int)), | 199 | connect(hdr, SIGNAL(showDate(int,int,int)), |
200 | this, SIGNAL(showDate(int,int,int))); | 200 | this, SIGNAL(showDate(int,int,int))); |
201 | connect(hdr, SIGNAL(addEvent(const QDateTime &, | 201 | connect(hdr, SIGNAL(addEvent(const QDateTime &, |
202 | const QDateTime &, | 202 | const QDateTime &, |
203 | const QString &)), | 203 | const QString &, const QString &)), |
204 | this, SIGNAL(addEvent(const QDateTime &, | 204 | this, SIGNAL(addEvent(const QDateTime &, |
205 | const QDateTime &, | 205 | const QDateTime &, |
206 | const QString &))); | 206 | const QString &, const QString &))); |
207 | layout->addWidget(hdr); | 207 | layout->addWidget(hdr); |
208 | 208 | ||
209 | // Events | 209 | // Events |
210 | while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { | 210 | while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { |
211 | if(!((*it).end().hour()==(*it).start().hour() && (*it).end().minute()==(*it).start().minute())) {// Skip effective events with no duration. (i.e ending at 00:00) | 211 | if(!((*it).end().hour()==(*it).start().hour() && (*it).end().minute()==(*it).start().minute())) {// Skip effective events with no duration. (i.e ending at 00:00) |
212 | DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this); | 212 | DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this); |
213 | layout->addWidget(l); | 213 | layout->addWidget(l); |
214 | connect (l, SIGNAL(editEvent(const Event &)), | 214 | connect (l, SIGNAL(editEvent(const Event &)), |
215 | this, SIGNAL(editEvent(const Event &))); | 215 | this, SIGNAL(editEvent(const Event &))); |
216 | } | 216 | } |
217 | it++; | 217 | it++; |
218 | } | 218 | } |
@@ -230,39 +230,39 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, | |||
230 | const char* name, WFlags fl) | 230 | const char* name, WFlags fl) |
231 | : QWidget( parent, name, fl ) | 231 | : QWidget( parent, name, fl ) |
232 | { | 232 | { |
233 | QHBoxLayout *layout = new QHBoxLayout( this ); | 233 | QHBoxLayout *layout = new QHBoxLayout( this ); |
234 | 234 | ||
235 | DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); | 235 | DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); |
236 | layout->addWidget(w); | 236 | layout->addWidget(w); |
237 | connect (w, SIGNAL(editEvent(const Event &)), | 237 | connect (w, SIGNAL(editEvent(const Event &)), |
238 | this, SIGNAL(editEvent(const Event &))); | 238 | this, SIGNAL(editEvent(const Event &))); |
239 | connect (w, SIGNAL(showDate(int,int,int)), | 239 | connect (w, SIGNAL(showDate(int,int,int)), |
240 | this, SIGNAL(showDate(int,int,int))); | 240 | this, SIGNAL(showDate(int,int,int))); |
241 | connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | 241 | connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, |
242 | const QString &)), | 242 | const QString &,const QString &)), |
243 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | 243 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, |
244 | const QString &))); | 244 | const QString &, const QString &))); |
245 | 245 | ||
246 | 246 | ||
247 | w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); | 247 | w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); |
248 | layout->addWidget(w); | 248 | layout->addWidget(w); |
249 | connect (w, SIGNAL(editEvent(const Event &)), | 249 | connect (w, SIGNAL(editEvent(const Event &)), |
250 | this, SIGNAL(editEvent(const Event &))); | 250 | this, SIGNAL(editEvent(const Event &))); |
251 | connect (w, SIGNAL(showDate(int,int,int)), | 251 | connect (w, SIGNAL(showDate(int,int,int)), |
252 | this, SIGNAL(showDate(int,int,int))); | 252 | this, SIGNAL(showDate(int,int,int))); |
253 | connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | 253 | connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, |
254 | const QString &)), | 254 | const QString &, const QString &)), |
255 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | 255 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, |
256 | const QString &))); | 256 | const QString &, const QString &))); |
257 | } | 257 | } |
258 | 258 | ||
259 | DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, | 259 | DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, |
260 | QWidget *parent, | 260 | QWidget *parent, |
261 | const char *name ) | 261 | const char *name ) |
262 | : QWidget( parent, name ), | 262 | : QWidget( parent, name ), |
263 | db( newDB ), | 263 | db( newDB ), |
264 | startTime( 0 ), | 264 | startTime( 0 ), |
265 | ampm( ap ), | 265 | ampm( ap ), |
266 | onMonday(onM) | 266 | onMonday(onM) |
267 | { | 267 | { |
268 | setFocusPolicy(StrongFocus); | 268 | setFocusPolicy(StrongFocus); |
@@ -332,27 +332,27 @@ void DateBookWeekLst::getEvents() { | |||
332 | QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); | 332 | QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); |
333 | 333 | ||
334 | view=new DateBookWeekLstDblView(el,el2,start,onMonday,scroll); | 334 | view=new DateBookWeekLstDblView(el,el2,start,onMonday,scroll); |
335 | } else { | 335 | } else { |
336 | view=new DateBookWeekLstView(el,start,onMonday,scroll); | 336 | view=new DateBookWeekLstView(el,start,onMonday,scroll); |
337 | } | 337 | } |
338 | 338 | ||
339 | connect (view, SIGNAL(editEvent(const Event &)), | 339 | connect (view, SIGNAL(editEvent(const Event &)), |
340 | this, SIGNAL(editEvent(const Event &))); | 340 | this, SIGNAL(editEvent(const Event &))); |
341 | connect (view, SIGNAL(showDate(int,int,int)), | 341 | connect (view, SIGNAL(showDate(int,int,int)), |
342 | this, SIGNAL(showDate(int,int,int))); | 342 | this, SIGNAL(showDate(int,int,int))); |
343 | connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | 343 | connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, |
344 | const QString &)), | 344 | const QString &, const QString &)), |
345 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | 345 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, |
346 | const QString &))); | 346 | const QString &, const QString &))); |
347 | 347 | ||
348 | scroll->addChild(view); | 348 | scroll->addChild(view); |
349 | view->show(); | 349 | view->show(); |
350 | scroll->updateScrollBars(); | 350 | scroll->updateScrollBars(); |
351 | } | 351 | } |
352 | 352 | ||
353 | void DateBookWeekLst::dateChanged(int y, int w) { | 353 | void DateBookWeekLst::dateChanged(int y, int w) { |
354 | year=y; | 354 | year=y; |
355 | _week=w; | 355 | _week=w; |
356 | getEvents(); | 356 | getEvents(); |
357 | } | 357 | } |
358 | 358 | ||