author | zautrix <zautrix> | 2005-01-31 22:41:05 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-31 22:41:05 (UTC) |
commit | 336678d691a8c3346c92a4e561ac7938ed532003 (patch) (unidiff) | |
tree | d4c12ab5536003910727b4478f70372324b7c00d /korganizer | |
parent | 949ead6797c44f632a4addd2e6aae1fb88f37816 (diff) | |
download | kdepimpi-336678d691a8c3346c92a4e561ac7938ed532003.zip kdepimpi-336678d691a8c3346c92a4e561ac7938ed532003.tar.gz kdepimpi-336678d691a8c3346c92a4e561ac7938ed532003.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/koagendaview.cpp | 44 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 3 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 9 |
3 files changed, 47 insertions, 9 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 8e9add3..d43712f 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -588,48 +588,64 @@ 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() | ||
613 | { | ||
614 | QString cap = ((QPushButton*) sender() )->caption(); | ||
615 | |||
616 | QDate firstDate = mSelectedDates.first(); | ||
617 | if ( cap == "0" ) | ||
618 | emit showDateView( 6, firstDate ); | ||
619 | else if ( cap != "last" ) { | ||
620 | if ( mSelectedDates.count() == 1) | ||
621 | emit showDateView( 9, firstDate.addDays( cap.toInt()-1 ) ); | ||
622 | else | ||
623 | emit showDateView( 3, firstDate.addDays( cap.toInt()-1 ) ); | ||
624 | } | ||
625 | else | ||
626 | showDateView( 10, firstDate.addDays(1 ) ); | ||
627 | } | ||
612 | void KOAgendaView::createDayLabels() | 628 | void KOAgendaView::createDayLabels() |
613 | { | 629 | { |
614 | 630 | ||
615 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { | 631 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { |
616 | // qDebug(" KOAgendaView::createDayLabels() blocked "); | 632 | // qDebug(" KOAgendaView::createDayLabels() blocked "); |
617 | return; | 633 | return; |
618 | 634 | ||
619 | } | 635 | } |
620 | int newHight; | 636 | int newHight; |
621 | 637 | ||
622 | // ### Before deleting and recreating we could check if mSelectedDates changed... | 638 | // ### Before deleting and recreating we could check if mSelectedDates changed... |
623 | // It would remove some flickering and gain speed (since this is called by | 639 | // It would remove some flickering and gain speed (since this is called by |
624 | // each updateView() call) | 640 | // each updateView() call) |
625 | 641 | ||
626 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; | 642 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; |
627 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); | 643 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); |
628 | if ( maxWid < 0 ) | 644 | if ( maxWid < 0 ) |
629 | maxWid = 20; | 645 | maxWid = 20; |
630 | 646 | ||
631 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; | 647 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; |
632 | QFontMetrics fm ( dlf ); | 648 | QFontMetrics fm ( dlf ); |
633 | int selCount = mSelectedDates.count(); | 649 | int selCount = mSelectedDates.count(); |
634 | QString dayTest = "Mon 20"; | 650 | QString dayTest = "Mon 20"; |
635 | int wid = fm.width( dayTest ); | 651 | int wid = fm.width( dayTest ); |
@@ -649,170 +665,184 @@ void KOAgendaView::createDayLabels() | |||
649 | int fontPoint = dlf.pointSize(); | 665 | int fontPoint = dlf.pointSize(); |
650 | if ( maxLen < 2 ) { | 666 | if ( maxLen < 2 ) { |
651 | int fontPoint = dlf.pointSize(); | 667 | int fontPoint = dlf.pointSize(); |
652 | while ( fontPoint > 4 ) { | 668 | while ( fontPoint > 4 ) { |
653 | --fontPoint; | 669 | --fontPoint; |
654 | dlf.setPointSize( fontPoint ); | 670 | dlf.setPointSize( fontPoint ); |
655 | QFontMetrics f( dlf ); | 671 | QFontMetrics f( dlf ); |
656 | wid = f.width( "20" ); | 672 | wid = f.width( "20" ); |
657 | needWid = wid * selCount; | 673 | needWid = wid * selCount; |
658 | if ( needWid < maxWid ) | 674 | if ( needWid < maxWid ) |
659 | break; | 675 | break; |
660 | } | 676 | } |
661 | maxLen = 2; | 677 | maxLen = 2; |
662 | } | 678 | } |
663 | //qDebug("Max len %d ", dayTest.length() ); | 679 | //qDebug("Max len %d ", dayTest.length() ); |
664 | 680 | ||
665 | QFontMetrics tempF( dlf ); | 681 | QFontMetrics tempF( dlf ); |
666 | newHight = tempF.height(); | 682 | newHight = tempF.height(); |
667 | mDayLabels->setFont( dlf ); | 683 | mDayLabels->setFont( dlf ); |
668 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; | 684 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; |
669 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); | 685 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); |
670 | //mLayoutDayLabels->addSpacing( 2 ); | 686 | //mLayoutDayLabels->addSpacing( 2 ); |
671 | // QFont lFont = dlf; | 687 | // QFont lFont = dlf; |
672 | bool appendLabels = false; | 688 | bool appendLabels = false; |
673 | QLabel *dayLabel; | 689 | QPushButton *dayLabel; |
674 | dayLabel = mDayLabelsList.first(); | 690 | dayLabel = mDayLabelsList.first(); |
675 | if ( !dayLabel ) { | 691 | if ( !dayLabel ) { |
676 | appendLabels = true; | 692 | appendLabels = true; |
677 | dayLabel = new QLabel(mDayLabels); | 693 | dayLabel = new QPushButton(mDayLabels); |
694 | dayLabel->setFlat( true ); | ||
695 | connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) ); | ||
696 | dayLabel->setFocusPolicy(NoFocus); | ||
678 | mDayLabelsList.append( dayLabel ); | 697 | mDayLabelsList.append( dayLabel ); |
679 | mLayoutDayLabels->addWidget(dayLabel); | 698 | mLayoutDayLabels->addWidget(dayLabel); |
680 | } | 699 | } |
681 | dayLabel->setFixedWidth( mTimeLabels->width()+2 ); | 700 | dayLabel->setFixedWidth( mTimeLabels->width()+2 ); |
682 | dayLabel->setFont( dlf ); | 701 | dayLabel->setFont( dlf ); |
683 | dayLabel->setAlignment(QLabel::AlignHCenter); | 702 | dayLabel->setCaption("0"); |
703 | //dayLabel->setAlignment(QLabel::AlignHCenter); | ||
684 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); | 704 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); |
685 | dayLabel->show(); | 705 | dayLabel->show(); |
686 | DateList::ConstIterator dit; | 706 | DateList::ConstIterator dit; |
687 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); | 707 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); |
708 | int counter = 0; | ||
688 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 709 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
710 | ++counter; | ||
689 | QDate date = *dit; | 711 | QDate date = *dit; |
690 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); | 712 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); |
691 | if ( ! appendLabels ) { | 713 | if ( ! appendLabels ) { |
692 | dayLabel = mDayLabelsList.next(); | 714 | dayLabel = mDayLabelsList.next(); |
693 | if ( !dayLabel ) | 715 | if ( !dayLabel ) |
694 | appendLabels = true; | 716 | appendLabels = true; |
695 | } | 717 | } |
696 | if ( appendLabels ) { | 718 | if ( appendLabels ) { |
697 | dayLabel = new QLabel(mDayLabels); | 719 | dayLabel = new QPushButton(mDayLabels); |
720 | dayLabel->setFlat( true ); | ||
721 | connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) ); | ||
722 | dayLabel->setFocusPolicy(NoFocus); | ||
698 | mDayLabelsList.append( dayLabel ); | 723 | mDayLabelsList.append( dayLabel ); |
699 | mLayoutDayLabels->addWidget(dayLabel); | 724 | mLayoutDayLabels->addWidget(dayLabel); |
700 | } | 725 | } |
701 | dayLabel->setMinimumWidth( 1 ); | 726 | dayLabel->setMinimumWidth( 1 ); |
702 | dayLabel->setMaximumWidth( 2048 ); | 727 | dayLabel->setMaximumWidth( 2048 ); |
703 | dayLabel->setFont( dlf ); | 728 | dayLabel->setFont( dlf ); |
704 | dayLabel->show(); | 729 | dayLabel->show(); |
730 | dayLabel->setCaption(QString::number( counter )); | ||
705 | QString str; | 731 | QString str; |
706 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); | 732 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); |
707 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); | 733 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); |
708 | switch ( maxLen ) { | 734 | switch ( maxLen ) { |
709 | case 2: | 735 | case 2: |
710 | str = QString::number( date.day() ); | 736 | str = QString::number( date.day() ); |
711 | break; | 737 | break; |
712 | 738 | ||
713 | case 3: | 739 | case 3: |
714 | str = dayName.left( 1 ) +QString::number( date.day()); | 740 | str = dayName.left( 1 ) +QString::number( date.day()); |
715 | 741 | ||
716 | break; | 742 | break; |
717 | case 4: | 743 | case 4: |
718 | str = dayName.left( 1 ) + " " +QString::number( date.day()); | 744 | str = dayName.left( 1 ) + " " +QString::number( date.day()); |
719 | 745 | ||
720 | break; | 746 | break; |
721 | case 5: | 747 | case 5: |
722 | str = dayName.left( 2 ) + " " +QString::number( date.day()); | 748 | str = dayName.left( 2 ) + " " +QString::number( date.day()); |
723 | 749 | ||
724 | break; | 750 | break; |
725 | case 6: | 751 | case 6: |
726 | str = dayName.left( 3 ) + " " +QString::number( date.day()); | 752 | str = dayName.left( 3 ) + " " +QString::number( date.day()); |
727 | break; | 753 | break; |
728 | 754 | ||
729 | default: | 755 | default: |
730 | break; | 756 | break; |
731 | } | 757 | } |
732 | if ( oneday ) { | 758 | if ( oneday ) { |
733 | QString addString; | 759 | QString addString; |
734 | if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) | 760 | if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) |
735 | addString = i18n("Today"); | 761 | addString = i18n("Today"); |
736 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) | 762 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) |
737 | addString = i18n("Tomorrow"); | 763 | addString = i18n("Tomorrow"); |
738 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) | 764 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) |
739 | addString = i18n("Yesterday"); | 765 | addString = i18n("Yesterday"); |
740 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) | 766 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) |
741 | addString = i18n("Day before yesterday"); | 767 | addString = i18n("Day before yesterday"); |
742 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) | 768 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) |
743 | addString = i18n("Day after tomorrow"); | 769 | addString = i18n("Day after tomorrow"); |
744 | if ( !addString.isEmpty() ) { | 770 | if ( !addString.isEmpty() ) { |
745 | str = addString+", " + str; | 771 | str = addString+", " + str; |
746 | } | 772 | } |
747 | } | 773 | } |
748 | dayLabel->setText(str); | 774 | dayLabel->setText(str); |
749 | dayLabel->setAlignment(QLabel::AlignHCenter); | 775 | //dayLabel->setAlignment(QLabel::AlignHCenter); |
750 | if (date == QDate::currentDate()) { | 776 | if (date == QDate::currentDate()) { |
751 | QFont bFont = dlf; | 777 | QFont bFont = dlf; |
752 | bFont.setBold( true ); | 778 | bFont.setBold( true ); |
753 | dayLabel->setFont(bFont); | 779 | dayLabel->setFont(bFont); |
754 | } | 780 | } |
755 | //dayLayout->addWidget(dayLabel); | 781 | //dayLayout->addWidget(dayLabel); |
756 | 782 | ||
757 | #ifndef KORG_NOPLUGINS | 783 | #ifndef KORG_NOPLUGINS |
758 | CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); | 784 | CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); |
759 | CalendarDecoration *it; | 785 | CalendarDecoration *it; |
760 | for(it = cds.first(); it; it = cds.next()) { | 786 | for(it = cds.first(); it; it = cds.next()) { |
761 | QString text = it->shortText( date ); | 787 | QString text = it->shortText( date ); |
762 | if ( !text.isEmpty() ) { | 788 | if ( !text.isEmpty() ) { |
763 | QLabel *label = new QLabel(text,mDayLabels); | 789 | QLabel *label = new QLabel(text,mDayLabels); |
764 | label->setAlignment(AlignCenter); | 790 | label->setAlignment(AlignCenter); |
765 | dayLayout->addWidget(label); | 791 | dayLayout->addWidget(label); |
766 | } | 792 | } |
767 | } | 793 | } |
768 | 794 | ||
769 | for(it = cds.first(); it; it = cds.next()) { | 795 | for(it = cds.first(); it; it = cds.next()) { |
770 | QWidget *wid = it->smallWidget(mDayLabels,date); | 796 | QWidget *wid = it->smallWidget(mDayLabels,date); |
771 | if ( wid ) { | 797 | if ( wid ) { |
772 | // wid->setHeight(20); | 798 | // wid->setHeight(20); |
773 | dayLayout->addWidget(wid); | 799 | dayLayout->addWidget(wid); |
774 | } | 800 | } |
775 | } | 801 | } |
776 | #endif | 802 | #endif |
777 | } | 803 | } |
778 | if ( ! appendLabels ) { | 804 | if ( ! appendLabels ) { |
779 | dayLabel = mDayLabelsList.next(); | 805 | dayLabel = mDayLabelsList.next(); |
780 | if ( !dayLabel ) | 806 | if ( !dayLabel ) |
781 | appendLabels = true; | 807 | appendLabels = true; |
782 | } | 808 | } |
783 | if ( appendLabels ) { | 809 | if ( appendLabels ) { |
784 | dayLabel = new QLabel(mDayLabels); | 810 | dayLabel = new QPushButton(mDayLabels); |
811 | dayLabel->setFlat( true ); | ||
812 | connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) ); | ||
813 | dayLabel->setFocusPolicy(NoFocus); | ||
785 | mDayLabelsList.append( dayLabel ); | 814 | mDayLabelsList.append( dayLabel ); |
786 | mLayoutDayLabels->addWidget(dayLabel); | 815 | mLayoutDayLabels->addWidget(dayLabel); |
787 | } | 816 | } |
788 | //dayLabel->hide();//test only | 817 | //dayLabel->hide();//test only |
789 | 818 | ||
790 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; | 819 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; |
791 | if ( offset < 0 ) offset = 0; | 820 | if ( offset < 0 ) offset = 0; |
792 | //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); | 821 | //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); |
793 | dayLabel->setText("");//QString::number ( mSelectedDates.first().month() ) ); | 822 | dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); |
794 | dayLabel->show(); | 823 | dayLabel->show(); |
824 | dayLabel->setCaption("last"); | ||
795 | dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); | 825 | dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); |
796 | //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); | 826 | //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); |
797 | //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); | 827 | //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); |
798 | if ( !appendLabels ) { | 828 | if ( !appendLabels ) { |
799 | dayLabel = mDayLabelsList.next(); | 829 | dayLabel = mDayLabelsList.next(); |
800 | while ( dayLabel ) { | 830 | while ( dayLabel ) { |
801 | //qDebug("!dayLabel %d",dayLabel ); | 831 | //qDebug("!dayLabel %d",dayLabel ); |
802 | dayLabel->hide(); | 832 | dayLabel->hide(); |
803 | dayLabel = mDayLabelsList.next(); | 833 | dayLabel = mDayLabelsList.next(); |
804 | } | 834 | } |
805 | } | 835 | } |
806 | //mDayLabelsFrame->show(); | 836 | //mDayLabelsFrame->show(); |
807 | //mDayLabels->show(); | 837 | //mDayLabels->show(); |
808 | //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight); | 838 | //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight); |
809 | //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight ); | 839 | //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight ); |
810 | mDayLabelsFrame->setFixedHeight( newHight ); | 840 | mDayLabelsFrame->setFixedHeight( newHight ); |
811 | } | 841 | } |
812 | 842 | ||
813 | int KOAgendaView::maxDatesHint() | 843 | int KOAgendaView::maxDatesHint() |
814 | { | 844 | { |
815 | // Not sure about the max number of events, so return 0 for now. | 845 | // Not sure about the max number of events, so return 0 for now. |
816 | return 0; | 846 | return 0; |
817 | } | 847 | } |
818 | 848 | ||
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index 7774fbe..fd0a7af 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h | |||
@@ -186,77 +186,78 @@ class KOAgendaView : public KOEventView { | |||
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 | bool mBlockUpdating; | 193 | bool mBlockUpdating; |
194 | int mUpcomingWidth; | 194 | int mUpcomingWidth; |
195 | /** Fill agenda beginning with date startDate */ | 195 | /** Fill agenda beginning with date startDate */ |
196 | void fillAgenda(const QDate &startDate); | 196 | void fillAgenda(const QDate &startDate); |
197 | void resizeEvent( QResizeEvent* e ); | 197 | void resizeEvent( QResizeEvent* e ); |
198 | /** Fill agenda using the current set value for the start date */ | 198 | /** Fill agenda using the current set value for the start date */ |
199 | void fillAgenda(); | 199 | void fillAgenda(); |
200 | 200 | ||
201 | /** Create labels for the selected dates. */ | 201 | /** Create labels for the selected dates. */ |
202 | void createDayLabels(); | 202 | void createDayLabels(); |
203 | 203 | ||
204 | /** | 204 | /** |
205 | Set the masks on the agenda widgets indicating, which days are holidays. | 205 | Set the masks on the agenda widgets indicating, which days are holidays. |
206 | */ | 206 | */ |
207 | void setHolidayMasks(); | 207 | void setHolidayMasks(); |
208 | 208 | ||
209 | protected slots: | 209 | protected slots: |
210 | void slotDaylabelClicked(); | ||
210 | /** Update event belonging to agenda item */ | 211 | /** Update event belonging to agenda item */ |
211 | void updateEventDates(KOAgendaItem *item, int mode = -1); | 212 | void updateEventDates(KOAgendaItem *item, int mode = -1); |
212 | //void updateMovedTodo(); | 213 | //void updateMovedTodo(); |
213 | 214 | ||
214 | void updateEventIndicatorTop(int newY); | 215 | void updateEventIndicatorTop(int newY); |
215 | void updateEventIndicatorBottom(int newY); | 216 | void updateEventIndicatorBottom(int newY); |
216 | 217 | ||
217 | /** Updates data for selected timespan */ | 218 | /** Updates data for selected timespan */ |
218 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); | 219 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); |
219 | /** Updates data for selected timespan for all day event*/ | 220 | /** Updates data for selected timespan for all day event*/ |
220 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); | 221 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); |
221 | 222 | ||
222 | private: | 223 | private: |
223 | // view widgets | 224 | // view widgets |
224 | QFrame *mDayLabels; | 225 | QFrame *mDayLabels; |
225 | QHBox *mDayLabelsFrame; | 226 | QHBox *mDayLabelsFrame; |
226 | QBoxLayout *mLayoutDayLabels; | 227 | QBoxLayout *mLayoutDayLabels; |
227 | QFrame *mAllDayFrame; | 228 | QFrame *mAllDayFrame; |
228 | KOAgenda *mAllDayAgenda; | 229 | KOAgenda *mAllDayAgenda; |
229 | KOAgenda *mAgenda; | 230 | KOAgenda *mAgenda; |
230 | TimeLabels *mTimeLabels; | 231 | TimeLabels *mTimeLabels; |
231 | QWidget *mDummyAllDayLeft; | 232 | QWidget *mDummyAllDayLeft; |
232 | 233 | ||
233 | KDGanttMinimizeSplitter* mSplitterAgenda; | 234 | KDGanttMinimizeSplitter* mSplitterAgenda; |
234 | QPushButton *mExpandButton; | 235 | QPushButton *mExpandButton; |
235 | 236 | ||
236 | DateList mSelectedDates; // List of dates to be displayed | 237 | DateList mSelectedDates; // List of dates to be displayed |
237 | int mViewType; | 238 | int mViewType; |
238 | 239 | ||
239 | bool mWeekStartsMonday; | 240 | bool mWeekStartsMonday; |
240 | int mStartHour; | 241 | int mStartHour; |
241 | 242 | ||
242 | KOEventPopupMenu *mAgendaPopup; | 243 | KOEventPopupMenu *mAgendaPopup; |
243 | KOEventPopupMenu *mAllDayAgendaPopup; | 244 | KOEventPopupMenu *mAllDayAgendaPopup; |
244 | 245 | ||
245 | EventIndicator *mEventIndicatorTop; | 246 | EventIndicator *mEventIndicatorTop; |
246 | EventIndicator *mEventIndicatorBottom; | 247 | EventIndicator *mEventIndicatorBottom; |
247 | 248 | ||
248 | QMemArray<int> mMinY; | 249 | QMemArray<int> mMinY; |
249 | QMemArray<int> mMaxY; | 250 | QMemArray<int> mMaxY; |
250 | 251 | ||
251 | QMemArray<bool> mHolidayMask; | 252 | QMemArray<bool> mHolidayMask; |
252 | 253 | ||
253 | QPixmap mExpandedPixmap; | 254 | QPixmap mExpandedPixmap; |
254 | QPixmap mNotExpandedPixmap; | 255 | QPixmap mNotExpandedPixmap; |
255 | QPtrList<QLabel> mDayLabelsList; | 256 | QPtrList<QPushButton> mDayLabelsList; |
256 | QDateTime mTimeSpanBegin; | 257 | QDateTime mTimeSpanBegin; |
257 | QDateTime mTimeSpanEnd; | 258 | QDateTime mTimeSpanEnd; |
258 | bool mTimeSpanInAllDay; | 259 | bool mTimeSpanInAllDay; |
259 | void keyPressEvent ( QKeyEvent * e ); | 260 | void keyPressEvent ( QKeyEvent * e ); |
260 | }; | 261 | }; |
261 | 262 | ||
262 | #endif // KOAGENDAVIEW_H | 263 | #endif // KOAGENDAVIEW_H |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index db23882..30f5fb1 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -90,73 +90,80 @@ void KOViewManager::readSettings(KConfig *config) | |||
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 | 101 | ||
102 | void KOViewManager::showDateView( int view, QDate date) | 102 | void KOViewManager::showDateView( int view, QDate date) |
103 | { | 103 | { |
104 | 104 | ||
105 | //qDebug("date %d %s", view, date.toString().latin1()); | 105 | //qDebug("date %d %s", view, date.toString().latin1()); |
106 | #if 0 | 106 | #if 0 |
107 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); | 107 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); |
108 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next Week"),4 ); | 108 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next Week"),4 ); |
109 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Two Weeks"),5 ); | 109 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Two Weeks"),5 ); |
110 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Month"),6 ); | 110 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Month"),6 ); |
111 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); | 111 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); |
112 | #endif | 112 | #endif |
113 | if ( view == 3 ) { | 113 | if ( view == 3 ) { |
114 | //mCurrentAgendaView = 1 ; | ||
114 | mMainView->showDay( date ); | 115 | mMainView->showDay( date ); |
115 | } else if (view == 4 ) { | 116 | } else if (view == 4 ) { |
117 | mCurrentAgendaView = 7 ; | ||
116 | mMainView->dateNavigator()->selectDates( date, 7 ); | 118 | mMainView->dateNavigator()->selectDates( date, 7 ); |
117 | } else if (view == 5 ) { | 119 | } else if (view == 5 ) { |
120 | mCurrentAgendaView = 14 ; | ||
118 | mMainView->dateNavigator()->selectDates( date, 14); | 121 | mMainView->dateNavigator()->selectDates( date, 14); |
119 | } else if (view == 6 ) { | 122 | } else if (view == 6 ) { |
120 | mMainView->dateNavigator()->blockSignals( true ); | 123 | mMainView->dateNavigator()->blockSignals( true ); |
121 | showMonthView(); | 124 | showMonthView(); |
122 | mMainView->dateNavigator()->selectMonthByDate( date ); | 125 | mMainView->dateNavigator()->selectMonthByDate( date ); |
123 | mMainView->dateNavigator()->blockSignals( false ); | 126 | mMainView->dateNavigator()->blockSignals( false ); |
124 | mMainView->dateNavigator()->selectDate( date ); | 127 | mMainView->dateNavigator()->selectDate( date ); |
125 | } else if (view == 7 ) { | 128 | } else if (view == 7 ) { |
126 | mMainView->dateNavigator()->selectDate( date ); | 129 | mMainView->dateNavigator()->selectDate( date ); |
127 | showJournalView(); | 130 | showJournalView(); |
128 | } else if (view == 8 ) { | 131 | } else if (view == 8 ) { |
129 | globalFlagBlockAgenda = 1; | 132 | globalFlagBlockAgenda = 1; |
130 | if ( mCurrentAgendaView != 3 ) | 133 | if ( mCurrentAgendaView != 3 ) |
131 | mCurrentAgendaView = -1; | 134 | mCurrentAgendaView = -1; |
132 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 135 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
133 | globalFlagBlockAgenda = 2; | 136 | globalFlagBlockAgenda = 2; |
134 | mMainView->dateNavigator()->selectDates( date , | 137 | mMainView->dateNavigator()->selectDates( date , |
135 | KOPrefs::instance()->mNextXDays ); | 138 | KOPrefs::instance()->mNextXDays ); |
136 | mFlagShowNextxDays = true; | 139 | mFlagShowNextxDays = true; |
137 | mCurrentAgendaView = 3 ; | 140 | mCurrentAgendaView = 3 ; |
138 | } | 141 | } if (view == 9) { |
142 | showWeekView(); | ||
143 | } else if (view == 10) { | ||
144 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); | ||
145 | } | ||
139 | 146 | ||
140 | #if 0 | 147 | #if 0 |
141 | dateNavigator()->blockSignals( true ); | 148 | dateNavigator()->blockSignals( true ); |
142 | dateNavigator()->selectDate( d ); | 149 | dateNavigator()->selectDate( d ); |
143 | dateNavigator()->blockSignals( false ); | 150 | dateNavigator()->blockSignals( false ); |
144 | mViewManager->showDayView(); | 151 | mViewManager->showDayView(); |
145 | #endif | 152 | #endif |
146 | 153 | ||
147 | } | 154 | } |
148 | 155 | ||
149 | 156 | ||
150 | 157 | ||
151 | void KOViewManager::writeSettings(KConfig *config) | 158 | void KOViewManager::writeSettings(KConfig *config) |
152 | { | 159 | { |
153 | config->setGroup("General"); | 160 | config->setGroup("General"); |
154 | 161 | ||
155 | QString view; | 162 | QString view; |
156 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 163 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
157 | else if (mCurrentView == mMonthView) view = "Month"; | 164 | else if (mCurrentView == mMonthView) view = "Month"; |
158 | else if (mCurrentView == mListView) view = "List"; | 165 | else if (mCurrentView == mListView) view = "List"; |
159 | else if (mCurrentView == mJournalView) view = "Journal"; | 166 | else if (mCurrentView == mJournalView) view = "Journal"; |
160 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 167 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
161 | else if (mCurrentView == mTodoView) view = "Todo"; | 168 | else if (mCurrentView == mTodoView) view = "Todo"; |
162 | else view = "Agenda"; | 169 | else view = "Agenda"; |