-rw-r--r-- | korganizer/komonthview.cpp | 94 | ||||
-rw-r--r-- | korganizer/komonthview.h | 3 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 4 |
3 files changed, 44 insertions, 57 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index ffb2e1e..70cbf96 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -526,1063 +526,1051 @@ void MonthViewCell::insertEvent(Event *event) | |||
526 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 526 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
527 | } else { | 527 | } else { |
528 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 528 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
529 | } | 529 | } |
530 | } | 530 | } |
531 | 531 | ||
532 | } else { | 532 | } else { |
533 | pal = mStandardPalette ; | 533 | pal = mStandardPalette ; |
534 | } | 534 | } |
535 | item->setPalette( pal ); | 535 | item->setPalette( pal ); |
536 | item->setRecur( event->recurrence()->doesRecur() ); | 536 | item->setRecur( event->recurrence()->doesRecur() ); |
537 | item->setAlarm( event->isAlarmEnabled() ); | 537 | item->setAlarm( event->isAlarmEnabled() ); |
538 | item->setMoreInfo( event->description().length() > 0 ); | 538 | item->setMoreInfo( event->description().length() > 0 ); |
539 | #ifdef DESKTOP_VERSION | 539 | #ifdef DESKTOP_VERSION |
540 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 540 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
541 | KOPrefs::instance()->email()); | 541 | KOPrefs::instance()->email()); |
542 | if ( me != 0 ) { | 542 | if ( me != 0 ) { |
543 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 543 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
544 | item->setReply(true); | 544 | item->setReply(true); |
545 | else | 545 | else |
546 | item->setReply(false); | 546 | item->setReply(false); |
547 | } else | 547 | } else |
548 | item->setReply(false); | 548 | item->setReply(false); |
549 | #endif | 549 | #endif |
550 | mItemList->insertItem( item ); | 550 | mItemList->insertItem( item ); |
551 | mToolTip += "\n"; | 551 | mToolTip += "\n"; |
552 | } | 552 | } |
553 | void MonthViewCell::insertTodo(Todo *todo) | 553 | void MonthViewCell::insertTodo(Todo *todo) |
554 | { | 554 | { |
555 | QString text; | 555 | QString text; |
556 | mItemList->setFocusPolicy(WheelFocus); | 556 | mItemList->setFocusPolicy(WheelFocus); |
557 | if (todo->hasDueDate()) { | 557 | if (todo->hasDueDate()) { |
558 | if (!todo->doesFloat()) { | 558 | if (!todo->doesFloat()) { |
559 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 559 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
560 | text += " "; | 560 | text += " "; |
561 | } | 561 | } |
562 | } | 562 | } |
563 | text += i18n("T: %1").arg(todo->summary()); | 563 | text += i18n("T: %1").arg(todo->summary()); |
564 | 564 | ||
565 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 565 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
566 | //item->setPalette( mStandardPalette ); | 566 | //item->setPalette( mStandardPalette ); |
567 | QPalette pal; | 567 | QPalette pal; |
568 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 568 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
569 | QStringList categories = todo->categories(); | 569 | QStringList categories = todo->categories(); |
570 | QString cat = categories.first(); | 570 | QString cat = categories.first(); |
571 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 571 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
572 | pal = getPalette(); | 572 | pal = getPalette(); |
573 | if (cat.isEmpty()) { | 573 | if (cat.isEmpty()) { |
574 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 574 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
575 | } else { | 575 | } else { |
576 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 576 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
577 | } | 577 | } |
578 | 578 | ||
579 | } else { | 579 | } else { |
580 | if (cat.isEmpty()) { | 580 | if (cat.isEmpty()) { |
581 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 581 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
582 | } else { | 582 | } else { |
583 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 583 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
584 | } | 584 | } |
585 | } | 585 | } |
586 | 586 | ||
587 | } else { | 587 | } else { |
588 | pal = mStandardPalette ; | 588 | pal = mStandardPalette ; |
589 | } | 589 | } |
590 | item->setPalette( pal ); | 590 | item->setPalette( pal ); |
591 | mItemList->insertItem( item ); | 591 | mItemList->insertItem( item ); |
592 | mToolTip += text+"\n"; | 592 | mToolTip += text+"\n"; |
593 | } | 593 | } |
594 | void MonthViewCell::finishUpdateCell() | 594 | void MonthViewCell::finishUpdateCell() |
595 | { | 595 | { |
596 | #ifdef DESKTOP_VERSION | 596 | #ifdef DESKTOP_VERSION |
597 | if (mToolTip != "") | 597 | if (mToolTip != "") |
598 | QToolTip::add(this,mToolTip,toolTipGroup(),""); | 598 | QToolTip::add(this,mToolTip,toolTipGroup(),""); |
599 | #endif | 599 | #endif |
600 | mItemList->sort(); | 600 | mItemList->sort(); |
601 | //setMyPalette(); | 601 | //setMyPalette(); |
602 | setMyPalette(); | 602 | setMyPalette(); |
603 | QString text; | 603 | QString text; |
604 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 604 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
605 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 605 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
606 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 606 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
607 | mLabel->resize( mLabelBigSize ); | 607 | mLabel->resize( mLabelBigSize ); |
608 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 608 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
609 | } else { | 609 | } else { |
610 | mLabel->resize( mLabelSize ); | 610 | mLabel->resize( mLabelSize ); |
611 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 611 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
612 | } | 612 | } |
613 | 613 | ||
614 | mLabel->setText( text ); | 614 | mLabel->setText( text ); |
615 | resizeEvent( 0 ); | 615 | resizeEvent( 0 ); |
616 | } | 616 | } |
617 | void MonthViewCell::updateCell() | 617 | void MonthViewCell::updateCell() |
618 | { | 618 | { |
619 | if ( !mMonthView->isUpdatePossible() ) | 619 | if ( !mMonthView->isUpdatePossible() ) |
620 | return; | 620 | return; |
621 | startUpdateCell(); | 621 | startUpdateCell(); |
622 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 622 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
623 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 623 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
624 | Event *event; | 624 | Event *event; |
625 | for( event = events.first(); event; event = events.next() ) { // for event | 625 | for( event = events.first(); event; event = events.next() ) { // for event |
626 | insertEvent(event); | 626 | insertEvent(event); |
627 | } | 627 | } |
628 | // insert due todos | 628 | // insert due todos |
629 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 629 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
630 | Todo *todo; | 630 | Todo *todo; |
631 | for(todo = todos.first(); todo; todo = todos.next()) { | 631 | for(todo = todos.first(); todo; todo = todos.next()) { |
632 | insertTodo( todo ); | 632 | insertTodo( todo ); |
633 | } | 633 | } |
634 | finishUpdateCell(); | 634 | finishUpdateCell(); |
635 | // if ( isVisible()) | 635 | // if ( isVisible()) |
636 | //qApp->processEvents(); | 636 | //qApp->processEvents(); |
637 | } | 637 | } |
638 | 638 | ||
639 | void MonthViewCell::updateConfig( bool bigFont ) // = false | 639 | void MonthViewCell::updateConfig( bool bigFont ) // = false |
640 | { | 640 | { |
641 | 641 | ||
642 | if ( bigFont ) { | 642 | if ( bigFont ) { |
643 | QFont fo = KOPrefs::instance()->mMonthViewFont; | 643 | QFont fo = KOPrefs::instance()->mMonthViewFont; |
644 | int ps = fo.pointSize() + 2; | 644 | int ps = fo.pointSize() + 2; |
645 | if ( ps < 18 ) | 645 | if ( ps < 18 ) |
646 | ps += 2; | 646 | ps += 2; |
647 | fo.setPointSize( ps ); | 647 | fo.setPointSize( ps ); |
648 | setFont( fo ); | 648 | setFont( fo ); |
649 | } else | 649 | } else |
650 | setFont( KOPrefs::instance()->mMonthViewFont ); | 650 | setFont( KOPrefs::instance()->mMonthViewFont ); |
651 | 651 | ||
652 | QFontMetrics fm( font() ); | 652 | QFontMetrics fm( font() ); |
653 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 653 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
654 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 654 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
655 | mHolidayPalette = mStandardPalette; | 655 | mHolidayPalette = mStandardPalette; |
656 | mPrimaryPalette = mStandardPalette; | 656 | mPrimaryPalette = mStandardPalette; |
657 | mNonPrimaryPalette = mStandardPalette; | 657 | mNonPrimaryPalette = mStandardPalette; |
658 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 658 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
659 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 659 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
660 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 660 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
661 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 661 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
662 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 662 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
663 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 663 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
664 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 664 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
665 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 665 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
666 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 666 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
667 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 667 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
668 | } | 668 | } |
669 | //updateCell(); | 669 | //updateCell(); |
670 | } | 670 | } |
671 | 671 | ||
672 | void MonthViewCell::enableScrollBars( bool enabled ) | 672 | void MonthViewCell::enableScrollBars( bool enabled ) |
673 | { | 673 | { |
674 | if ( enabled ) { | 674 | if ( enabled ) { |
675 | mItemList->setVScrollBarMode(QScrollView::Auto); | 675 | mItemList->setVScrollBarMode(QScrollView::Auto); |
676 | mItemList->setHScrollBarMode(QScrollView::Auto); | 676 | mItemList->setHScrollBarMode(QScrollView::Auto); |
677 | } else { | 677 | } else { |
678 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); | 678 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); |
679 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); | 679 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); |
680 | } | 680 | } |
681 | } | 681 | } |
682 | 682 | ||
683 | Incidence *MonthViewCell::selectedIncidence() | 683 | Incidence *MonthViewCell::selectedIncidence() |
684 | { | 684 | { |
685 | int index = mItemList->currentItem(); | 685 | int index = mItemList->currentItem(); |
686 | if ( index < 0 ) return 0; | 686 | if ( index < 0 ) return 0; |
687 | 687 | ||
688 | MonthViewItem *item = | 688 | MonthViewItem *item = |
689 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 689 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
690 | 690 | ||
691 | if ( !item ) return 0; | 691 | if ( !item ) return 0; |
692 | 692 | ||
693 | return item->incidence(); | 693 | return item->incidence(); |
694 | } | 694 | } |
695 | 695 | ||
696 | QDate MonthViewCell::selectedIncidenceDate() | 696 | QDate MonthViewCell::selectedIncidenceDate() |
697 | { | 697 | { |
698 | QDate qd; | 698 | QDate qd; |
699 | int index = mItemList->currentItem(); | 699 | int index = mItemList->currentItem(); |
700 | if ( index < 0 ) return qd; | 700 | if ( index < 0 ) return qd; |
701 | 701 | ||
702 | MonthViewItem *item = | 702 | MonthViewItem *item = |
703 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 703 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
704 | 704 | ||
705 | if ( !item ) return qd; | 705 | if ( !item ) return qd; |
706 | 706 | ||
707 | return item->incidenceDate(); | 707 | return item->incidenceDate(); |
708 | } | 708 | } |
709 | 709 | ||
710 | void MonthViewCell::deselect() | 710 | void MonthViewCell::deselect() |
711 | { | 711 | { |
712 | mItemList->clearSelection(); | 712 | mItemList->clearSelection(); |
713 | enableScrollBars( false ); | 713 | enableScrollBars( false ); |
714 | // updateCell(); | 714 | // updateCell(); |
715 | } | 715 | } |
716 | void MonthViewCell::select() | 716 | void MonthViewCell::select() |
717 | { | 717 | { |
718 | ;// updateCell(); | 718 | ;// updateCell(); |
719 | } | 719 | } |
720 | 720 | ||
721 | void MonthViewCell::resizeEvent ( QResizeEvent * ) | 721 | void MonthViewCell::resizeEvent ( QResizeEvent * ) |
722 | { | 722 | { |
723 | if ( !mMonthView->isUpdatePossible() ) | 723 | if ( !mMonthView->isUpdatePossible() ) |
724 | return; | 724 | return; |
725 | 725 | ||
726 | int size = height() - mLabel->height() - 2; | 726 | int size = height() - mLabel->height() - 2; |
727 | if ( size > 0 ) | 727 | if ( size > 0 ) |
728 | mItemList->verticalScrollBar()->setMaximumHeight( size ); | 728 | mItemList->verticalScrollBar()->setMaximumHeight( size ); |
729 | size = width() - mLabel->width() -2; | 729 | size = width() - mLabel->width() -2; |
730 | if ( size > 0 ) | 730 | if ( size > 0 ) |
731 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); | 731 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); |
732 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); | 732 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); |
733 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 733 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
734 | } | 734 | } |
735 | 735 | ||
736 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 736 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
737 | { | 737 | { |
738 | if ( !item ) return; | 738 | if ( !item ) return; |
739 | 739 | ||
740 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 740 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
741 | Incidence *incidence = eventItem->incidence(); | 741 | Incidence *incidence = eventItem->incidence(); |
742 | if ( incidence ) mMonthView->defaultAction( incidence ); | 742 | if ( incidence ) mMonthView->defaultAction( incidence ); |
743 | } | 743 | } |
744 | void MonthViewCell::showDay() | 744 | void MonthViewCell::showDay() |
745 | { | 745 | { |
746 | emit showDaySignal( date() ); | 746 | emit showDaySignal( date() ); |
747 | } | 747 | } |
748 | void MonthViewCell::newEvent() | 748 | void MonthViewCell::newEvent() |
749 | { | 749 | { |
750 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 750 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
751 | emit newEventSignal( dt ); | 751 | emit newEventSignal( dt ); |
752 | } | 752 | } |
753 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 753 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
754 | { | 754 | { |
755 | static QListBoxItem * lastClicked = 0; | 755 | static QListBoxItem * lastClicked = 0; |
756 | if ( item == 0 ) { | 756 | if ( item == 0 ) { |
757 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 757 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
758 | emit newEventSignal( dt ); | 758 | emit newEventSignal( dt ); |
759 | return; | 759 | return; |
760 | } | 760 | } |
761 | /* | 761 | /* |
762 | if ( lastClicked ) | 762 | if ( lastClicked ) |
763 | if ( ! item ) { | 763 | if ( ! item ) { |
764 | if ( lastClicked->listBox() != item->listBox() ) | 764 | if ( lastClicked->listBox() != item->listBox() ) |
765 | lastClicked->listBox()->clearSelection(); | 765 | lastClicked->listBox()->clearSelection(); |
766 | } | 766 | } |
767 | */ | 767 | */ |
768 | 768 | ||
769 | mMonthView->setSelectedCell( this ); | 769 | mMonthView->setSelectedCell( this ); |
770 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); | 770 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); |
771 | select(); | 771 | select(); |
772 | } | 772 | } |
773 | 773 | ||
774 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 774 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
775 | { | 775 | { |
776 | if ( !item ) return; | 776 | if ( !item ) return; |
777 | 777 | ||
778 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 778 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
779 | Incidence *incidence = eventItem->incidence(); | 779 | Incidence *incidence = eventItem->incidence(); |
780 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 780 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
781 | } | 781 | } |
782 | 782 | ||
783 | void MonthViewCell::selection( QListBoxItem *item ) | 783 | void MonthViewCell::selection( QListBoxItem *item ) |
784 | { | 784 | { |
785 | if ( !item ) return; | 785 | if ( !item ) return; |
786 | mMonthView->setSelectedCell( this ); | 786 | mMonthView->setSelectedCell( this ); |
787 | } | 787 | } |
788 | 788 | ||
789 | 789 | ||
790 | // ******************************************************************************* | 790 | // ******************************************************************************* |
791 | // ******************************************************************************* | 791 | // ******************************************************************************* |
792 | // ******************************************************************************* | 792 | // ******************************************************************************* |
793 | 793 | ||
794 | 794 | ||
795 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 795 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
796 | : KOEventView( calendar, parent, name ), | 796 | : KOEventView( calendar, parent, name ), |
797 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 797 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
798 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 798 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
799 | { | 799 | { |
800 | ignoreResizeEvent = 0; | 800 | ignoreResizeEvent = 0; |
801 | mShortDayLabelsW = false; | 801 | mShortDayLabelsW = false; |
802 | mShortDayLabelsM = false; | 802 | mShortDayLabelsM = false; |
803 | clPending = true; | 803 | clPending = true; |
804 | mWidStack = new QWidgetStack( this ); | 804 | mWidStack = new QWidgetStack( this ); |
805 | QHBoxLayout* hb = new QHBoxLayout( this ); | 805 | QHBoxLayout* hb = new QHBoxLayout( this ); |
806 | mMonthView = new QWidget( mWidStack ); | 806 | mMonthView = new QWidget( mWidStack ); |
807 | mWeekView = new QWidget( mWidStack ); | 807 | mWeekView = new QWidget( mWidStack ); |
808 | #if QT_VERSION >= 0x030000 | 808 | #if QT_VERSION >= 0x030000 |
809 | mWidStack->addWidget(mMonthView ); | 809 | mWidStack->addWidget(mMonthView ); |
810 | mWidStack->addWidget(mWeekView ); | 810 | mWidStack->addWidget(mWeekView ); |
811 | #else | 811 | #else |
812 | mWidStack->addWidget( mMonthView, 1 ); | 812 | mWidStack->addWidget( mMonthView, 1 ); |
813 | mWidStack->addWidget( mWeekView , 1 ); | 813 | mWidStack->addWidget( mWeekView , 1 ); |
814 | #endif | 814 | #endif |
815 | hb->addWidget( mWidStack ); | 815 | hb->addWidget( mWidStack ); |
816 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 816 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
817 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | 817 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; |
818 | if ( mShowWeekView ) | 818 | if ( mShowWeekView ) |
819 | mWeekStartsMonday = true; | 819 | mWeekStartsMonday = true; |
820 | updatePossible = false; | 820 | updatePossible = false; |
821 | mCells.setAutoDelete( true ); | 821 | mCells.setAutoDelete( true ); |
822 | mDayLabels.resize( mDaysPerWeek ); | 822 | mDayLabels.resize( mDaysPerWeek ); |
823 | mDayLabelsW.resize( mDaysPerWeek ); | 823 | mDayLabelsW.resize( mDaysPerWeek ); |
824 | QFont bfont = font(); | 824 | QFont bfont = font(); |
825 | if ( QApplication::desktop()->width() < 650 ) { | 825 | if ( QApplication::desktop()->width() < 650 ) { |
826 | bfont.setPointSize( bfont.pointSize() - 2 ); | 826 | bfont.setPointSize( bfont.pointSize() - 2 ); |
827 | } | 827 | } |
828 | bfont.setBold( true ); | 828 | bfont.setBold( true ); |
829 | int i; | 829 | int i; |
830 | 830 | ||
831 | for( i = 0; i < mDaysPerWeek; i++ ) { | 831 | for( i = 0; i < mDaysPerWeek; i++ ) { |
832 | QLabel *label = new QLabel( mMonthView ); | 832 | QLabel *label = new QLabel( mMonthView ); |
833 | label->setFont(bfont); | 833 | label->setFont(bfont); |
834 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 834 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
835 | label->setLineWidth(1); | 835 | label->setLineWidth(1); |
836 | label->setAlignment(AlignCenter); | 836 | label->setAlignment(AlignCenter); |
837 | mDayLabels.insert( i, label ); | 837 | mDayLabels.insert( i, label ); |
838 | label = new QLabel( mWeekView ); | 838 | label = new QLabel( mWeekView ); |
839 | label->setFont(bfont); | 839 | label->setFont(bfont); |
840 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 840 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
841 | label->setLineWidth(1); | 841 | label->setLineWidth(1); |
842 | label->setAlignment(AlignCenter); | 842 | label->setAlignment(AlignCenter); |
843 | mDayLabelsW.insert( i, label ); | 843 | mDayLabelsW.insert( i, label ); |
844 | } | 844 | } |
845 | 845 | ||
846 | bfont.setBold( false ); | 846 | bfont.setBold( false ); |
847 | mWeekLabels.resize( mNumWeeks+1 ); | 847 | mWeekLabels.resize( mNumWeeks+1 ); |
848 | mWeekLabelsW.resize( 2 ); | 848 | mWeekLabelsW.resize( 2 ); |
849 | for( i = 0; i < mNumWeeks+1; i++ ) { | 849 | for( i = 0; i < mNumWeeks+1; i++ ) { |
850 | KOWeekButton *label = new KOWeekButton( mMonthView ); | 850 | KOWeekButton *label = new KOWeekButton( mMonthView ); |
851 | label->setFocusPolicy(NoFocus); | 851 | label->setFocusPolicy(NoFocus); |
852 | label->setFont(bfont); | 852 | label->setFont(bfont); |
853 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 853 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
854 | label->setFlat(true); | 854 | label->setFlat(true); |
855 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 855 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
856 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 856 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
857 | //label->setLineWidth(1); | 857 | //label->setLineWidth(1); |
858 | //label->setAlignment(AlignCenter); | 858 | //label->setAlignment(AlignCenter); |
859 | mWeekLabels.insert( i, label ); | 859 | mWeekLabels.insert( i, label ); |
860 | } | 860 | } |
861 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 861 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
862 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); | 862 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); |
863 | 863 | ||
864 | for( i = 0; i < 1+1; i++ ) { | 864 | for( i = 0; i < 1+1; i++ ) { |
865 | KOWeekButton *label = new KOWeekButton( mWeekView ); | 865 | KOWeekButton *label = new KOWeekButton( mWeekView ); |
866 | label->setFocusPolicy(NoFocus); | 866 | label->setFocusPolicy(NoFocus); |
867 | label->setFont(bfont); | 867 | label->setFont(bfont); |
868 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 868 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
869 | label->setFlat(true); | 869 | label->setFlat(true); |
870 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 870 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
871 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 871 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
872 | //label->setLineWidth(1); | 872 | //label->setLineWidth(1); |
873 | //label->setAlignment(AlignCenter); | 873 | //label->setAlignment(AlignCenter); |
874 | mWeekLabelsW.insert( i, label ); | 874 | mWeekLabelsW.insert( i, label ); |
875 | } | 875 | } |
876 | mWeekLabelsW[1]->setText( i18n("W")); | 876 | mWeekLabelsW[1]->setText( i18n("W")); |
877 | 877 | ||
878 | 878 | ||
879 | int row, col; | 879 | int row, col; |
880 | mCells.resize( mNumCells ); | 880 | mCells.resize( mNumCells ); |
881 | for( row = 0; row < mNumWeeks; ++row ) { | 881 | for( row = 0; row < mNumWeeks; ++row ) { |
882 | for( col = 0; col < mDaysPerWeek; ++col ) { | 882 | for( col = 0; col < mDaysPerWeek; ++col ) { |
883 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); | 883 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); |
884 | mCells.insert( row * mDaysPerWeek + col, cell ); | 884 | mCells.insert( row * mDaysPerWeek + col, cell ); |
885 | 885 | ||
886 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 886 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
887 | SLOT( defaultAction( Incidence * ) ) ); | 887 | SLOT( defaultAction( Incidence * ) ) ); |
888 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 888 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
889 | SIGNAL( newEventSignal( QDateTime ) ) ); | 889 | SIGNAL( newEventSignal( QDateTime ) ) ); |
890 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 890 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
891 | SIGNAL( showDaySignal( QDate ) ) ); | 891 | SIGNAL( showDaySignal( QDate ) ) ); |
892 | } | 892 | } |
893 | } | 893 | } |
894 | mCellsW.resize( mDaysPerWeek ); | 894 | mCellsW.resize( mDaysPerWeek ); |
895 | for( col = 0; col < mDaysPerWeek; ++col ) { | 895 | for( col = 0; col < mDaysPerWeek; ++col ) { |
896 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); | 896 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); |
897 | mCellsW.insert( col, cell ); | 897 | mCellsW.insert( col, cell ); |
898 | 898 | ||
899 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 899 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
900 | SLOT( defaultAction( Incidence * ) ) ); | 900 | SLOT( defaultAction( Incidence * ) ) ); |
901 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 901 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
902 | SIGNAL( newEventSignal( QDateTime ) ) ); | 902 | SIGNAL( newEventSignal( QDateTime ) ) ); |
903 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 903 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
904 | SIGNAL( showDaySignal( QDate ) ) ); | 904 | SIGNAL( showDaySignal( QDate ) ) ); |
905 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); | 905 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); |
906 | } | 906 | } |
907 | 907 | ||
908 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 908 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
909 | mContextMenu = eventPopup(); | 909 | mContextMenu = eventPopup(); |
910 | updateConfig(); //useless here | 910 | //updateConfig(); //useless here ... |
911 | // ... but we need mWidthLongDayLabel computed | ||
912 | QFontMetrics fontmetric(mDayLabels[0]->font()); | ||
913 | mWidthLongDayLabel = 0; | ||
914 | for (int i = 0; i < 7; i++) { | ||
915 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | ||
916 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | ||
917 | } | ||
911 | 918 | ||
912 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 919 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
913 | 920 | ||
914 | if ( mShowWeekView ) | 921 | if ( mShowWeekView ) |
915 | mWidStack->raiseWidget( mWeekView ); | 922 | mWidStack->raiseWidget( mWeekView ); |
916 | else | 923 | else |
917 | mWidStack->raiseWidget( mMonthView ); | 924 | mWidStack->raiseWidget( mMonthView ); |
918 | 925 | ||
919 | emit incidenceSelected( 0 ); | 926 | emit incidenceSelected( 0 ); |
920 | } | 927 | } |
921 | 928 | ||
922 | KOMonthView::~KOMonthView() | 929 | KOMonthView::~KOMonthView() |
923 | { | 930 | { |
924 | delete mContextMenu; | 931 | delete mContextMenu; |
925 | } | 932 | } |
926 | 933 | ||
927 | void KOMonthView::selectInternalWeekNum ( int n ) | 934 | void KOMonthView::selectInternalWeekNum ( int n ) |
928 | { | 935 | { |
929 | switchView(); | 936 | switchView(); |
930 | emit selectWeekNum ( n ); | 937 | emit selectWeekNum ( n ); |
931 | } | 938 | } |
932 | 939 | ||
933 | int KOMonthView::currentWeek() | 940 | int KOMonthView::currentWeek() |
934 | { | 941 | { |
935 | if ( mShowWeekView ) | 942 | if ( mShowWeekView ) |
936 | return mWeekLabelsW[0]->getWeekNum(); | 943 | return mWeekLabelsW[0]->getWeekNum(); |
937 | return mWeekLabels[0]->getWeekNum(); | 944 | return mWeekLabels[0]->getWeekNum(); |
938 | } | 945 | } |
939 | void KOMonthView::switchView() | 946 | void KOMonthView::switchView() |
940 | { | 947 | { |
941 | 948 | ||
942 | if ( selectedCell( ) ) | 949 | if ( selectedCell( ) ) |
943 | selectedCell()->deselect(); | 950 | selectedCell()->deselect(); |
944 | mShowWeekView = !mShowWeekView; | 951 | mShowWeekView = !mShowWeekView; |
945 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 952 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
946 | //emit showNavigator( !mShowWeekView ); | 953 | //emit showNavigator( !mShowWeekView ); |
947 | if ( clPending ) { | 954 | if ( clPending ) { |
948 | computeLayout(); | 955 | computeLayout(); |
949 | updateConfig(); | 956 | updateConfig(); |
950 | } | 957 | } |
951 | if ( mShowWeekView ) | 958 | if ( mShowWeekView ) |
952 | mWidStack->raiseWidget( mWeekView ); | 959 | mWidStack->raiseWidget( mWeekView ); |
953 | else | 960 | else |
954 | mWidStack->raiseWidget( mMonthView ); | 961 | mWidStack->raiseWidget( mMonthView ); |
955 | clPending = false; | 962 | clPending = false; |
956 | } | 963 | } |
957 | 964 | ||
958 | int KOMonthView::maxDatesHint() | 965 | int KOMonthView::maxDatesHint() |
959 | { | 966 | { |
960 | return mNumCells; | 967 | return mNumCells; |
961 | } | 968 | } |
962 | 969 | ||
963 | int KOMonthView::currentDateCount() | 970 | int KOMonthView::currentDateCount() |
964 | { | 971 | { |
965 | return mNumCells; | 972 | return mNumCells; |
966 | } | 973 | } |
967 | 974 | ||
968 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 975 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
969 | { | 976 | { |
970 | QPtrList<Incidence> selected; | 977 | QPtrList<Incidence> selected; |
971 | 978 | ||
972 | if ( mSelectedCell ) { | 979 | if ( mSelectedCell ) { |
973 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 980 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
974 | if ( incidence ) selected.append( incidence ); | 981 | if ( incidence ) selected.append( incidence ); |
975 | } | 982 | } |
976 | 983 | ||
977 | return selected; | 984 | return selected; |
978 | } | 985 | } |
979 | 986 | ||
980 | DateList KOMonthView::selectedDates() | 987 | DateList KOMonthView::selectedDates() |
981 | { | 988 | { |
982 | DateList selected; | 989 | DateList selected; |
983 | 990 | ||
984 | if ( mSelectedCell ) { | 991 | if ( mSelectedCell ) { |
985 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 992 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
986 | if ( qd.isValid() ) selected.append( qd ); | 993 | if ( qd.isValid() ) selected.append( qd ); |
987 | } | 994 | } |
988 | 995 | ||
989 | return selected; | 996 | return selected; |
990 | } | 997 | } |
991 | 998 | ||
992 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 999 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
993 | const QDate &td) | 1000 | const QDate &td) |
994 | { | 1001 | { |
995 | #ifndef KORG_NOPRINTER | 1002 | #ifndef KORG_NOPRINTER |
996 | calPrinter->preview(CalPrinter::Month, fd, td); | 1003 | calPrinter->preview(CalPrinter::Month, fd, td); |
997 | #endif | 1004 | #endif |
998 | } | 1005 | } |
999 | 1006 | ||
1000 | void KOMonthView::updateConfig() | 1007 | void KOMonthView::updateConfig() |
1001 | { | 1008 | { |
1002 | 1009 | ||
1003 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 1010 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1004 | 1011 | ||
1005 | if ( mShowWeekView ) { | 1012 | if ( mShowWeekView ) { |
1006 | mWeekStartsMonday = true; | 1013 | mWeekStartsMonday = true; |
1007 | } | 1014 | } |
1008 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1015 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1009 | mWidthLongDayLabel = 0; | 1016 | mWidthLongDayLabel = 0; |
1010 | qDebug("KOMonthView::updateConfig() "); | ||
1011 | for (int i = 0; i < 7; i++) { | 1017 | for (int i = 0; i < 7; i++) { |
1012 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 1018 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
1013 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 1019 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
1014 | } | 1020 | } |
1015 | if ( ! mShowWeekView ) { | 1021 | if ( ! mShowWeekView ) { |
1016 | computeLayout(); | 1022 | computeLayout(); |
1017 | } | 1023 | } |
1018 | updateDayLabels(); | 1024 | updateDayLabels(); |
1019 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 1025 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
1020 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 1026 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
1021 | //resizeEvent( 0 ); | 1027 | //resizeEvent( 0 ); |
1022 | for (uint i = 0; i < mCells.count(); ++i) { | 1028 | for (uint i = 0; i < mCells.count(); ++i) { |
1023 | mCells[i]->updateConfig(); | 1029 | mCells[i]->updateConfig(); |
1024 | } | 1030 | } |
1025 | 1031 | ||
1026 | for (uint i = 0; i < mCellsW.count(); ++i) { | 1032 | for (uint i = 0; i < mCellsW.count(); ++i) { |
1027 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); | 1033 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); |
1028 | } | 1034 | } |
1029 | #ifdef DESKTOP_VERSION | 1035 | #ifdef DESKTOP_VERSION |
1030 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 1036 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
1031 | #endif | 1037 | #endif |
1032 | updateView(); | 1038 | updateView(); |
1033 | } | 1039 | } |
1034 | 1040 | ||
1035 | void KOMonthView::updateDayLabels() | 1041 | void KOMonthView::updateDayLabels() |
1036 | { | 1042 | { |
1037 | 1043 | ||
1038 | QPtrVector<QLabel> *mDayLabelsT; | 1044 | QPtrVector<QLabel> *mDayLabelsT; |
1039 | #if 0 | 1045 | |
1040 | if (mShowWeekView ) | ||
1041 | mDayLabelsT = &mDayLabelsW; | ||
1042 | else | ||
1043 | mDayLabelsT = &mDayLabels; | ||
1044 | #endif | ||
1045 | qDebug("updateDayLabels W %d M %d ",mShortDayLabelsW ,mShortDayLabelsM); | ||
1046 | mDayLabelsT = &mDayLabelsW; | 1046 | mDayLabelsT = &mDayLabelsW; |
1047 | for (int i = 0; i < 7; i++) { | 1047 | for (int i = 0; i < 7; i++) { |
1048 | if (mWeekStartsMonday) { | 1048 | if (mWeekStartsMonday) { |
1049 | bool show = mShortDayLabelsW; | 1049 | bool show = mShortDayLabelsW; |
1050 | if ( i > 4 && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1050 | if ( i > 4 && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1051 | show = true; | 1051 | show = true; |
1052 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1052 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1053 | } else { | 1053 | } else { |
1054 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW)); | 1054 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW)); |
1055 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW)); | 1055 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW)); |
1056 | 1056 | ||
1057 | } | 1057 | } |
1058 | } | 1058 | } |
1059 | mDayLabelsT = &mDayLabels; | 1059 | mDayLabelsT = &mDayLabels; |
1060 | for (int i = 0; i < 7; i++) { | 1060 | for (int i = 0; i < 7; i++) { |
1061 | if (mWeekStartsMonday) { | 1061 | if (mWeekStartsMonday) { |
1062 | bool show = mShortDayLabelsM; | 1062 | bool show = mShortDayLabelsM; |
1063 | if ( i > 4 && KOPrefs::instance()->mMonthViewSatSunTog && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1063 | if ( i > 4 && KOPrefs::instance()->mMonthViewSatSunTog && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1064 | show = true; | 1064 | show = true; |
1065 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1065 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1066 | } else { | 1066 | } else { |
1067 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); | 1067 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); |
1068 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); | 1068 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); |
1069 | 1069 | ||
1070 | } | 1070 | } |
1071 | } | 1071 | } |
1072 | 1072 | ||
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | void KOMonthView::showDates(const QDate &start, const QDate &) | 1075 | void KOMonthView::showDates(const QDate &start, const QDate &) |
1076 | { | 1076 | { |
1077 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 1077 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
1078 | 1078 | ||
1079 | QPtrVector<MonthViewCell> *cells; | 1079 | QPtrVector<MonthViewCell> *cells; |
1080 | QPtrVector<QLabel> *dayLabels; | 1080 | QPtrVector<QLabel> *dayLabels; |
1081 | QPtrVector<KOWeekButton> *weekLabels; | 1081 | QPtrVector<KOWeekButton> *weekLabels; |
1082 | int weekNum = 6; | 1082 | int weekNum = 6; |
1083 | if ( mShowWeekView ) { | 1083 | if ( mShowWeekView ) { |
1084 | weekNum = 1; | 1084 | weekNum = 1; |
1085 | cells = &mCellsW; | 1085 | cells = &mCellsW; |
1086 | dayLabels = &mDayLabelsW; | 1086 | dayLabels = &mDayLabelsW; |
1087 | weekLabels = &mWeekLabelsW; | 1087 | weekLabels = &mWeekLabelsW; |
1088 | } else { | 1088 | } else { |
1089 | cells = &mCells; | 1089 | cells = &mCells; |
1090 | dayLabels = &mDayLabels; | 1090 | dayLabels = &mDayLabels; |
1091 | weekLabels = &mWeekLabels; | 1091 | weekLabels = &mWeekLabels; |
1092 | } | 1092 | } |
1093 | 1093 | ||
1094 | mStartDate = start; | 1094 | mStartDate = start; |
1095 | 1095 | ||
1096 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 1096 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
1097 | 1097 | ||
1098 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 1098 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
1099 | mStartDate = mStartDate.addDays( -1 ); | 1099 | mStartDate = mStartDate.addDays( -1 ); |
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | bool primary = false; | 1102 | bool primary = false; |
1103 | uint i; | 1103 | uint i; |
1104 | for( i = 0; i < (*cells).size(); ++i ) { | 1104 | for( i = 0; i < (*cells).size(); ++i ) { |
1105 | QDate date = mStartDate.addDays( i ); | 1105 | QDate date = mStartDate.addDays( i ); |
1106 | (*cells)[i]->setDate( date ); | 1106 | (*cells)[i]->setDate( date ); |
1107 | 1107 | ||
1108 | #ifndef KORG_NOPLUGINS | 1108 | #ifndef KORG_NOPLUGINS |
1109 | // add holiday, if present | 1109 | // add holiday, if present |
1110 | QString hstring(KOCore::self()->holiday(date)); | 1110 | QString hstring(KOCore::self()->holiday(date)); |
1111 | (*cells)[i]->setHoliday( hstring ); | 1111 | (*cells)[i]->setHoliday( hstring ); |
1112 | #endif | 1112 | #endif |
1113 | 1113 | ||
1114 | } | 1114 | } |
1115 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 1115 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
1116 | for( i = 0; i < weekNum; ++i ) { | 1116 | for( i = 0; i < weekNum; ++i ) { |
1117 | int wno; | 1117 | int wno; |
1118 | // remember, according to ISO 8601, the first week of the year is the | 1118 | // remember, according to ISO 8601, the first week of the year is the |
1119 | // first week that contains a thursday. Thus we must subtract off 4, | 1119 | // first week that contains a thursday. Thus we must subtract off 4, |
1120 | // not just 1. | 1120 | // not just 1. |
1121 | int dayOfYear = date.dayOfYear(); | 1121 | int dayOfYear = date.dayOfYear(); |
1122 | if (dayOfYear % 7 != 0) | 1122 | if (dayOfYear % 7 != 0) |
1123 | wno = dayOfYear / 7 + 1; | 1123 | wno = dayOfYear / 7 + 1; |
1124 | else | 1124 | else |
1125 | wno =dayOfYear / 7; | 1125 | wno =dayOfYear / 7; |
1126 | (*weekLabels)[i]->setWeekNum( wno ); | 1126 | (*weekLabels)[i]->setWeekNum( wno ); |
1127 | date = date.addDays( 7 ); | 1127 | date = date.addDays( 7 ); |
1128 | } | 1128 | } |
1129 | updateView(); | 1129 | updateView(); |
1130 | } | 1130 | } |
1131 | 1131 | ||
1132 | void KOMonthView::showEvents(QPtrList<Event>) | 1132 | void KOMonthView::showEvents(QPtrList<Event>) |
1133 | { | 1133 | { |
1134 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 1134 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
1135 | } | 1135 | } |
1136 | 1136 | ||
1137 | void KOMonthView::changeEventDisplay(Event *, int) | 1137 | void KOMonthView::changeEventDisplay(Event *, int) |
1138 | { | 1138 | { |
1139 | // this should be re-written to be much more efficient, but this | 1139 | // this should be re-written to be much more efficient, but this |
1140 | // quick-and-dirty-hack gets the job done for right now. | 1140 | // quick-and-dirty-hack gets the job done for right now. |
1141 | updateView(); | 1141 | updateView(); |
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | void KOMonthView::updateView() | 1144 | void KOMonthView::updateView() |
1145 | { | 1145 | { |
1146 | 1146 | ||
1147 | if ( !updatePossible ) | 1147 | if ( !updatePossible ) |
1148 | return; | 1148 | return; |
1149 | //QTime ti; | 1149 | //QTime ti; |
1150 | //ti.start(); | 1150 | //ti.start(); |
1151 | QPtrVector<MonthViewCell> *cells; | 1151 | QPtrVector<MonthViewCell> *cells; |
1152 | if ( mShowWeekView ) { | 1152 | if ( mShowWeekView ) { |
1153 | cells = &mCellsW; | 1153 | cells = &mCellsW; |
1154 | } else { | 1154 | } else { |
1155 | cells = &mCells; | 1155 | cells = &mCells; |
1156 | } | 1156 | } |
1157 | #if 1 | 1157 | #if 1 |
1158 | int i; | 1158 | int i; |
1159 | int timeSpan = (*cells).size()-1; | 1159 | int timeSpan = (*cells).size()-1; |
1160 | if ( KOPrefs::instance()->mMonthViewWeek ) | 1160 | if ( KOPrefs::instance()->mMonthViewWeek ) |
1161 | timeSpan = 6; | 1161 | timeSpan = 6; |
1162 | for( i = 0; i < timeSpan + 1; ++i ) { | 1162 | for( i = 0; i < timeSpan + 1; ++i ) { |
1163 | (*cells)[i]->startUpdateCell(); | 1163 | (*cells)[i]->startUpdateCell(); |
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | QPtrList<Event> events = calendar()->events(); | 1166 | QPtrList<Event> events = calendar()->events(); |
1167 | Event *event; | 1167 | Event *event; |
1168 | QDateTime dt; | 1168 | QDateTime dt; |
1169 | bool ok; | 1169 | bool ok; |
1170 | QDate endDate = mStartDate.addDays( timeSpan ); | 1170 | QDate endDate = mStartDate.addDays( timeSpan ); |
1171 | for( event = events.first(); event; event = events.next() ) { // for event | 1171 | for( event = events.first(); event; event = events.next() ) { // for event |
1172 | if ( event->doesRecur() ) { | 1172 | if ( event->doesRecur() ) { |
1173 | bool last; | 1173 | bool last; |
1174 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 1174 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
1175 | QDateTime incidenceEnd; | 1175 | QDateTime incidenceEnd; |
1176 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 1176 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
1177 | bool invalid = false; | 1177 | bool invalid = false; |
1178 | while( true ) { | 1178 | while( true ) { |
1179 | if ( incidenceStart.isValid() ) { | 1179 | if ( incidenceStart.isValid() ) { |
1180 | incidenceEnd = incidenceStart.addDays( eventlen ); | 1180 | incidenceEnd = incidenceStart.addDays( eventlen ); |
1181 | int st = incidenceStart.date().daysTo( endDate ); | 1181 | int st = incidenceStart.date().daysTo( endDate ); |
1182 | if ( st >= 0 ) { // start before timeend | 1182 | if ( st >= 0 ) { // start before timeend |
1183 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 1183 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
1184 | if ( end >= 0 ) { // end after timestart --- got one! | 1184 | if ( end >= 0 ) { // end after timestart --- got one! |
1185 | //normalize | 1185 | //normalize |
1186 | st = timeSpan - st; | 1186 | st = timeSpan - st; |
1187 | if ( st < 0 ) st = 0; | 1187 | if ( st < 0 ) st = 0; |
1188 | if ( end > timeSpan ) end = timeSpan; | 1188 | if ( end > timeSpan ) end = timeSpan; |
1189 | int iii; | 1189 | int iii; |
1190 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 1190 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
1191 | for ( iii = st;iii<= end;++iii) | 1191 | for ( iii = st;iii<= end;++iii) |
1192 | (*cells)[iii]->insertEvent( event ); | 1192 | (*cells)[iii]->insertEvent( event ); |
1193 | } | 1193 | } |
1194 | } | 1194 | } |
1195 | } else { | 1195 | } else { |
1196 | if ( invalid ) | 1196 | if ( invalid ) |
1197 | break; | 1197 | break; |
1198 | invalid = true; | 1198 | invalid = true; |
1199 | //qDebug("invalid %s", event->summary().latin1()); | 1199 | //qDebug("invalid %s", event->summary().latin1()); |
1200 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; | 1200 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; |
1201 | } | 1201 | } |
1202 | if ( last ) | 1202 | if ( last ) |
1203 | break; | 1203 | break; |
1204 | bool ok; | 1204 | bool ok; |
1205 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 1205 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
1206 | if ( ! ok ) | 1206 | if ( ! ok ) |
1207 | break; | 1207 | break; |
1208 | if ( incidenceStart.date() > endDate ) | 1208 | if ( incidenceStart.date() > endDate ) |
1209 | break; | 1209 | break; |
1210 | } | 1210 | } |
1211 | } else { // no recur | 1211 | } else { // no recur |
1212 | int st = event->dtStart().date().daysTo( endDate ); | 1212 | int st = event->dtStart().date().daysTo( endDate ); |
1213 | if ( st >= 0 ) { // start before timeend | 1213 | if ( st >= 0 ) { // start before timeend |
1214 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 1214 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
1215 | if ( end >= 0 ) { // end after timestart --- got one! | 1215 | if ( end >= 0 ) { // end after timestart --- got one! |
1216 | //normalize | 1216 | //normalize |
1217 | st = timeSpan - st; | 1217 | st = timeSpan - st; |
1218 | if ( st < 0 ) st = 0; | 1218 | if ( st < 0 ) st = 0; |
1219 | if ( end > timeSpan ) end = timeSpan; | 1219 | if ( end > timeSpan ) end = timeSpan; |
1220 | int iii; | 1220 | int iii; |
1221 | for ( iii = st;iii<= end;++iii) | 1221 | for ( iii = st;iii<= end;++iii) |
1222 | (*cells)[iii]->insertEvent( event ); | 1222 | (*cells)[iii]->insertEvent( event ); |
1223 | } | 1223 | } |
1224 | } | 1224 | } |
1225 | } | 1225 | } |
1226 | } | 1226 | } |
1227 | // insert due todos | 1227 | // insert due todos |
1228 | QPtrList<Todo> todos = calendar()->todos( ); | 1228 | QPtrList<Todo> todos = calendar()->todos( ); |
1229 | Todo *todo; | 1229 | Todo *todo; |
1230 | for(todo = todos.first(); todo; todo = todos.next()) { | 1230 | for(todo = todos.first(); todo; todo = todos.next()) { |
1231 | //insertTodo( todo ); | 1231 | //insertTodo( todo ); |
1232 | if ( todo->hasDueDate() ) { | 1232 | if ( todo->hasDueDate() ) { |
1233 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 1233 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
1234 | if ( day >= 0 && day < timeSpan + 1) { | 1234 | if ( day >= 0 && day < timeSpan + 1) { |
1235 | (*cells)[day]->insertTodo( todo ); | 1235 | (*cells)[day]->insertTodo( todo ); |
1236 | } | 1236 | } |
1237 | } | 1237 | } |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | for( i = 0; i < timeSpan+1; ++i ) { | 1240 | for( i = 0; i < timeSpan+1; ++i ) { |
1241 | (*cells)[i]->finishUpdateCell(); | 1241 | (*cells)[i]->finishUpdateCell(); |
1242 | } | 1242 | } |
1243 | processSelectionChange(); | 1243 | processSelectionChange(); |
1244 | (*cells)[0]->setFocus(); | 1244 | (*cells)[0]->setFocus(); |
1245 | 1245 | ||
1246 | 1246 | ||
1247 | #else | 1247 | #else |
1248 | // old code | 1248 | // old code |
1249 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1249 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1250 | int i; | 1250 | int i; |
1251 | for( i = 0; i < (*cells).count(); ++i ) { | 1251 | for( i = 0; i < (*cells).count(); ++i ) { |
1252 | (*cells)[i]->updateCell(); | 1252 | (*cells)[i]->updateCell(); |
1253 | } | 1253 | } |
1254 | 1254 | ||
1255 | //qDebug("KOMonthView::updateView() "); | 1255 | //qDebug("KOMonthView::updateView() "); |
1256 | processSelectionChange(); | 1256 | processSelectionChange(); |
1257 | // qDebug("---------------------------------------------------------------------+ "); | 1257 | // qDebug("---------------------------------------------------------------------+ "); |
1258 | (*cells)[0]->setFocus(); | 1258 | (*cells)[0]->setFocus(); |
1259 | #endif | 1259 | #endif |
1260 | 1260 | ||
1261 | //qDebug("update time %d ", ti.elapsed()); | 1261 | //qDebug("update time %d ", ti.elapsed()); |
1262 | } | 1262 | } |
1263 | 1263 | ||
1264 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1264 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1265 | { | 1265 | { |
1266 | qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); | 1266 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); |
1267 | if ( ignoreResizeEvent ) { | 1267 | if ( ignoreResizeEvent ) { |
1268 | int diff = e->size().height() - e->oldSize().height(); | 1268 | //qDebug("KOMonthView::resizeEvent ignored "); |
1269 | if ( diff < 0 ) | 1269 | --ignoreResizeEvent; |
1270 | diff = diff * (-1); | 1270 | return; |
1271 | if ( diff == ignoreResizeEventHeight ) { | ||
1272 | qDebug("KOMonthView::resizeEvent ignored "); | ||
1273 | --ignoreResizeEvent; | ||
1274 | return; | ||
1275 | } | ||
1276 | ignoreResizeEvent = 0; | ||
1277 | } | 1271 | } |
1278 | if ( e->size().width()+ e->size().height() < 240 ) | 1272 | if ( e->size().width()+ e->size().height() < 240 ) |
1279 | return; | 1273 | return; |
1280 | computeLayout(); | 1274 | computeLayout(); |
1281 | clPending = true; | 1275 | clPending = true; |
1282 | if ( mShowWeekView ) | 1276 | if ( mShowWeekView ) |
1283 | mCellsW[0]->setFocus(); | 1277 | mCellsW[0]->setFocus(); |
1284 | else | 1278 | else |
1285 | mCells[0]->setFocus(); | 1279 | mCells[0]->setFocus(); |
1286 | } | 1280 | } |
1287 | void KOMonthView::computeLayoutWeek() | 1281 | void KOMonthView::computeLayoutWeek() |
1288 | { | 1282 | { |
1289 | 1283 | static int widd = 0; | |
1284 | static int heigg = 0; | ||
1285 | if ( widd == width() && heigg == height () ) { | ||
1286 | return; | ||
1287 | } | ||
1288 | widd = width() ; | ||
1289 | heigg = height (); | ||
1290 | int daysToShow; | 1290 | int daysToShow; |
1291 | int tWid = topLevelWidget()->size().width(); | ||
1292 | int tHei = topLevelWidget()->size().height(); | ||
1293 | |||
1294 | int wid = size().width();//e | 1291 | int wid = size().width();//e |
1295 | int hei = size().height()-1; | 1292 | int hei = size().height()-1; |
1296 | |||
1297 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | ||
1298 | return; | ||
1299 | |||
1300 | if ( wid < hei ) | 1293 | if ( wid < hei ) |
1301 | daysToShow = 2; | 1294 | daysToShow = 2; |
1302 | else | 1295 | else |
1303 | daysToShow = 3; | 1296 | daysToShow = 3; |
1304 | bool combinedSatSun = true; | 1297 | bool combinedSatSun = true; |
1305 | 1298 | ||
1306 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | ||
1307 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1299 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1308 | int weeklabelwid = fm.width( "888" ); | 1300 | int weeklabelwid = fm.width( "888" ); |
1309 | wid -= weeklabelwid; | 1301 | wid -= weeklabelwid; |
1310 | 1302 | ||
1311 | int colWid = wid / daysToShow; | 1303 | int colWid = wid / daysToShow; |
1312 | int lastCol = wid - ( colWid*6 ); | 1304 | int lastCol = wid - ( colWid*6 ); |
1313 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); | 1305 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); |
1314 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); | 1306 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); |
1315 | int colModulo = wid % daysToShow; | 1307 | int colModulo = wid % daysToShow; |
1316 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; | 1308 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; |
1317 | //qDebug("rowmod %d ", rowModulo); | 1309 | //qDebug("rowmod %d ", rowModulo); |
1318 | int i; | 1310 | int i; |
1319 | int x,y,w,h; | 1311 | int x,y,w,h; |
1320 | x= 0; | 1312 | x= 0; |
1321 | y= 0; | 1313 | y= 0; |
1322 | w = colWid; | 1314 | w = colWid; |
1323 | h = dayLabelHei ; | 1315 | h = dayLabelHei ; |
1324 | for ( i = 0; i < 7; i++) { | 1316 | for ( i = 0; i < 7; i++) { |
1325 | if ( i && !( i % daysToShow) && i < 6) { | 1317 | if ( i && !( i % daysToShow) && i < 6) { |
1326 | y += hei/(5-daysToShow); | 1318 | y += hei/(5-daysToShow); |
1327 | x = 0; | 1319 | x = 0; |
1328 | w = colWid; | 1320 | w = colWid; |
1329 | } | 1321 | } |
1330 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1322 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1331 | ++w; | 1323 | ++w; |
1332 | } | 1324 | } |
1333 | if ( i >= 5 ) { | 1325 | if ( i >= 5 ) { |
1334 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); | 1326 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); |
1335 | x -= (w/2 ); | 1327 | x -= (w/2 ); |
1336 | } | 1328 | } |
1337 | else | 1329 | else |
1338 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); | 1330 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); |
1339 | x += w; | 1331 | x += w; |
1340 | } | 1332 | } |
1341 | x= 0; | 1333 | x= 0; |
1342 | y= dayLabelHei; | 1334 | y= dayLabelHei; |
1343 | w = colWid; | 1335 | w = colWid; |
1344 | h = cellHei; | 1336 | h = cellHei; |
1345 | for ( i = 0; i < mCellsW.count(); ++i) { | 1337 | for ( i = 0; i < mCellsW.count(); ++i) { |
1346 | if ( i > 6 ) { | 1338 | if ( i > 6 ) { |
1347 | mCellsW[i]->hide(); | 1339 | mCellsW[i]->hide(); |
1348 | continue; | 1340 | continue; |
1349 | } | 1341 | } |
1350 | 1342 | ||
1351 | w = colWid; | 1343 | w = colWid; |
1352 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1344 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1353 | ++w; | 1345 | ++w; |
1354 | } | 1346 | } |
1355 | if ( i == (daysToShow-1-rowModulo)*7) | 1347 | if ( i == (daysToShow-1-rowModulo)*7) |
1356 | ++h; | 1348 | ++h; |
1357 | 1349 | ||
1358 | if ( i >= 5 ) { | 1350 | if ( i >= 5 ) { |
1359 | if ( i ==5 ) { | 1351 | if ( i ==5 ) { |
1360 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1352 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1361 | x -= w ;y += h/2; | 1353 | x -= w ;y += h/2; |
1362 | } else { | 1354 | } else { |
1363 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { | 1355 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { |
1364 | ++w; | 1356 | ++w; |
1365 | } | 1357 | } |
1366 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1358 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1367 | y -= h/2; | 1359 | y -= h/2; |
1368 | } | 1360 | } |
1369 | } else | 1361 | } else |
1370 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1362 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1371 | 1363 | ||
1372 | 1364 | ||
1373 | x += w; | 1365 | x += w; |
1374 | if ( x + w/2 > wid ) { | 1366 | if ( x + w/2 > wid ) { |
1375 | x = 0; | 1367 | x = 0; |
1376 | y += h+dayLabelHei ; | 1368 | y += h+dayLabelHei ; |
1377 | } | 1369 | } |
1378 | } | 1370 | } |
1379 | y= dayLabelHei; | 1371 | y= dayLabelHei; |
1380 | h = cellHei ; | 1372 | h = cellHei ; |
1381 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); | 1373 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); |
1382 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1374 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1383 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1375 | |
1384 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | ||
1385 | mShortDayLabelsW = mDayLabelsW[0]->width() < mWidthLongDayLabel ; | 1376 | mShortDayLabelsW = mDayLabelsW[0]->width() < mWidthLongDayLabel ; |
1386 | updateDayLabels(); | 1377 | updateDayLabels(); |
1387 | bool forceUpdate = !updatePossible; | 1378 | bool forceUpdate = !updatePossible; |
1388 | updatePossible = true; | 1379 | updatePossible = true; |
1389 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); | 1380 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); |
1390 | if ( forceUpdate ) | 1381 | if ( forceUpdate ) |
1391 | updateView(); | 1382 | updateView(); |
1392 | } | 1383 | } |
1393 | void KOMonthView::computeLayout() | 1384 | void KOMonthView::computeLayout() |
1394 | { | 1385 | { |
1395 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". | 1386 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". |
1396 | // note this only changes the text if the requested size crosses the | 1387 | // note this only changes the text if the requested size crosses the |
1397 | // threshold between big enough to support the full name and not big | 1388 | // threshold between big enough to support the full name and not big |
1398 | // enough. | 1389 | // enough. |
1390 | |||
1391 | int tWid = topLevelWidget()->size().width(); | ||
1392 | int tHei = topLevelWidget()->size().height(); | ||
1393 | |||
1394 | int wid = size().width();//e | ||
1395 | int hei = size().height()-1; | ||
1396 | |||
1397 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | ||
1398 | return; | ||
1399 | |||
1400 | |||
1399 | if ( mShowWeekView ){ | 1401 | if ( mShowWeekView ){ |
1400 | computeLayoutWeek(); | 1402 | computeLayoutWeek(); |
1401 | return; | 1403 | return; |
1402 | } | 1404 | } |
1405 | static int widd = 0; | ||
1406 | static int heigg = 0; | ||
1407 | if ( widd == width() && heigg == height () ) { | ||
1408 | return; | ||
1409 | } | ||
1410 | widd = width() ; | ||
1411 | heigg = height (); | ||
1412 | |||
1403 | int daysToShow = 7; | 1413 | int daysToShow = 7; |
1404 | bool combinedSatSun = false; | 1414 | bool combinedSatSun = false; |
1405 | if (KOPrefs::instance()->mMonthViewSatSunTog ) { | 1415 | if (KOPrefs::instance()->mMonthViewSatSunTog ) { |
1406 | daysToShow = 6; | 1416 | daysToShow = 6; |
1407 | combinedSatSun = true; | 1417 | combinedSatSun = true; |
1408 | } | 1418 | } |
1409 | int tWid = topLevelWidget()->size().width(); | ||
1410 | int tHei = topLevelWidget()->size().height(); | ||
1411 | |||
1412 | int wid = size().width();//e | ||
1413 | int hei = size().height()-1; | ||
1414 | |||
1415 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | ||
1416 | return; | ||
1417 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | ||
1418 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1419 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1419 | int weeklabelwid = fm.width( "888" ); | 1420 | int weeklabelwid = fm.width( "888" ); |
1420 | wid -= weeklabelwid; | 1421 | wid -= weeklabelwid; |
1421 | 1422 | ||
1422 | int colWid = wid / daysToShow; | 1423 | int colWid = wid / daysToShow; |
1423 | int lastCol = wid - ( colWid*6 ); | 1424 | int lastCol = wid - ( colWid*6 ); |
1424 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1425 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
1425 | int cellHei = (hei - dayLabelHei) /6; | 1426 | int cellHei = (hei - dayLabelHei) /6; |
1426 | int colModulo = wid % daysToShow; | 1427 | int colModulo = wid % daysToShow; |
1427 | int rowModulo = (hei- dayLabelHei) % 6; | 1428 | int rowModulo = (hei- dayLabelHei) % 6; |
1428 | //qDebug("rowmod %d ", rowModulo); | 1429 | //qDebug("rowmod %d ", rowModulo); |
1429 | int i; | 1430 | int i; |
1430 | int x,y,w,h; | 1431 | int x,y,w,h; |
1431 | x= 0; | 1432 | x= 0; |
1432 | y= 0; | 1433 | y= 0; |
1433 | w = colWid; | 1434 | w = colWid; |
1434 | h = dayLabelHei ; | 1435 | h = dayLabelHei ; |
1435 | for ( i = 0; i < 7; i++) { | 1436 | for ( i = 0; i < 7; i++) { |
1436 | if ( i == daysToShow-colModulo ) | 1437 | if ( i == daysToShow-colModulo ) |
1437 | ++w; | 1438 | ++w; |
1438 | if ( combinedSatSun ) { | 1439 | if ( combinedSatSun ) { |
1439 | if ( i >= daysToShow-1 ) { | 1440 | if ( i >= daysToShow-1 ) { |
1440 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 1441 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); |
1441 | x -= w/2 ; | 1442 | x -= w/2 ; |
1442 | } | 1443 | } |
1443 | else | 1444 | else |
1444 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1445 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1445 | } else | 1446 | } else |
1446 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1447 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1447 | x += w; | 1448 | x += w; |
1448 | } | 1449 | } |
1449 | x= 0; | 1450 | x= 0; |
1450 | y= dayLabelHei; | 1451 | y= dayLabelHei; |
1451 | w = colWid; | 1452 | w = colWid; |
1452 | h = cellHei ; | 1453 | h = cellHei ; |
1453 | for ( i = 0; i < mCells.count(); ++i) { | 1454 | for ( i = 0; i < mCells.count(); ++i) { |
1454 | w = colWid; | 1455 | w = colWid; |
1455 | if ( ((i) % 7) >= 7-colModulo ) { | 1456 | if ( ((i) % 7) >= 7-colModulo ) { |
1456 | ++w; | 1457 | ++w; |
1457 | } | 1458 | } |
1458 | if ( i == (6-rowModulo)*7) | 1459 | if ( i == (6-rowModulo)*7) |
1459 | ++h; | 1460 | ++h; |
1460 | if ( combinedSatSun ) { | 1461 | if ( combinedSatSun ) { |
1461 | if ( (i)%7 >= daysToShow-1 ) { | 1462 | if ( (i)%7 >= daysToShow-1 ) { |
1462 | if ( (i)%7 == daysToShow-1 ) { | 1463 | if ( (i)%7 == daysToShow-1 ) { |
1463 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1464 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1464 | x -= w ;y += h/2; | 1465 | x -= w ;y += h/2; |
1465 | } else { | 1466 | } else { |
1466 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1467 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1467 | y -= h/2; | 1468 | y -= h/2; |
1468 | } | 1469 | } |
1469 | } else | 1470 | } else |
1470 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1471 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1471 | 1472 | ||
1472 | } | 1473 | } |
1473 | else | 1474 | else |
1474 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1475 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1475 | x += w; | 1476 | x += w; |
1476 | if ( x + w/2 > wid ) { | 1477 | if ( x + w/2 > wid ) { |
1477 | x = 0; | 1478 | x = 0; |
1478 | y += h; | 1479 | y += h; |
1479 | } | 1480 | } |
1480 | } | 1481 | } |
1481 | y= dayLabelHei; | 1482 | y= dayLabelHei; |
1482 | h = cellHei ; | 1483 | h = cellHei ; |
1483 | for ( i = 0; i < 6; i++) { | 1484 | for ( i = 0; i < 6; i++) { |
1484 | if ( i == (6-rowModulo)) | 1485 | if ( i == (6-rowModulo)) |
1485 | ++h; | 1486 | ++h; |
1486 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1487 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1487 | y += h; | 1488 | y += h; |
1488 | } | 1489 | } |
1489 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1490 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1490 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | ||
1491 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | ||
1492 | mShortDayLabelsM = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1491 | mShortDayLabelsM = mDayLabels[0]->width() < mWidthLongDayLabel ; |
1493 | qDebug("dlwid %d %d ",mDayLabels[0]->width() , mWidthLongDayLabel); | 1492 | qDebug("dlwid %d %d ",mDayLabels[0]->width() , mWidthLongDayLabel); |
1494 | updateDayLabels(); | 1493 | updateDayLabels(); |
1495 | bool forceUpdate = !updatePossible; | 1494 | bool forceUpdate = !updatePossible; |
1496 | updatePossible = true; | 1495 | updatePossible = true; |
1497 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | ||
1498 | if ( forceUpdate ) | 1496 | if ( forceUpdate ) |
1499 | updateView(); | 1497 | updateView(); |
1500 | } | 1498 | } |
1501 | 1499 | ||
1502 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1500 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1503 | { | 1501 | { |
1504 | mContextMenu->showIncidencePopup(incidence); | 1502 | mContextMenu->showIncidencePopup(incidence); |
1505 | /* | 1503 | |
1506 | if( incidence && incidence->type() == "Event" ) { | ||
1507 | Event *event = static_cast<Event *>(incidence); | ||
1508 | mContextMenu->showEventPopup(event); | ||
1509 | } else { | ||
1510 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | ||
1511 | } | ||
1512 | */ | ||
1513 | } | 1504 | } |
1514 | MonthViewCell * KOMonthView::selectedCell( ) | 1505 | MonthViewCell * KOMonthView::selectedCell( ) |
1515 | { | 1506 | { |
1516 | return mSelectedCell; | 1507 | return mSelectedCell; |
1517 | } | 1508 | } |
1518 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1509 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1519 | { | 1510 | { |
1520 | //qDebug("KOMonthView::setSelectedCell %x ", cell); | ||
1521 | if ( mSelectedCell && mSelectedCell != cell ) { | 1511 | if ( mSelectedCell && mSelectedCell != cell ) { |
1522 | MonthViewCell * mvc = mSelectedCell; | 1512 | MonthViewCell * mvc = mSelectedCell; |
1523 | mSelectedCell = cell; | 1513 | mSelectedCell = cell; |
1524 | mvc->deselect(); | 1514 | mvc->deselect(); |
1525 | } else | 1515 | } else |
1526 | mSelectedCell = cell; | 1516 | mSelectedCell = cell; |
1527 | // if ( mSelectedCell ) | ||
1528 | // mSelectedCell->select(); | ||
1529 | if ( !mSelectedCell ) | 1517 | if ( !mSelectedCell ) |
1530 | emit incidenceSelected( 0 ); | 1518 | emit incidenceSelected( 0 ); |
1531 | else | 1519 | else |
1532 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1520 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1533 | } | 1521 | } |
1534 | 1522 | ||
1535 | void KOMonthView::processSelectionChange() | 1523 | void KOMonthView::processSelectionChange() |
1536 | { | 1524 | { |
1537 | QPtrList<Incidence> incidences = selectedIncidences(); | 1525 | QPtrList<Incidence> incidences = selectedIncidences(); |
1538 | if (incidences.count() > 0) { | 1526 | if (incidences.count() > 0) { |
1539 | emit incidenceSelected( incidences.first() ); | 1527 | emit incidenceSelected( incidences.first() ); |
1540 | } else { | 1528 | } else { |
1541 | emit incidenceSelected( 0 ); | 1529 | emit incidenceSelected( 0 ); |
1542 | } | 1530 | } |
1543 | } | 1531 | } |
1544 | 1532 | ||
1545 | void KOMonthView::clearSelection() | 1533 | void KOMonthView::clearSelection() |
1546 | { | 1534 | { |
1547 | if ( mSelectedCell ) { | 1535 | if ( mSelectedCell ) { |
1548 | mSelectedCell->deselect(); | 1536 | mSelectedCell->deselect(); |
1549 | mSelectedCell = 0; | 1537 | mSelectedCell = 0; |
1550 | } | 1538 | } |
1551 | } | 1539 | } |
1552 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1540 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
1553 | { | 1541 | { |
1554 | //qDebug("KOMonthView::keyPressEvent "); | 1542 | //qDebug("KOMonthView::keyPressEvent "); |
1555 | switch(e->key()) { | 1543 | switch(e->key()) { |
1556 | case Key_Up: | 1544 | case Key_Up: |
1557 | { | 1545 | { |
1558 | emit prevMonth(); | 1546 | emit prevMonth(); |
1559 | if ( mShowWeekView ) | 1547 | if ( mShowWeekView ) |
1560 | mCellsW[0]->setFocus(); | 1548 | mCellsW[0]->setFocus(); |
1561 | else | 1549 | else |
1562 | mCells[0]->setFocus(); | 1550 | mCells[0]->setFocus(); |
1563 | } | 1551 | } |
1564 | e->accept(); | 1552 | e->accept(); |
1565 | break; | 1553 | break; |
1566 | case Key_Down: | 1554 | case Key_Down: |
1567 | { | 1555 | { |
1568 | emit nextMonth(); | 1556 | emit nextMonth(); |
1569 | if ( mShowWeekView ) | 1557 | if ( mShowWeekView ) |
1570 | mCellsW[0]->setFocus(); | 1558 | mCellsW[0]->setFocus(); |
1571 | else | 1559 | else |
1572 | mCells[0]->setFocus(); | 1560 | mCells[0]->setFocus(); |
1573 | 1561 | ||
1574 | } | 1562 | } |
1575 | e->accept(); | 1563 | e->accept(); |
1576 | break; | 1564 | break; |
1577 | case Key_Return: | 1565 | case Key_Return: |
1578 | case Key_Enter: | 1566 | case Key_Enter: |
1579 | { | 1567 | { |
1580 | selectInternalWeekNum ( currentWeek() ); | 1568 | selectInternalWeekNum ( currentWeek() ); |
1581 | } | 1569 | } |
1582 | e->accept(); | 1570 | e->accept(); |
1583 | break; | 1571 | break; |
1584 | default: | 1572 | default: |
1585 | e->ignore(); | 1573 | e->ignore(); |
1586 | break; | 1574 | break; |
1587 | } | 1575 | } |
1588 | } | 1576 | } |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index d70cda1..9dbe319 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -1,298 +1,297 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef _KOMONTHVIEW_H | 20 | #ifndef _KOMONTHVIEW_H |
21 | #define _KOMONTHVIEW_H | 21 | #define _KOMONTHVIEW_H |
22 | 22 | ||
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qframe.h> | 24 | #include <qframe.h> |
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | #include <qlistbox.h> | 26 | #include <qlistbox.h> |
27 | #include <qpoint.h> | 27 | #include <qpoint.h> |
28 | #include <qwidgetstack.h> | 28 | #include <qwidgetstack.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qintdict.h> | 30 | #include <qintdict.h> |
31 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
32 | #include <qvaluelist.h> | 32 | #include <qvaluelist.h> |
33 | #include <qptrvector.h> | 33 | #include <qptrvector.h> |
34 | 34 | ||
35 | #include <libkcal/calendar.h> | 35 | #include <libkcal/calendar.h> |
36 | #include <libkcal/event.h> | 36 | #include <libkcal/event.h> |
37 | 37 | ||
38 | #include "koeventview.h" | 38 | #include "koeventview.h" |
39 | 39 | ||
40 | #ifdef DESKTOP_VERSION | 40 | #ifdef DESKTOP_VERSION |
41 | class QToolTipGroup; | 41 | class QToolTipGroup; |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | class KNOWhatsThis; | 44 | class KNOWhatsThis; |
45 | class KOWeekButton : public QPushButton | 45 | class KOWeekButton : public QPushButton |
46 | { | 46 | { |
47 | Q_OBJECT | 47 | Q_OBJECT |
48 | public: | 48 | public: |
49 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : | 49 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : |
50 | QPushButton( parent, name) | 50 | QPushButton( parent, name) |
51 | { | 51 | { |
52 | connect( this, SIGNAL( clicked() ), | 52 | connect( this, SIGNAL( clicked() ), |
53 | SLOT( bottonClicked() )); | 53 | SLOT( bottonClicked() )); |
54 | mNumber = -1; | 54 | mNumber = -1; |
55 | } | 55 | } |
56 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} | 56 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} |
57 | int getWeekNum() { return mNumber;} | 57 | int getWeekNum() { return mNumber;} |
58 | signals: | 58 | signals: |
59 | void selectWeekNum ( int ); | 59 | void selectWeekNum ( int ); |
60 | private: | 60 | private: |
61 | int mNumber; | 61 | int mNumber; |
62 | private slots : | 62 | private slots : |
63 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } | 63 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } |
64 | }; | 64 | }; |
65 | 65 | ||
66 | class KNoScrollListBox: public QListBox | 66 | class KNoScrollListBox: public QListBox |
67 | { | 67 | { |
68 | Q_OBJECT | 68 | Q_OBJECT |
69 | public: | 69 | public: |
70 | KNoScrollListBox(QWidget *parent=0, const char *name=0); | 70 | KNoScrollListBox(QWidget *parent=0, const char *name=0); |
71 | ~KNoScrollListBox(); | 71 | ~KNoScrollListBox(); |
72 | QString getWhatsThisText(QPoint p) ; | 72 | QString getWhatsThisText(QPoint p) ; |
73 | 73 | ||
74 | signals: | 74 | signals: |
75 | void shiftDown(); | 75 | void shiftDown(); |
76 | void shiftUp(); | 76 | void shiftUp(); |
77 | void rightClick(); | 77 | void rightClick(); |
78 | 78 | ||
79 | protected slots: | 79 | protected slots: |
80 | void oneDown(); | 80 | void oneDown(); |
81 | void keyPressEvent(QKeyEvent *); | 81 | void keyPressEvent(QKeyEvent *); |
82 | void keyReleaseEvent(QKeyEvent *); | 82 | void keyReleaseEvent(QKeyEvent *); |
83 | void mousePressEvent(QMouseEvent *); | 83 | void mousePressEvent(QMouseEvent *); |
84 | 84 | ||
85 | private: | 85 | private: |
86 | KNOWhatsThis * mWT; | 86 | KNOWhatsThis * mWT; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | 89 | ||
90 | class MonthViewItem: public QListBoxItem | 90 | class MonthViewItem: public QListBoxItem |
91 | { | 91 | { |
92 | public: | 92 | public: |
93 | MonthViewItem( Incidence *, QDate qd, const QString & title ); | 93 | MonthViewItem( Incidence *, QDate qd, const QString & title ); |
94 | 94 | ||
95 | void setRecur(bool on) { mRecur = on; } | 95 | void setRecur(bool on) { mRecur = on; } |
96 | void setAlarm(bool on) { mAlarm = on; } | 96 | void setAlarm(bool on) { mAlarm = on; } |
97 | void setReply(bool on) { mReply = on; } | 97 | void setReply(bool on) { mReply = on; } |
98 | void setMoreInfo(bool on) { mInfo = on; } | 98 | void setMoreInfo(bool on) { mInfo = on; } |
99 | 99 | ||
100 | 100 | ||
101 | void setPalette(const QPalette &p) { mPalette = p; } | 101 | void setPalette(const QPalette &p) { mPalette = p; } |
102 | QPalette palette() const { return mPalette; } | 102 | QPalette palette() const { return mPalette; } |
103 | 103 | ||
104 | Incidence *incidence() const { return mIncidence; } | 104 | Incidence *incidence() const { return mIncidence; } |
105 | QDate incidenceDate() { return mDate; } | 105 | QDate incidenceDate() { return mDate; } |
106 | 106 | ||
107 | protected: | 107 | protected: |
108 | virtual void paint(QPainter *); | 108 | virtual void paint(QPainter *); |
109 | virtual int height(const QListBox *) const; | 109 | virtual int height(const QListBox *) const; |
110 | virtual int width(const QListBox *) const; | 110 | virtual int width(const QListBox *) const; |
111 | 111 | ||
112 | private: | 112 | private: |
113 | bool mRecur; | 113 | bool mRecur; |
114 | bool mAlarm; | 114 | bool mAlarm; |
115 | bool mReply; | 115 | bool mReply; |
116 | bool mInfo; | 116 | bool mInfo; |
117 | 117 | ||
118 | QPalette mPalette; | 118 | QPalette mPalette; |
119 | QDate mDate; | 119 | QDate mDate; |
120 | 120 | ||
121 | Incidence *mIncidence; | 121 | Incidence *mIncidence; |
122 | }; | 122 | }; |
123 | 123 | ||
124 | 124 | ||
125 | class KOMonthView; | 125 | class KOMonthView; |
126 | 126 | ||
127 | class MonthViewCell : public QWidget | 127 | class MonthViewCell : public QWidget |
128 | { | 128 | { |
129 | Q_OBJECT | 129 | Q_OBJECT |
130 | public: | 130 | public: |
131 | MonthViewCell(KOMonthView *,QWidget* ); | 131 | MonthViewCell(KOMonthView *,QWidget* ); |
132 | 132 | ||
133 | void setDate( const QDate & ); | 133 | void setDate( const QDate & ); |
134 | QDate date() const; | 134 | QDate date() const; |
135 | 135 | ||
136 | void setPrimary( bool ); | 136 | void setPrimary( bool ); |
137 | bool isPrimary() const; | 137 | bool isPrimary() const; |
138 | 138 | ||
139 | void setHoliday( bool ); | 139 | void setHoliday( bool ); |
140 | void setHoliday( const QString & ); | 140 | void setHoliday( const QString & ); |
141 | 141 | ||
142 | void updateCell(); | 142 | void updateCell(); |
143 | void startUpdateCell(); | 143 | void startUpdateCell(); |
144 | void finishUpdateCell(); | 144 | void finishUpdateCell(); |
145 | void insertEvent(Event *); | 145 | void insertEvent(Event *); |
146 | void insertTodo(Todo *); | 146 | void insertTodo(Todo *); |
147 | 147 | ||
148 | void updateConfig( bool bigFont = false ); | 148 | void updateConfig( bool bigFont = false ); |
149 | 149 | ||
150 | void enableScrollBars( bool ); | 150 | void enableScrollBars( bool ); |
151 | 151 | ||
152 | Incidence *selectedIncidence(); | 152 | Incidence *selectedIncidence(); |
153 | QDate selectedIncidenceDate(); | 153 | QDate selectedIncidenceDate(); |
154 | 154 | ||
155 | void deselect(); | 155 | void deselect(); |
156 | void select(); | 156 | void select(); |
157 | void clear(); | 157 | void clear(); |
158 | 158 | ||
159 | #ifdef DESKTOP_VERSION | 159 | #ifdef DESKTOP_VERSION |
160 | static QToolTipGroup *toolTipGroup(); | 160 | static QToolTipGroup *toolTipGroup(); |
161 | #endif | 161 | #endif |
162 | signals: | 162 | signals: |
163 | void defaultAction( Incidence * ); | 163 | void defaultAction( Incidence * ); |
164 | void newEventSignal( QDateTime ); | 164 | void newEventSignal( QDateTime ); |
165 | void showDaySignal( QDate ); | 165 | void showDaySignal( QDate ); |
166 | 166 | ||
167 | protected: | 167 | protected: |
168 | QString mToolTip; | 168 | QString mToolTip; |
169 | void resizeEvent( QResizeEvent * ); | 169 | void resizeEvent( QResizeEvent * ); |
170 | 170 | ||
171 | protected slots: | 171 | protected slots: |
172 | void defaultAction( QListBoxItem * ); | 172 | void defaultAction( QListBoxItem * ); |
173 | void contextMenu( QListBoxItem * ); | 173 | void contextMenu( QListBoxItem * ); |
174 | void selection( QListBoxItem * ); | 174 | void selection( QListBoxItem * ); |
175 | void cellClicked( QListBoxItem * ); | 175 | void cellClicked( QListBoxItem * ); |
176 | void newEvent(); | 176 | void newEvent(); |
177 | void showDay(); | 177 | void showDay(); |
178 | 178 | ||
179 | private: | 179 | private: |
180 | KOMonthView *mMonthView; | 180 | KOMonthView *mMonthView; |
181 | 181 | ||
182 | QDate mDate; | 182 | QDate mDate; |
183 | bool mPrimary; | 183 | bool mPrimary; |
184 | bool mHoliday; | 184 | bool mHoliday; |
185 | QString mHolidayString; | 185 | QString mHolidayString; |
186 | 186 | ||
187 | //QLabel *mLabel; | 187 | //QLabel *mLabel; |
188 | QPushButton *mLabel; | 188 | QPushButton *mLabel; |
189 | QListBox *mItemList; | 189 | QListBox *mItemList; |
190 | #ifdef DESKTOP_VERSION | 190 | #ifdef DESKTOP_VERSION |
191 | static QToolTipGroup *mToolTipGroup; | 191 | static QToolTipGroup *mToolTipGroup; |
192 | #endif | 192 | #endif |
193 | QSize mLabelSize; | 193 | QSize mLabelSize; |
194 | QSize mLabelBigSize; | 194 | QSize mLabelBigSize; |
195 | QPalette mHolidayPalette; | 195 | QPalette mHolidayPalette; |
196 | QPalette mStandardPalette; | 196 | QPalette mStandardPalette; |
197 | QPalette mPrimaryPalette; | 197 | QPalette mPrimaryPalette; |
198 | QPalette mNonPrimaryPalette; | 198 | QPalette mNonPrimaryPalette; |
199 | void setMyPalette(); | 199 | void setMyPalette(); |
200 | QPalette getPalette (); | 200 | QPalette getPalette (); |
201 | void keyPressEvent ( QKeyEvent * ) ; | 201 | void keyPressEvent ( QKeyEvent * ) ; |
202 | 202 | ||
203 | }; | 203 | }; |
204 | 204 | ||
205 | 205 | ||
206 | class KOMonthView: public KOEventView | 206 | class KOMonthView: public KOEventView |
207 | { | 207 | { |
208 | Q_OBJECT | 208 | Q_OBJECT |
209 | public: | 209 | public: |
210 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 210 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
211 | ~KOMonthView(); | 211 | ~KOMonthView(); |
212 | 212 | ||
213 | /** Returns maximum number of days supported by the komonthview */ | 213 | /** Returns maximum number of days supported by the komonthview */ |
214 | virtual int maxDatesHint(); | 214 | virtual int maxDatesHint(); |
215 | 215 | ||
216 | /** Returns number of currently shown dates. */ | 216 | /** Returns number of currently shown dates. */ |
217 | virtual int currentDateCount(); | 217 | virtual int currentDateCount(); |
218 | 218 | ||
219 | /** returns the currently selected events */ | 219 | /** returns the currently selected events */ |
220 | virtual QPtrList<Incidence> selectedIncidences(); | 220 | virtual QPtrList<Incidence> selectedIncidences(); |
221 | 221 | ||
222 | /** returns dates of the currently selected events */ | 222 | /** returns dates of the currently selected events */ |
223 | virtual DateList selectedDates(); | 223 | virtual DateList selectedDates(); |
224 | 224 | ||
225 | virtual void printPreview(CalPrinter *calPrinter, | 225 | virtual void printPreview(CalPrinter *calPrinter, |
226 | const QDate &, const QDate &); | 226 | const QDate &, const QDate &); |
227 | bool isMonthView() { return true; } | 227 | bool isMonthView() { return true; } |
228 | bool isUpdatePossible() { return updatePossible; } | 228 | bool isUpdatePossible() { return updatePossible; } |
229 | void setIgnoreResizeEvent( int c, int h ) { ignoreResizeEvent = c ;ignoreResizeEventHeight = h;} | 229 | void setIgnoreResizeEvent( int c ) { ignoreResizeEvent = c ;} |
230 | 230 | ||
231 | MonthViewCell * selectedCell(); | 231 | MonthViewCell * selectedCell(); |
232 | public slots: | 232 | public slots: |
233 | virtual void updateView(); | 233 | virtual void updateView(); |
234 | virtual void updateConfig(); | 234 | virtual void updateConfig(); |
235 | virtual void showDates(const QDate &start, const QDate &end); | 235 | virtual void showDates(const QDate &start, const QDate &end); |
236 | virtual void showEvents(QPtrList<Event> eventList); | 236 | virtual void showEvents(QPtrList<Event> eventList); |
237 | 237 | ||
238 | void changeEventDisplay(Event *, int); | 238 | void changeEventDisplay(Event *, int); |
239 | 239 | ||
240 | void clearSelection(); | 240 | void clearSelection(); |
241 | 241 | ||
242 | void showContextMenu( Incidence * ); | 242 | void showContextMenu( Incidence * ); |
243 | 243 | ||
244 | void setSelectedCell( MonthViewCell * ); | 244 | void setSelectedCell( MonthViewCell * ); |
245 | 245 | ||
246 | protected slots: | 246 | protected slots: |
247 | void selectInternalWeekNum ( int ); | 247 | void selectInternalWeekNum ( int ); |
248 | void switchView(); | 248 | void switchView(); |
249 | void processSelectionChange(); | 249 | void processSelectionChange(); |
250 | signals: | 250 | signals: |
251 | void nextMonth(); | 251 | void nextMonth(); |
252 | void prevMonth(); | 252 | void prevMonth(); |
253 | void showNavigator( bool ); | 253 | void showNavigator( bool ); |
254 | void selectWeekNum ( int ); | 254 | void selectWeekNum ( int ); |
255 | void showDaySignal( QDate ); | 255 | void showDaySignal( QDate ); |
256 | protected: | 256 | protected: |
257 | void resizeEvent(QResizeEvent *); | 257 | void resizeEvent(QResizeEvent *); |
258 | void viewChanged(); | 258 | void viewChanged(); |
259 | void updateDayLabels(); | 259 | void updateDayLabels(); |
260 | 260 | ||
261 | private: | 261 | private: |
262 | int ignoreResizeEvent; | 262 | int ignoreResizeEvent; |
263 | int ignoreResizeEventHeight; | ||
264 | int currentWeek(); | 263 | int currentWeek(); |
265 | bool clPending; | 264 | bool clPending; |
266 | QWidgetStack * mWidStack; | 265 | QWidgetStack * mWidStack; |
267 | QWidget* mMonthView; | 266 | QWidget* mMonthView; |
268 | QWidget* mWeekView; | 267 | QWidget* mWeekView; |
269 | bool mShowWeekView; | 268 | bool mShowWeekView; |
270 | bool updatePossible; | 269 | bool updatePossible; |
271 | int mDaysPerWeek; | 270 | int mDaysPerWeek; |
272 | int mNumWeeks; | 271 | int mNumWeeks; |
273 | int mNumCells; | 272 | int mNumCells; |
274 | bool mWeekStartsMonday; | 273 | bool mWeekStartsMonday; |
275 | void computeLayout(); | 274 | void computeLayout(); |
276 | void computeLayoutWeek(); | 275 | void computeLayoutWeek(); |
277 | 276 | ||
278 | QPtrVector<MonthViewCell> mCells; | 277 | QPtrVector<MonthViewCell> mCells; |
279 | QPtrVector<QLabel> mDayLabels; | 278 | QPtrVector<QLabel> mDayLabels; |
280 | QPtrVector<KOWeekButton> mWeekLabels; | 279 | QPtrVector<KOWeekButton> mWeekLabels; |
281 | QPtrVector<MonthViewCell> mCellsW; | 280 | QPtrVector<MonthViewCell> mCellsW; |
282 | QPtrVector<QLabel> mDayLabelsW; | 281 | QPtrVector<QLabel> mDayLabelsW; |
283 | QPtrVector<KOWeekButton> mWeekLabelsW; | 282 | QPtrVector<KOWeekButton> mWeekLabelsW; |
284 | 283 | ||
285 | bool mShortDayLabelsM; | 284 | bool mShortDayLabelsM; |
286 | bool mShortDayLabelsW; | 285 | bool mShortDayLabelsW; |
287 | int mWidthLongDayLabel; | 286 | int mWidthLongDayLabel; |
288 | 287 | ||
289 | QDate mStartDate; | 288 | QDate mStartDate; |
290 | 289 | ||
291 | MonthViewCell *mSelectedCell; | 290 | MonthViewCell *mSelectedCell; |
292 | 291 | ||
293 | KOEventPopupMenu *mContextMenu; | 292 | KOEventPopupMenu *mContextMenu; |
294 | void keyPressEvent ( QKeyEvent * ) ; | 293 | void keyPressEvent ( QKeyEvent * ) ; |
295 | 294 | ||
296 | }; | 295 | }; |
297 | 296 | ||
298 | #endif | 297 | #endif |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index c35de0a..62d3e7f 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -1,611 +1,611 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2001 | 4 | Copyright (c) 2001 |
5 | Cornelius Schumacher <schumacher@kde.org> | 5 | Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | 20 | ||
21 | As a special exception, permission is given to link this program | 21 | As a special exception, permission is given to link this program |
22 | with any edition of Qt, and distribute the resulting executable, | 22 | with any edition of Qt, and distribute the resulting executable, |
23 | without including the source code for Qt in the source distribution. | 23 | without including the source code for Qt in the source distribution. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | 27 | ||
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
36 | #include "calendarview.h" | 36 | #include "calendarview.h" |
37 | #include "datenavigator.h" | 37 | #include "datenavigator.h" |
38 | #include "kotodoview.h" | 38 | #include "kotodoview.h" |
39 | #include "koagendaview.h" | 39 | #include "koagendaview.h" |
40 | #include "kodialogmanager.h" | 40 | #include "kodialogmanager.h" |
41 | #include "komonthview.h" | 41 | #include "komonthview.h" |
42 | #include "kolistview.h" | 42 | #include "kolistview.h" |
43 | #include "kowhatsnextview.h" | 43 | #include "kowhatsnextview.h" |
44 | #include "kojournalview.h" | 44 | #include "kojournalview.h" |
45 | #include "kotimespanview.h" | 45 | #include "kotimespanview.h" |
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "navigatorbar.h" | 47 | #include "navigatorbar.h" |
48 | #include "kdatenavigator.h" | 48 | #include "kdatenavigator.h" |
49 | 49 | ||
50 | #include "koviewmanager.h" | 50 | #include "koviewmanager.h" |
51 | //extern bool externFlagMonthviewBlockPainting; | 51 | //extern bool externFlagMonthviewBlockPainting; |
52 | 52 | ||
53 | //bool globalFlagBlockPainting = false; | 53 | //bool globalFlagBlockPainting = false; |
54 | int globalFlagBlockAgenda = 0; | 54 | int globalFlagBlockAgenda = 0; |
55 | int globalFlagBlockLabel = 0; | 55 | int globalFlagBlockLabel = 0; |
56 | int globalFlagBlockAgendaItemPaint = 1; | 56 | int globalFlagBlockAgendaItemPaint = 1; |
57 | int globalFlagBlockAgendaItemUpdate = 1; | 57 | int globalFlagBlockAgendaItemUpdate = 1; |
58 | 58 | ||
59 | 59 | ||
60 | KOViewManager::KOViewManager( CalendarView *mainView ) : | 60 | KOViewManager::KOViewManager( CalendarView *mainView ) : |
61 | QObject(), mMainView( mainView ) | 61 | QObject(), mMainView( mainView ) |
62 | { | 62 | { |
63 | mCurrentView = 0; | 63 | mCurrentView = 0; |
64 | 64 | ||
65 | mWhatsNextView = 0; | 65 | mWhatsNextView = 0; |
66 | mTodoView = 0; | 66 | mTodoView = 0; |
67 | mAgendaView = 0; | 67 | mAgendaView = 0; |
68 | mMonthView = 0; | 68 | mMonthView = 0; |
69 | mListView = 0; | 69 | mListView = 0; |
70 | mJournalView = 0; | 70 | mJournalView = 0; |
71 | mTimeSpanView = 0; | 71 | mTimeSpanView = 0; |
72 | mCurrentAgendaView = 0 ; | 72 | mCurrentAgendaView = 0 ; |
73 | mFlagShowNextxDays = false; | 73 | mFlagShowNextxDays = false; |
74 | } | 74 | } |
75 | 75 | ||
76 | KOViewManager::~KOViewManager() | 76 | KOViewManager::~KOViewManager() |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | KOrg::BaseView *KOViewManager::currentView() | 81 | KOrg::BaseView *KOViewManager::currentView() |
82 | { | 82 | { |
83 | return mCurrentView; | 83 | return mCurrentView; |
84 | } | 84 | } |
85 | 85 | ||
86 | void KOViewManager::readSettings(KConfig *config) | 86 | void KOViewManager::readSettings(KConfig *config) |
87 | { | 87 | { |
88 | config->setGroup("General"); | 88 | config->setGroup("General"); |
89 | QString view = config->readEntry("Current View"); | 89 | QString view = config->readEntry("Current View"); |
90 | if (view == "WhatsNext") showWhatsNextView(); | 90 | if (view == "WhatsNext") showWhatsNextView(); |
91 | else if (view == "Month") showMonthView(); | 91 | else if (view == "Month") showMonthView(); |
92 | else if (view == "List") showListView(); | 92 | else if (view == "List") showListView(); |
93 | else if (view == "Journal") showJournalView(); | 93 | else if (view == "Journal") showJournalView(); |
94 | else if (view == "TimeSpan") showTimeSpanView(); | 94 | else if (view == "TimeSpan") showTimeSpanView(); |
95 | else if (view == "Todo") showTodoView(); | 95 | else if (view == "Todo") showTodoView(); |
96 | else { | 96 | else { |
97 | showAgendaView(); | 97 | showAgendaView(); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | void KOViewManager::showDateView( int view, QDate date) | 101 | void KOViewManager::showDateView( int view, QDate date) |
102 | { | 102 | { |
103 | static int lastMode = 0; | 103 | static int lastMode = 0; |
104 | static int lastCount = 0; | 104 | static int lastCount = 0; |
105 | static bool lastNDMode = false; | 105 | static bool lastNDMode = false; |
106 | static QDate lastDate; | 106 | static QDate lastDate; |
107 | //qDebug("date %d %s", view, date.toString().latin1()); | 107 | //qDebug("date %d %s", view, date.toString().latin1()); |
108 | 108 | ||
109 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); | 109 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); |
110 | bool savemFlagShowNextxDays = mFlagShowNextxDays; | 110 | bool savemFlagShowNextxDays = mFlagShowNextxDays; |
111 | mFlagShowNextxDays = false; | 111 | mFlagShowNextxDays = false; |
112 | if ( view == 3 ) { | 112 | if ( view == 3 ) { |
113 | //mCurrentAgendaView = 1 ; | 113 | //mCurrentAgendaView = 1 ; |
114 | lastDate = mMainView->dateNavigator()->selectedDates().first(); | 114 | lastDate = mMainView->dateNavigator()->selectedDates().first(); |
115 | lastCount = mMainView->dateNavigator()->selectedDates().count(); | 115 | lastCount = mMainView->dateNavigator()->selectedDates().count(); |
116 | lastNDMode = savemFlagShowNextxDays; | 116 | lastNDMode = savemFlagShowNextxDays; |
117 | mMainView->showDay( date ); | 117 | mMainView->showDay( date ); |
118 | } else if (view == 4 ) { | 118 | } else if (view == 4 ) { |
119 | mCurrentAgendaView = 7 ; | 119 | mCurrentAgendaView = 7 ; |
120 | mMainView->dateNavigator()->selectDates( date, 7 ); | 120 | mMainView->dateNavigator()->selectDates( date, 7 ); |
121 | } else if (view == 5 ) { | 121 | } else if (view == 5 ) { |
122 | mCurrentAgendaView = 14 ; | 122 | mCurrentAgendaView = 14 ; |
123 | mMainView->dateNavigator()->selectDates( date, 14); | 123 | mMainView->dateNavigator()->selectDates( date, 14); |
124 | } else if (view == 6 ) { | 124 | } else if (view == 6 ) { |
125 | //mMainView->dateNavigator()->selectDates( date, 7 ); | 125 | //mMainView->dateNavigator()->selectDates( date, 7 ); |
126 | showMonthView(); | 126 | showMonthView(); |
127 | } else if (view == 7 ) { | 127 | } else if (view == 7 ) { |
128 | mMainView->dateNavigator()->selectDate( date ); | 128 | mMainView->dateNavigator()->selectDate( date ); |
129 | showJournalView(); | 129 | showJournalView(); |
130 | } else if (view == 8 ) { | 130 | } else if (view == 8 ) { |
131 | globalFlagBlockAgenda = 1; | 131 | globalFlagBlockAgenda = 1; |
132 | if ( mCurrentAgendaView != 3 ) | 132 | if ( mCurrentAgendaView != 3 ) |
133 | mCurrentAgendaView = -1; | 133 | mCurrentAgendaView = -1; |
134 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 134 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
135 | globalFlagBlockAgenda = 2; | 135 | globalFlagBlockAgenda = 2; |
136 | mMainView->dateNavigator()->selectDates( date , | 136 | mMainView->dateNavigator()->selectDates( date , |
137 | KOPrefs::instance()->mNextXDays ); | 137 | KOPrefs::instance()->mNextXDays ); |
138 | mFlagShowNextxDays = true; | 138 | mFlagShowNextxDays = true; |
139 | mCurrentAgendaView = 3 ; | 139 | mCurrentAgendaView = 3 ; |
140 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) | 140 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) |
141 | if ( lastMode ) { | 141 | if ( lastMode ) { |
142 | mCurrentAgendaView = lastCount ; | 142 | mCurrentAgendaView = lastCount ; |
143 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); | 143 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); |
144 | mFlagShowNextxDays = lastNDMode; | 144 | mFlagShowNextxDays = lastNDMode; |
145 | if ( mFlagShowNextxDays ) { | 145 | if ( mFlagShowNextxDays ) { |
146 | mCurrentAgendaView = 3 ; | 146 | mCurrentAgendaView = 3 ; |
147 | } | 147 | } |
148 | } else | 148 | } else |
149 | showWeekView(); | 149 | showWeekView(); |
150 | } else if (view == 10) { | 150 | } else if (view == 10) { |
151 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); | 151 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); |
152 | } | 152 | } |
153 | lastMode = view; | 153 | lastMode = view; |
154 | } | 154 | } |
155 | 155 | ||
156 | 156 | ||
157 | 157 | ||
158 | void KOViewManager::writeSettings(KConfig *config) | 158 | void KOViewManager::writeSettings(KConfig *config) |
159 | { | 159 | { |
160 | config->setGroup("General"); | 160 | config->setGroup("General"); |
161 | 161 | ||
162 | QString view; | 162 | QString view; |
163 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 163 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
164 | else if (mCurrentView == mMonthView) view = "Month"; | 164 | else if (mCurrentView == mMonthView) view = "Month"; |
165 | else if (mCurrentView == mListView) view = "List"; | 165 | else if (mCurrentView == mListView) view = "List"; |
166 | else if (mCurrentView == mJournalView) view = "Journal"; | 166 | else if (mCurrentView == mJournalView) view = "Journal"; |
167 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 167 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
168 | else if (mCurrentView == mTodoView) view = "Todo"; | 168 | else if (mCurrentView == mTodoView) view = "Todo"; |
169 | else view = "Agenda"; | 169 | else view = "Agenda"; |
170 | 170 | ||
171 | config->writeEntry("Current View",view); | 171 | config->writeEntry("Current View",view); |
172 | 172 | ||
173 | if (mAgendaView) { | 173 | if (mAgendaView) { |
174 | mAgendaView->writeSettings(config); | 174 | mAgendaView->writeSettings(config); |
175 | } | 175 | } |
176 | if (mTimeSpanView) { | 176 | if (mTimeSpanView) { |
177 | mTimeSpanView->writeSettings(config); | 177 | mTimeSpanView->writeSettings(config); |
178 | } | 178 | } |
179 | if (mListView) { | 179 | if (mListView) { |
180 | mListView->writeSettings(config); | 180 | mListView->writeSettings(config); |
181 | } | 181 | } |
182 | if (mTodoView) { | 182 | if (mTodoView) { |
183 | mTodoView->saveLayout(config,"Todo View"); | 183 | mTodoView->saveLayout(config,"Todo View"); |
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
187 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 187 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
188 | { | 188 | { |
189 | 189 | ||
190 | //mFlagShowNextxDays = false; | 190 | //mFlagShowNextxDays = false; |
191 | //if(view == mCurrentView) return; | 191 | //if(view == mCurrentView) return; |
192 | if ( view == 0 ) { | 192 | if ( view == 0 ) { |
193 | view = mCurrentView; | 193 | view = mCurrentView; |
194 | if ( view == 0 ) | 194 | if ( view == 0 ) |
195 | return; | 195 | return; |
196 | } | 196 | } |
197 | bool full = fullScreen; | 197 | bool full = fullScreen; |
198 | if(view == mCurrentView && view != mWhatsNextView ) { | 198 | if(view == mCurrentView && view != mWhatsNextView ) { |
199 | if ( mCurrentAgendaView < 0 ) | 199 | if ( mCurrentAgendaView < 0 ) |
200 | return; | 200 | return; |
201 | full = mMainView->leftFrame()->isVisible(); | 201 | full = mMainView->leftFrame()->isVisible(); |
202 | } else { | 202 | } else { |
203 | if ( view == mMonthView && mMonthView) | ||
204 | mMonthView->setIgnoreResizeEvent( 1 ); | ||
203 | mCurrentView = view; | 205 | mCurrentView = view; |
204 | // bool full = fullScreen; | 206 | // bool full = fullScreen; |
205 | bool isFull = !mMainView->leftFrame()->isVisible(); | 207 | bool isFull = !mMainView->leftFrame()->isVisible(); |
206 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 208 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
207 | full = true; | 209 | full = true; |
208 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 210 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
209 | full = false; | 211 | full = false; |
210 | } | 212 | } |
211 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 213 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
212 | //raiseCurrentView( full ); | 214 | //raiseCurrentView( full ); |
213 | mMainView->processIncidenceSelection( 0 ); | 215 | mMainView->processIncidenceSelection( 0 ); |
214 | //mMainView->updateView(); | 216 | //mMainView->updateView(); |
215 | raiseCurrentView( full, true ); | 217 | raiseCurrentView( full, true ); |
216 | mMainView->adaptNavigationUnits(); | 218 | mMainView->adaptNavigationUnits(); |
217 | } | 219 | } |
218 | 220 | ||
219 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) | 221 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) |
220 | { | 222 | { |
221 | mCurrentAgendaView = 0; | 223 | mCurrentAgendaView = 0; |
222 | int wid = mMainView->width() ; | 224 | int wid = mMainView->width() ; |
223 | int hei = mMainView->height(); | 225 | int hei = mMainView->height(); |
224 | if ( mCurrentView == mMonthView ) { | 226 | if ( mCurrentView == mMonthView ) { |
225 | if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) { | 227 | if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) { |
226 | |||
227 | mMonthView->setIgnoreResizeEvent( 2 ,mMainView->navigatorBar()->height()); | ||
228 | mMainView->navigatorBar()->show(); | 228 | mMainView->navigatorBar()->show(); |
229 | hei -= mMainView->navigatorBar()->sizeHint().height(); | 229 | hei -= mMainView->navigatorBar()->sizeHint().height(); |
230 | } | 230 | } |
231 | //mMainView->navigatorBar()->hide(); | 231 | //mMainView->navigatorBar()->hide(); |
232 | } else { | 232 | } else { |
233 | mMainView->navigatorBar()->hide(); | 233 | mMainView->navigatorBar()->hide(); |
234 | } | 234 | } |
235 | if ( fullScreen ) { | 235 | if ( fullScreen ) { |
236 | mMainView->leftFrame()->hide(); | 236 | mMainView->leftFrame()->hide(); |
237 | } else { | 237 | } else { |
238 | mMainView->leftFrame()->show(); | 238 | mMainView->leftFrame()->show(); |
239 | if ( KOPrefs::instance()->mVerticalScreen ) | 239 | if ( KOPrefs::instance()->mVerticalScreen ) |
240 | hei -= mMainView->leftFrame()->height(); | 240 | hei -= mMainView->leftFrame()->height(); |
241 | else | 241 | else |
242 | wid -= mMainView->leftFrame()->width(); | 242 | wid -= mMainView->leftFrame()->width(); |
243 | } | 243 | } |
244 | emit signalFullScreen( !fullScreen ); | 244 | emit signalFullScreen( !fullScreen ); |
245 | if ( callUpdateView ) | 245 | if ( callUpdateView ) |
246 | mMainView->updateView(); | 246 | mMainView->updateView(); |
247 | 247 | ||
248 | if ( globalFlagBlockAgenda == 5 ) { | 248 | if ( globalFlagBlockAgenda == 5 ) { |
249 | globalFlagBlockAgenda = 4; | 249 | globalFlagBlockAgenda = 4; |
250 | globalFlagBlockAgendaItemPaint = 1; | 250 | globalFlagBlockAgendaItemPaint = 1; |
251 | } | 251 | } |
252 | mMainView->viewStack()->raiseWidget(mCurrentView); | 252 | mMainView->viewStack()->raiseWidget(mCurrentView); |
253 | if ( globalFlagBlockAgenda == 4 ) { | 253 | if ( globalFlagBlockAgenda == 4 ) { |
254 | if ( mCurrentView == mAgendaView ) { | 254 | if ( mCurrentView == mAgendaView ) { |
255 | //globalFlagBlockAgenda =1 ; | 255 | //globalFlagBlockAgenda =1 ; |
256 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 256 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
257 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 257 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
258 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 258 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
259 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 259 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
260 | qApp->processEvents(); | 260 | qApp->processEvents(); |
261 | //qDebug("qApp->processEvents() "); | 261 | //qDebug("qApp->processEvents() "); |
262 | globalFlagBlockAgenda = 0; | 262 | globalFlagBlockAgenda = 0; |
263 | mAgendaView->repaintAgenda(); | 263 | mAgendaView->repaintAgenda(); |
264 | 264 | ||
265 | } | 265 | } |
266 | globalFlagBlockAgenda = 0; | 266 | globalFlagBlockAgenda = 0; |
267 | } | 267 | } |
268 | emit signalAgendaView( mCurrentView == mAgendaView ); | 268 | emit signalAgendaView( mCurrentView == mAgendaView ); |
269 | //qDebug("raiseCurrentView ende "); | 269 | //qDebug("raiseCurrentView ende "); |
270 | 270 | ||
271 | } | 271 | } |
272 | 272 | ||
273 | void KOViewManager::updateView() | 273 | void KOViewManager::updateView() |
274 | { | 274 | { |
275 | // qDebug("KOViewManager::updateView() "); | 275 | // qDebug("KOViewManager::updateView() "); |
276 | // if we are updating mTodoView, we get endless recursion | 276 | // if we are updating mTodoView, we get endless recursion |
277 | if ( mTodoView == mCurrentView ) | 277 | if ( mTodoView == mCurrentView ) |
278 | return; | 278 | return; |
279 | if ( mCurrentView ) mCurrentView->updateView(); | 279 | if ( mCurrentView ) mCurrentView->updateView(); |
280 | 280 | ||
281 | } | 281 | } |
282 | 282 | ||
283 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 283 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
284 | { | 284 | { |
285 | // kdDebug() << "KOViewManager::updateView()" << endl; | 285 | // kdDebug() << "KOViewManager::updateView()" << endl; |
286 | 286 | ||
287 | if (mCurrentView) mCurrentView->showDates(start, end); | 287 | if (mCurrentView) mCurrentView->showDates(start, end); |
288 | 288 | ||
289 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); | 289 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); |
290 | } | 290 | } |
291 | 291 | ||
292 | 292 | ||
293 | void KOViewManager::updateWNview() | 293 | void KOViewManager::updateWNview() |
294 | { | 294 | { |
295 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 295 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
296 | mWhatsNextView->updateView(); | 296 | mWhatsNextView->updateView(); |
297 | 297 | ||
298 | } | 298 | } |
299 | void KOViewManager::showWhatsNextView() | 299 | void KOViewManager::showWhatsNextView() |
300 | { | 300 | { |
301 | if (!mWhatsNextView) { | 301 | if (!mWhatsNextView) { |
302 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 302 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
303 | "KOViewManager::WhatsNextView"); | 303 | "KOViewManager::WhatsNextView"); |
304 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 304 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
305 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 305 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
306 | addView(mWhatsNextView); | 306 | addView(mWhatsNextView); |
307 | connect(this, SIGNAL( printWNV() ), | 307 | connect(this, SIGNAL( printWNV() ), |
308 | mWhatsNextView, SLOT( printMe() ) ); | 308 | mWhatsNextView, SLOT( printMe() ) ); |
309 | } | 309 | } |
310 | globalFlagBlockAgenda = 1; | 310 | globalFlagBlockAgenda = 1; |
311 | showView(mWhatsNextView, true ); | 311 | showView(mWhatsNextView, true ); |
312 | //mWhatsNextView->updateView(); | 312 | //mWhatsNextView->updateView(); |
313 | 313 | ||
314 | } | 314 | } |
315 | 315 | ||
316 | void KOViewManager::showListView() | 316 | void KOViewManager::showListView() |
317 | { | 317 | { |
318 | if (!mListView) { | 318 | if (!mListView) { |
319 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 319 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
320 | addView(mListView); | 320 | addView(mListView); |
321 | 321 | ||
322 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 322 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
323 | mMainView, SLOT(showIncidence(Incidence *))); | 323 | mMainView, SLOT(showIncidence(Incidence *))); |
324 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 324 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
325 | mMainView, SLOT(editIncidence(Incidence *))); | 325 | mMainView, SLOT(editIncidence(Incidence *))); |
326 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 326 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
327 | mMainView, SLOT(deleteIncidence(Incidence *))); | 327 | mMainView, SLOT(deleteIncidence(Incidence *))); |
328 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 328 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
329 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 329 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
330 | connect( mListView, SIGNAL( signalNewEvent() ), | 330 | connect( mListView, SIGNAL( signalNewEvent() ), |
331 | mMainView, SLOT( newEvent() ) ); | 331 | mMainView, SLOT( newEvent() ) ); |
332 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 332 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
333 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 333 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
334 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 334 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
335 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 335 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
336 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 336 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
337 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 337 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
338 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 338 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
339 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 339 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
340 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 340 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
341 | } | 341 | } |
342 | // bool temp = mFlagShowNextxDays; | 342 | // bool temp = mFlagShowNextxDays; |
343 | //globalFlagBlockPainting = true; | 343 | //globalFlagBlockPainting = true; |
344 | globalFlagBlockAgenda = 1; | 344 | globalFlagBlockAgenda = 1; |
345 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { | 345 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { |
346 | mMainView->setBlockShowDates( true ); | 346 | mMainView->setBlockShowDates( true ); |
347 | mMainView->dateNavigator()->selectMonth(); | 347 | mMainView->dateNavigator()->selectMonth(); |
348 | mMainView->setBlockShowDates( false ); | 348 | mMainView->setBlockShowDates( false ); |
349 | } | 349 | } |
350 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 350 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
351 | //mFlagShowNextxDays = temp; | 351 | //mFlagShowNextxDays = temp; |
352 | } | 352 | } |
353 | 353 | ||
354 | void KOViewManager::showAgendaView( bool fullScreen ) | 354 | void KOViewManager::showAgendaView( bool fullScreen ) |
355 | { | 355 | { |
356 | 356 | ||
357 | mMainView->dialogManager()->hideSearchDialog(); | 357 | mMainView->dialogManager()->hideSearchDialog(); |
358 | // qDebug("KOViewManager::showAgendaView "); | 358 | // qDebug("KOViewManager::showAgendaView "); |
359 | bool full; | 359 | bool full; |
360 | full = fullScreen; | 360 | full = fullScreen; |
361 | if (!mAgendaView) { | 361 | if (!mAgendaView) { |
362 | full = false; | 362 | full = false; |
363 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 363 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
364 | addView(mAgendaView); | 364 | addView(mAgendaView); |
365 | #ifndef DESKTOP_VERSION | 365 | #ifndef DESKTOP_VERSION |
366 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 366 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
367 | #endif | 367 | #endif |
368 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 368 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
369 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 369 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
370 | 370 | ||
371 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 371 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
372 | 372 | ||
373 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); | 373 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); |
374 | 374 | ||
375 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), | 375 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), |
376 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); | 376 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); |
377 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 377 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
378 | mMainView, SLOT(newEvent(QDateTime))); | 378 | mMainView, SLOT(newEvent(QDateTime))); |
379 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 379 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
380 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 380 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
381 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 381 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
382 | mMainView, SLOT(newEvent(QDate))); | 382 | mMainView, SLOT(newEvent(QDate))); |
383 | 383 | ||
384 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 384 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
385 | mMainView, SLOT(editIncidence(Incidence *))); | 385 | mMainView, SLOT(editIncidence(Incidence *))); |
386 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 386 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
387 | mMainView, SLOT(showIncidence(Incidence *))); | 387 | mMainView, SLOT(showIncidence(Incidence *))); |
388 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 388 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
389 | mMainView, SLOT(deleteIncidence(Incidence *))); | 389 | mMainView, SLOT(deleteIncidence(Incidence *))); |
390 | 390 | ||
391 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 391 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
392 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 392 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
393 | 393 | ||
394 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 394 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
395 | mMainView, SLOT( toggleExpand() ) ); | 395 | mMainView, SLOT( toggleExpand() ) ); |
396 | 396 | ||
397 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), | 397 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), |
398 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); | 398 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); |
399 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 399 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
400 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 400 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
401 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 401 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
402 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 402 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
403 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 403 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
404 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 404 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
405 | SLOT( updateTodo( Todo *, int ) ) ); | 405 | SLOT( updateTodo( Todo *, int ) ) ); |
406 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 406 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
407 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 407 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
408 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 408 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
409 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 409 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
410 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 410 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
411 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 411 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
412 | connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), | 412 | connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), |
413 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); | 413 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); |
414 | mAgendaView->readSettings(); | 414 | mAgendaView->readSettings(); |
415 | mAgendaView->updateConfig(); | 415 | mAgendaView->updateConfig(); |
416 | } | 416 | } |
417 | 417 | ||
418 | showView( mAgendaView, full); | 418 | showView( mAgendaView, full); |
419 | 419 | ||
420 | } | 420 | } |
421 | 421 | ||
422 | void KOViewManager::showDayView() | 422 | void KOViewManager::showDayView() |
423 | { | 423 | { |
424 | mFlagShowNextxDays = false; | 424 | mFlagShowNextxDays = false; |
425 | globalFlagBlockLabel = 1; | 425 | globalFlagBlockLabel = 1; |
426 | globalFlagBlockAgenda = 1; | 426 | globalFlagBlockAgenda = 1; |
427 | if ( mCurrentAgendaView != 1 ) | 427 | if ( mCurrentAgendaView != 1 ) |
428 | mCurrentAgendaView = -1; | 428 | mCurrentAgendaView = -1; |
429 | showAgendaView(); | 429 | showAgendaView(); |
430 | qApp->processEvents(); | 430 | qApp->processEvents(); |
431 | globalFlagBlockAgenda = 2; | 431 | globalFlagBlockAgenda = 2; |
432 | globalFlagBlockLabel = 0; | 432 | globalFlagBlockLabel = 0; |
433 | mMainView->dateNavigator()->selectDates( 1 ); | 433 | mMainView->dateNavigator()->selectDates( 1 ); |
434 | mCurrentAgendaView = 1 ; | 434 | mCurrentAgendaView = 1 ; |
435 | 435 | ||
436 | } | 436 | } |
437 | 437 | ||
438 | void KOViewManager::showWorkWeekView() | 438 | void KOViewManager::showWorkWeekView() |
439 | { | 439 | { |
440 | mFlagShowNextxDays = false; | 440 | mFlagShowNextxDays = false; |
441 | globalFlagBlockAgenda = 1; | 441 | globalFlagBlockAgenda = 1; |
442 | globalFlagBlockLabel = 1; | 442 | globalFlagBlockLabel = 1; |
443 | if ( mCurrentAgendaView != 5 ) | 443 | if ( mCurrentAgendaView != 5 ) |
444 | mCurrentAgendaView = -1; | 444 | mCurrentAgendaView = -1; |
445 | showAgendaView(); | 445 | showAgendaView(); |
446 | qApp->processEvents(); | 446 | qApp->processEvents(); |
447 | globalFlagBlockAgenda = 2; | 447 | globalFlagBlockAgenda = 2; |
448 | globalFlagBlockLabel = 0; | 448 | globalFlagBlockLabel = 0; |
449 | mMainView->dateNavigator()->selectWorkWeek(); | 449 | mMainView->dateNavigator()->selectWorkWeek(); |
450 | mCurrentAgendaView = 5 ; | 450 | mCurrentAgendaView = 5 ; |
451 | 451 | ||
452 | } | 452 | } |
453 | 453 | ||
454 | void KOViewManager::showWeekView() | 454 | void KOViewManager::showWeekView() |
455 | { | 455 | { |
456 | /* | 456 | /* |
457 | globalFlagBlockAgenda = 2; | 457 | globalFlagBlockAgenda = 2; |
458 | qDebug("4globalFlagBlockAgenda = 2; "); | 458 | qDebug("4globalFlagBlockAgenda = 2; "); |
459 | //globalFlagBlockPainting = true; | 459 | //globalFlagBlockPainting = true; |
460 | mMainView->dateNavigator()->selectWeek(); | 460 | mMainView->dateNavigator()->selectWeek(); |
461 | showAgendaView(); | 461 | showAgendaView(); |
462 | */ | 462 | */ |
463 | 463 | ||
464 | 464 | ||
465 | mFlagShowNextxDays = false; | 465 | mFlagShowNextxDays = false; |
466 | globalFlagBlockAgenda = 1; | 466 | globalFlagBlockAgenda = 1; |
467 | globalFlagBlockLabel = 1; | 467 | globalFlagBlockLabel = 1; |
468 | if ( mCurrentAgendaView != 7 ) | 468 | if ( mCurrentAgendaView != 7 ) |
469 | mCurrentAgendaView = -1; | 469 | mCurrentAgendaView = -1; |
470 | showAgendaView(); | 470 | showAgendaView(); |
471 | qApp->processEvents(); | 471 | qApp->processEvents(); |
472 | globalFlagBlockAgenda = 2; | 472 | globalFlagBlockAgenda = 2; |
473 | globalFlagBlockLabel = 0; | 473 | globalFlagBlockLabel = 0; |
474 | mMainView->dateNavigator()->selectWeek(); | 474 | mMainView->dateNavigator()->selectWeek(); |
475 | mCurrentAgendaView = 7 ; | 475 | mCurrentAgendaView = 7 ; |
476 | } | 476 | } |
477 | 477 | ||
478 | void KOViewManager::showNextXView() | 478 | void KOViewManager::showNextXView() |
479 | { | 479 | { |
480 | 480 | ||
481 | globalFlagBlockAgenda = 1; | 481 | globalFlagBlockAgenda = 1; |
482 | if ( mCurrentAgendaView != 3 ) | 482 | if ( mCurrentAgendaView != 3 ) |
483 | mCurrentAgendaView = -1; | 483 | mCurrentAgendaView = -1; |
484 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 484 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
485 | globalFlagBlockAgenda = 2; | 485 | globalFlagBlockAgenda = 2; |
486 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), | 486 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), |
487 | KOPrefs::instance()->mNextXDays ); | 487 | KOPrefs::instance()->mNextXDays ); |
488 | mFlagShowNextxDays = true; | 488 | mFlagShowNextxDays = true; |
489 | mCurrentAgendaView = 3 ; | 489 | mCurrentAgendaView = 3 ; |
490 | } | 490 | } |
491 | bool KOViewManager::showsNextDays() | 491 | bool KOViewManager::showsNextDays() |
492 | { | 492 | { |
493 | return mFlagShowNextxDays; | 493 | return mFlagShowNextxDays; |
494 | } | 494 | } |
495 | void KOViewManager::showMonthView() | 495 | void KOViewManager::showMonthView() |
496 | { | 496 | { |
497 | if (!mMonthView) { | 497 | if (!mMonthView) { |
498 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 498 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
499 | 499 | ||
500 | addView(mMonthView); | 500 | addView(mMonthView); |
501 | // mMonthView->show(); | 501 | // mMonthView->show(); |
502 | // SIGNALS/SLOTS FOR MONTH VIEW | 502 | // SIGNALS/SLOTS FOR MONTH VIEW |
503 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), | 503 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), |
504 | mMainView, SLOT(newEvent(QDateTime))); | 504 | mMainView, SLOT(newEvent(QDateTime))); |
505 | 505 | ||
506 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), | 506 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), |
507 | mMainView, SLOT(showIncidence(Incidence *))); | 507 | mMainView, SLOT(showIncidence(Incidence *))); |
508 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), | 508 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), |
509 | mMainView, SLOT(editIncidence(Incidence *))); | 509 | mMainView, SLOT(editIncidence(Incidence *))); |
510 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 510 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
511 | mMainView, SLOT(deleteIncidence(Incidence *))); | 511 | mMainView, SLOT(deleteIncidence(Incidence *))); |
512 | 512 | ||
513 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), | 513 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), |
514 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 514 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
515 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 515 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
516 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 516 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
517 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 517 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
518 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 518 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
519 | 519 | ||
520 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 520 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
521 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 521 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
522 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 522 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
523 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 523 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
524 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 524 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
525 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); | 525 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); |
526 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), | 526 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), |
527 | mMainView, SLOT ( showDay( QDate ) ) ); | 527 | mMainView, SLOT ( showDay( QDate ) ) ); |
528 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); | 528 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); |
529 | connect( mMonthView, SIGNAL(nextMonth() ), | 529 | connect( mMonthView, SIGNAL(nextMonth() ), |
530 | mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); | 530 | mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); |
531 | connect( mMonthView, SIGNAL(prevMonth() ), | 531 | connect( mMonthView, SIGNAL(prevMonth() ), |
532 | mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); | 532 | mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); |
533 | connect( mMonthView, SIGNAL( showNavigator(bool) ), | 533 | connect( mMonthView, SIGNAL( showNavigator(bool) ), |
534 | mMainView, SLOT ( showNavigatorBar(bool) ) ); | 534 | mMainView, SLOT ( showNavigatorBar(bool) ) ); |
535 | } | 535 | } |
536 | 536 | ||
537 | globalFlagBlockAgenda = 1; | 537 | globalFlagBlockAgenda = 1; |
538 | //mFlagShowNextxDays = false; | 538 | //mFlagShowNextxDays = false; |
539 | // if(mMonthView == mCurrentView) return; | 539 | // if(mMonthView == mCurrentView) return; |
540 | if ( KOPrefs::instance()->mMonthViewWeek ) | 540 | if ( KOPrefs::instance()->mMonthViewWeek ) |
541 | mMainView->dateNavigator()->selectWeek(); | 541 | mMainView->dateNavigator()->selectWeek(); |
542 | else | 542 | else |
543 | mMainView->dateNavigator()->selectMonth(); | 543 | mMainView->dateNavigator()->selectMonth(); |
544 | 544 | ||
545 | showView(mMonthView, true ); | 545 | showView(mMonthView, true ); |
546 | 546 | ||
547 | } | 547 | } |
548 | 548 | ||
549 | void KOViewManager::showTodoView() | 549 | void KOViewManager::showTodoView() |
550 | { | 550 | { |
551 | //mFlagShowNextxDays = false; | 551 | //mFlagShowNextxDays = false; |
552 | if ( !mTodoView ) { | 552 | if ( !mTodoView ) { |
553 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), | 553 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), |
554 | "KOViewManager::TodoView" ); | 554 | "KOViewManager::TodoView" ); |
555 | 555 | ||
556 | addView( mTodoView ); | 556 | addView( mTodoView ); |
557 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); | 557 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); |
558 | 558 | ||
559 | // SIGNALS/SLOTS FOR TODO VIEW | 559 | // SIGNALS/SLOTS FOR TODO VIEW |
560 | connect( mTodoView, SIGNAL( newTodoSignal() ), | 560 | connect( mTodoView, SIGNAL( newTodoSignal() ), |
561 | mMainView, SLOT( newTodo() ) ); | 561 | mMainView, SLOT( newTodo() ) ); |
562 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), | 562 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), |
563 | mMainView, SLOT( newSubTodo( Todo *) ) ); | 563 | mMainView, SLOT( newSubTodo( Todo *) ) ); |
564 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), | 564 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), |
565 | mMainView, SLOT( showTodo( Todo * ) ) ); | 565 | mMainView, SLOT( showTodo( Todo * ) ) ); |
566 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), | 566 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), |
567 | mMainView, SLOT( editTodo( Todo * ) ) ); | 567 | mMainView, SLOT( editTodo( Todo * ) ) ); |
568 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), | 568 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), |
569 | mMainView, SLOT( deleteTodo( Todo * ) ) ); | 569 | mMainView, SLOT( deleteTodo( Todo * ) ) ); |
570 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), | 570 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), |
571 | mMainView, SLOT( purgeCompleted() ) ); | 571 | mMainView, SLOT( purgeCompleted() ) ); |
572 | 572 | ||
573 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), | 573 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), |
574 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 574 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
575 | 575 | ||
576 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, | 576 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, |
577 | SLOT( updateConfig() ) ); | 577 | SLOT( updateConfig() ) ); |
578 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, | 578 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, |
579 | SLOT( updateTodo( Todo *, int ) ) ); | 579 | SLOT( updateTodo( Todo *, int ) ) ); |
580 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 580 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
581 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); | 581 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); |
582 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), | 582 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), |
583 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 583 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
584 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), | 584 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), |
585 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 585 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
586 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), | 586 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), |
587 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); | 587 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); |
588 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 588 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
589 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); | 589 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); |
590 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), | 590 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), |
591 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 591 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
592 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), | 592 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), |
593 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 593 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
594 | KConfig *config = KOGlobals::config(); | 594 | KConfig *config = KOGlobals::config(); |
595 | mTodoView->restoreLayout(config,"Todo View"); | 595 | mTodoView->restoreLayout(config,"Todo View"); |
596 | mTodoView->setNavigator( mMainView->dateNavigator() ); | 596 | mTodoView->setNavigator( mMainView->dateNavigator() ); |
597 | } | 597 | } |
598 | 598 | ||
599 | globalFlagBlockAgenda = 1; | 599 | globalFlagBlockAgenda = 1; |
600 | showView( mTodoView, true ); | 600 | showView( mTodoView, true ); |
601 | 601 | ||
602 | } | 602 | } |
603 | 603 | ||
604 | void KOViewManager::showJournalView() | 604 | void KOViewManager::showJournalView() |
605 | { | 605 | { |
606 | //mFlagShowNextxDays = false; | 606 | //mFlagShowNextxDays = false; |
607 | if (!mJournalView) { | 607 | if (!mJournalView) { |
608 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), | 608 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), |
609 | "KOViewManager::JournalView"); | 609 | "KOViewManager::JournalView"); |
610 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, | 610 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, |
611 | SLOT( updateConfig() ) ); | 611 | SLOT( updateConfig() ) ); |