summaryrefslogtreecommitdiffabout
path: root/korganizer/kodaymatrix.cpp
Unidiff
Diffstat (limited to 'korganizer/kodaymatrix.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kodaymatrix.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 322131f..ecca374 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -295,100 +295,100 @@ bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end)
295{ 295{
296 mRedrawNeeded = true; 296 mRedrawNeeded = true;
297 bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION ); 297 bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION );
298 mSelStart = startdate.daysTo(start); 298 mSelStart = startdate.daysTo(start);
299 if ( mSelStart < 0 ) 299 if ( mSelStart < 0 )
300 mSelStart = 0; 300 mSelStart = 0;
301 mSelEnd = startdate.daysTo(end); 301 mSelEnd = startdate.daysTo(end);
302 if ( mSelEnd > NUMDAYS-1 ) 302 if ( mSelEnd > NUMDAYS-1 )
303 mSelEnd = NUMDAYS-1; 303 mSelEnd = NUMDAYS-1;
304 if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) { 304 if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) {
305 clearSelection(); 305 clearSelection();
306 if ( noSel ) 306 if ( noSel )
307 return false; 307 return false;
308 } 308 }
309 309
310 return true; 310 return true;
311} 311}
312void KODayMatrix::clearSelection() 312void KODayMatrix::clearSelection()
313{ 313{
314 mSelEnd = mSelStart = NOSELECTION; 314 mSelEnd = mSelStart = NOSELECTION;
315} 315}
316 316
317 317
318void KODayMatrix::recalculateToday() 318void KODayMatrix::recalculateToday()
319{ 319{
320 today = -1; 320 today = -1;
321 for (int i=0; i<NUMDAYS; i++) { 321 for (int i=0; i<NUMDAYS; i++) {
322 //events[i] = 0; 322 //events[i] = 0;
323 days[i] = startdate.addDays(i); 323 days[i] = startdate.addDays(i);
324 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); 324 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] ));
325 325
326 // if today is in the currently displayed month, hilight today 326 // if today is in the currently displayed month, hilight today
327 if (days[i].year() == QDate::currentDate().year() && 327 if (days[i].year() == QDate::currentDate().year() &&
328 days[i].month() == QDate::currentDate().month() && 328 days[i].month() == QDate::currentDate().month() &&
329 days[i].day() == QDate::currentDate().day()) { 329 days[i].day() == QDate::currentDate().day()) {
330 today = i; 330 today = i;
331 } 331 }
332 } 332 }
333 // qDebug(QString("Today is visible at %1.").arg(today)); 333 // qDebug(QString("Today is visible at %1.").arg(today));
334} 334}
335 335
336void KODayMatrix::updateView() 336void KODayMatrix::updateView()
337{ 337{
338 updateView(startdate); 338 updateView(startdate);
339} 339}
340void KODayMatrix::repaintViewTimed() 340void KODayMatrix::repaintViewTimed()
341{ 341{
342 mRedrawNeeded = true; 342 mRedrawNeeded = true;
343 bDays.fill( false); 343 // bDays.fill( false);
344 pDays.fill( false); 344 //pDays.fill( false);
345 hDays.fill( false); 345 //hDays.fill( false);
346 eDays.fill( false); 346 //eDays.fill( false);
347 mRepaintTimer->stop(); 347 mRepaintTimer->stop();
348 int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday 348 int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday
349 int i; 349 int i;
350 for(i = 0; i < NUMDAYS; i++) { 350 for(i = 0; i < NUMDAYS; i++) {
351 if ( ( (i+startDay) % 7 == 0 ) ) { 351 if ( ( (i+startDay) % 7 == 0 ) ) {
352 pDays.setBit(i); 352 pDays.setBit(i);
353 } 353 }
354 } 354 }
355 repaint(false); 355 repaint(false);
356} 356}
357void KODayMatrix::computeEvent(Event *event, int i ) 357void KODayMatrix::computeEvent(Event *event, int i )
358{ 358{
359 QString holiStr = mHolidays[i]; 359 QString holiStr = mHolidays[i];
360 if ( event->isHoliday()) { 360 if ( event->isHoliday()) {
361 pDays.setBit(i); 361 pDays.setBit(i);
362 hDays.setBit(i); 362 hDays.setBit(i);
363 if ( !holiStr.isEmpty() ) 363 if ( !holiStr.isEmpty() )
364 holiStr += "\n"; 364 holiStr += "\n";
365 holiStr += event->summary(); 365 holiStr += event->summary();
366 if ( !event->location().isEmpty() ) 366 if ( !event->location().isEmpty() )
367 holiStr += " (" + event->location() + ")"; 367 holiStr += " (" + event->location() + ")";
368 mHolidays[i] =holiStr ; 368 mHolidays[i] =holiStr ;
369 } 369 }
370 if ( event->isBirthday()) { 370 if ( event->isBirthday()) {
371 pDays.setBit(i); 371 pDays.setBit(i);
372 if ( !holiStr.isEmpty() ) 372 if ( !holiStr.isEmpty() )
373 holiStr += "\n"; 373 holiStr += "\n";
374 holiStr += i18n("Birthday") + ": "+event->summary(); 374 holiStr += i18n("Birthday") + ": "+event->summary();
375 if ( !event->location().isEmpty() ) 375 if ( !event->location().isEmpty() )
376 holiStr += " (" + event->location() + ")"; 376 holiStr += " (" + event->location() + ")";
377 bDays.setBit(i); 377 bDays.setBit(i);
378 mHolidays[i] =holiStr ; 378 mHolidays[i] =holiStr ;
379 } 379 }
380 eDays.setBit(i); 380 eDays.setBit(i);
381} 381}
382void KODayMatrix::updateViewTimed() 382void KODayMatrix::updateViewTimed()
383{ 383{
384 mUpdateTimer->stop(); 384 mUpdateTimer->stop();
385 if ( !mCalendar ) { 385 if ( !mCalendar ) {
386 qDebug("NOT CAL "); 386 qDebug("NOT CAL ");
387 return; 387 return;
388 } 388 }
389#if 1 389#if 1
390 390
391 int i; 391 int i;
392 int timeSpan = NUMDAYS-1; 392 int timeSpan = NUMDAYS-1;
393 QPtrList<Event> events = mCalendar->events(); 393 QPtrList<Event> events = mCalendar->events();
394 Event *event; 394 Event *event;