author | zautrix <zautrix> | 2005-03-25 18:26:36 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-25 18:26:36 (UTC) |
commit | 89a72c007045dcfa5dbf57012b4cf0c2aebd1495 (patch) (unidiff) | |
tree | 6accbe5706b724e307d1590152fa2d2c78cdef70 /korganizer/komonthview.cpp | |
parent | 3326831dbf6f962e97a978781361db5198f6a035 (diff) | |
download | kdepimpi-89a72c007045dcfa5dbf57012b4cf0c2aebd1495.zip kdepimpi-89a72c007045dcfa5dbf57012b4cf0c2aebd1495.tar.gz kdepimpi-89a72c007045dcfa5dbf57012b4cf0c2aebd1495.tar.bz2 |
layout fixes
-rw-r--r-- | korganizer/komonthview.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 12233ee..9085775 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -469,96 +469,101 @@ void MonthViewCell::setMyPalette() | |||
469 | //QPalette pal = palette(); | 469 | //QPalette pal = palette(); |
470 | 470 | ||
471 | //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 471 | //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
472 | } | 472 | } |
473 | QPalette MonthViewCell::getPalette () | 473 | QPalette MonthViewCell::getPalette () |
474 | { | 474 | { |
475 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 475 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
476 | return mStandardPalette; | 476 | return mStandardPalette; |
477 | if ( mHoliday) { | 477 | if ( mHoliday) { |
478 | return mHolidayPalette ; | 478 | return mHolidayPalette ; |
479 | } else { | 479 | } else { |
480 | if ( mPrimary ) { | 480 | if ( mPrimary ) { |
481 | return mPrimaryPalette ; | 481 | return mPrimaryPalette ; |
482 | } | 482 | } |
483 | } | 483 | } |
484 | return mNonPrimaryPalette; | 484 | return mNonPrimaryPalette; |
485 | } | 485 | } |
486 | bool MonthViewCell::isPrimary() const | 486 | bool MonthViewCell::isPrimary() const |
487 | { | 487 | { |
488 | return mPrimary; | 488 | return mPrimary; |
489 | } | 489 | } |
490 | 490 | ||
491 | void MonthViewCell::setHoliday( bool holiday ) | 491 | void MonthViewCell::setHoliday( bool holiday ) |
492 | { | 492 | { |
493 | mHoliday = holiday; | 493 | mHoliday = holiday; |
494 | //setMyPalette(); | 494 | //setMyPalette(); |
495 | } | 495 | } |
496 | 496 | ||
497 | void MonthViewCell::setHoliday( const QString &holiday ) | 497 | void MonthViewCell::setHoliday( const QString &holiday ) |
498 | { | 498 | { |
499 | mHolidayString = holiday; | 499 | mHolidayString = holiday; |
500 | 500 | ||
501 | if ( !holiday.isEmpty() ) { | 501 | if ( !holiday.isEmpty() ) { |
502 | setHoliday( true ); | 502 | setHoliday( true ); |
503 | } | 503 | } |
504 | } | 504 | } |
505 | 505 | ||
506 | void MonthViewCell::startUpdateCell() | 506 | void MonthViewCell::startUpdateCell() |
507 | { | 507 | { |
508 | 508 | ||
509 | setFocusPolicy(NoFocus); | 509 | setFocusPolicy(NoFocus); |
510 | if ( !mMonthView->isUpdatePossible() ) | 510 | if ( !mMonthView->isUpdatePossible() ) |
511 | return; | 511 | return; |
512 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 512 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
513 | while ( mitem ) { | 513 | while ( mitem ) { |
514 | mitem->setBlockRepaint( true ); | 514 | mitem->setBlockRepaint( true ); |
515 | mitem = (MonthViewItem *)mitem->next(); | 515 | mitem = (MonthViewItem *)mitem->next(); |
516 | } | 516 | } |
517 | if ( mAvailItemList.count() > 20 ) { | ||
518 | mAvailItemList.setAutoDelete( true ); | ||
519 | mAvailItemList.clear(); | ||
520 | mAvailItemList.setAutoDelete( false ); | ||
521 | } | ||
517 | /* | 522 | /* |
518 | if ( !isVisible() ){ | 523 | if ( !isVisible() ){ |
519 | return; | 524 | return; |
520 | } | 525 | } |
521 | */ | 526 | */ |
522 | // qDebug("MonthViewCell::updateCell() "); | 527 | // qDebug("MonthViewCell::updateCell() "); |
523 | setPrimary( mDate.month()%2 ); | 528 | setPrimary( mDate.month()%2 ); |
524 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 529 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
525 | if ( mDate == QDate::currentDate() ) { | 530 | if ( mDate == QDate::currentDate() ) { |
526 | setLineWidth( 3 ); | 531 | setLineWidth( 3 ); |
527 | } else { | 532 | } else { |
528 | setLineWidth( 1 ); | 533 | setLineWidth( 1 ); |
529 | } | 534 | } |
530 | mCurrentAvailItem = (MonthViewItem*) firstItem (); | 535 | mCurrentAvailItem = (MonthViewItem*) firstItem (); |
531 | //clear(); | 536 | //clear(); |
532 | 537 | ||
533 | #ifdef DESKTOP_VERSION | 538 | #ifdef DESKTOP_VERSION |
534 | QToolTip::remove(this); | 539 | QToolTip::remove(this); |
535 | #endif | 540 | #endif |
536 | mToolTip.clear(); | 541 | mToolTip.clear(); |
537 | //qApp->processEvents(); | 542 | //qApp->processEvents(); |
538 | #if 0 | 543 | #if 0 |
539 | if ( !mHolidayString.isEmpty() ) { | 544 | if ( !mHolidayString.isEmpty() ) { |
540 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 545 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
541 | item->setPalette( mHolidayPalette ); | 546 | item->setPalette( mHolidayPalette ); |
542 | insertItem( item ); | 547 | insertItem( item ); |
543 | mToolTip.append ( mHolidayString ); | 548 | mToolTip.append ( mHolidayString ); |
544 | } | 549 | } |
545 | #endif | 550 | #endif |
546 | } | 551 | } |
547 | 552 | ||
548 | void MonthViewCell::insertEvent(Event *event) | 553 | void MonthViewCell::insertEvent(Event *event) |
549 | { | 554 | { |
550 | QString mToolTipText; | 555 | QString mToolTipText; |
551 | bool insertNewItem = false; | 556 | bool insertNewItem = false; |
552 | setFocusPolicy(WheelFocus); | 557 | setFocusPolicy(WheelFocus); |
553 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 558 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
554 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 559 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
555 | return; | 560 | return; |
556 | else | 561 | else |
557 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 562 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
558 | return; | 563 | return; |
559 | } | 564 | } |
560 | 565 | ||
561 | if ( event->isHoliday()) { | 566 | if ( event->isHoliday()) { |
562 | setHoliday( true ); | 567 | setHoliday( true ); |
563 | if ( mDate.dayOfWeek() == 7 ) | 568 | if ( mDate.dayOfWeek() == 7 ) |
564 | setLineWidth( 3 ); | 569 | setLineWidth( 3 ); |
@@ -772,103 +777,103 @@ void MonthViewCell::updateCell() | |||
772 | } | 777 | } |
773 | // insert due todos | 778 | // insert due todos |
774 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 779 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
775 | Todo *todo; | 780 | Todo *todo; |
776 | for(todo = todos.first(); todo; todo = todos.next()) { | 781 | for(todo = todos.first(); todo; todo = todos.next()) { |
777 | insertTodo( todo ); | 782 | insertTodo( todo ); |
778 | } | 783 | } |
779 | finishUpdateCell(); | 784 | finishUpdateCell(); |
780 | // if ( isVisible()) | 785 | // if ( isVisible()) |
781 | //qApp->processEvents(); | 786 | //qApp->processEvents(); |
782 | } | 787 | } |
783 | 788 | ||
784 | void MonthViewCell::updateConfig( bool bigFont ) // = false | 789 | void MonthViewCell::updateConfig( bool bigFont ) // = false |
785 | { | 790 | { |
786 | 791 | ||
787 | if ( bigFont ) { | 792 | if ( bigFont ) { |
788 | QFont fo = KOPrefs::instance()->mMonthViewFont; | 793 | QFont fo = KOPrefs::instance()->mMonthViewFont; |
789 | int ps = fo.pointSize() + 2; | 794 | int ps = fo.pointSize() + 2; |
790 | if ( ps < 18 ) | 795 | if ( ps < 18 ) |
791 | ps += 2; | 796 | ps += 2; |
792 | fo.setPointSize( ps ); | 797 | fo.setPointSize( ps ); |
793 | setFont( fo ); | 798 | setFont( fo ); |
794 | } else | 799 | } else |
795 | setFont( KOPrefs::instance()->mMonthViewFont ); | 800 | setFont( KOPrefs::instance()->mMonthViewFont ); |
796 | 801 | ||
797 | QFontMetrics fm( font() ); | 802 | QFontMetrics fm( font() ); |
798 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 803 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
799 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 804 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
800 | mHolidayPalette = mStandardPalette; | 805 | mHolidayPalette = mStandardPalette; |
801 | mPrimaryPalette = mStandardPalette; | 806 | mPrimaryPalette = mStandardPalette; |
802 | mNonPrimaryPalette = mStandardPalette; | 807 | mNonPrimaryPalette = mStandardPalette; |
803 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 808 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
804 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 809 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
805 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 810 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
806 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 811 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
807 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 812 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
808 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 813 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
809 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 814 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
810 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 815 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
811 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 816 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
812 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 817 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
813 | } | 818 | } |
814 | //updateCell(); | 819 | //updateCell(); |
815 | } | 820 | } |
816 | 821 | ||
817 | void MonthViewCell::enableScrollBars( bool enabled ) | 822 | void MonthViewCell::enableScrollBars( bool enabled ) |
818 | { | 823 | { |
819 | if ( enabled ) { | 824 | if ( enabled ) { |
820 | |||
821 | QListBoxItem *fi = firstItem (); | 825 | QListBoxItem *fi = firstItem (); |
822 | if (fi ) { | 826 | if (fi ) { |
823 | int ihei = fi->height( this ); | 827 | int ihei = fi->height( this ); |
824 | int hei = numRows () * ihei; | 828 | int hei = numRows () * ihei; |
825 | if ( hei < height() - horizontalScrollBar()->height () ) | 829 | if ( hei < height() - horizontalScrollBar()->height () ) { |
826 | setVScrollBarMode(QScrollView::AlwaysOff); | 830 | setVScrollBarMode(QScrollView::AlwaysOff); |
831 | } | ||
827 | else | 832 | else |
828 | setVScrollBarMode(QScrollView::Auto); | 833 | setVScrollBarMode(QScrollView::Auto); |
829 | if ( ihei *3 > height() ) | 834 | if ( ihei *3 > height() ) |
830 | setHScrollBarMode(QScrollView::AlwaysOff); | 835 | setHScrollBarMode(QScrollView::AlwaysOff); |
831 | else | 836 | else |
832 | setHScrollBarMode(QScrollView::Auto); | 837 | setHScrollBarMode(QScrollView::Auto); |
833 | } else { | 838 | } else { |
834 | setVScrollBarMode(QScrollView::Auto); | 839 | setVScrollBarMode(QScrollView::Auto); |
835 | setHScrollBarMode(QScrollView::Auto); | 840 | setHScrollBarMode(QScrollView::Auto); |
836 | } | 841 | } |
837 | } else { | 842 | } else { |
838 | setVScrollBarMode(QScrollView::AlwaysOff); | 843 | setVScrollBarMode(QScrollView::AlwaysOff); |
839 | setHScrollBarMode(QScrollView::AlwaysOff); | 844 | setHScrollBarMode(QScrollView::AlwaysOff); |
840 | } | 845 | } |
841 | } | 846 | } |
842 | 847 | ||
843 | Incidence *MonthViewCell::selectedIncidence() | 848 | Incidence *MonthViewCell::selectedIncidence() |
844 | { | 849 | { |
845 | int index = currentItem(); | 850 | int index = currentItem(); |
846 | if ( index < 0 ) return 0; | 851 | if ( index < 0 ) return 0; |
847 | 852 | ||
848 | MonthViewItem *mitem = | 853 | MonthViewItem *mitem = |
849 | static_cast<MonthViewItem *>( item( index ) ); | 854 | static_cast<MonthViewItem *>( item( index ) ); |
850 | 855 | ||
851 | if ( !mitem ) return 0; | 856 | if ( !mitem ) return 0; |
852 | 857 | ||
853 | return mitem->incidence(); | 858 | return mitem->incidence(); |
854 | } | 859 | } |
855 | 860 | ||
856 | QDate MonthViewCell::selectedIncidenceDate() | 861 | QDate MonthViewCell::selectedIncidenceDate() |
857 | { | 862 | { |
858 | QDate qd; | 863 | QDate qd; |
859 | int index = currentItem(); | 864 | int index = currentItem(); |
860 | if ( index < 0 ) return qd; | 865 | if ( index < 0 ) return qd; |
861 | 866 | ||
862 | MonthViewItem *mitem = | 867 | MonthViewItem *mitem = |
863 | static_cast<MonthViewItem *>( item( index ) ); | 868 | static_cast<MonthViewItem *>( item( index ) ); |
864 | 869 | ||
865 | if ( !mitem ) return qd; | 870 | if ( !mitem ) return qd; |
866 | 871 | ||
867 | return mitem->incidenceDate(); | 872 | return mitem->incidenceDate(); |
868 | } | 873 | } |
869 | 874 | ||
870 | void MonthViewCell::deselect() | 875 | void MonthViewCell::deselect() |
871 | { | 876 | { |
872 | clearSelection(); | 877 | clearSelection(); |
873 | enableScrollBars( false ); | 878 | enableScrollBars( false ); |
874 | // updateCell(); | 879 | // updateCell(); |