-rw-r--r-- | korganizer/koagendaview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 77a3164..947bb66 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -757,513 +757,513 @@ QPtrList<Incidence> KOAgendaView::selectedIncidences() | |||
757 | { | 757 | { |
758 | QPtrList<Incidence> selected; | 758 | QPtrList<Incidence> selected; |
759 | Incidence *incidence; | 759 | Incidence *incidence; |
760 | 760 | ||
761 | incidence = mAgenda->selectedIncidence(); | 761 | incidence = mAgenda->selectedIncidence(); |
762 | if (incidence) selected.append(incidence); | 762 | if (incidence) selected.append(incidence); |
763 | 763 | ||
764 | incidence = mAllDayAgenda->selectedIncidence(); | 764 | incidence = mAllDayAgenda->selectedIncidence(); |
765 | if (incidence) selected.append(incidence); | 765 | if (incidence) selected.append(incidence); |
766 | 766 | ||
767 | return selected; | 767 | return selected; |
768 | } | 768 | } |
769 | 769 | ||
770 | DateList KOAgendaView::selectedDates() | 770 | DateList KOAgendaView::selectedDates() |
771 | { | 771 | { |
772 | DateList selected; | 772 | DateList selected; |
773 | QDate qd; | 773 | QDate qd; |
774 | 774 | ||
775 | qd = mAgenda->selectedIncidenceDate(); | 775 | qd = mAgenda->selectedIncidenceDate(); |
776 | if (qd.isValid()) selected.append(qd); | 776 | if (qd.isValid()) selected.append(qd); |
777 | 777 | ||
778 | qd = mAllDayAgenda->selectedIncidenceDate(); | 778 | qd = mAllDayAgenda->selectedIncidenceDate(); |
779 | if (qd.isValid()) selected.append(qd); | 779 | if (qd.isValid()) selected.append(qd); |
780 | 780 | ||
781 | return selected; | 781 | return selected; |
782 | } | 782 | } |
783 | 783 | ||
784 | 784 | ||
785 | void KOAgendaView::updateView() | 785 | void KOAgendaView::updateView() |
786 | { | 786 | { |
787 | if ( mBlockUpdating ) | 787 | if ( mBlockUpdating ) |
788 | return; | 788 | return; |
789 | // kdDebug() << "KOAgendaView::updateView()" << endl; | 789 | // kdDebug() << "KOAgendaView::updateView()" << endl; |
790 | fillAgenda(); | 790 | fillAgenda(); |
791 | 791 | ||
792 | } | 792 | } |
793 | 793 | ||
794 | 794 | ||
795 | /* | 795 | /* |
796 | Update configuration settings for the agenda view. This method is not | 796 | Update configuration settings for the agenda view. This method is not |
797 | complete. | 797 | complete. |
798 | */ | 798 | */ |
799 | void KOAgendaView::updateConfig() | 799 | void KOAgendaView::updateConfig() |
800 | { | 800 | { |
801 | if ( mBlockUpdating ) | 801 | if ( mBlockUpdating ) |
802 | return; | 802 | return; |
803 | // kdDebug() << "KOAgendaView::updateConfig()" << endl; | 803 | // kdDebug() << "KOAgendaView::updateConfig()" << endl; |
804 | 804 | ||
805 | // update config for children | 805 | // update config for children |
806 | mTimeLabels->updateConfig(); | 806 | mTimeLabels->updateConfig(); |
807 | mAgenda->storePosition(); | 807 | mAgenda->storePosition(); |
808 | mAgenda->updateConfig(); | 808 | mAgenda->updateConfig(); |
809 | mAllDayAgenda->updateConfig(); | 809 | mAllDayAgenda->updateConfig(); |
810 | // widget synchronization | 810 | // widget synchronization |
811 | //TODO: find a better way, maybe signal/slot | 811 | //TODO: find a better way, maybe signal/slot |
812 | mTimeLabels->positionChanged(); | 812 | mTimeLabels->positionChanged(); |
813 | 813 | ||
814 | // for some reason, this needs to be called explicitly | 814 | // for some reason, this needs to be called explicitly |
815 | mTimeLabels->repaint(); | 815 | mTimeLabels->repaint(); |
816 | 816 | ||
817 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 817 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
818 | 818 | ||
819 | // ToolTips displaying summary of events | 819 | // ToolTips displaying summary of events |
820 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() | 820 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() |
821 | ->mEnableToolTips); | 821 | ->mEnableToolTips); |
822 | 822 | ||
823 | //setHolidayMasks(); | 823 | //setHolidayMasks(); |
824 | 824 | ||
825 | //createDayLabels(); called by via updateView(); | 825 | //createDayLabels(); called by via updateView(); |
826 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); | 826 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); |
827 | updateView(); | 827 | updateView(); |
828 | mAgenda->restorePosition(); | 828 | mAgenda->restorePosition(); |
829 | } | 829 | } |
830 | 830 | ||
831 | 831 | ||
832 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) | 832 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) |
833 | { | 833 | { |
834 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; | 834 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; |
835 | //qDebug("KOAgendaView::updateEventDates "); | 835 | //qDebug("KOAgendaView::updateEventDates "); |
836 | QDateTime startDt,endDt; | 836 | QDateTime startDt,endDt; |
837 | QDate startDate; | 837 | QDate startDate; |
838 | int lenInSecs; | 838 | int lenInSecs; |
839 | // if ( type == KOAgenda::RESIZETOP ) | 839 | // if ( type == KOAgenda::RESIZETOP ) |
840 | // qDebug("RESIZETOP "); | 840 | // qDebug("RESIZETOP "); |
841 | // if ( type == KOAgenda::RESIZEBOTTOM ) | 841 | // if ( type == KOAgenda::RESIZEBOTTOM ) |
842 | // qDebug("RESIZEBOTTOM "); | 842 | // qDebug("RESIZEBOTTOM "); |
843 | // if ( type == KOAgenda::MOVE ) | 843 | // if ( type == KOAgenda::MOVE ) |
844 | // qDebug("MOVE "); | 844 | // qDebug("MOVE "); |
845 | if ( item->incidence()->type() == "Event" ) { | 845 | if ( item->incidence()->type() == "Event" ) { |
846 | startDt =item->incidence()->dtStart(); | 846 | startDt =item->incidence()->dtStart(); |
847 | endDt = item->incidence()->dtEnd(); | 847 | endDt = item->incidence()->dtEnd(); |
848 | lenInSecs = startDt.secsTo( endDt ); | 848 | lenInSecs = startDt.secsTo( endDt ); |
849 | } | 849 | } |
850 | 850 | ||
851 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); | 851 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); |
852 | 852 | ||
853 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { | 853 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { |
854 | startDate = mSelectedDates[item->mLastMoveXPos]; | 854 | startDate = mSelectedDates[item->mLastMoveXPos]; |
855 | } else { | 855 | } else { |
856 | if (item->cellX() < 0) { | 856 | if (item->cellX() < 0) { |
857 | startDate = (mSelectedDates.first()).addDays(item->cellX()); | 857 | startDate = (mSelectedDates.first()).addDays(item->cellX()); |
858 | } else { | 858 | } else { |
859 | startDate = mSelectedDates[item->cellX()]; | 859 | startDate = mSelectedDates[item->cellX()]; |
860 | } | 860 | } |
861 | } | 861 | } |
862 | startDt.setDate(startDate); | 862 | startDt.setDate(startDate); |
863 | 863 | ||
864 | if (item->incidence()->doesFloat()) { | 864 | if (item->incidence()->doesFloat()) { |
865 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); | 865 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); |
866 | } else { | 866 | } else { |
867 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) | 867 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) |
868 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); | 868 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); |
869 | if ( item->incidence()->type() == "Event" ) { | 869 | if ( item->incidence()->type() == "Event" ) { |
870 | if ( type == KOAgenda::MOVE ) { | 870 | if ( type == KOAgenda::MOVE ) { |
871 | endDt = startDt.addSecs(lenInSecs); | 871 | endDt = startDt.addSecs(lenInSecs); |
872 | 872 | ||
873 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { | 873 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { |
874 | if (item->lastMultiItem()) { | 874 | if (item->lastMultiItem()) { |
875 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 875 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
876 | endDt.setDate(startDate. | 876 | endDt.setDate(startDate. |
877 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 877 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
878 | } else { | 878 | } else { |
879 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 879 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
880 | endDt.setDate(startDate); | 880 | endDt.setDate(startDate); |
881 | } | 881 | } |
882 | } | 882 | } |
883 | } else { | 883 | } else { |
884 | // todo | 884 | // todo |
885 | if (item->lastMultiItem()) { | 885 | if (item->lastMultiItem()) { |
886 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 886 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
887 | endDt.setDate(startDate. | 887 | endDt.setDate(startDate. |
888 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 888 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
889 | } else { | 889 | } else { |
890 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); | 890 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); |
891 | if ( item->cellYBottom() > 0 ) | 891 | if ( item->cellYBottom() > 0 ) |
892 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 892 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
893 | else | 893 | else |
894 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); | 894 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); |
895 | endDt.setDate(startDate); | 895 | endDt.setDate(startDate); |
896 | } | 896 | } |
897 | } | 897 | } |
898 | } | 898 | } |
899 | 899 | ||
900 | 900 | ||
901 | if ( item->incidence()->type() == "Event" ) { | 901 | if ( item->incidence()->type() == "Event" ) { |
902 | item->incidence()->setDtStart(startDt); | 902 | item->incidence()->setDtStart(startDt); |
903 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); | 903 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); |
904 | } else if ( item->incidence()->type() == "Todo" ) { | 904 | } else if ( item->incidence()->type() == "Todo" ) { |
905 | (static_cast<Todo*>(item->incidence()))->setDtDue(endDt); | 905 | (static_cast<Todo*>(item->incidence()))->setDtDue(endDt); |
906 | } | 906 | } |
907 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); | 907 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); |
908 | item->incidence()->setRevision(item->incidence()->revision()+1); | 908 | item->incidence()->setRevision(item->incidence()->revision()+1); |
909 | item->setItemDate(startDt.date()); | 909 | item->setItemDate(startDt.date()); |
910 | //item->updateItem(); | 910 | //item->updateItem(); |
911 | if ( item->incidence()->type() == "Todo" ) { | 911 | if ( item->incidence()->type() == "Todo" ) { |
912 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); | 912 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); |
913 | 913 | ||
914 | } | 914 | } |
915 | else | 915 | else |
916 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); | 916 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); |
917 | item->updateItem(); | 917 | item->updateItem(); |
918 | } | 918 | } |
919 | 919 | ||
920 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) | 920 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) |
921 | { | 921 | { |
922 | // kdDebug() << "KOAgendaView::selectDates" << endl; | 922 | // kdDebug() << "KOAgendaView::selectDates" << endl; |
923 | 923 | ||
924 | mSelectedDates.clear(); | 924 | mSelectedDates.clear(); |
925 | // qDebug("KOAgendaView::showDates "); | 925 | // qDebug("KOAgendaView::showDates "); |
926 | QDate d = start; | 926 | QDate d = start; |
927 | while (d <= end) { | 927 | while (d <= end) { |
928 | mSelectedDates.append(d); | 928 | mSelectedDates.append(d); |
929 | d = d.addDays( 1 ); | 929 | d = d.addDays( 1 ); |
930 | } | 930 | } |
931 | 931 | ||
932 | // and update the view | 932 | // and update the view |
933 | fillAgenda(); | 933 | fillAgenda(); |
934 | } | 934 | } |
935 | 935 | ||
936 | 936 | ||
937 | void KOAgendaView::showEvents(QPtrList<Event>) | 937 | void KOAgendaView::showEvents(QPtrList<Event>) |
938 | { | 938 | { |
939 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; | 939 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; |
940 | } | 940 | } |
941 | 941 | ||
942 | void KOAgendaView::changeEventDisplay(Event *, int) | 942 | void KOAgendaView::changeEventDisplay(Event *, int) |
943 | { | 943 | { |
944 | // qDebug("KOAgendaView::changeEventDisplay "); | 944 | // qDebug("KOAgendaView::changeEventDisplay "); |
945 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; | 945 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; |
946 | // this should be re-written to be MUCH smarter. Right now we | 946 | // this should be re-written to be MUCH smarter. Right now we |
947 | // are just playing dumb. | 947 | // are just playing dumb. |
948 | fillAgenda(); | 948 | fillAgenda(); |
949 | } | 949 | } |
950 | 950 | ||
951 | void KOAgendaView::fillAgenda(const QDate &) | 951 | void KOAgendaView::fillAgenda(const QDate &) |
952 | { | 952 | { |
953 | // qDebug("KOAgendaView::fillAgenda "); | 953 | // qDebug("KOAgendaView::fillAgenda "); |
954 | fillAgenda(); | 954 | fillAgenda(); |
955 | } | 955 | } |
956 | 956 | ||
957 | void KOAgendaView::fillAgenda() | 957 | void KOAgendaView::fillAgenda() |
958 | { | 958 | { |
959 | if ( globalFlagBlockStartup ) | 959 | if ( globalFlagBlockStartup ) |
960 | return; | 960 | return; |
961 | if ( globalFlagBlockAgenda == 1 ) | 961 | if ( globalFlagBlockAgenda == 1 ) |
962 | return; | 962 | return; |
963 | //if ( globalFlagBlockAgenda == 2 ) | 963 | //if ( globalFlagBlockAgenda == 2 ) |
964 | //globalFlagBlockAgenda = 0; | 964 | //globalFlagBlockAgenda = 0; |
965 | // globalFlagBlockPainting = false; | 965 | // globalFlagBlockPainting = false; |
966 | if ( globalFlagBlockAgenda == 0 ) | 966 | if ( globalFlagBlockAgenda == 0 ) |
967 | globalFlagBlockAgenda = 1; | 967 | globalFlagBlockAgenda = 1; |
968 | // clearView(); | 968 | // clearView(); |
969 | //qDebug("fillAgenda()++++ "); | 969 | //qDebug("fillAgenda()++++ "); |
970 | globalFlagBlockAgendaItemPaint = 1; | 970 | globalFlagBlockAgendaItemPaint = 1; |
971 | mAllDayAgenda->changeColumns(mSelectedDates.count()); | 971 | mAllDayAgenda->changeColumns(mSelectedDates.count()); |
972 | mAgenda->changeColumns(mSelectedDates.count()); | 972 | mAgenda->changeColumns(mSelectedDates.count()); |
973 | qApp->processEvents(); | 973 | qApp->processEvents(); |
974 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); | 974 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); |
975 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); | 975 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); |
976 | setHolidayMasks(); | 976 | setHolidayMasks(); |
977 | 977 | ||
978 | //mAgenda->hideUnused(); | 978 | //mAgenda->hideUnused(); |
979 | //mAllDayAgenda->hideUnused(); | 979 | //mAllDayAgenda->hideUnused(); |
980 | 980 | ||
981 | // mAgenda->blockNextRepaint( false ); | 981 | // mAgenda->blockNextRepaint( false ); |
982 | // mAgenda->viewport()->repaint(); | 982 | // mAgenda->viewport()->repaint(); |
983 | // mAgenda->blockNextRepaint( true ); | 983 | // mAgenda->blockNextRepaint( true ); |
984 | mMinY.resize(mSelectedDates.count()); | 984 | mMinY.resize(mSelectedDates.count()); |
985 | mMaxY.resize(mSelectedDates.count()); | 985 | mMaxY.resize(mSelectedDates.count()); |
986 | 986 | ||
987 | QPtrList<Event> dayEvents; | 987 | QPtrList<Event> dayEvents; |
988 | 988 | ||
989 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 989 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
990 | // Therefore, get all of them. | 990 | // Therefore, get all of them. |
991 | QPtrList<Todo> todos = calendar()->todos(); | 991 | QPtrList<Todo> todos = calendar()->todos(); |
992 | 992 | ||
993 | mAgenda->setDateList(mSelectedDates); | 993 | mAgenda->setDateList(mSelectedDates); |
994 | 994 | ||
995 | QDate today = QDate::currentDate(); | 995 | QDate today = QDate::currentDate(); |
996 | 996 | ||
997 | DateList::ConstIterator dit; | 997 | DateList::ConstIterator dit; |
998 | int curCol = 0; | 998 | int curCol = 0; |
999 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 999 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
1000 | QDate currentDate = *dit; | 1000 | QDate currentDate = *dit; |
1001 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() | 1001 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() |
1002 | // << endl; | 1002 | // << endl; |
1003 | 1003 | ||
1004 | dayEvents = calendar()->events(currentDate,true); | 1004 | dayEvents = calendar()->events(currentDate,true); |
1005 | 1005 | ||
1006 | // Default values, which can never be reached | 1006 | // Default values, which can never be reached |
1007 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; | 1007 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; |
1008 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; | 1008 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; |
1009 | 1009 | ||
1010 | unsigned int numEvent; | 1010 | unsigned int numEvent; |
1011 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { | 1011 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { |
1012 | Event *event = dayEvents.at(numEvent); | 1012 | Event *event = dayEvents.at(numEvent); |
1013 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(21) == QString("last-syncEvent-device") ) | 1013 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(15) == QString("last-syncEvent-") ) |
1014 | continue; | 1014 | continue; |
1015 | // kdDebug() << " Event: " << event->summary() << endl; | 1015 | // kdDebug() << " Event: " << event->summary() << endl; |
1016 | 1016 | ||
1017 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; | 1017 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; |
1018 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; | 1018 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; |
1019 | 1019 | ||
1020 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; | 1020 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; |
1021 | 1021 | ||
1022 | if (event->doesFloat()) { | 1022 | if (event->doesFloat()) { |
1023 | if (event->recurrence()->doesRecur()) { | 1023 | if (event->recurrence()->doesRecur()) { |
1024 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); | 1024 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); |
1025 | } else { | 1025 | } else { |
1026 | if (beginX <= 0 && curCol == 0) { | 1026 | if (beginX <= 0 && curCol == 0) { |
1027 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1027 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1028 | } else if (beginX == curCol) { | 1028 | } else if (beginX == curCol) { |
1029 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1029 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1030 | } | 1030 | } |
1031 | } | 1031 | } |
1032 | } else if (event->isMultiDay()) { | 1032 | } else if (event->isMultiDay()) { |
1033 | if ( event->doesRecur () ) { | 1033 | if ( event->doesRecur () ) { |
1034 | QDate dateit = currentDate; | 1034 | QDate dateit = currentDate; |
1035 | int count = 0; | 1035 | int count = 0; |
1036 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; | 1036 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; |
1037 | while (! event->recursOn( dateit ) && count <= max ) { | 1037 | while (! event->recursOn( dateit ) && count <= max ) { |
1038 | ++count; | 1038 | ++count; |
1039 | dateit = dateit.addDays( -1 ); | 1039 | dateit = dateit.addDays( -1 ); |
1040 | } | 1040 | } |
1041 | bool ok; | 1041 | bool ok; |
1042 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); | 1042 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); |
1043 | if ( ok ) | 1043 | if ( ok ) |
1044 | { | 1044 | { |
1045 | int secs = event->dtStart().secsTo( event->dtEnd() ); | 1045 | int secs = event->dtStart().secsTo( event->dtEnd() ); |
1046 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; | 1046 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; |
1047 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; | 1047 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; |
1048 | endX = currentDate.daysTo(nextOcend.date()) + curCol; | 1048 | endX = currentDate.daysTo(nextOcend.date()) + curCol; |
1049 | 1049 | ||
1050 | } | 1050 | } |
1051 | } | 1051 | } |
1052 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1052 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1053 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1053 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1054 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); | 1054 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); |
1055 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { | 1055 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { |
1056 | //qDebug("insert!!! "); | 1056 | //qDebug("insert!!! "); |
1057 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); | 1057 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); |
1058 | } | 1058 | } |
1059 | if (beginX == curCol) { | 1059 | if (beginX == curCol) { |
1060 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1060 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1061 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1061 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1062 | } else if (endX == curCol) { | 1062 | } else if (endX == curCol) { |
1063 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1063 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1064 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1064 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1065 | } else { | 1065 | } else { |
1066 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1066 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1067 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1067 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1068 | } | 1068 | } |
1069 | } else { | 1069 | } else { |
1070 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1070 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1071 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1071 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1072 | if (endY < startY) endY = startY; | 1072 | if (endY < startY) endY = startY; |
1073 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); | 1073 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); |
1074 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1074 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1075 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1075 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1076 | } | 1076 | } |
1077 | } | 1077 | } |
1078 | // ---------- [display Todos -------------- | 1078 | // ---------- [display Todos -------------- |
1079 | unsigned int numTodo; | 1079 | unsigned int numTodo; |
1080 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { | 1080 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { |
1081 | Todo *todo = todos.at(numTodo); | 1081 | Todo *todo = todos.at(numTodo); |
1082 | 1082 | ||
1083 | if ( ! todo->hasDueDate() ) continue; // todo shall not be displayed if it has no date | 1083 | if ( ! todo->hasDueDate() ) continue; // todo shall not be displayed if it has no date |
1084 | 1084 | ||
1085 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1085 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1086 | // Already completed items can be displayed on their original due date | 1086 | // Already completed items can be displayed on their original due date |
1087 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda | 1087 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda |
1088 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; | 1088 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; |
1089 | 1089 | ||
1090 | if ( ((todo->dtDue().date() == currentDate) && !overdue) || | 1090 | if ( ((todo->dtDue().date() == currentDate) && !overdue) || |
1091 | ((currentDate == today) && overdue) ) { | 1091 | ((currentDate == today) && overdue) ) { |
1092 | if ( todo->doesFloat() || overdue ) { // Todo has no due-time set or is already overdue | 1092 | if ( todo->doesFloat() || overdue ) { // Todo has no due-time set or is already overdue |
1093 | if ( KOPrefs::instance()->mShowTodoInAgenda ) | 1093 | if ( KOPrefs::instance()->mShowTodoInAgenda ) |
1094 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); | 1094 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); |
1095 | } | 1095 | } |
1096 | else { | 1096 | else { |
1097 | 1097 | ||
1098 | int endY = mAgenda->timeToY(todo->dtDue().time()) - 1; | 1098 | int endY = mAgenda->timeToY(todo->dtDue().time()) - 1; |
1099 | int hi = (18/KOPrefs::instance()->mHourSize); | 1099 | int hi = (18/KOPrefs::instance()->mHourSize); |
1100 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); | 1100 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); |
1101 | int startY = endY -hi; | 1101 | int startY = endY -hi; |
1102 | 1102 | ||
1103 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); | 1103 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); |
1104 | 1104 | ||
1105 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1105 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1106 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1106 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1107 | } | 1107 | } |
1108 | } | 1108 | } |
1109 | } | 1109 | } |
1110 | // ---------- display Todos] -------------- | 1110 | // ---------- display Todos] -------------- |
1111 | 1111 | ||
1112 | ++curCol; | 1112 | ++curCol; |
1113 | } | 1113 | } |
1114 | mAgenda->hideUnused(); | 1114 | mAgenda->hideUnused(); |
1115 | mAllDayAgenda->hideUnused(); | 1115 | mAllDayAgenda->hideUnused(); |
1116 | mAgenda->checkScrollBoundaries(); | 1116 | mAgenda->checkScrollBoundaries(); |
1117 | 1117 | ||
1118 | deleteSelectedDateTime(); | 1118 | deleteSelectedDateTime(); |
1119 | 1119 | ||
1120 | createDayLabels(); | 1120 | createDayLabels(); |
1121 | emit incidenceSelected( 0 ); | 1121 | emit incidenceSelected( 0 ); |
1122 | 1122 | ||
1123 | if ( globalFlagBlockAgenda == 2 ) { | 1123 | if ( globalFlagBlockAgenda == 2 ) { |
1124 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 1124 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
1125 | setStartHour( KOPrefs::instance()->mDayBegins ); | 1125 | setStartHour( KOPrefs::instance()->mDayBegins ); |
1126 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 1126 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
1127 | setStartHour( QTime::currentTime ().hour() ); | 1127 | setStartHour( QTime::currentTime ().hour() ); |
1128 | // qApp->processEvents(); | 1128 | // qApp->processEvents(); |
1129 | } | 1129 | } |
1130 | qApp->processEvents(); | 1130 | qApp->processEvents(); |
1131 | //qDebug("qApp->processEvents(); END "); | 1131 | //qDebug("qApp->processEvents(); END "); |
1132 | globalFlagBlockAgenda = 0; | 1132 | globalFlagBlockAgenda = 0; |
1133 | 1133 | ||
1134 | // mAgenda->hideUnused(); | 1134 | // mAgenda->hideUnused(); |
1135 | //mAllDayAgenda->hideUnused(); | 1135 | //mAllDayAgenda->hideUnused(); |
1136 | mAllDayAgenda->drawContentsToPainter(); | 1136 | mAllDayAgenda->drawContentsToPainter(); |
1137 | mAgenda->drawContentsToPainter(); | 1137 | mAgenda->drawContentsToPainter(); |
1138 | repaintAgenda(); | 1138 | repaintAgenda(); |
1139 | // mAgenda->finishUpdate(); | 1139 | // mAgenda->finishUpdate(); |
1140 | //mAllDayAgenda->finishUpdate(); | 1140 | //mAllDayAgenda->finishUpdate(); |
1141 | 1141 | ||
1142 | // repaintAgenda(); | 1142 | // repaintAgenda(); |
1143 | //qApp->processEvents(); | 1143 | //qApp->processEvents(); |
1144 | // globalFlagBlockAgenda = 0; | 1144 | // globalFlagBlockAgenda = 0; |
1145 | } | 1145 | } |
1146 | void KOAgendaView::repaintAgenda() | 1146 | void KOAgendaView::repaintAgenda() |
1147 | { | 1147 | { |
1148 | // mAllDayAgenda->drawContentsToPainter(); | 1148 | // mAllDayAgenda->drawContentsToPainter(); |
1149 | // mAllDayAgenda->viewport()->repaint( false ); | 1149 | // mAllDayAgenda->viewport()->repaint( false ); |
1150 | // mAgenda->drawContentsToPainter(); | 1150 | // mAgenda->drawContentsToPainter(); |
1151 | // mAgenda->viewport()->repaint( false ); | 1151 | // mAgenda->viewport()->repaint( false ); |
1152 | // qApp->processEvents(); | 1152 | // qApp->processEvents(); |
1153 | 1153 | ||
1154 | //qDebug("KOAgendaView::repaintAgenda() "); | 1154 | //qDebug("KOAgendaView::repaintAgenda() "); |
1155 | //qApp->processEvents(); | 1155 | //qApp->processEvents(); |
1156 | mAgenda->viewport()->repaint( false ); | 1156 | mAgenda->viewport()->repaint( false ); |
1157 | mAllDayAgenda->viewport()->repaint( false ); | 1157 | mAllDayAgenda->viewport()->repaint( false ); |
1158 | mAgenda->finishUpdate(); | 1158 | mAgenda->finishUpdate(); |
1159 | mAllDayAgenda->finishUpdate(); | 1159 | mAllDayAgenda->finishUpdate(); |
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | 1162 | ||
1163 | void KOAgendaView::clearView() | 1163 | void KOAgendaView::clearView() |
1164 | { | 1164 | { |
1165 | // kdDebug() << "ClearView" << endl; | 1165 | // kdDebug() << "ClearView" << endl; |
1166 | mAllDayAgenda->clear(); | 1166 | mAllDayAgenda->clear(); |
1167 | mAgenda->clear(); | 1167 | mAgenda->clear(); |
1168 | } | 1168 | } |
1169 | 1169 | ||
1170 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1170 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1171 | const QDate &td) | 1171 | const QDate &td) |
1172 | { | 1172 | { |
1173 | #ifndef KORG_NOPRINTER | 1173 | #ifndef KORG_NOPRINTER |
1174 | if (fd == td) | 1174 | if (fd == td) |
1175 | calPrinter->preview(CalPrinter::Day, fd, td); | 1175 | calPrinter->preview(CalPrinter::Day, fd, td); |
1176 | else | 1176 | else |
1177 | calPrinter->preview(CalPrinter::Week, fd, td); | 1177 | calPrinter->preview(CalPrinter::Week, fd, td); |
1178 | #endif | 1178 | #endif |
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | // void KOAgendaView::updateMovedTodo() | 1181 | // void KOAgendaView::updateMovedTodo() |
1182 | // { | 1182 | // { |
1183 | // // updateConfig(); | 1183 | // // updateConfig(); |
1184 | // // emit updateTodoViews(); | 1184 | // // emit updateTodoViews(); |
1185 | // } | 1185 | // } |
1186 | 1186 | ||
1187 | void KOAgendaView::newEvent(int gx, int gy) | 1187 | void KOAgendaView::newEvent(int gx, int gy) |
1188 | { | 1188 | { |
1189 | if (!mSelectedDates.count()) return; | 1189 | if (!mSelectedDates.count()) return; |
1190 | 1190 | ||
1191 | QDate day = mSelectedDates[gx]; | 1191 | QDate day = mSelectedDates[gx]; |
1192 | 1192 | ||
1193 | QTime time = mAgenda->gyToTime(gy); | 1193 | QTime time = mAgenda->gyToTime(gy); |
1194 | QDateTime dt(day,time); | 1194 | QDateTime dt(day,time); |
1195 | // if ( dt < QDateTime::currentDateTime () ) | 1195 | // if ( dt < QDateTime::currentDateTime () ) |
1196 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); | 1196 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); |
1197 | emit newEventSignal(dt); | 1197 | emit newEventSignal(dt); |
1198 | } | 1198 | } |
1199 | 1199 | ||
1200 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) | 1200 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) |
1201 | { | 1201 | { |
1202 | if (!mSelectedDates.count()) return; | 1202 | if (!mSelectedDates.count()) return; |
1203 | 1203 | ||
1204 | QDate dayStart = mSelectedDates[gxStart]; | 1204 | QDate dayStart = mSelectedDates[gxStart]; |
1205 | QDate dayEnd = mSelectedDates[gxEnd]; | 1205 | QDate dayEnd = mSelectedDates[gxEnd]; |
1206 | 1206 | ||
1207 | QTime timeStart = mAgenda->gyToTime(gyStart); | 1207 | QTime timeStart = mAgenda->gyToTime(gyStart); |
1208 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); | 1208 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); |
1209 | 1209 | ||
1210 | QDateTime dtStart(dayStart,timeStart); | 1210 | QDateTime dtStart(dayStart,timeStart); |
1211 | QDateTime dtEnd(dayEnd,timeEnd); | 1211 | QDateTime dtEnd(dayEnd,timeEnd); |
1212 | 1212 | ||
1213 | emit newEventSignal(dtStart,dtEnd); | 1213 | emit newEventSignal(dtStart,dtEnd); |
1214 | } | 1214 | } |
1215 | 1215 | ||
1216 | void KOAgendaView::newEventAllDay(int gx, int ) | 1216 | void KOAgendaView::newEventAllDay(int gx, int ) |
1217 | { | 1217 | { |
1218 | if (!mSelectedDates.count()) return; | 1218 | if (!mSelectedDates.count()) return; |
1219 | 1219 | ||
1220 | QDate day = mSelectedDates[gx]; | 1220 | QDate day = mSelectedDates[gx]; |
1221 | 1221 | ||
1222 | emit newEventSignal(day); | 1222 | emit newEventSignal(day); |
1223 | } | 1223 | } |
1224 | 1224 | ||
1225 | void KOAgendaView::updateEventIndicatorTop(int newY) | 1225 | void KOAgendaView::updateEventIndicatorTop(int newY) |
1226 | { | 1226 | { |
1227 | uint i; | 1227 | uint i; |
1228 | for(i=0;i<mMinY.size();++i) { | 1228 | for(i=0;i<mMinY.size();++i) { |
1229 | if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); | 1229 | if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); |
1230 | else mEventIndicatorTop->enableColumn(i,false); | 1230 | else mEventIndicatorTop->enableColumn(i,false); |
1231 | } | 1231 | } |
1232 | 1232 | ||
1233 | mEventIndicatorTop->update(); | 1233 | mEventIndicatorTop->update(); |
1234 | } | 1234 | } |
1235 | 1235 | ||
1236 | void KOAgendaView::updateEventIndicatorBottom(int newY) | 1236 | void KOAgendaView::updateEventIndicatorBottom(int newY) |
1237 | { | 1237 | { |
1238 | uint i; | 1238 | uint i; |
1239 | for(i=0;i<mMaxY.size();++i) { | 1239 | for(i=0;i<mMaxY.size();++i) { |
1240 | if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true); | 1240 | if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true); |
1241 | else mEventIndicatorBottom->enableColumn(i,false); | 1241 | else mEventIndicatorBottom->enableColumn(i,false); |
1242 | } | 1242 | } |
1243 | 1243 | ||
1244 | mEventIndicatorBottom->update(); | 1244 | mEventIndicatorBottom->update(); |
1245 | } | 1245 | } |
1246 | 1246 | ||
1247 | void KOAgendaView::startDrag(Event *event) | 1247 | void KOAgendaView::startDrag(Event *event) |
1248 | { | 1248 | { |
1249 | #ifndef KORG_NODND | 1249 | #ifndef KORG_NODND |
1250 | DndFactory factory( calendar() ); | 1250 | DndFactory factory( calendar() ); |
1251 | ICalDrag *vd = factory.createDrag(event,this); | 1251 | ICalDrag *vd = factory.createDrag(event,this); |
1252 | if (vd->drag()) { | 1252 | if (vd->drag()) { |
1253 | kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; | 1253 | kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; |
1254 | } | 1254 | } |
1255 | #endif | 1255 | #endif |
1256 | } | 1256 | } |
1257 | 1257 | ||
1258 | void KOAgendaView::readSettings() | 1258 | void KOAgendaView::readSettings() |
1259 | { | 1259 | { |
1260 | readSettings(KOGlobals::config()); | 1260 | readSettings(KOGlobals::config()); |
1261 | } | 1261 | } |
1262 | 1262 | ||
1263 | void KOAgendaView::readSettings(KConfig *config) | 1263 | void KOAgendaView::readSettings(KConfig *config) |
1264 | { | 1264 | { |
1265 | // kdDebug() << "KOAgendaView::readSettings()" << endl; | 1265 | // kdDebug() << "KOAgendaView::readSettings()" << endl; |
1266 | 1266 | ||
1267 | config->setGroup("Views"); | 1267 | config->setGroup("Views"); |
1268 | 1268 | ||
1269 | //#ifndef KORG_NOSPLITTER | 1269 | //#ifndef KORG_NOSPLITTER |