-rw-r--r-- | korganizer/komonthview.cpp | 24 | ||||
-rw-r--r-- | korganizer/komonthview.h | 2 |
2 files changed, 14 insertions, 12 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 4bf9dea..004ff50 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -399,357 +399,359 @@ void MonthViewCell::setDate( const QDate &date ) | |||
399 | mDate = date; | 399 | mDate = date; |
400 | 400 | ||
401 | 401 | ||
402 | 402 | ||
403 | //resizeEvent( 0 ); | 403 | //resizeEvent( 0 ); |
404 | } | 404 | } |
405 | 405 | ||
406 | QDate MonthViewCell::date() const | 406 | QDate MonthViewCell::date() const |
407 | { | 407 | { |
408 | return mDate; | 408 | return mDate; |
409 | } | 409 | } |
410 | 410 | ||
411 | void MonthViewCell::setPrimary( bool primary ) | 411 | void MonthViewCell::setPrimary( bool primary ) |
412 | { | 412 | { |
413 | mPrimary = primary; | 413 | mPrimary = primary; |
414 | //setMyPalette(); | 414 | //setMyPalette(); |
415 | } | 415 | } |
416 | void MonthViewCell::setMyPalette() | 416 | void MonthViewCell::setMyPalette() |
417 | { | 417 | { |
418 | 418 | ||
419 | if ( mHoliday) { | 419 | if ( mHoliday) { |
420 | setPalette( mHolidayPalette ); | 420 | setPalette( mHolidayPalette ); |
421 | } else { | 421 | } else { |
422 | if ( mPrimary ) { | 422 | if ( mPrimary ) { |
423 | setPalette( mPrimaryPalette ); | 423 | setPalette( mPrimaryPalette ); |
424 | } else { | 424 | } else { |
425 | setPalette( mNonPrimaryPalette ); | 425 | setPalette( mNonPrimaryPalette ); |
426 | } | 426 | } |
427 | } | 427 | } |
428 | QPalette pal = palette(); | 428 | QPalette pal = palette(); |
429 | 429 | ||
430 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 430 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
431 | } | 431 | } |
432 | QPalette MonthViewCell::getPalette () | 432 | QPalette MonthViewCell::getPalette () |
433 | { | 433 | { |
434 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 434 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
435 | return mStandardPalette; | 435 | return mStandardPalette; |
436 | if ( mHoliday) { | 436 | if ( mHoliday) { |
437 | return mHolidayPalette ; | 437 | return mHolidayPalette ; |
438 | } else { | 438 | } else { |
439 | if ( mPrimary ) { | 439 | if ( mPrimary ) { |
440 | return mPrimaryPalette ; | 440 | return mPrimaryPalette ; |
441 | } | 441 | } |
442 | } | 442 | } |
443 | return mNonPrimaryPalette; | 443 | return mNonPrimaryPalette; |
444 | } | 444 | } |
445 | bool MonthViewCell::isPrimary() const | 445 | bool MonthViewCell::isPrimary() const |
446 | { | 446 | { |
447 | return mPrimary; | 447 | return mPrimary; |
448 | } | 448 | } |
449 | 449 | ||
450 | void MonthViewCell::setHoliday( bool holiday ) | 450 | void MonthViewCell::setHoliday( bool holiday ) |
451 | { | 451 | { |
452 | mHoliday = holiday; | 452 | mHoliday = holiday; |
453 | //setMyPalette(); | 453 | //setMyPalette(); |
454 | } | 454 | } |
455 | 455 | ||
456 | void MonthViewCell::setHoliday( const QString &holiday ) | 456 | void MonthViewCell::setHoliday( const QString &holiday ) |
457 | { | 457 | { |
458 | mHolidayString = holiday; | 458 | mHolidayString = holiday; |
459 | 459 | ||
460 | if ( !holiday.isEmpty() ) { | 460 | if ( !holiday.isEmpty() ) { |
461 | setHoliday( true ); | 461 | setHoliday( true ); |
462 | } | 462 | } |
463 | } | 463 | } |
464 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | 464 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) |
465 | { | 465 | { |
466 | 466 | ||
467 | e->ignore(); | 467 | e->ignore(); |
468 | 468 | ||
469 | } | 469 | } |
470 | 470 | ||
471 | void MonthViewCell::startUpdateCell() | 471 | void MonthViewCell::startUpdateCell() |
472 | { | 472 | { |
473 | 473 | ||
474 | mItemList->setFocusPolicy(NoFocus); | 474 | mItemList->setFocusPolicy(NoFocus); |
475 | if ( !mMonthView->isUpdatePossible() ) | 475 | if ( !mMonthView->isUpdatePossible() ) |
476 | return; | 476 | return; |
477 | 477 | ||
478 | /* | 478 | /* |
479 | if ( !isVisible() ){ | 479 | if ( !isVisible() ){ |
480 | return; | 480 | return; |
481 | } | 481 | } |
482 | */ | 482 | */ |
483 | // qDebug("MonthViewCell::updateCell() "); | 483 | // qDebug("MonthViewCell::updateCell() "); |
484 | setPrimary( mDate.month()%2 ); | 484 | setPrimary( mDate.month()%2 ); |
485 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 485 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
486 | if ( mDate == QDate::currentDate() ) { | 486 | if ( mDate == QDate::currentDate() ) { |
487 | mItemList->setLineWidth( 3 ); | 487 | mItemList->setLineWidth( 3 ); |
488 | } else { | 488 | } else { |
489 | mItemList->setLineWidth( 1 ); | 489 | mItemList->setLineWidth( 1 ); |
490 | } | 490 | } |
491 | mItemList->clear(); | 491 | mItemList->clear(); |
492 | 492 | ||
493 | #ifdef DESKTOP_VERSION | 493 | #ifdef DESKTOP_VERSION |
494 | QToolTip::remove(this); | 494 | QToolTip::remove(this); |
495 | #endif | 495 | #endif |
496 | mToolTip = ""; | 496 | mToolTip.clear(); |
497 | //qApp->processEvents(); | 497 | //qApp->processEvents(); |
498 | if ( !mHolidayString.isEmpty() ) { | 498 | if ( !mHolidayString.isEmpty() ) { |
499 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 499 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
500 | item->setPalette( mHolidayPalette ); | 500 | item->setPalette( mHolidayPalette ); |
501 | mItemList->insertItem( item ); | 501 | mItemList->insertItem( item ); |
502 | mToolTip += mHolidayString+"\n"; | 502 | mToolTip.append ( mHolidayString ); |
503 | } | 503 | } |
504 | } | 504 | } |
505 | 505 | ||
506 | void MonthViewCell::insertEvent(Event *event) | 506 | void MonthViewCell::insertEvent(Event *event) |
507 | { | 507 | { |
508 | 508 | QString mToolTipText; | |
509 | mItemList->setFocusPolicy(WheelFocus); | 509 | mItemList->setFocusPolicy(WheelFocus); |
510 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 510 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
511 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 511 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
512 | return; | 512 | return; |
513 | else | 513 | else |
514 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 514 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
515 | return; | 515 | return; |
516 | } | 516 | } |
517 | 517 | ||
518 | if ( event->categories().contains("Holiday") || | 518 | if ( event->categories().contains("Holiday") || |
519 | event->categories().contains(i18n("Holiday"))) { | 519 | event->categories().contains(i18n("Holiday"))) { |
520 | setHoliday( true ); | 520 | setHoliday( true ); |
521 | if ( mDate.dayOfWeek() == 7 ) | 521 | if ( mDate.dayOfWeek() == 7 ) |
522 | mItemList->setLineWidth( 3 ); | 522 | mItemList->setLineWidth( 3 ); |
523 | } | 523 | } |
524 | QString text; | 524 | QString text; |
525 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | 525 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day |
526 | if (event->isMultiDay()) { | 526 | if (event->isMultiDay()) { |
527 | QString prefix = "<->";multiday = 2; | 527 | QString prefix = "<->";multiday = 2; |
528 | QString time; | 528 | QString time; |
529 | if ( event->doesRecur() ) { | 529 | if ( event->doesRecur() ) { |
530 | if ( event->recursOn( mDate) ) { | 530 | if ( event->recursOn( mDate) ) { |
531 | prefix ="->" ;multiday = 1; | 531 | prefix ="->" ;multiday = 1; |
532 | } | 532 | } |
533 | else { | 533 | else { |
534 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 534 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
535 | if ( event->recursOn( mDate.addDays( -days)) ) { | 535 | if ( event->recursOn( mDate.addDays( -days)) ) { |
536 | prefix ="<-" ;multiday = 3; | 536 | prefix ="<-" ;multiday = 3; |
537 | } | 537 | } |
538 | } | 538 | } |
539 | 539 | ||
540 | } else { | 540 | } else { |
541 | if (mDate == event->dtStart().date()) { | 541 | if (mDate == event->dtStart().date()) { |
542 | prefix ="->" ;multiday = 1; | 542 | prefix ="->" ;multiday = 1; |
543 | } else if (mDate == event->dtEnd().date()) { | 543 | } else if (mDate == event->dtEnd().date()) { |
544 | prefix ="<-" ;multiday = 3; | 544 | prefix ="<-" ;multiday = 3; |
545 | } | 545 | } |
546 | } | 546 | } |
547 | if ( !event->doesFloat() ) { | 547 | if ( !event->doesFloat() ) { |
548 | if ( mDate == event->dtStart().date () ) | 548 | if ( mDate == event->dtStart().date () ) |
549 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 549 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
550 | else if ( mDate == event->dtEnd().date () ) | 550 | else if ( mDate == event->dtEnd().date () ) |
551 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 551 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
552 | 552 | ||
553 | } | 553 | } |
554 | text = time + event->summary(); | 554 | text = time + event->summary(); |
555 | mToolTip += prefix + text; | 555 | mToolTipText += prefix + text; |
556 | } else { | 556 | } else { |
557 | if (event->doesFloat()) { | 557 | if (event->doesFloat()) { |
558 | text = event->summary(); | 558 | text = event->summary(); |
559 | mToolTip += text; | 559 | mToolTipText += text; |
560 | } | 560 | } |
561 | else { | 561 | else { |
562 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 562 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
563 | text += " " + event->summary(); | 563 | text += " " + event->summary(); |
564 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 564 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
565 | } | 565 | } |
566 | } | 566 | } |
567 | 567 | ||
568 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); | 568 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); |
569 | QPalette pal; | 569 | QPalette pal; |
570 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 570 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
571 | QStringList categories = event->categories(); | 571 | QStringList categories = event->categories(); |
572 | QString cat = categories.first(); | 572 | QString cat = categories.first(); |
573 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 573 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
574 | pal = getPalette(); | 574 | pal = getPalette(); |
575 | if (cat.isEmpty()) { | 575 | if (cat.isEmpty()) { |
576 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 576 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
577 | } else { | 577 | } else { |
578 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 578 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
579 | } | 579 | } |
580 | 580 | ||
581 | } else { | 581 | } else { |
582 | if (cat.isEmpty()) { | 582 | if (cat.isEmpty()) { |
583 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 583 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
584 | } else { | 584 | } else { |
585 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 585 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
586 | } | 586 | } |
587 | } | 587 | } |
588 | 588 | ||
589 | } else { | 589 | } else { |
590 | pal = mStandardPalette ; | 590 | pal = mStandardPalette ; |
591 | } | 591 | } |
592 | item->setPalette( pal ); | 592 | item->setPalette( pal ); |
593 | item->setRecur( event->recurrence()->doesRecur() ); | 593 | item->setRecur( event->recurrence()->doesRecur() ); |
594 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 ); | 594 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 ); |
595 | item->setMoreInfo( event->description().length() > 0 ); | 595 | item->setMoreInfo( event->description().length() > 0 ); |
596 | #ifdef DESKTOP_VERSION | 596 | #ifdef DESKTOP_VERSION |
597 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 597 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
598 | KOPrefs::instance()->email()); | 598 | KOPrefs::instance()->email()); |
599 | if ( me != 0 ) { | 599 | if ( me != 0 ) { |
600 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 600 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
601 | item->setReply(true && multiday < 2); | 601 | item->setReply(true && multiday < 2); |
602 | else | 602 | else |
603 | item->setReply(false); | 603 | item->setReply(false); |
604 | } else | 604 | } else |
605 | item->setReply(false); | 605 | item->setReply(false); |
606 | #endif | 606 | #endif |
607 | item->setMultiDay( multiday ); | 607 | item->setMultiDay( multiday ); |
608 | mItemList->insertItem( item ); | 608 | mItemList->insertItem( item ); |
609 | mToolTip += "\n"; | 609 | mToolTip.append( mToolTipText ); |
610 | } | 610 | } |
611 | void MonthViewCell::insertTodo(Todo *todo) | 611 | void MonthViewCell::insertTodo(Todo *todo) |
612 | { | 612 | { |
613 | mItemList->setFocusPolicy(WheelFocus); | 613 | mItemList->setFocusPolicy(WheelFocus); |
614 | QString text; | 614 | QString text; |
615 | if (todo->hasDueDate()) { | 615 | if (todo->hasDueDate()) { |
616 | if (!todo->doesFloat()) { | 616 | if (!todo->doesFloat()) { |
617 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 617 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
618 | text += " "; | 618 | text += " "; |
619 | } | 619 | } |
620 | } | 620 | } |
621 | text += todo->summary(); | 621 | text += todo->summary(); |
622 | 622 | ||
623 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 623 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
624 | //item->setPalette( mStandardPalette ); | 624 | //item->setPalette( mStandardPalette ); |
625 | QPalette pal; | 625 | QPalette pal; |
626 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 626 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
627 | QStringList categories = todo->categories(); | 627 | QStringList categories = todo->categories(); |
628 | QString cat = categories.first(); | 628 | QString cat = categories.first(); |
629 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 629 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
630 | pal = getPalette(); | 630 | pal = getPalette(); |
631 | if (cat.isEmpty()) { | 631 | if (cat.isEmpty()) { |
632 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 632 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
633 | } else { | 633 | } else { |
634 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 634 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
635 | } | 635 | } |
636 | 636 | ||
637 | } else { | 637 | } else { |
638 | if (cat.isEmpty()) { | 638 | if (cat.isEmpty()) { |
639 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 639 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
640 | } else { | 640 | } else { |
641 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 641 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
642 | } | 642 | } |
643 | } | 643 | } |
644 | 644 | ||
645 | } else { | 645 | } else { |
646 | pal = mStandardPalette ; | 646 | pal = mStandardPalette ; |
647 | } | 647 | } |
648 | item->setPalette( pal ); | 648 | item->setPalette( pal ); |
649 | item->setRecur( todo->recurrence()->doesRecur() ); | 649 | item->setRecur( todo->recurrence()->doesRecur() ); |
650 | item->setAlarm( todo->isAlarmEnabled() ); | 650 | item->setAlarm( todo->isAlarmEnabled() ); |
651 | item->setMoreInfo( todo->description().length() > 0 ); | 651 | item->setMoreInfo( todo->description().length() > 0 ); |
652 | mItemList->insertItem( item ); | 652 | mItemList->insertItem( item ); |
653 | mToolTip += text+"\n"; | 653 | mToolTip.append( text ); |
654 | } | 654 | } |
655 | void MonthViewCell::finishUpdateCell() | 655 | void MonthViewCell::finishUpdateCell() |
656 | { | 656 | { |
657 | #ifdef DESKTOP_VERSION | 657 | #ifdef DESKTOP_VERSION |
658 | if (mToolTip != "") | 658 | if (mToolTip.count() > 0 ) { |
659 | QToolTip::add(this,mToolTip,toolTipGroup(),""); | 659 | mToolTip.sort(); |
660 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); | ||
661 | } | ||
660 | #endif | 662 | #endif |
661 | mItemList->sort(); | 663 | mItemList->sort(); |
662 | //setMyPalette(); | 664 | //setMyPalette(); |
663 | setMyPalette(); | 665 | setMyPalette(); |
664 | QString text; | 666 | QString text; |
665 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 667 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
666 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 668 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
667 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 669 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
668 | mLabel->resize( mLabelBigSize ); | 670 | mLabel->resize( mLabelBigSize ); |
669 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 671 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
670 | } else { | 672 | } else { |
671 | mLabel->resize( mLabelSize ); | 673 | mLabel->resize( mLabelSize ); |
672 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 674 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
673 | } | 675 | } |
674 | 676 | ||
675 | mLabel->setText( text ); | 677 | mLabel->setText( text ); |
676 | resizeEvent( 0 ); | 678 | resizeEvent( 0 ); |
677 | } | 679 | } |
678 | void MonthViewCell::updateCell() | 680 | void MonthViewCell::updateCell() |
679 | { | 681 | { |
680 | //qDebug("MonthViewCell::updateCell() "); | 682 | //qDebug("MonthViewCell::updateCell() "); |
681 | if ( !mMonthView->isUpdatePossible() ) | 683 | if ( !mMonthView->isUpdatePossible() ) |
682 | return; | 684 | return; |
683 | startUpdateCell(); | 685 | startUpdateCell(); |
684 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 686 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
685 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 687 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
686 | Event *event; | 688 | Event *event; |
687 | for( event = events.first(); event; event = events.next() ) { // for event | 689 | for( event = events.first(); event; event = events.next() ) { // for event |
688 | insertEvent(event); | 690 | insertEvent(event); |
689 | } | 691 | } |
690 | // insert due todos | 692 | // insert due todos |
691 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 693 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
692 | Todo *todo; | 694 | Todo *todo; |
693 | for(todo = todos.first(); todo; todo = todos.next()) { | 695 | for(todo = todos.first(); todo; todo = todos.next()) { |
694 | insertTodo( todo ); | 696 | insertTodo( todo ); |
695 | } | 697 | } |
696 | finishUpdateCell(); | 698 | finishUpdateCell(); |
697 | // if ( isVisible()) | 699 | // if ( isVisible()) |
698 | //qApp->processEvents(); | 700 | //qApp->processEvents(); |
699 | } | 701 | } |
700 | 702 | ||
701 | void MonthViewCell::updateConfig( bool bigFont ) // = false | 703 | void MonthViewCell::updateConfig( bool bigFont ) // = false |
702 | { | 704 | { |
703 | 705 | ||
704 | if ( bigFont ) { | 706 | if ( bigFont ) { |
705 | QFont fo = KOPrefs::instance()->mMonthViewFont; | 707 | QFont fo = KOPrefs::instance()->mMonthViewFont; |
706 | int ps = fo.pointSize() + 2; | 708 | int ps = fo.pointSize() + 2; |
707 | if ( ps < 18 ) | 709 | if ( ps < 18 ) |
708 | ps += 2; | 710 | ps += 2; |
709 | fo.setPointSize( ps ); | 711 | fo.setPointSize( ps ); |
710 | setFont( fo ); | 712 | setFont( fo ); |
711 | } else | 713 | } else |
712 | setFont( KOPrefs::instance()->mMonthViewFont ); | 714 | setFont( KOPrefs::instance()->mMonthViewFont ); |
713 | 715 | ||
714 | QFontMetrics fm( font() ); | 716 | QFontMetrics fm( font() ); |
715 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 717 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
716 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 718 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
717 | mHolidayPalette = mStandardPalette; | 719 | mHolidayPalette = mStandardPalette; |
718 | mPrimaryPalette = mStandardPalette; | 720 | mPrimaryPalette = mStandardPalette; |
719 | mNonPrimaryPalette = mStandardPalette; | 721 | mNonPrimaryPalette = mStandardPalette; |
720 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 722 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
721 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 723 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
722 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 724 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
723 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 725 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
724 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 726 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
725 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 727 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
726 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 728 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
727 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 729 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
728 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 730 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
729 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 731 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
730 | } | 732 | } |
731 | //updateCell(); | 733 | //updateCell(); |
732 | } | 734 | } |
733 | 735 | ||
734 | void MonthViewCell::enableScrollBars( bool enabled ) | 736 | void MonthViewCell::enableScrollBars( bool enabled ) |
735 | { | 737 | { |
736 | if ( enabled ) { | 738 | if ( enabled ) { |
737 | mItemList->setVScrollBarMode(QScrollView::Auto); | 739 | mItemList->setVScrollBarMode(QScrollView::Auto); |
738 | mItemList->setHScrollBarMode(QScrollView::Auto); | 740 | mItemList->setHScrollBarMode(QScrollView::Auto); |
739 | } else { | 741 | } else { |
740 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); | 742 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); |
741 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); | 743 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); |
742 | } | 744 | } |
743 | } | 745 | } |
744 | 746 | ||
745 | Incidence *MonthViewCell::selectedIncidence() | 747 | Incidence *MonthViewCell::selectedIncidence() |
746 | { | 748 | { |
747 | int index = mItemList->currentItem(); | 749 | int index = mItemList->currentItem(); |
748 | if ( index < 0 ) return 0; | 750 | if ( index < 0 ) return 0; |
749 | 751 | ||
750 | MonthViewItem *item = | 752 | MonthViewItem *item = |
751 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 753 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
752 | 754 | ||
753 | if ( !item ) return 0; | 755 | if ( !item ) return 0; |
754 | 756 | ||
755 | return item->incidence(); | 757 | return item->incidence(); |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index fd8cbf2..a92421b 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -74,193 +74,193 @@ class KNoScrollListBox: public QListBox | |||
74 | 74 | ||
75 | signals: | 75 | signals: |
76 | void shiftDown(); | 76 | void shiftDown(); |
77 | void shiftUp(); | 77 | void shiftUp(); |
78 | void rightClick(); | 78 | void rightClick(); |
79 | 79 | ||
80 | protected slots: | 80 | protected slots: |
81 | void oneDown(); | 81 | void oneDown(); |
82 | void keyPressEvent(QKeyEvent *); | 82 | void keyPressEvent(QKeyEvent *); |
83 | void keyReleaseEvent(QKeyEvent *); | 83 | void keyReleaseEvent(QKeyEvent *); |
84 | void mousePressEvent(QMouseEvent *); | 84 | void mousePressEvent(QMouseEvent *); |
85 | 85 | ||
86 | private: | 86 | private: |
87 | KNOWhatsThis * mWT; | 87 | KNOWhatsThis * mWT; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | 90 | ||
91 | class MonthViewItem: public QListBoxItem | 91 | class MonthViewItem: public QListBoxItem |
92 | { | 92 | { |
93 | public: | 93 | public: |
94 | MonthViewItem( Incidence *, QDate qd, const QString & title ); | 94 | MonthViewItem( Incidence *, QDate qd, const QString & title ); |
95 | 95 | ||
96 | void setRecur(bool on) { mRecur = on; } | 96 | void setRecur(bool on) { mRecur = on; } |
97 | void setAlarm(bool on) { mAlarm = on; } | 97 | void setAlarm(bool on) { mAlarm = on; } |
98 | void setReply(bool on) { mReply = on; } | 98 | void setReply(bool on) { mReply = on; } |
99 | void setMoreInfo(bool on) { mInfo = on; } | 99 | void setMoreInfo(bool on) { mInfo = on; } |
100 | void setMultiDay(int type) { mMultiday = type; } | 100 | void setMultiDay(int type) { mMultiday = type; } |
101 | 101 | ||
102 | 102 | ||
103 | void setPalette(const QPalette &p) { mPalette = p; } | 103 | void setPalette(const QPalette &p) { mPalette = p; } |
104 | QPalette palette() const { return mPalette; } | 104 | QPalette palette() const { return mPalette; } |
105 | 105 | ||
106 | Incidence *incidence() const { return mIncidence; } | 106 | Incidence *incidence() const { return mIncidence; } |
107 | QDate incidenceDate() { return mDate; } | 107 | QDate incidenceDate() { return mDate; } |
108 | 108 | ||
109 | protected: | 109 | protected: |
110 | virtual void paint(QPainter *); | 110 | virtual void paint(QPainter *); |
111 | virtual int height(const QListBox *) const; | 111 | virtual int height(const QListBox *) const; |
112 | virtual int width(const QListBox *) const; | 112 | virtual int width(const QListBox *) const; |
113 | 113 | ||
114 | private: | 114 | private: |
115 | int mMultiday; | 115 | int mMultiday; |
116 | bool mRecur; | 116 | bool mRecur; |
117 | bool mAlarm; | 117 | bool mAlarm; |
118 | bool mReply; | 118 | bool mReply; |
119 | bool mInfo; | 119 | bool mInfo; |
120 | 120 | ||
121 | QPalette mPalette; | 121 | QPalette mPalette; |
122 | QDate mDate; | 122 | QDate mDate; |
123 | 123 | ||
124 | Incidence *mIncidence; | 124 | Incidence *mIncidence; |
125 | }; | 125 | }; |
126 | 126 | ||
127 | 127 | ||
128 | class KOMonthView; | 128 | class KOMonthView; |
129 | 129 | ||
130 | class MonthViewCell : public QWidget | 130 | class MonthViewCell : public QWidget |
131 | { | 131 | { |
132 | Q_OBJECT | 132 | Q_OBJECT |
133 | public: | 133 | public: |
134 | MonthViewCell(KOMonthView *,QWidget* ); | 134 | MonthViewCell(KOMonthView *,QWidget* ); |
135 | 135 | ||
136 | void setDate( const QDate & ); | 136 | void setDate( const QDate & ); |
137 | QDate date() const; | 137 | QDate date() const; |
138 | 138 | ||
139 | void setPrimary( bool ); | 139 | void setPrimary( bool ); |
140 | bool isPrimary() const; | 140 | bool isPrimary() const; |
141 | 141 | ||
142 | void setHoliday( bool ); | 142 | void setHoliday( bool ); |
143 | void setHoliday( const QString & ); | 143 | void setHoliday( const QString & ); |
144 | 144 | ||
145 | void updateCell(); | 145 | void updateCell(); |
146 | void startUpdateCell(); | 146 | void startUpdateCell(); |
147 | void finishUpdateCell(); | 147 | void finishUpdateCell(); |
148 | void insertEvent(Event *); | 148 | void insertEvent(Event *); |
149 | void insertTodo(Todo *); | 149 | void insertTodo(Todo *); |
150 | 150 | ||
151 | void updateConfig( bool bigFont = false ); | 151 | void updateConfig( bool bigFont = false ); |
152 | 152 | ||
153 | void enableScrollBars( bool ); | 153 | void enableScrollBars( bool ); |
154 | 154 | ||
155 | Incidence *selectedIncidence(); | 155 | Incidence *selectedIncidence(); |
156 | QDate selectedIncidenceDate(); | 156 | QDate selectedIncidenceDate(); |
157 | 157 | ||
158 | void deselect(); | 158 | void deselect(); |
159 | void select(); | 159 | void select(); |
160 | 160 | ||
161 | #ifdef DESKTOP_VERSION | 161 | #ifdef DESKTOP_VERSION |
162 | static QToolTipGroup *toolTipGroup(); | 162 | static QToolTipGroup *toolTipGroup(); |
163 | #endif | 163 | #endif |
164 | signals: | 164 | signals: |
165 | void defaultAction( Incidence * ); | 165 | void defaultAction( Incidence * ); |
166 | void newEventSignal( QDateTime ); | 166 | void newEventSignal( QDateTime ); |
167 | void showDaySignal( QDate ); | 167 | void showDaySignal( QDate ); |
168 | 168 | ||
169 | protected: | 169 | protected: |
170 | QString mToolTip; | 170 | QStringList mToolTip; |
171 | void resizeEvent( QResizeEvent * ); | 171 | void resizeEvent( QResizeEvent * ); |
172 | 172 | ||
173 | 173 | ||
174 | public slots: | 174 | public slots: |
175 | void showDay(); | 175 | void showDay(); |
176 | 176 | ||
177 | protected slots: | 177 | protected slots: |
178 | void defaultAction( QListBoxItem * ); | 178 | void defaultAction( QListBoxItem * ); |
179 | void contextMenu( QListBoxItem * ); | 179 | void contextMenu( QListBoxItem * ); |
180 | void selection( QListBoxItem * ); | 180 | void selection( QListBoxItem * ); |
181 | void cellClicked( QListBoxItem * ); | 181 | void cellClicked( QListBoxItem * ); |
182 | void newEvent(); | 182 | void newEvent(); |
183 | 183 | ||
184 | private: | 184 | private: |
185 | KOMonthView *mMonthView; | 185 | KOMonthView *mMonthView; |
186 | 186 | ||
187 | QDate mDate; | 187 | QDate mDate; |
188 | bool mPrimary; | 188 | bool mPrimary; |
189 | bool mHoliday; | 189 | bool mHoliday; |
190 | QString mHolidayString; | 190 | QString mHolidayString; |
191 | 191 | ||
192 | //QLabel *mLabel; | 192 | //QLabel *mLabel; |
193 | QPushButton *mLabel; | 193 | QPushButton *mLabel; |
194 | QListBox *mItemList; | 194 | QListBox *mItemList; |
195 | #ifdef DESKTOP_VERSION | 195 | #ifdef DESKTOP_VERSION |
196 | static QToolTipGroup *mToolTipGroup; | 196 | static QToolTipGroup *mToolTipGroup; |
197 | #endif | 197 | #endif |
198 | QSize mLabelSize; | 198 | QSize mLabelSize; |
199 | QSize mLabelBigSize; | 199 | QSize mLabelBigSize; |
200 | QPalette mHolidayPalette; | 200 | QPalette mHolidayPalette; |
201 | QPalette mStandardPalette; | 201 | QPalette mStandardPalette; |
202 | QPalette mPrimaryPalette; | 202 | QPalette mPrimaryPalette; |
203 | QPalette mNonPrimaryPalette; | 203 | QPalette mNonPrimaryPalette; |
204 | void setMyPalette(); | 204 | void setMyPalette(); |
205 | QPalette getPalette (); | 205 | QPalette getPalette (); |
206 | void keyPressEvent ( QKeyEvent * ) ; | 206 | void keyPressEvent ( QKeyEvent * ) ; |
207 | 207 | ||
208 | }; | 208 | }; |
209 | 209 | ||
210 | 210 | ||
211 | class KOMonthView: public KOEventView | 211 | class KOMonthView: public KOEventView |
212 | { | 212 | { |
213 | Q_OBJECT | 213 | Q_OBJECT |
214 | public: | 214 | public: |
215 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 215 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
216 | ~KOMonthView(); | 216 | ~KOMonthView(); |
217 | 217 | ||
218 | /** Returns maximum number of days supported by the komonthview */ | 218 | /** Returns maximum number of days supported by the komonthview */ |
219 | virtual int maxDatesHint(); | 219 | virtual int maxDatesHint(); |
220 | 220 | ||
221 | /** Returns number of currently shown dates. */ | 221 | /** Returns number of currently shown dates. */ |
222 | virtual int currentDateCount(); | 222 | virtual int currentDateCount(); |
223 | 223 | ||
224 | /** returns the currently selected events */ | 224 | /** returns the currently selected events */ |
225 | virtual QPtrList<Incidence> selectedIncidences(); | 225 | virtual QPtrList<Incidence> selectedIncidences(); |
226 | 226 | ||
227 | /** returns dates of the currently selected events */ | 227 | /** returns dates of the currently selected events */ |
228 | virtual DateList selectedDates(); | 228 | virtual DateList selectedDates(); |
229 | 229 | ||
230 | virtual void printPreview(CalPrinter *calPrinter, | 230 | virtual void printPreview(CalPrinter *calPrinter, |
231 | const QDate &, const QDate &); | 231 | const QDate &, const QDate &); |
232 | bool isMonthView() { return !mShowWeekView; } | 232 | bool isMonthView() { return !mShowWeekView; } |
233 | bool isUpdatePossible() { return updatePossible; } | 233 | bool isUpdatePossible() { return updatePossible; } |
234 | 234 | ||
235 | MonthViewCell * selectedCell(); | 235 | MonthViewCell * selectedCell(); |
236 | bool skipResize; | 236 | bool skipResize; |
237 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} | 237 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} |
238 | public slots: | 238 | public slots: |
239 | virtual void updateView(); | 239 | virtual void updateView(); |
240 | virtual void updateConfig(); | 240 | virtual void updateConfig(); |
241 | virtual void showDates(const QDate &start, const QDate &end); | 241 | virtual void showDates(const QDate &start, const QDate &end); |
242 | virtual void showEvents(QPtrList<Event> eventList); | 242 | virtual void showEvents(QPtrList<Event> eventList); |
243 | 243 | ||
244 | void changeEventDisplay(Event *, int); | 244 | void changeEventDisplay(Event *, int); |
245 | 245 | ||
246 | void clearSelection(); | 246 | void clearSelection(); |
247 | 247 | ||
248 | void showContextMenu( Incidence * ); | 248 | void showContextMenu( Incidence * ); |
249 | 249 | ||
250 | void setSelectedCell( MonthViewCell * ); | 250 | void setSelectedCell( MonthViewCell * ); |
251 | void switchView(); | 251 | void switchView(); |
252 | 252 | ||
253 | protected slots: | 253 | protected slots: |
254 | void selectInternalWeekNum ( int ); | 254 | void selectInternalWeekNum ( int ); |
255 | void processSelectionChange(); | 255 | void processSelectionChange(); |
256 | signals: | 256 | signals: |
257 | void nextMonth(); | 257 | void nextMonth(); |
258 | void prevMonth(); | 258 | void prevMonth(); |
259 | void selectWeekNum ( int ); | 259 | void selectWeekNum ( int ); |
260 | void selectMonth (); | 260 | void selectMonth (); |
261 | void showDaySignal( QDate ); | 261 | void showDaySignal( QDate ); |
262 | protected: | 262 | protected: |
263 | void resizeEvent(QResizeEvent *); | 263 | void resizeEvent(QResizeEvent *); |
264 | void viewChanged(); | 264 | void viewChanged(); |
265 | void updateDayLabels(); | 265 | void updateDayLabels(); |
266 | 266 | ||