-rw-r--r-- | korganizer/koagendaview.cpp | 41 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 1 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 8 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 41 |
4 files changed, 48 insertions, 43 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index aa36553..8c27c43 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -580,284 +580,285 @@ void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | |||
580 | KOAgendaView::~KOAgendaView() | 580 | KOAgendaView::~KOAgendaView() |
581 | { | 581 | { |
582 | delete mAgendaPopup; | 582 | delete mAgendaPopup; |
583 | delete mAllDayAgendaPopup; | 583 | delete mAllDayAgendaPopup; |
584 | delete KOAgendaItem::paintPix(); | 584 | delete KOAgendaItem::paintPix(); |
585 | delete KOAgendaItem::paintPixSel(); | 585 | delete KOAgendaItem::paintPixSel(); |
586 | } | 586 | } |
587 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 587 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
588 | { | 588 | { |
589 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 589 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
590 | bool uc = false; | 590 | bool uc = false; |
591 | int ow = e->oldSize().width(); | 591 | int ow = e->oldSize().width(); |
592 | int oh = e->oldSize().height(); | 592 | int oh = e->oldSize().height(); |
593 | int w = e->size().width(); | 593 | int w = e->size().width(); |
594 | int h = e->size().height(); | 594 | int h = e->size().height(); |
595 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 595 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
596 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 596 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
597 | uc = true; | 597 | uc = true; |
598 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); | 598 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); |
599 | } | 599 | } |
600 | mUpcomingWidth = e->size().width() ; | 600 | mUpcomingWidth = e->size().width() ; |
601 | if ( mBlockUpdating || uc ) { | 601 | if ( mBlockUpdating || uc ) { |
602 | mBlockUpdating = false; | 602 | mBlockUpdating = false; |
603 | //mAgenda->setMinimumSize(800 , 600 ); | 603 | //mAgenda->setMinimumSize(800 , 600 ); |
604 | //qDebug("mAgenda->resize+++++++++++++++ "); | 604 | //qDebug("mAgenda->resize+++++++++++++++ "); |
605 | updateConfig(); | 605 | updateConfig(); |
606 | //qDebug("KOAgendaView::Updating now possible "); | 606 | //qDebug("KOAgendaView::Updating now possible "); |
607 | } else | 607 | } else |
608 | createDayLabels(); | 608 | createDayLabels(); |
609 | //qDebug("resizeEvent end "); | 609 | //qDebug("resizeEvent end "); |
610 | 610 | ||
611 | } | 611 | } |
612 | void KOAgendaView::slotDaylabelClicked() | 612 | void KOAgendaView::slotDaylabelClicked() |
613 | { | 613 | { |
614 | QString cap = ((QPushButton*) sender() )->caption(); | 614 | QString cap = ((QPushButton*) sender() )->caption(); |
615 | 615 | ||
616 | QDate firstDate = mSelectedDates.first(); | 616 | QDate firstDate = mSelectedDates.first(); |
617 | if ( cap == "0" ) | 617 | if ( cap == "0" ) |
618 | emit showDateView( 6, firstDate ); | 618 | emit showDateView( 6, firstDate ); |
619 | else if ( cap != "last" ) { | 619 | else if ( cap != "last" ) { |
620 | if ( mSelectedDates.count() == 1) | 620 | if ( mSelectedDates.count() == 1) |
621 | emit showDateView( 9, firstDate.addDays( cap.toInt()-1 ) ); | 621 | emit showDateView( 9, firstDate.addDays( cap.toInt()-1 ) ); |
622 | else | 622 | else |
623 | emit showDateView( 3, firstDate.addDays( cap.toInt()-1 ) ); | 623 | emit showDateView( 3, firstDate.addDays( cap.toInt()-1 ) ); |
624 | } | 624 | } |
625 | else | 625 | else |
626 | showDateView( 10, firstDate.addDays(1 ) ); | 626 | showDateView( 10, firstDate.addDays(1 ) ); |
627 | } | 627 | } |
628 | |||
629 | QPushButton* KOAgendaView::getNewDaylabel() | ||
630 | { | ||
631 | |||
632 | QPushButton * dayLabel = new QPushButton(mDayLabels); | ||
633 | dayLabel->setFlat( true ); | ||
634 | connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) ); | ||
635 | dayLabel->setFocusPolicy(NoFocus); | ||
636 | dayLabel->setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); | ||
637 | mDayLabelsList.append( dayLabel ); | ||
638 | mLayoutDayLabels->addWidget(dayLabel); | ||
639 | //mLayoutDayLabels->setStretchFactor(dayLabel, 100); | ||
640 | return dayLabel ; | ||
641 | } | ||
642 | |||
628 | void KOAgendaView::createDayLabels() | 643 | void KOAgendaView::createDayLabels() |
629 | { | 644 | { |
630 | 645 | ||
631 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { | 646 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { |
632 | // qDebug(" KOAgendaView::createDayLabels() blocked "); | 647 | // qDebug(" KOAgendaView::createDayLabels() blocked "); |
633 | return; | 648 | return; |
634 | 649 | ||
635 | } | 650 | } |
636 | int newHight; | 651 | int newHight; |
637 | 652 | ||
638 | // ### Before deleting and recreating we could check if mSelectedDates changed... | 653 | // ### Before deleting and recreating we could check if mSelectedDates changed... |
639 | // It would remove some flickering and gain speed (since this is called by | 654 | // It would remove some flickering and gain speed (since this is called by |
640 | // each updateView() call) | 655 | // each updateView() call) |
641 | 656 | ||
642 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; | 657 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; |
643 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); | 658 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); |
644 | if ( maxWid < 0 ) | 659 | if ( maxWid < 0 ) |
645 | maxWid = 20; | 660 | maxWid = 20; |
646 | 661 | ||
647 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; | 662 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; |
648 | QFontMetrics fm ( dlf ); | 663 | QFontMetrics fm ( dlf ); |
649 | int selCount = mSelectedDates.count(); | 664 | int selCount = mSelectedDates.count(); |
650 | QString dayTest = "Mon 20"; | 665 | QString dayTest = "Mon 20"; |
651 | int wid = fm.width( dayTest ); | 666 | int wid = fm.width( dayTest ); |
652 | maxWid -= ( selCount * 3 ); | 667 | //maxWid -= ( selCount * 3 ); //working for QLabels |
668 | maxWid -= ( selCount * 5 ); //working for QPushButton | ||
653 | if ( maxWid < 0 ) | 669 | if ( maxWid < 0 ) |
654 | maxWid = 20; | 670 | maxWid = 20; |
655 | int needWid = wid * selCount; | 671 | int needWid = wid * selCount; |
656 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); | 672 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); |
657 | //if ( needWid > maxWid ) | 673 | //if ( needWid > maxWid ) |
658 | // qDebug("DAYLABELS TOOOOOOO BIG "); | 674 | // qDebug("DAYLABELS TOOOOOOO BIG "); |
659 | while ( needWid > maxWid ) { | 675 | while ( needWid > maxWid ) { |
660 | dayTest = dayTest.left( dayTest.length() - 1 ); | 676 | dayTest = dayTest.left( dayTest.length() - 1 ); |
661 | wid = fm.width( dayTest ); | 677 | wid = fm.width( dayTest ); |
662 | needWid = wid * selCount; | 678 | needWid = wid * selCount; |
663 | } | 679 | } |
664 | int maxLen = dayTest.length(); | 680 | int maxLen = dayTest.length(); |
665 | int fontPoint = dlf.pointSize(); | 681 | int fontPoint = dlf.pointSize(); |
666 | if ( maxLen < 2 ) { | 682 | if ( maxLen < 2 ) { |
667 | int fontPoint = dlf.pointSize(); | 683 | int fontPoint = dlf.pointSize(); |
668 | while ( fontPoint > 4 ) { | 684 | while ( fontPoint > 4 ) { |
669 | --fontPoint; | 685 | --fontPoint; |
670 | dlf.setPointSize( fontPoint ); | 686 | dlf.setPointSize( fontPoint ); |
671 | QFontMetrics f( dlf ); | 687 | QFontMetrics f( dlf ); |
672 | wid = f.width( "20" ); | 688 | wid = f.width( "20" )+2; |
673 | needWid = wid * selCount; | 689 | needWid = wid * selCount; |
674 | if ( needWid < maxWid ) | 690 | if ( needWid < maxWid ) |
675 | break; | 691 | break; |
676 | } | 692 | } |
677 | maxLen = 2; | 693 | maxLen = 2; |
678 | } | 694 | } |
679 | //qDebug("Max len %d ", dayTest.length() ); | 695 | //qDebug("Max len %d ", dayTest.length() ); |
680 | 696 | ||
681 | QFontMetrics tempF( dlf ); | 697 | QFontMetrics tempF( dlf ); |
682 | newHight = tempF.height(); | 698 | newHight = tempF.height(); |
683 | mDayLabels->setFont( dlf ); | 699 | mDayLabels->setFont( dlf ); |
684 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; | 700 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; |
685 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); | 701 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); |
686 | //mLayoutDayLabels->addSpacing( 2 ); | 702 | //mLayoutDayLabels->addSpacing( 2 ); |
687 | // QFont lFont = dlf; | 703 | // QFont lFont = dlf; |
688 | bool appendLabels = false; | 704 | bool appendLabels = false; |
689 | QPushButton *dayLabel; | 705 | QPushButton *dayLabel; |
690 | dayLabel = mDayLabelsList.first(); | 706 | dayLabel = mDayLabelsList.first(); |
691 | if ( !dayLabel ) { | 707 | if ( !dayLabel ) { |
692 | appendLabels = true; | 708 | appendLabels = true; |
693 | dayLabel = new QPushButton(mDayLabels); | 709 | dayLabel = getNewDaylabel(); |
694 | dayLabel->setFlat( true ); | ||
695 | connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) ); | ||
696 | dayLabel->setFocusPolicy(NoFocus); | ||
697 | mDayLabelsList.append( dayLabel ); | ||
698 | mLayoutDayLabels->addWidget(dayLabel); | ||
699 | } | 710 | } |
700 | dayLabel->setFixedWidth( mTimeLabels->width()+2 ); | 711 | dayLabel->setFixedWidth( mTimeLabels->width()+2 ); |
701 | dayLabel->setFont( dlf ); | 712 | dayLabel->setFont( dlf ); |
702 | dayLabel->setCaption("0"); | 713 | dayLabel->setCaption("0"); |
703 | //dayLabel->setAlignment(QLabel::AlignHCenter); | 714 | //dayLabel->setAlignment(QLabel::AlignHCenter); |
704 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); | 715 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); |
705 | dayLabel->show(); | 716 | dayLabel->show(); |
706 | DateList::ConstIterator dit; | 717 | DateList::ConstIterator dit; |
707 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); | 718 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); |
708 | int counter = 0; | 719 | int counter = 0; |
709 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 720 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
710 | ++counter; | 721 | ++counter; |
711 | QDate date = *dit; | 722 | QDate date = *dit; |
712 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); | 723 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); |
713 | if ( ! appendLabels ) { | 724 | if ( ! appendLabels ) { |
714 | dayLabel = mDayLabelsList.next(); | 725 | dayLabel = mDayLabelsList.next(); |
715 | if ( !dayLabel ) | 726 | if ( !dayLabel ) |
716 | appendLabels = true; | 727 | appendLabels = true; |
717 | } | 728 | } |
718 | if ( appendLabels ) { | 729 | if ( appendLabels ) { |
719 | dayLabel = new QPushButton(mDayLabels); | 730 | dayLabel = getNewDaylabel(); |
720 | dayLabel->setFlat( true ); | ||
721 | connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) ); | ||
722 | dayLabel->setFocusPolicy(NoFocus); | ||
723 | mDayLabelsList.append( dayLabel ); | ||
724 | mLayoutDayLabels->addWidget(dayLabel); | ||
725 | } | 731 | } |
726 | dayLabel->setMinimumWidth( 1 ); | 732 | dayLabel->setMinimumWidth( 1 ); |
727 | dayLabel->setMaximumWidth( 2048 ); | 733 | dayLabel->setMaximumWidth( 2048 ); |
728 | dayLabel->setFont( dlf ); | 734 | dayLabel->setFont( dlf ); |
729 | dayLabel->show(); | 735 | dayLabel->show(); |
730 | dayLabel->setCaption(QString::number( counter )); | 736 | dayLabel->setCaption(QString::number( counter )); |
731 | QString str; | 737 | QString str; |
732 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); | 738 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); |
733 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); | 739 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); |
734 | switch ( maxLen ) { | 740 | switch ( maxLen ) { |
735 | case 2: | 741 | case 2: |
736 | str = QString::number( date.day() ); | 742 | str = QString::number( date.day() ); |
737 | break; | 743 | break; |
738 | 744 | ||
739 | case 3: | 745 | case 3: |
740 | str = dayName.left( 1 ) +QString::number( date.day()); | 746 | str = dayName.left( 1 ) +QString::number( date.day()); |
741 | 747 | ||
742 | break; | 748 | break; |
743 | case 4: | 749 | case 4: |
744 | str = dayName.left( 1 ) + " " +QString::number( date.day()); | 750 | str = dayName.left( 1 ) + " " +QString::number( date.day()); |
745 | 751 | ||
746 | break; | 752 | break; |
747 | case 5: | 753 | case 5: |
748 | str = dayName.left( 2 ) + " " +QString::number( date.day()); | 754 | str = dayName.left( 2 ) + " " +QString::number( date.day()); |
749 | 755 | ||
750 | break; | 756 | break; |
751 | case 6: | 757 | case 6: |
752 | str = dayName.left( 3 ) + " " +QString::number( date.day()); | 758 | str = dayName.left( 3 ) + " " +QString::number( date.day()); |
753 | break; | 759 | break; |
754 | 760 | ||
755 | default: | 761 | default: |
756 | break; | 762 | break; |
757 | } | 763 | } |
758 | if ( oneday ) { | 764 | if ( oneday ) { |
759 | QString addString; | 765 | QString addString; |
760 | if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) | 766 | if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) |
761 | addString = i18n("Today"); | 767 | addString = i18n("Today"); |
762 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) | 768 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) |
763 | addString = i18n("Tomorrow"); | 769 | addString = i18n("Tomorrow"); |
764 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) | 770 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) |
765 | addString = i18n("Yesterday"); | 771 | addString = i18n("Yesterday"); |
766 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) | 772 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) |
767 | addString = i18n("Day before yesterday"); | 773 | addString = i18n("Day before yesterday"); |
768 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) | 774 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) |
769 | addString = i18n("Day after tomorrow"); | 775 | addString = i18n("Day after tomorrow"); |
770 | if ( !addString.isEmpty() ) { | 776 | if ( !addString.isEmpty() ) { |
771 | str = addString+", " + str; | 777 | str = addString+", " + str; |
772 | } | 778 | } |
773 | } | 779 | } |
774 | dayLabel->setText(str); | 780 | dayLabel->setText(str); |
775 | //dayLabel->setAlignment(QLabel::AlignHCenter); | 781 | //dayLabel->setAlignment(QLabel::AlignHCenter); |
776 | if (date == QDate::currentDate()) { | 782 | if (date == QDate::currentDate()) { |
777 | QFont bFont = dlf; | 783 | QFont bFont = dlf; |
778 | bFont.setBold( true ); | 784 | bFont.setBold( true ); |
779 | dayLabel->setFont(bFont); | 785 | dayLabel->setFont(bFont); |
780 | } | 786 | } |
781 | //dayLayout->addWidget(dayLabel); | 787 | //dayLayout->addWidget(dayLabel); |
782 | 788 | ||
783 | #ifndef KORG_NOPLUGINS | 789 | #ifndef KORG_NOPLUGINS |
784 | CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); | 790 | CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); |
785 | CalendarDecoration *it; | 791 | CalendarDecoration *it; |
786 | for(it = cds.first(); it; it = cds.next()) { | 792 | for(it = cds.first(); it; it = cds.next()) { |
787 | QString text = it->shortText( date ); | 793 | QString text = it->shortText( date ); |
788 | if ( !text.isEmpty() ) { | 794 | if ( !text.isEmpty() ) { |
789 | QLabel *label = new QLabel(text,mDayLabels); | 795 | QLabel *label = new QLabel(text,mDayLabels); |
790 | label->setAlignment(AlignCenter); | 796 | label->setAlignment(AlignCenter); |
791 | dayLayout->addWidget(label); | 797 | dayLayout->addWidget(label); |
792 | } | 798 | } |
793 | } | 799 | } |
794 | 800 | ||
795 | for(it = cds.first(); it; it = cds.next()) { | 801 | for(it = cds.first(); it; it = cds.next()) { |
796 | QWidget *wid = it->smallWidget(mDayLabels,date); | 802 | QWidget *wid = it->smallWidget(mDayLabels,date); |
797 | if ( wid ) { | 803 | if ( wid ) { |
798 | // wid->setHeight(20); | 804 | // wid->setHeight(20); |
799 | dayLayout->addWidget(wid); | 805 | dayLayout->addWidget(wid); |
800 | } | 806 | } |
801 | } | 807 | } |
802 | #endif | 808 | #endif |
803 | } | 809 | } |
804 | if ( ! appendLabels ) { | 810 | if ( ! appendLabels ) { |
805 | dayLabel = mDayLabelsList.next(); | 811 | dayLabel = mDayLabelsList.next(); |
806 | if ( !dayLabel ) | 812 | if ( !dayLabel ) |
807 | appendLabels = true; | 813 | appendLabels = true; |
808 | } | 814 | } |
809 | if ( appendLabels ) { | 815 | if ( appendLabels ) { |
810 | dayLabel = new QPushButton(mDayLabels); | 816 | dayLabel = getNewDaylabel(); |
811 | dayLabel->setFlat( true ); | ||
812 | connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) ); | ||
813 | dayLabel->setFocusPolicy(NoFocus); | ||
814 | mDayLabelsList.append( dayLabel ); | ||
815 | mLayoutDayLabels->addWidget(dayLabel); | ||
816 | } | 817 | } |
817 | //dayLabel->hide();//test only | 818 | //dayLabel->hide();//test only |
818 | 819 | ||
819 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; | 820 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; |
820 | if ( offset < 0 ) offset = 0; | 821 | if ( offset < 0 ) offset = 0; |
821 | //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); | 822 | //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); |
822 | dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); | 823 | dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); |
823 | dayLabel->setFont( dlf ); | 824 | dayLabel->setFont( dlf ); |
824 | dayLabel->show(); | 825 | dayLabel->show(); |
825 | dayLabel->setCaption("last"); | 826 | dayLabel->setCaption("last"); |
826 | dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); | 827 | dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); |
827 | //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); | 828 | //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); |
828 | //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); | 829 | //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); |
829 | if ( !appendLabels ) { | 830 | if ( !appendLabels ) { |
830 | dayLabel = mDayLabelsList.next(); | 831 | dayLabel = mDayLabelsList.next(); |
831 | while ( dayLabel ) { | 832 | while ( dayLabel ) { |
832 | //qDebug("!dayLabel %d",dayLabel ); | 833 | //qDebug("!dayLabel %d",dayLabel ); |
833 | dayLabel->hide(); | 834 | dayLabel->hide(); |
834 | dayLabel = mDayLabelsList.next(); | 835 | dayLabel = mDayLabelsList.next(); |
835 | } | 836 | } |
836 | } | 837 | } |
837 | //mDayLabelsFrame->show(); | 838 | //mDayLabelsFrame->show(); |
838 | //mDayLabels->show(); | 839 | //mDayLabels->show(); |
839 | //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight); | 840 | //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight); |
840 | //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight ); | 841 | //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight ); |
841 | mDayLabelsFrame->setFixedHeight( newHight ); | 842 | mDayLabelsFrame->setFixedHeight( newHight ); |
842 | } | 843 | } |
843 | 844 | ||
844 | int KOAgendaView::maxDatesHint() | 845 | int KOAgendaView::maxDatesHint() |
845 | { | 846 | { |
846 | // Not sure about the max number of events, so return 0 for now. | 847 | // Not sure about the max number of events, so return 0 for now. |
847 | return 0; | 848 | return 0; |
848 | } | 849 | } |
849 | 850 | ||
850 | int KOAgendaView::currentDateCount() | 851 | int KOAgendaView::currentDateCount() |
851 | { | 852 | { |
852 | return mSelectedDates.count(); | 853 | return mSelectedDates.count(); |
853 | } | 854 | } |
854 | 855 | ||
855 | QPtrList<Incidence> KOAgendaView::selectedIncidences() | 856 | QPtrList<Incidence> KOAgendaView::selectedIncidences() |
856 | { | 857 | { |
857 | QPtrList<Incidence> selected; | 858 | QPtrList<Incidence> selected; |
858 | Incidence *incidence; | 859 | Incidence *incidence; |
859 | 860 | ||
860 | incidence = mAgenda->selectedIncidence(); | 861 | incidence = mAgenda->selectedIncidence(); |
861 | if (incidence) selected.append(incidence); | 862 | if (incidence) selected.append(incidence); |
862 | 863 | ||
863 | incidence = mAllDayAgenda->selectedIncidence(); | 864 | incidence = mAllDayAgenda->selectedIncidence(); |
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index fd0a7af..cbe86b6 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h | |||
@@ -145,96 +145,97 @@ class KOAgendaView : public KOEventView { | |||
145 | /** start-datetime of selection */ | 145 | /** start-datetime of selection */ |
146 | QDateTime selectionStart() {return mTimeSpanBegin;} | 146 | QDateTime selectionStart() {return mTimeSpanBegin;} |
147 | /** end-datetime of selection */ | 147 | /** end-datetime of selection */ |
148 | QDateTime selectionEnd() {return mTimeSpanEnd;} | 148 | QDateTime selectionEnd() {return mTimeSpanEnd;} |
149 | /** returns true if selection is for whole day */ | 149 | /** returns true if selection is for whole day */ |
150 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} | 150 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} |
151 | /** make selected start/end invalid */ | 151 | /** make selected start/end invalid */ |
152 | void deleteSelectedDateTime(); | 152 | void deleteSelectedDateTime(); |
153 | void repaintAgenda(); | 153 | void repaintAgenda(); |
154 | public slots: | 154 | public slots: |
155 | virtual void updateView(); | 155 | virtual void updateView(); |
156 | virtual void updateConfig(); | 156 | virtual void updateConfig(); |
157 | virtual void showDates(const QDate &start, const QDate &end); | 157 | virtual void showDates(const QDate &start, const QDate &end); |
158 | virtual void showEvents(QPtrList<Event> eventList); | 158 | virtual void showEvents(QPtrList<Event> eventList); |
159 | 159 | ||
160 | void updateTodo( Todo *, int ); | 160 | void updateTodo( Todo *, int ); |
161 | void changeEventDisplay(Event *, int); | 161 | void changeEventDisplay(Event *, int); |
162 | 162 | ||
163 | void clearSelection(); | 163 | void clearSelection(); |
164 | 164 | ||
165 | void newTodo(int gx,int gy); | 165 | void newTodo(int gx,int gy); |
166 | void newEvent(int gx,int gy); | 166 | void newEvent(int gx,int gy); |
167 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); | 167 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); |
168 | void newEventAllDay(int gx, int gy); | 168 | void newEventAllDay(int gx, int gy); |
169 | void newTodoAllDay(int gx, int gy); | 169 | void newTodoAllDay(int gx, int gy); |
170 | 170 | ||
171 | void startDrag(Event *); | 171 | void startDrag(Event *); |
172 | 172 | ||
173 | void readSettings(); | 173 | void readSettings(); |
174 | void readSettings(KConfig *); | 174 | void readSettings(KConfig *); |
175 | void writeSettings(KConfig *); | 175 | void writeSettings(KConfig *); |
176 | 176 | ||
177 | void setContentsPos(int y); | 177 | void setContentsPos(int y); |
178 | 178 | ||
179 | void setExpandedButton( bool expanded ); | 179 | void setExpandedButton( bool expanded ); |
180 | void scrollOneHourUp(); | 180 | void scrollOneHourUp(); |
181 | void scrollOneHourDown(); | 181 | void scrollOneHourDown(); |
182 | void addToCalSlot(Incidence *, Incidence *); | 182 | void addToCalSlot(Incidence *, Incidence *); |
183 | 183 | ||
184 | signals: | 184 | signals: |
185 | void showDateView( int, QDate ); | 185 | void showDateView( int, QDate ); |
186 | void newTodoSignal( QDateTime ,bool ); | 186 | void newTodoSignal( QDateTime ,bool ); |
187 | void toggleExpand(); | 187 | void toggleExpand(); |
188 | void todoMoved( Todo *, int ); | 188 | void todoMoved( Todo *, int ); |
189 | void incidenceChanged(Incidence * , int ); | 189 | void incidenceChanged(Incidence * , int ); |
190 | // void cloneIncidenceSignal(Incidence *); | 190 | // void cloneIncidenceSignal(Incidence *); |
191 | 191 | ||
192 | protected: | 192 | protected: |
193 | QPushButton* getNewDaylabel(); | ||
193 | bool mBlockUpdating; | 194 | bool mBlockUpdating; |
194 | int mUpcomingWidth; | 195 | int mUpcomingWidth; |
195 | /** Fill agenda beginning with date startDate */ | 196 | /** Fill agenda beginning with date startDate */ |
196 | void fillAgenda(const QDate &startDate); | 197 | void fillAgenda(const QDate &startDate); |
197 | void resizeEvent( QResizeEvent* e ); | 198 | void resizeEvent( QResizeEvent* e ); |
198 | /** Fill agenda using the current set value for the start date */ | 199 | /** Fill agenda using the current set value for the start date */ |
199 | void fillAgenda(); | 200 | void fillAgenda(); |
200 | 201 | ||
201 | /** Create labels for the selected dates. */ | 202 | /** Create labels for the selected dates. */ |
202 | void createDayLabels(); | 203 | void createDayLabels(); |
203 | 204 | ||
204 | /** | 205 | /** |
205 | Set the masks on the agenda widgets indicating, which days are holidays. | 206 | Set the masks on the agenda widgets indicating, which days are holidays. |
206 | */ | 207 | */ |
207 | void setHolidayMasks(); | 208 | void setHolidayMasks(); |
208 | 209 | ||
209 | protected slots: | 210 | protected slots: |
210 | void slotDaylabelClicked(); | 211 | void slotDaylabelClicked(); |
211 | /** Update event belonging to agenda item */ | 212 | /** Update event belonging to agenda item */ |
212 | void updateEventDates(KOAgendaItem *item, int mode = -1); | 213 | void updateEventDates(KOAgendaItem *item, int mode = -1); |
213 | //void updateMovedTodo(); | 214 | //void updateMovedTodo(); |
214 | 215 | ||
215 | void updateEventIndicatorTop(int newY); | 216 | void updateEventIndicatorTop(int newY); |
216 | void updateEventIndicatorBottom(int newY); | 217 | void updateEventIndicatorBottom(int newY); |
217 | 218 | ||
218 | /** Updates data for selected timespan */ | 219 | /** Updates data for selected timespan */ |
219 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); | 220 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); |
220 | /** Updates data for selected timespan for all day event*/ | 221 | /** Updates data for selected timespan for all day event*/ |
221 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); | 222 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); |
222 | 223 | ||
223 | private: | 224 | private: |
224 | // view widgets | 225 | // view widgets |
225 | QFrame *mDayLabels; | 226 | QFrame *mDayLabels; |
226 | QHBox *mDayLabelsFrame; | 227 | QHBox *mDayLabelsFrame; |
227 | QBoxLayout *mLayoutDayLabels; | 228 | QBoxLayout *mLayoutDayLabels; |
228 | QFrame *mAllDayFrame; | 229 | QFrame *mAllDayFrame; |
229 | KOAgenda *mAllDayAgenda; | 230 | KOAgenda *mAllDayAgenda; |
230 | KOAgenda *mAgenda; | 231 | KOAgenda *mAgenda; |
231 | TimeLabels *mTimeLabels; | 232 | TimeLabels *mTimeLabels; |
232 | QWidget *mDummyAllDayLeft; | 233 | QWidget *mDummyAllDayLeft; |
233 | 234 | ||
234 | KDGanttMinimizeSplitter* mSplitterAgenda; | 235 | KDGanttMinimizeSplitter* mSplitterAgenda; |
235 | QPushButton *mExpandButton; | 236 | QPushButton *mExpandButton; |
236 | 237 | ||
237 | DateList mSelectedDates; // List of dates to be displayed | 238 | DateList mSelectedDates; // List of dates to be displayed |
238 | int mViewType; | 239 | int mViewType; |
239 | 240 | ||
240 | bool mWeekStartsMonday; | 241 | bool mWeekStartsMonday; |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index dd83d48..989f758 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -295,136 +295,136 @@ void KODayMatrix::updateView(QDate actdate) | |||
295 | } | 295 | } |
296 | } | 296 | } |
297 | 297 | ||
298 | const QDate& KODayMatrix::getDate(int offset) | 298 | const QDate& KODayMatrix::getDate(int offset) |
299 | { | 299 | { |
300 | if (offset < 0 || offset > NUMDAYS-1) { | 300 | if (offset < 0 || offset > NUMDAYS-1) { |
301 | qDebug("Wrong offset2 "); | 301 | qDebug("Wrong offset2 "); |
302 | return days[0]; | 302 | return days[0]; |
303 | } | 303 | } |
304 | return days[offset]; | 304 | return days[offset]; |
305 | } | 305 | } |
306 | 306 | ||
307 | QString KODayMatrix::getHolidayLabel(int offset) | 307 | QString KODayMatrix::getHolidayLabel(int offset) |
308 | { | 308 | { |
309 | if (offset < 0 || offset > NUMDAYS-1) { | 309 | if (offset < 0 || offset > NUMDAYS-1) { |
310 | qDebug("Wrong offset1 "); | 310 | qDebug("Wrong offset1 "); |
311 | return 0; | 311 | return 0; |
312 | } | 312 | } |
313 | return mHolidays[offset]; | 313 | return mHolidays[offset]; |
314 | } | 314 | } |
315 | 315 | ||
316 | int KODayMatrix::getDayIndexFrom(int x, int y) | 316 | int KODayMatrix::getDayIndexFrom(int x, int y) |
317 | { | 317 | { |
318 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? | 318 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? |
319 | 6 - x/daysize.width() : x/daysize.width()); | 319 | 6 - x/daysize.width() : x/daysize.width()); |
320 | } | 320 | } |
321 | 321 | ||
322 | // ---------------------------------------------------------------------------- | 322 | // ---------------------------------------------------------------------------- |
323 | // M O U S E E V E N T H A N D L I N G | 323 | // M O U S E E V E N T H A N D L I N G |
324 | // ---------------------------------------------------------------------------- | 324 | // ---------------------------------------------------------------------------- |
325 | 325 | ||
326 | void KODayMatrix::mousePressEvent (QMouseEvent* e) | 326 | void KODayMatrix::mousePressEvent (QMouseEvent* e) |
327 | { | 327 | { |
328 | mSelStart = getDayIndexFrom(e->x(), e->y()); | 328 | mSelStart = getDayIndexFrom(e->x(), e->y()); |
329 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; | 329 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; |
330 | mSelInit = mSelStart; | 330 | mSelInit = mSelStart; |
331 | } | 331 | } |
332 | 332 | ||
333 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) | 333 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) |
334 | { | 334 | { |
335 | 335 | ||
336 | int tmp = getDayIndexFrom(e->x(), e->y()); | 336 | int tmp = getDayIndexFrom(e->x(), e->y()); |
337 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 337 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
338 | 338 | ||
339 | if (mSelInit > tmp) { | 339 | if (mSelInit > tmp) { |
340 | mSelEnd = mSelInit; | 340 | mSelEnd = mSelInit; |
341 | if (tmp != mSelStart) { | 341 | if (tmp != mSelStart) { |
342 | mSelStart = tmp; | 342 | mSelStart = tmp; |
343 | repaint(); | 343 | repaint(false); |
344 | } | 344 | } |
345 | } else { | 345 | } else { |
346 | mSelStart = mSelInit; | 346 | mSelStart = mSelInit; |
347 | 347 | ||
348 | //repaint only if selection has changed | 348 | //repaint only if selection has changed |
349 | if (tmp != mSelEnd) { | 349 | if (tmp != mSelEnd) { |
350 | mSelEnd = tmp; | 350 | mSelEnd = tmp; |
351 | repaint(); | 351 | repaint(false); |
352 | } | 352 | } |
353 | } | 353 | } |
354 | 354 | ||
355 | DateList daylist; | 355 | DateList daylist; |
356 | if ( mSelStart < 0 ) | 356 | if ( mSelStart < 0 ) |
357 | mSelStart = 0; | 357 | mSelStart = 0; |
358 | for (int i = mSelStart; i <= mSelEnd; i++) { | 358 | for (int i = mSelStart; i <= mSelEnd; i++) { |
359 | daylist.append(days[i]); | 359 | daylist.append(days[i]); |
360 | } | 360 | } |
361 | emit selected((const DateList)daylist); | 361 | emit selected((const DateList)daylist); |
362 | 362 | ||
363 | } | 363 | } |
364 | 364 | ||
365 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) | 365 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) |
366 | { | 366 | { |
367 | int tmp = getDayIndexFrom(e->x(), e->y()); | 367 | int tmp = getDayIndexFrom(e->x(), e->y()); |
368 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 368 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
369 | 369 | ||
370 | if (mSelInit > tmp) { | 370 | if (mSelInit > tmp) { |
371 | mSelEnd = mSelInit; | 371 | mSelEnd = mSelInit; |
372 | if (tmp != mSelStart) { | 372 | if (tmp != mSelStart) { |
373 | mSelStart = tmp; | 373 | mSelStart = tmp; |
374 | repaint(); | 374 | repaint(false); |
375 | } | 375 | } |
376 | } else { | 376 | } else { |
377 | mSelStart = mSelInit; | 377 | mSelStart = mSelInit; |
378 | 378 | ||
379 | //repaint only if selection has changed | 379 | //repaint only if selection has changed |
380 | if (tmp != mSelEnd) { | 380 | if (tmp != mSelEnd) { |
381 | mSelEnd = tmp; | 381 | mSelEnd = tmp; |
382 | repaint(); | 382 | repaint(false); |
383 | } | 383 | } |
384 | } | 384 | } |
385 | } | 385 | } |
386 | 386 | ||
387 | // ---------------------------------------------------------------------------- | 387 | // ---------------------------------------------------------------------------- |
388 | // D R A G ' N D R O P H A N D L I N G | 388 | // D R A G ' N D R O P H A N D L I N G |
389 | // ---------------------------------------------------------------------------- | 389 | // ---------------------------------------------------------------------------- |
390 | 390 | ||
391 | void KODayMatrix::dragEnterEvent(QDragEnterEvent *e) | 391 | void KODayMatrix::dragEnterEvent(QDragEnterEvent *e) |
392 | { | 392 | { |
393 | #ifndef KORG_NODND | 393 | #ifndef KORG_NODND |
394 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 394 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
395 | e->ignore(); | 395 | e->ignore(); |
396 | return; | 396 | return; |
397 | } | 397 | } |
398 | 398 | ||
399 | // some visual feedback | 399 | // some visual feedback |
400 | // oldPalette = palette(); | 400 | // oldPalette = palette(); |
401 | // setPalette(my_HilitePalette); | 401 | // setPalette(my_HilitePalette); |
402 | // update(); | 402 | // update(); |
403 | #endif | 403 | #endif |
404 | } | 404 | } |
405 | 405 | ||
406 | void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) | 406 | void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) |
407 | { | 407 | { |
408 | #ifndef KORG_NODND | 408 | #ifndef KORG_NODND |
409 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 409 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
410 | e->ignore(); | 410 | e->ignore(); |
411 | return; | 411 | return; |
412 | } | 412 | } |
413 | 413 | ||
414 | e->accept(); | 414 | e->accept(); |
415 | #endif | 415 | #endif |
416 | } | 416 | } |
417 | 417 | ||
418 | void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) | 418 | void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) |
419 | { | 419 | { |
420 | #ifndef KORG_NODND | 420 | #ifndef KORG_NODND |
421 | // setPalette(oldPalette); | 421 | // setPalette(oldPalette); |
422 | // update(); | 422 | // update(); |
423 | #endif | 423 | #endif |
424 | } | 424 | } |
425 | 425 | ||
426 | void KODayMatrix::dropEvent(QDropEvent *e) | 426 | void KODayMatrix::dropEvent(QDropEvent *e) |
427 | { | 427 | { |
428 | #ifndef KORG_NODND | 428 | #ifndef KORG_NODND |
429 | // kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; | 429 | // kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; |
430 | 430 | ||
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 188ad23..7e126d9 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -53,149 +53,152 @@ | |||
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 | |||
102 | void KOViewManager::showDateView( int view, QDate date) | 101 | void KOViewManager::showDateView( int view, QDate date) |
103 | { | 102 | { |
104 | 103 | static int lastMode = 0; | |
104 | static int lastCount = 0; | ||
105 | static bool lastNDMode = false; | ||
106 | static QDate lastDate; | ||
105 | //qDebug("date %d %s", view, date.toString().latin1()); | 107 | //qDebug("date %d %s", view, date.toString().latin1()); |
106 | #if 0 | 108 | |
107 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); | 109 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); |
108 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next Week"),4 ); | 110 | bool savemFlagShowNextxDays = mFlagShowNextxDays; |
109 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Two Weeks"),5 ); | 111 | mFlagShowNextxDays = false; |
110 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Month"),6 ); | ||
111 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); | ||
112 | #endif | ||
113 | if ( view == 3 ) { | 112 | if ( view == 3 ) { |
114 | //mCurrentAgendaView = 1 ; | 113 | //mCurrentAgendaView = 1 ; |
114 | lastDate = mMainView->dateNavigator()->selectedDates().first(); | ||
115 | lastCount = mMainView->dateNavigator()->selectedDates().count(); | ||
116 | lastNDMode = savemFlagShowNextxDays; | ||
115 | mMainView->showDay( date ); | 117 | mMainView->showDay( date ); |
116 | } else if (view == 4 ) { | 118 | } else if (view == 4 ) { |
117 | mCurrentAgendaView = 7 ; | 119 | mCurrentAgendaView = 7 ; |
118 | mMainView->dateNavigator()->selectDates( date, 7 ); | 120 | mMainView->dateNavigator()->selectDates( date, 7 ); |
119 | } else if (view == 5 ) { | 121 | } else if (view == 5 ) { |
120 | mCurrentAgendaView = 14 ; | 122 | mCurrentAgendaView = 14 ; |
121 | mMainView->dateNavigator()->selectDates( date, 14); | 123 | mMainView->dateNavigator()->selectDates( date, 14); |
122 | } else if (view == 6 ) { | 124 | } else if (view == 6 ) { |
123 | mMainView->dateNavigator()->blockSignals( true ); | 125 | mMainView->dateNavigator()->blockSignals( true ); |
124 | showMonthView(); | 126 | showMonthView(); |
125 | mMainView->dateNavigator()->selectMonthByDate( date ); | 127 | mMainView->dateNavigator()->selectMonthByDate( date ); |
126 | mMainView->dateNavigator()->blockSignals( false ); | 128 | mMainView->dateNavigator()->blockSignals( false ); |
127 | mMainView->dateNavigator()->selectDate( date ); | 129 | mMainView->dateNavigator()->selectDate( date ); |
128 | } else if (view == 7 ) { | 130 | } else if (view == 7 ) { |
129 | mMainView->dateNavigator()->selectDate( date ); | 131 | mMainView->dateNavigator()->selectDate( date ); |
130 | showJournalView(); | 132 | showJournalView(); |
131 | } else if (view == 8 ) { | 133 | } else if (view == 8 ) { |
132 | globalFlagBlockAgenda = 1; | 134 | globalFlagBlockAgenda = 1; |
133 | if ( mCurrentAgendaView != 3 ) | 135 | if ( mCurrentAgendaView != 3 ) |
134 | mCurrentAgendaView = -1; | 136 | mCurrentAgendaView = -1; |
135 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 137 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
136 | globalFlagBlockAgenda = 2; | 138 | globalFlagBlockAgenda = 2; |
137 | mMainView->dateNavigator()->selectDates( date , | 139 | mMainView->dateNavigator()->selectDates( date , |
138 | KOPrefs::instance()->mNextXDays ); | 140 | KOPrefs::instance()->mNextXDays ); |
139 | mFlagShowNextxDays = true; | 141 | mFlagShowNextxDays = true; |
140 | mCurrentAgendaView = 3 ; | 142 | mCurrentAgendaView = 3 ; |
141 | } if (view == 9) { | 143 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) |
142 | showWeekView(); | 144 | if ( lastMode ) { |
145 | mCurrentAgendaView = lastCount ; | ||
146 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); | ||
147 | mFlagShowNextxDays = lastNDMode; | ||
148 | if ( mFlagShowNextxDays ) { | ||
149 | mCurrentAgendaView = 3 ; | ||
150 | } | ||
151 | } else | ||
152 | showWeekView(); | ||
143 | } else if (view == 10) { | 153 | } else if (view == 10) { |
144 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); | 154 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); |
145 | } | 155 | } |
146 | 156 | lastMode = view; | |
147 | #if 0 | ||
148 | dateNavigator()->blockSignals( true ); | ||
149 | dateNavigator()->selectDate( d ); | ||
150 | dateNavigator()->blockSignals( false ); | ||
151 | mViewManager->showDayView(); | ||
152 | #endif | ||
153 | |||
154 | } | 157 | } |
155 | 158 | ||
156 | 159 | ||
157 | 160 | ||
158 | void KOViewManager::writeSettings(KConfig *config) | 161 | void KOViewManager::writeSettings(KConfig *config) |
159 | { | 162 | { |
160 | config->setGroup("General"); | 163 | config->setGroup("General"); |
161 | 164 | ||
162 | QString view; | 165 | QString view; |
163 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 166 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
164 | else if (mCurrentView == mMonthView) view = "Month"; | 167 | else if (mCurrentView == mMonthView) view = "Month"; |
165 | else if (mCurrentView == mListView) view = "List"; | 168 | else if (mCurrentView == mListView) view = "List"; |
166 | else if (mCurrentView == mJournalView) view = "Journal"; | 169 | else if (mCurrentView == mJournalView) view = "Journal"; |
167 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 170 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
168 | else if (mCurrentView == mTodoView) view = "Todo"; | 171 | else if (mCurrentView == mTodoView) view = "Todo"; |
169 | else view = "Agenda"; | 172 | else view = "Agenda"; |
170 | 173 | ||
171 | config->writeEntry("Current View",view); | 174 | config->writeEntry("Current View",view); |
172 | 175 | ||
173 | if (mAgendaView) { | 176 | if (mAgendaView) { |
174 | mAgendaView->writeSettings(config); | 177 | mAgendaView->writeSettings(config); |
175 | } | 178 | } |
176 | if (mTimeSpanView) { | 179 | if (mTimeSpanView) { |
177 | mTimeSpanView->writeSettings(config); | 180 | mTimeSpanView->writeSettings(config); |
178 | } | 181 | } |
179 | if (mListView) { | 182 | if (mListView) { |
180 | mListView->writeSettings(config); | 183 | mListView->writeSettings(config); |
181 | } | 184 | } |
182 | if (mTodoView) { | 185 | if (mTodoView) { |
183 | mTodoView->saveLayout(config,"Todo View"); | 186 | mTodoView->saveLayout(config,"Todo View"); |
184 | } | 187 | } |
185 | } | 188 | } |
186 | 189 | ||
187 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 190 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
188 | { | 191 | { |
189 | 192 | ||
190 | //mFlagShowNextxDays = false; | 193 | //mFlagShowNextxDays = false; |
191 | //if(view == mCurrentView) return; | 194 | //if(view == mCurrentView) return; |
192 | if ( view == 0 ) { | 195 | if ( view == 0 ) { |
193 | view = mCurrentView; | 196 | view = mCurrentView; |
194 | if ( view == 0 ) | 197 | if ( view == 0 ) |
195 | return; | 198 | return; |
196 | } | 199 | } |
197 | bool full = fullScreen; | 200 | bool full = fullScreen; |
198 | if(view == mCurrentView && view != mWhatsNextView ) { | 201 | if(view == mCurrentView && view != mWhatsNextView ) { |
199 | if ( mCurrentAgendaView < 0 ) | 202 | if ( mCurrentAgendaView < 0 ) |
200 | return; | 203 | return; |
201 | full = mMainView->leftFrame()->isVisible(); | 204 | full = mMainView->leftFrame()->isVisible(); |