summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-27 19:29:38 (UTC)
committer zautrix <zautrix>2005-06-27 19:29:38 (UTC)
commitd730e4b5cd81965f224b69efcc91dd58253f0b98 (patch) (unidiff)
tree38874ec3d889bee7ab12a79a1ef690e6c47aac5f
parent427221638f1e652bd57a37835a1de0134266c3f7 (diff)
downloadkdepimpi-d730e4b5cd81965f224b69efcc91dd58253f0b98.zip
kdepimpi-d730e4b5cd81965f224b69efcc91dd58253f0b98.tar.gz
kdepimpi-d730e4b5cd81965f224b69efcc91dd58253f0b98.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp57
-rw-r--r--korganizer/komonthview.h6
2 files changed, 18 insertions, 45 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 00e5a6f..aeb3974 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -233,253 +233,232 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
233 break; 233 break;
234 case Key_Shift: 234 case Key_Shift:
235 emit shiftDown(); 235 emit shiftDown();
236 break; 236 break;
237 default: 237 default:
238 e->ignore(); 238 e->ignore();
239 break; 239 break;
240 } 240 }
241} 241}
242 242
243void KNoScrollListBox::oneDown() 243void KNoScrollListBox::oneDown()
244{ 244{
245 if ( count () ) { 245 if ( count () ) {
246 if ( currentItem()+1 == count () ) { 246 if ( currentItem()+1 == count () ) {
247 emit nextCell(); 247 emit nextCell();
248 } else { 248 } else {
249 resetOnFocusIn = false; 249 resetOnFocusIn = false;
250 setCurrentItem((currentItem()+1)%count()); 250 setCurrentItem((currentItem()+1)%count());
251 if(!itemVisible(currentItem())) { 251 if(!itemVisible(currentItem())) {
252 if(currentItem() == 0) { 252 if(currentItem() == 0) {
253 setTopItem(0); 253 setTopItem(0);
254 } else { 254 } else {
255 setTopItem(topItem()+1); 255 setTopItem(topItem()+1);
256 } 256 }
257 } 257 }
258 } 258 }
259 } 259 }
260} 260}
261void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) 261void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
262{ 262{
263 switch(e->key()) { 263 switch(e->key()) {
264 case Key_Shift: 264 case Key_Shift:
265 emit shiftUp(); 265 emit shiftUp();
266 break; 266 break;
267 default: 267 default:
268 break; 268 break;
269 } 269 }
270} 270}
271 271
272void KNoScrollListBox::mousePressEvent(QMouseEvent *e) 272void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
273{ 273{
274 QListBox::mousePressEvent(e); 274 QListBox::mousePressEvent(e);
275 275
276 if(e->button() == RightButton) { 276 if(e->button() == RightButton) {
277 emit rightClick(); 277 emit rightClick();
278 } 278 }
279} 279}
280 280
281MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) 281MonthViewItem::MonthViewItem( Incidence *incidence, const QString & s)
282 : QListBoxItem() 282 : QListBoxItem()
283{ 283{
284 mDisplayHightlighted = false;
285 mblockRepaint = true; 284 mblockRepaint = true;
286 setText( s );
287 mMultiday = 0;
288 mIncidence = incidence;
289 mDate = qd;
290 mRecur = false;
291 mAlarm = false;
292 mReply = false;
293 mInfo = false;
294 mdayPos = 0;
295 isWeekItem = KOPrefs::instance()->mMonthViewWeek; 285 isWeekItem = KOPrefs::instance()->mMonthViewWeek;
286 recycle( incidence, s );
296} 287}
297void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) 288void MonthViewItem::recycle( Incidence *incidence, const QString & s)
298{ 289{
299 mDisplayHightlighted = false; 290 mDisplayHightlighted = false;
300 setText( s ); 291 setText( s );
301 mMultiday = 0; 292 mMultiday = 0;
302 mIncidence = incidence; 293 mIncidence = incidence;
303 mDate = qd;
304 mRecur = false;
305 mAlarm = false;
306 mReply = false;
307 mInfo = false;
308 mdayPos = 0;
309}
310void MonthViewItem::clearData()
311{
312 mDisplayHightlighted = false;
313 setText( "" );
314 mMultiday = 0;
315 mIncidence = 0;
316 mRecur = false; 294 mRecur = false;
317 mAlarm = false; 295 mAlarm = false;
318 mReply = false; 296 mReply = false;
319 mInfo = false; 297 mInfo = false;
320 mdayPos = 0; 298 mdayPos = 0;
321} 299}
300
322bool MonthViewItem::setHighlightedFalse() 301bool MonthViewItem::setHighlightedFalse()
323{ 302{
324 if ( !mDisplayHightlighted ) 303 if ( !mDisplayHightlighted )
325 return false; 304 return false;
326 mDisplayHightlighted = false; 305 mDisplayHightlighted = false;
327 return true; 306 return true;
328} 307}
329 308
330bool MonthViewItem::setHighlighted( Incidence * inc ) 309bool MonthViewItem::setHighlighted( Incidence * inc )
331{ 310{
332 if ( inc == mIncidence ) { 311 if ( inc == mIncidence ) {
333 if ( mDisplayHightlighted ) 312 if ( mDisplayHightlighted )
334 return false; 313 return false;
335 mDisplayHightlighted = true; 314 mDisplayHightlighted = true;
336 return true; 315 return true;
337 } else { 316 } else {
338 if ( !mDisplayHightlighted ) 317 if ( !mDisplayHightlighted )
339 return false; 318 return false;
340 mDisplayHightlighted = false; 319 mDisplayHightlighted = false;
341 return true; 320 return true;
342 } 321 }
343 return false; 322 return false;
344} 323}
345void MonthViewItem::paint(QPainter *p) 324void MonthViewItem::paint(QPainter *p)
346{ 325{
347 if ( mblockRepaint ) { 326 if ( mblockRepaint || !mIncidence ) {
348 return; 327 return;
349 } 328 }
350#if QT_VERSION >= 0x030000 329#if QT_VERSION >= 0x030000
351 bool sel = isSelected(); 330 bool sel = isSelected();
352#else 331#else
353 bool sel = selected(); 332 bool sel = selected();
354#endif 333#endif
355 int heihei = height( listBox () ); 334 int heihei = height( listBox () );
356 int x = 1; 335 int x = 1;
357 if (KOPrefs::instance()->mMonthViewUsesCategoryColor || mDisplayHightlighted ) 336 if (KOPrefs::instance()->mMonthViewUsesCategoryColor || mDisplayHightlighted || sel )
358 { 337 {
359 if ( mDisplayHightlighted ) 338 if ( mDisplayHightlighted )
360 sel = true; 339 sel = true;
361 p->setBackgroundColor( palette().color( QPalette::Normal, \ 340 p->setBackgroundColor( palette().color( QPalette::Normal, \
362 sel ? QColorGroup::Highlight : QColorGroup::Background ) ); 341 sel ? QColorGroup::Highlight : QColorGroup::Background ) );
363 p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei ); 342 p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei );
364 } 343 }
365 344
366 //int y = 3;//(height() - mRecurPixmap.height()) /2; 345 //int y = 3;//(height() - mRecurPixmap.height()) /2;
367 int size = PIXMAP_SIZE; 346 int size = PIXMAP_SIZE;
368 if ( QApplication::desktop()->width() < 300 ) 347 if ( QApplication::desktop()->width() < 300 )
369 size = 3; 348 size = 3;
370 int y = (heihei - size -1 ) /2; 349 int y = (heihei - size -1 ) /2;
371 350
372 if ( mIncidence->calID() > 1 ) { 351 if ( mIncidence->calID() > 1 ) {
373 p->fillRect ( x, y-2,size,size+4, KOPrefs::instance()->defaultColor( mIncidence->calID() ) ); 352 p->fillRect ( x, y-2,size,size+4, KOPrefs::instance()->defaultColor( mIncidence->calID() ) );
374 p->drawRect ( x, y-2,size,size+4); 353 p->drawRect ( x, y-2,size,size+4);
375 x += size + 1; 354 x += size + 1;
376 } 355 }
377 if ( KOPrefs::instance()->mMonthShowIcons ) { 356 if ( KOPrefs::instance()->mMonthShowIcons ) {
378 if ( mInfo ) { 357 if ( mInfo ) {
379 p->fillRect ( x, y,size,size, Qt::darkGreen ); 358 p->fillRect ( x, y,size,size, Qt::darkGreen );
380 x += size + 1; 359 x += size + 1;
381 } 360 }
382 if ( mRecur ) { 361 if ( mRecur ) {
383 p->fillRect ( x, y,size,size, Qt::blue ); 362 p->fillRect ( x, y,size,size, Qt::blue );
384 x += size + 1; 363 x += size + 1;
385 } 364 }
386 if ( mAlarm ) { 365 if ( mAlarm ) {
387 p->fillRect ( x, y,size,size, Qt::red ); 366 p->fillRect ( x, y,size,size, Qt::red );
388 x += size + 1; 367 x += size + 1;
389 } 368 }
390 if ( mReply ) { 369 if ( mReply ) {
391 p->fillRect ( x, y,size,size, Qt::yellow ); 370 p->fillRect ( x, y,size,size, Qt::yellow );
392 x += size + 1; 371 x += size + 1;
393 } 372 }
394 } 373 }
395 if ( mMultiday ) { 374 if ( mMultiday ) {
396 int yyy = y+(size/2); 375 int yyy = y+(size/2);
397 int sizeM = size+2; 376 int sizeM = size+2;
398 p->setBrush( QBrush::SolidPattern ); 377 p->setBrush( QBrush( p->pen().color() ) );
399 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; 378 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ;
400 if ( mMultiday == 2 || mMultiday == 3 ) { 379 if ( mMultiday == 2 || mMultiday == 3 ) {
401 QPointArray pa ( 3 ); 380 QPointArray pa ( 3 );
402 pa.setPoint (0, x, yyy ); 381 pa.setPoint (0, x, yyy );
403 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); 382 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 );
404 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); 383 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 );
405 p->drawPolygon( pa ); 384 p->drawPolygon( pa );
406 } 385 }
407 if ( mMultiday == 2 || mMultiday == 1 ) { 386 if ( mMultiday == 2 || mMultiday == 1 ) {
408 QPointArray pa ( 3 ); 387 QPointArray pa ( 3 );
409 pa.setPoint (0, x+sizeM +sizeM/2, yyy ); 388 pa.setPoint (0, x+sizeM +sizeM/2, yyy );
410 pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); 389 pa.setPoint (1, x+sizeM, yyy+sizeM/2 );
411 pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); 390 pa.setPoint (2, x+sizeM, yyy-sizeM/2 );
412 p->drawPolygon( pa ); 391 p->drawPolygon( pa );
413 } 392 }
414 if ( mMultiday == 1 ) { 393 if ( mMultiday == 1 ) {
415 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 394 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
416 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); 395 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 );
417 } 396 }
418 if ( mMultiday == 3 ) { 397 if ( mMultiday == 3 ) {
419 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 398 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
420 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); 399 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 );
421 400
422 } 401 }
423 x += sizeM/2 + 1; 402 x += sizeM/2 + 1;
424 x += sizeM + 1; 403 x += sizeM + 1;
425 } 404 }
426 405
427 if ( mIncidence->typeID() == todoID ){ 406 if ( mIncidence->typeID() == todoID ){
428 Todo* td = ( Todo* ) mIncidence; 407 Todo* td = ( Todo* ) mIncidence;
429 if ( td->isCompleted() ) { 408 if ( td->isCompleted() ) {
430 int half = size/2; 409 int half = size/2;
431 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; 410 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ;
432 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; 411 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ;
433 x += half+half + 4; 412 x += half+half + 4;
434 413
435 } else { 414 } else {
436 int val = td->percentComplete()/20; 415 int val = td->percentComplete()/20;
437 p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); 416 p->fillRect ( x+1, y-2, val ,size+4,p->pen().color() );
438 p->drawRect ( x, y-2,7,size+4); 417 p->drawRect ( x, y-2,7,size+4);
439 x += size + 3; 418 x += size + 3;
440 } 419 }
441 } 420 }
442 QFontMetrics fm = p->fontMetrics(); 421 QFontMetrics fm = p->fontMetrics();
443 int yPos; 422 int yPos;
444 int pmheight = size; 423 int pmheight = size;
445 if( pmheight < fm.height() ) 424 if( pmheight < fm.height() )
446 yPos = fm.ascent() + fm.leading()/2; 425 yPos = fm.ascent() + fm.leading()/2;
447 else 426 else
448 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 427 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
449 p->setPen( palette().color( QPalette::Normal, sel ? \ 428 p->setPen( palette().color( QPalette::Normal, sel ? \
450 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 429 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
451 if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { 430 if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) {
452 p->drawText( x, yPos, text() ); 431 p->drawText( x, yPos, text() );
453 if ( mIncidence->cancelled() ) { 432 if ( mIncidence->cancelled() ) {
454 int wid = fm.width( text() ); 433 int wid = fm.width( text() );
455 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 434 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
456 } 435 }
457 } else { 436 } else {
458 QString pText = text(); 437 QString pText = text();
459 if( pText.mid(2,1) == ":" ) 438 if( pText.mid(2,1) == ":" )
460 pText = pText.mid( 6 ); 439 pText = pText.mid( 6 );
461 p->drawText( x, yPos, pText ); 440 p->drawText( x, yPos, pText );
462 if ( mIncidence->cancelled() ) { 441 if ( mIncidence->cancelled() ) {
463 int wid = fm.width( pText ); 442 int wid = fm.width( pText );
464 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 443 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
465 } 444 }
466 } 445 }
467} 446}
468 447
469int MonthViewItem::height(const QListBox *lb) const 448int MonthViewItem::height(const QListBox *lb) const
470{ 449{
471 int ret = 10; 450 int ret = 10;
472 if ( lb ) 451 if ( lb )
473 ret = lb->fontMetrics().lineSpacing()+1; 452 ret = lb->fontMetrics().lineSpacing()+1;
474 return ret; 453 return ret;
475} 454}
476 455
477int MonthViewItem::width(const QListBox *lb) const 456int MonthViewItem::width(const QListBox *lb) const
478{ 457{
479 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { 458 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) {
480 int size = PIXMAP_SIZE; 459 int size = PIXMAP_SIZE;
481 if ( QApplication::desktop()->width() < 300 ) 460 if ( QApplication::desktop()->width() < 300 )
482 size = 3; 461 size = 3;
483 int x = 1; 462 int x = 1;
484 if ( KOPrefs::instance()->mMonthShowIcons ) { 463 if ( KOPrefs::instance()->mMonthShowIcons ) {
485 if ( mInfo ) { 464 if ( mInfo ) {
@@ -623,312 +602,314 @@ bool MonthViewCell::isPrimary() const
623} 602}
624 603
625void MonthViewCell::setHoliday( bool holiday ) 604void MonthViewCell::setHoliday( bool holiday )
626{ 605{
627 mHoliday = holiday; 606 mHoliday = holiday;
628 //setMyPalette(); 607 //setMyPalette();
629} 608}
630 609
631void MonthViewCell::setHoliday( const QString &holiday ) 610void MonthViewCell::setHoliday( const QString &holiday )
632{ 611{
633 mHolidayString = holiday; 612 mHolidayString = holiday;
634 613
635 if ( !holiday.isEmpty() ) { 614 if ( !holiday.isEmpty() ) {
636 setHoliday( true ); 615 setHoliday( true );
637 } 616 }
638} 617}
639 618
640void MonthViewCell::startUpdateCell() 619void MonthViewCell::startUpdateCell()
641{ 620{
642 621
643 mdayCount = 0; 622 mdayCount = 0;
644 setFocusPolicy(NoFocus); 623 setFocusPolicy(NoFocus);
645 if ( !mMonthView->isUpdatePossible() ) 624 if ( !mMonthView->isUpdatePossible() )
646 return; 625 return;
647 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 626 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
648 while ( mitem ) { 627 while ( mitem ) {
649 mitem->setBlockRepaint( true ); 628 mitem->setBlockRepaint( true );
650 mitem = (MonthViewItem *)mitem->next(); 629 mitem = (MonthViewItem *)mitem->next();
651 } 630 }
652 if ( mAvailItemList.count() > 20 ) { 631 if ( mAvailItemList.count() > 20 ) {
653 mAvailItemList.setAutoDelete( true ); 632 mAvailItemList.setAutoDelete( true );
654 mAvailItemList.clear(); 633 mAvailItemList.clear();
655 mAvailItemList.setAutoDelete( false ); 634 mAvailItemList.setAutoDelete( false );
656 clear(); 635 clear();
657 } 636 }
658 637
659 setPrimary( mDate.month()%2 ); 638 setPrimary( mDate.month()%2 );
660 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); 639 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays);
661 if ( mDate == QDate::currentDate() ) { 640 if ( mDate == QDate::currentDate() ) {
662 setLineWidth( 3 ); 641 setLineWidth( 3 );
663 } else { 642 } else {
664 setLineWidth( 1 ); 643 setLineWidth( 1 );
665 } 644 }
666 MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); 645 MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem ();
667 //clear(); 646 //clear();
668 while ( CurrentAvailItem ) { 647 while ( CurrentAvailItem ) {
669 MonthViewItem *item = CurrentAvailItem; 648 MonthViewItem *item = CurrentAvailItem;
670 //item->setHighlightedFalse(); 649 //item->setHighlightedFalse();
671 item->clearData(); 650 item->recycle( 0, "");
672 CurrentAvailItem = (MonthViewItem *)item->next(); 651 CurrentAvailItem = (MonthViewItem *)item->next();
673 mAvailItemList.append( item ); 652 mAvailItemList.append( item );
674 takeItem ( item ); 653 takeItem ( item );
675 } 654 }
676 655
677#ifdef DESKTOP_VERSION 656#ifdef DESKTOP_VERSION
678 QToolTip::remove(this); 657 QToolTip::remove(this);
679#endif 658#endif
680 mToolTip.clear(); 659 mToolTip.clear();
681 //qApp->processEvents(); 660 //qApp->processEvents();
682#if 0 661#if 0
683 if ( !mHolidayString.isEmpty() ) { 662 if ( !mHolidayString.isEmpty() ) {
684 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); 663 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString );
685 item->setPalette( mHolidayPalette ); 664 item->setPalette( mHolidayPalette );
686 insertItem( item ); 665 insertItem( item );
687 mToolTip.append ( mHolidayString ); 666 mToolTip.append ( mHolidayString );
688 } 667 }
689#endif 668#endif
690} 669}
691 670
692int MonthViewCell::insertEvent(Event *event) 671int MonthViewCell::insertEvent(Event *event)
693{ 672{
694 bool useToolTips = true; 673 bool useToolTips = true;
695#ifndef DESKTOP_VERSION 674#ifndef DESKTOP_VERSION
696 useToolTips = false; 675 useToolTips = false;
697#endif 676#endif
698 QString mToolTipText; 677 QString mToolTipText;
699 setFocusPolicy(WheelFocus); 678 setFocusPolicy(WheelFocus);
700 if ( !(event->doesRecur() == Recurrence::rNone) ) { 679 if ( !(event->doesRecur() == Recurrence::rNone) ) {
701 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) 680 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily )
702 return mdayCount; 681 return mdayCount;
703 else 682 else
704 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) 683 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
705 return mdayCount; 684 return mdayCount;
706 } 685 }
707 686
708 if ( event->isHoliday()) { 687 if ( event->isHoliday()) {
709 setHoliday( true ); 688 setHoliday( true );
710 if ( mDate.dayOfWeek() == 7 ) 689 if ( mDate.dayOfWeek() == 7 )
711 setLineWidth( 3 ); 690 setLineWidth( 3 );
712 } 691 }
713 QString text; 692 QString text;
714 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day 693 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
715 if (event->isMultiDay()) { 694 if (event->isMultiDay()) {
716 QString prefix = "<->";multiday = 2; 695 QString prefix = "<->";multiday = 2;
717 QString time; 696 QString time;
718 if ( event->doesRecur() ) { 697 if ( event->doesRecur() ) {
719 if ( event->recursOn( mDate) ) { 698 if ( event->recursOn( mDate) ) {
720 prefix ="->" ;multiday = 1; 699 prefix ="->" ;multiday = 1;
721 } 700 }
722 else { 701 else {
723 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 702 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
724 if ( event->recursOn( mDate.addDays( -days)) ) { 703 if ( event->recursOn( mDate.addDays( -days)) ) {
725 prefix ="<-" ;multiday = 3; 704 prefix ="<-" ;multiday = 3;
726 } 705 }
727 } 706 }
728 707
729 } else { 708 } else {
730 if (mDate == event->dtStart().date()) { 709 if (mDate == event->dtStart().date()) {
731 prefix ="->" ;multiday = 1; 710 prefix ="->" ;multiday = 1;
732 } else if (mDate == event->dtEnd().date()) { 711 } else if (mDate == event->dtEnd().date()) {
733 prefix ="<-" ;multiday = 3; 712 prefix ="<-" ;multiday = 3;
734 } 713 }
735 } 714 }
736 if ( !event->doesFloat() ) { 715 if ( !event->doesFloat() ) {
737 if ( mDate == event->dtStart().date () ) 716 if ( mDate == event->dtStart().date () )
738 time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; 717 time = KGlobal::locale()->formatTime(event->dtStart().time())+" ";
739 else if ( mDate == event->dtEnd().date () ) 718 else if ( mDate == event->dtEnd().date () )
740 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; 719 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
741 720
742 } 721 }
743 text = time + event->summary(); 722 text = time + event->summary();
744 if ( useToolTips ) 723 if ( useToolTips )
745 mToolTipText += prefix + text; 724 mToolTipText += prefix + text;
746 } else { 725 } else {
747 if (event->doesFloat()) { 726 if (event->doesFloat()) {
748 text = event->summary(); 727 text = event->summary();
749 if ( useToolTips ) 728 if ( useToolTips )
750 mToolTipText += text; 729 mToolTipText += text;
751 } 730 }
752 else { 731 else {
753 text = KGlobal::locale()->formatTime(event->dtStart().time()); 732 text = KGlobal::locale()->formatTime(event->dtStart().time());
754 text += " " + event->summary(); 733 text += " " + event->summary();
755 if ( useToolTips ) 734 if ( useToolTips )
756 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 735 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
757 } 736 }
758 } 737 }
759 if ( useToolTips && ! event->location().isEmpty() ) { 738 if ( useToolTips && ! event->location().isEmpty() ) {
760 mToolTipText += " (" + event->location() +")"; 739 mToolTipText += " (" + event->location() +")";
761 } 740 }
762 MonthViewItem *item ; 741 MonthViewItem *item ;
763 742
764 if ( mAvailItemList.count() ) { 743 if ( mAvailItemList.count() ) {
765 item = mAvailItemList.first(); 744 item = mAvailItemList.first();
766 mAvailItemList.remove( item ); 745 mAvailItemList.remove( item );
767 item->recycle( event, mDate, text ); 746 item->recycle( event, text );
768 } else { 747 } else {
769 item = new MonthViewItem( event, mDate, text ); 748 item = new MonthViewItem( event, text );
770 } 749 }
771 750
772 QPalette pal; 751 QPalette pal;
773 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 752 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
774 QStringList categories = event->categories(); 753 QStringList categories = event->categories();
775 QString cat = categories.first(); 754 QString cat = categories.first();
776 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 755 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
777 pal = getPalette(); 756 pal = getPalette();
778 if (cat.isEmpty()) { 757 if (cat.isEmpty()) {
779 //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 758 //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
780 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( event->calID() )); 759 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( event->calID() ));
781 } else { 760 } else {
782 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 761 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
783 } 762 }
784 763
785 } else { 764 } else {
786 if (cat.isEmpty()) { 765 if (cat.isEmpty()) {
787 //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 766 //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
788 pal = QPalette( KOPrefs::instance()->defaultColor( event->calID() ), KOPrefs::instance()->defaultColor( event->calID() )); 767 pal = QPalette( KOPrefs::instance()->defaultColor( event->calID() ), KOPrefs::instance()->defaultColor( event->calID() ));
789 } else { 768 } else {
790 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 769 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
791 } 770 }
792 } 771 }
793 772
794 } else { 773 } else {
795 pal = mStandardPalette ; 774 pal = mStandardPalette ;
796 } 775 }
776 pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor);
797 item->setPalette( pal ); 777 item->setPalette( pal );
798 item->setRecur( event->recurrence()->doesRecur() ); 778 item->setRecur( event->recurrence()->doesRecur() );
799 item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() ); 779 item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() );
800 item->setMoreInfo( event->description().length() > 0 ); 780 item->setMoreInfo( event->description().length() > 0 );
801#ifdef DESKTOP_VERSION 781#ifdef DESKTOP_VERSION
802 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, 782 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails,
803 KOPrefs::instance()->email()); 783 KOPrefs::instance()->email());
804 if ( me != 0 ) { 784 if ( me != 0 ) {
805 if ( me->status() == Attendee::NeedsAction && me->RSVP()) 785 if ( me->status() == Attendee::NeedsAction && me->RSVP())
806 item->setReply(true && multiday < 2); 786 item->setReply(true && multiday < 2);
807 else 787 else
808 item->setReply(false); 788 item->setReply(false);
809 } else 789 } else
810 item->setReply(false); 790 item->setReply(false);
811#endif 791#endif
812 792
813 item->setMultiDay( multiday ); 793 item->setMultiDay( multiday );
814 if ( multiday ) { 794 if ( multiday ) {
815 insertItem( item ,mdayCount); 795 insertItem( item ,mdayCount);
816 ++mdayCount; 796 ++mdayCount;
817 } else { 797 } else {
818 uint i = mdayCount; 798 uint i = mdayCount;
819 uint pos = mdayCount; 799 uint pos = mdayCount;
820 uint itcount = count(); 800 uint itcount = count();
821 if ( itcount > 1000 ) { 801 if ( itcount > 1000 ) {
822 qDebug("KO: Bug in MonthViewCell::insertEvent %u ", itcount); 802 qDebug("KO: Bug in MonthViewCell::insertEvent %u ", itcount);
823 itcount = 0; 803 itcount = 0;
824 } 804 }
825 for ( i = pos; i < itcount;++i ) { 805 for ( i = pos; i < itcount;++i ) {
826 // qDebug("i %d mday %u count %d ",i,itcount,mdayCount ); 806 // qDebug("i %d mday %u count %d ",i,itcount,mdayCount );
827 QListBoxItem* it = this->item ( i ); 807 QListBoxItem* it = this->item ( i );
828 if ( it && text < it->text() ) { 808 if ( it && text < it->text() ) {
829 pos = i; 809 pos = i;
830 break; 810 break;
831 } 811 }
832 ++pos; 812 ++pos;
833 } 813 }
834 insertItem( item ,pos); 814 insertItem( item ,pos);
835 } 815 }
836 if ( useToolTips ) { 816 if ( useToolTips ) {
837 mToolTip.append( mToolTipText ); 817 mToolTip.append( mToolTipText );
838 } 818 }
839 return mdayCount; 819 return mdayCount;
840} 820}
841void MonthViewCell::insertTodo(Todo *todo) 821void MonthViewCell::insertTodo(Todo *todo)
842{ 822{
843 setFocusPolicy(WheelFocus); 823 setFocusPolicy(WheelFocus);
844 QString text; 824 QString text;
845 if (todo->hasDueDate()) { 825 if (todo->hasDueDate()) {
846 if (!todo->doesFloat()) { 826 if (!todo->doesFloat()) {
847 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 827 text += KGlobal::locale()->formatTime(todo->dtDue().time());
848 text += " "; 828 text += " ";
849 } 829 }
850 } 830 }
851 text += todo->summary(); 831 text += todo->summary();
852 MonthViewItem *item ; 832 MonthViewItem *item ;
853 if ( mAvailItemList.count() ) { 833 if ( mAvailItemList.count() ) {
854 item = mAvailItemList.first(); 834 item = mAvailItemList.first();
855 mAvailItemList.remove( item ); 835 mAvailItemList.remove( item );
856 item->recycle( todo, mDate, text ); 836 item->recycle( todo, text );
857 } else { 837 } else {
858 item = new MonthViewItem( todo, mDate, text ); 838 item = new MonthViewItem( todo, text );
859 } 839 }
860 //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); 840 //MonthViewItem *item = new MonthViewItem( todo, mDate, text );
861 //item->setPalette( mStandardPalette ); 841 //item->setPalette( mStandardPalette );
862 QPalette pal; 842 QPalette pal;
863 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 843 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
864 QStringList categories = todo->categories(); 844 QStringList categories = todo->categories();
865 QString cat = categories.first(); 845 QString cat = categories.first();
866 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 846 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
867 pal = getPalette(); 847 pal = getPalette();
868 if (cat.isEmpty()) { 848 if (cat.isEmpty()) {
869 //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 849 //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
870 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( todo->calID() )); 850 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( todo->calID() ));
871 } else { 851 } else {
872 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 852 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
873 } 853 }
874 854
875 } else { 855 } else {
876 if (cat.isEmpty()) { 856 if (cat.isEmpty()) {
877 //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 857 //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
878 pal = QPalette(KOPrefs::instance()->defaultColor( todo->calID() ), KOPrefs::instance()->defaultColor( todo->calID() )); 858 pal = QPalette(KOPrefs::instance()->defaultColor( todo->calID() ), KOPrefs::instance()->defaultColor( todo->calID() ));
879 } else { 859 } else {
880 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 860 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
881 } 861 }
882 } 862 }
883 863
884 } else { 864 } else {
885 pal = mStandardPalette ; 865 pal = mStandardPalette ;
886 } 866 }
867 pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor);
887 item->setPalette( pal ); 868 item->setPalette( pal );
888 item->setRecur( todo->recurrence()->doesRecur() ); 869 item->setRecur( todo->recurrence()->doesRecur() );
889 item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() ); 870 item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() );
890 item->setMoreInfo( todo->description().length() > 0 ); 871 item->setMoreInfo( todo->description().length() > 0 );
891 insertItem( item , count()); 872 insertItem( item , count());
892#ifdef DESKTOP_VERSION 873#ifdef DESKTOP_VERSION
893 mToolTip.append( text ); 874 mToolTip.append( text );
894#endif 875#endif
895} 876}
896void MonthViewCell::repaintfinishUpdateCell() 877void MonthViewCell::repaintfinishUpdateCell()
897{ 878{
898 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 879 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
899 while ( mitem ) { 880 while ( mitem ) {
900 mitem->setBlockRepaint( false ); 881 mitem->setBlockRepaint( false );
901 updateItem ( mitem ); 882 updateItem ( mitem );
902 mitem = (MonthViewItem *)mitem->next(); 883 mitem = (MonthViewItem *)mitem->next();
903 } 884 }
904} 885}
905void MonthViewCell::finishUpdateCell() 886void MonthViewCell::finishUpdateCell()
906{ 887{
907 888
908 889
909 890
910#ifdef DESKTOP_VERSION 891#ifdef DESKTOP_VERSION
911 if (mToolTip.count() > 0 ) { 892 if (mToolTip.count() > 0 ) {
912 mToolTip.sort(); 893 mToolTip.sort();
913 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); 894 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),"");
914 } 895 }
915#endif 896#endif
916 //sort(); 897 //sort();
917 //setMyPalette(); 898 //setMyPalette();
918 setMyPalette(); 899 setMyPalette();
919 900
920 resizeEvent( 0 ); 901 resizeEvent( 0 );
921 902
922} 903}
923void MonthViewCell::updateCell() 904void MonthViewCell::updateCell()
924{ 905{
925 if ( !mMonthView->isUpdatePossible() ) 906 if ( !mMonthView->isUpdatePossible() )
926 return; 907 return;
927 startUpdateCell(); 908 startUpdateCell();
928 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 909 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
929 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 910 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
930 Event *event; 911 Event *event;
931 for( event = events.first(); event; event = events.next() ) { // for event 912 for( event = events.first(); event; event = events.next() ) { // for event
932 insertEvent(event); 913 insertEvent(event);
933 } 914 }
934 // insert due todos 915 // insert due todos
@@ -978,103 +959,97 @@ void MonthViewCell::updateConfig( bool bigFont ) // = false
978void MonthViewCell::enableScrollBars( bool enabled ) 959void MonthViewCell::enableScrollBars( bool enabled )
979{ 960{
980 961
981 return; 962 return;
982 if ( enabled ) { 963 if ( enabled ) {
983 QListBoxItem *fi = firstItem (); 964 QListBoxItem *fi = firstItem ();
984 if (fi ) { 965 if (fi ) {
985 int ihei = fi->height( this ); 966 int ihei = fi->height( this );
986 int hei = numRows () * ihei; 967 int hei = numRows () * ihei;
987 if ( hei < height() - horizontalScrollBar()->height () ) { 968 if ( hei < height() - horizontalScrollBar()->height () ) {
988 setVScrollBarMode(QScrollView::AlwaysOff); 969 setVScrollBarMode(QScrollView::AlwaysOff);
989 } 970 }
990 else 971 else
991 setVScrollBarMode(QScrollView::Auto); 972 setVScrollBarMode(QScrollView::Auto);
992 if ( ihei *3 > height() ) { 973 if ( ihei *3 > height() ) {
993 setHScrollBarMode(QScrollView::AlwaysOff); 974 setHScrollBarMode(QScrollView::AlwaysOff);
994 } 975 }
995 else { 976 else {
996 setHScrollBarMode(QScrollView::Auto); 977 setHScrollBarMode(QScrollView::Auto);
997 } 978 }
998 } else { 979 } else {
999 setVScrollBarMode(QScrollView::Auto); 980 setVScrollBarMode(QScrollView::Auto);
1000 setHScrollBarMode(QScrollView::Auto); 981 setHScrollBarMode(QScrollView::Auto);
1001 } 982 }
1002 } else { 983 } else {
1003 setVScrollBarMode(QScrollView::AlwaysOff); 984 setVScrollBarMode(QScrollView::AlwaysOff);
1004 setHScrollBarMode(QScrollView::AlwaysOff); 985 setHScrollBarMode(QScrollView::AlwaysOff);
1005 } 986 }
1006} 987}
1007 988
1008Incidence *MonthViewCell::selectedIncidence() 989Incidence *MonthViewCell::selectedIncidence()
1009{ 990{
1010 int index = currentItem(); 991 int index = currentItem();
1011 if ( index < 0 ) return 0; 992 if ( index < 0 ) return 0;
1012 993
1013 MonthViewItem *mitem = 994 MonthViewItem *mitem =
1014 static_cast<MonthViewItem *>( item( index ) ); 995 static_cast<MonthViewItem *>( item( index ) );
1015 996
1016 if ( !mitem ) return 0; 997 if ( !mitem ) return 0;
1017 998
1018 return mitem->incidence(); 999 return mitem->incidence();
1019} 1000}
1020 1001
1021QDate MonthViewCell::selectedIncidenceDate() 1002QDate MonthViewCell::selectedIncidenceDate()
1022{ 1003{
1023 QDate qd; 1004 QDate qd;
1024 int index = currentItem(); 1005 int index = currentItem();
1025 if ( index < 0 ) return qd; 1006 if ( index < 0 ) return qd;
1026 1007 return mDate;
1027 MonthViewItem *mitem =
1028 static_cast<MonthViewItem *>( item( index ) );
1029
1030 if ( !mitem ) return qd;
1031
1032 return mitem->incidenceDate();
1033} 1008}
1034 1009
1035void MonthViewCell::deselect() 1010void MonthViewCell::deselect()
1036{ 1011{
1037 clearSelection(); 1012 clearSelection();
1038 enableScrollBars( false ); 1013 enableScrollBars( false );
1039 // updateCell(); 1014 // updateCell();
1040} 1015}
1041void MonthViewCell::select() 1016void MonthViewCell::select()
1042{ 1017{
1043 ;// updateCell(); 1018 ;// updateCell();
1044} 1019}
1045 1020
1046void MonthViewCell::resizeEvent ( QResizeEvent * e ) 1021void MonthViewCell::resizeEvent ( QResizeEvent * e )
1047{ 1022{
1048 if ( !mMonthView->isUpdatePossible() ) 1023 if ( !mMonthView->isUpdatePossible() )
1049 return; 1024 return;
1050 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); 1025 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height());
1051 deselect(); 1026 deselect();
1052 mLabel->setMaximumHeight( height() - lineWidth()*2 ); 1027 mLabel->setMaximumHeight( height() - lineWidth()*2 );
1053 1028
1054 QString text; 1029 QString text;
1055 mLabel->setText( text ); 1030 mLabel->setText( text );
1056 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; 1031 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
1057 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { 1032 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
1058 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; 1033 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " ";
1059 mLabel->resize( mLabelBigSize ); 1034 mLabel->resize( mLabelBigSize );
1060 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 1035 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
1061 } else { 1036 } else {
1062 mLabel->resize( mLabelSize ); 1037 mLabel->resize( mLabelSize );
1063 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 1038 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
1064 } 1039 }
1065 mLabel->setText( text ); 1040 mLabel->setText( text );
1066 1041
1067 int size = height() - mLabel->height() - lineWidth()-1; 1042 int size = height() - mLabel->height() - lineWidth()-1;
1068 //qDebug("LW %d ", lineWidth()); 1043 //qDebug("LW %d ", lineWidth());
1069 if ( size > 0 ) 1044 if ( size > 0 )
1070 verticalScrollBar()->setMaximumHeight( size ); 1045 verticalScrollBar()->setMaximumHeight( size );
1071 size = width() - mLabel->width() -lineWidth()-1; 1046 size = width() - mLabel->width() -lineWidth()-1;
1072 if ( size > 0 ) 1047 if ( size > 0 )
1073 horizontalScrollBar()->setMaximumWidth( size ); 1048 horizontalScrollBar()->setMaximumWidth( size );
1074 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); 1049 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() );
1075 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 1050 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
1076 // mItemList->resize ( width(), height () ); 1051 // mItemList->resize ( width(), height () );
1077 if ( e ) 1052 if ( e )
1078 KNoScrollListBox::resizeEvent ( e ); 1053 KNoScrollListBox::resizeEvent ( e );
1079} 1054}
1080 1055
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index ac97860..2622d10 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -60,115 +60,113 @@ class KOWeekButton : public QPushButton
60 int getWeekNum() { return mNumber;} 60 int getWeekNum() { return mNumber;}
61 signals: 61 signals:
62 void selectWeekNum ( int ); 62 void selectWeekNum ( int );
63private: 63private:
64 void focusInEvent ( QFocusEvent * ){;} 64 void focusInEvent ( QFocusEvent * ){;}
65 int mNumber; 65 int mNumber;
66 void keyPressEvent ( QKeyEvent * e ) 66 void keyPressEvent ( QKeyEvent * e )
67 { 67 {
68 e->ignore(); 68 e->ignore();
69 } 69 }
70 70
71private slots : 71private slots :
72 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } 72 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); }
73}; 73};
74 74
75class KNoScrollListBox: public QListBox 75class KNoScrollListBox: public QListBox
76{ 76{
77 Q_OBJECT 77 Q_OBJECT
78 public: 78 public:
79 KNoScrollListBox(QWidget *parent=0, const char *name=0); 79 KNoScrollListBox(QWidget *parent=0, const char *name=0);
80 ~KNoScrollListBox(); 80 ~KNoScrollListBox();
81 QString getWhatsThisText(QPoint p) ; 81 QString getWhatsThisText(QPoint p) ;
82 82
83 signals: 83 signals:
84 void shiftDown(); 84 void shiftDown();
85 void shiftUp(); 85 void shiftUp();
86 void rightClick(); 86 void rightClick();
87 void nextCell(); 87 void nextCell();
88 void prevCell(); 88 void prevCell();
89 void highligtIncidence( Incidence * , MonthViewCell*, int ); 89 void highligtIncidence( Incidence * , MonthViewCell*, int );
90 90
91 protected slots: 91 protected slots:
92 void oneDown(); 92 void oneDown();
93 void keyPressEvent(QKeyEvent *); 93 void keyPressEvent(QKeyEvent *);
94 void keyReleaseEvent(QKeyEvent *); 94 void keyReleaseEvent(QKeyEvent *);
95 void mousePressEvent(QMouseEvent *); 95 void mousePressEvent(QMouseEvent *);
96 void focusInEvent ( QFocusEvent * ); 96 void focusInEvent ( QFocusEvent * );
97 void focusOutEvent ( QFocusEvent * ); 97 void focusOutEvent ( QFocusEvent * );
98 98
99 private: 99 private:
100 bool resetOnFocusIn; 100 bool resetOnFocusIn;
101 KNOWhatsThis * mWT; 101 KNOWhatsThis * mWT;
102}; 102};
103 103
104 104
105class MonthViewItem: public QListBoxItem 105class MonthViewItem: public QListBoxItem
106{ 106{
107 public: 107 public:
108 MonthViewItem( Incidence *, QDate qd, const QString & title ); 108 MonthViewItem( Incidence *,const QString & title );
109 void recycle( Incidence *incidence, QDate qd, const QString & s); 109 void recycle( Incidence *incidence, const QString & s);
110 void clearData();
111 void setRecur(bool on) { mRecur = on; } 110 void setRecur(bool on) { mRecur = on; }
112 void setAlarm(bool on) { mAlarm = on; } 111 void setAlarm(bool on) { mAlarm = on; }
113 void setReply(bool on) { mReply = on; } 112 void setReply(bool on) { mReply = on; }
114 void setMoreInfo(bool on) { mInfo = on; } 113 void setMoreInfo(bool on) { mInfo = on; }
115 void setMultiDay(int type) { mMultiday = type; } 114 void setMultiDay(int type) { mMultiday = type; }
116 int multiDay() { return mMultiday; } 115 int multiDay() { return mMultiday; }
117 void setMultiDayPos(int type) { mdayPos = type; } 116 void setMultiDayPos(int type) { mdayPos = type; }
118 int gettMultiDayPos() { return mdayPos; } 117 int gettMultiDayPos() { return mdayPos; }
119 void setBlockRepaint(bool on) { mblockRepaint = on; } 118 void setBlockRepaint(bool on) { mblockRepaint = on; }
120 bool setHighlighted( Incidence * ); 119 bool setHighlighted( Incidence * );
121 120
122 void setPalette(const QPalette &p) { mPalette = p; } 121 void setPalette(const QPalette &p) { mPalette = p; }
123 QPalette palette() const { return mPalette; } 122 QPalette palette() const { return mPalette; }
124 bool setHighlightedFalse(); 123 bool setHighlightedFalse();
125 Incidence *incidence() const { return mIncidence; } 124 Incidence *incidence() const { return mIncidence; }
126 QDate incidenceDate() { return mDate; }
127 125
128 protected: 126 protected:
129 virtual void paint(QPainter *); 127 virtual void paint(QPainter *);
130 virtual int height(const QListBox *) const; 128 virtual int height(const QListBox *) const;
131 virtual int width(const QListBox *) const; 129 virtual int width(const QListBox *) const;
132 130
133 private: 131 private:
134 int mdayPos; 132 int mdayPos;
135 bool isWeekItem; 133 bool isWeekItem;
136 bool mblockRepaint; 134 bool mblockRepaint;
137 int mMultiday; 135 int mMultiday;
138 bool mRecur; 136 bool mRecur;
139 bool mAlarm; 137 bool mAlarm;
140 bool mReply; 138 bool mReply;
141 bool mInfo; 139 bool mInfo;
142 bool mDisplayHightlighted; 140 bool mDisplayHightlighted;
143 141
144 QPalette mPalette; 142 QPalette mPalette;
145 QDate mDate; 143 QDate mDate;
146 144
147 Incidence *mIncidence; 145 Incidence *mIncidence;
148}; 146};
149 147
150 148
151class KOMonthView; 149class KOMonthView;
152 150
153class MonthViewCell : public KNoScrollListBox 151class MonthViewCell : public KNoScrollListBox
154{ 152{
155 Q_OBJECT 153 Q_OBJECT
156 public: 154 public:
157 MonthViewCell(KOMonthView *,QWidget* ); 155 MonthViewCell(KOMonthView *,QWidget* );
158 ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} 156 ~MonthViewCell() {mAvailItemList.setAutoDelete( true );}
159 157
160 void setDate( const QDate & ); 158 void setDate( const QDate & );
161 QDate date() const; 159 QDate date() const;
162 160
163 void setPrimary( bool ); 161 void setPrimary( bool );
164 bool isPrimary() const; 162 bool isPrimary() const;
165 163
166 void setHoliday( bool ); 164 void setHoliday( bool );
167 void setHoliday( const QString & ); 165 void setHoliday( const QString & );
168 166
169 void updateCell(); 167 void updateCell();
170 void startUpdateCell(); 168 void startUpdateCell();
171 void finishUpdateCell(); 169 void finishUpdateCell();
172 void repaintfinishUpdateCell(); 170 void repaintfinishUpdateCell();
173 int insertEvent(Event *); 171 int insertEvent(Event *);
174 void insertTodo(Todo *); 172 void insertTodo(Todo *);