-rw-r--r-- | korganizer/koagendaview.cpp | 1 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 10 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 5 |
3 files changed, 8 insertions, 8 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index c8cef44..d4ff77a 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -887,193 +887,192 @@ void KOAgendaView::updateView() | |||
887 | // kdDebug() << "KOAgendaView::updateView()" << endl; | 887 | // kdDebug() << "KOAgendaView::updateView()" << endl; |
888 | fillAgenda(); | 888 | fillAgenda(); |
889 | 889 | ||
890 | } | 890 | } |
891 | 891 | ||
892 | 892 | ||
893 | /* | 893 | /* |
894 | Update configuration settings for the agenda view. This method is not | 894 | Update configuration settings for the agenda view. This method is not |
895 | complete. | 895 | complete. |
896 | */ | 896 | */ |
897 | void KOAgendaView::updateConfig() | 897 | void KOAgendaView::updateConfig() |
898 | { | 898 | { |
899 | if ( mBlockUpdating ) | 899 | if ( mBlockUpdating ) |
900 | return; | 900 | return; |
901 | // kdDebug() << "KOAgendaView::updateConfig()" << endl; | 901 | // kdDebug() << "KOAgendaView::updateConfig()" << endl; |
902 | 902 | ||
903 | // update config for children | 903 | // update config for children |
904 | mTimeLabels->updateConfig(); | 904 | mTimeLabels->updateConfig(); |
905 | mAgenda->storePosition(); | 905 | mAgenda->storePosition(); |
906 | mAgenda->updateConfig(); | 906 | mAgenda->updateConfig(); |
907 | mAllDayAgenda->updateConfig(); | 907 | mAllDayAgenda->updateConfig(); |
908 | // widget synchronization | 908 | // widget synchronization |
909 | //TODO: find a better way, maybe signal/slot | 909 | //TODO: find a better way, maybe signal/slot |
910 | mTimeLabels->positionChanged(); | 910 | mTimeLabels->positionChanged(); |
911 | 911 | ||
912 | // for some reason, this needs to be called explicitly | 912 | // for some reason, this needs to be called explicitly |
913 | mTimeLabels->repaint(); | 913 | mTimeLabels->repaint(); |
914 | 914 | ||
915 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 915 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
916 | 916 | ||
917 | // ToolTips displaying summary of events | 917 | // ToolTips displaying summary of events |
918 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() | 918 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() |
919 | ->mEnableToolTips); | 919 | ->mEnableToolTips); |
920 | 920 | ||
921 | //setHolidayMasks(); | 921 | //setHolidayMasks(); |
922 | 922 | ||
923 | //createDayLabels(); called by via updateView(); | 923 | //createDayLabels(); called by via updateView(); |
924 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); | 924 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); |
925 | updateView(); | 925 | updateView(); |
926 | mAgenda->restorePosition(); | 926 | mAgenda->restorePosition(); |
927 | } | 927 | } |
928 | 928 | ||
929 | 929 | ||
930 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) | 930 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) |
931 | { | 931 | { |
932 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; | 932 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; |
933 | //qDebug("KOAgendaView::updateEventDates "); | 933 | //qDebug("KOAgendaView::updateEventDates "); |
934 | QDateTime startDt,endDt; | 934 | QDateTime startDt,endDt; |
935 | QDate startDate; | 935 | QDate startDate; |
936 | int lenInSecs; | 936 | int lenInSecs; |
937 | // if ( type == KOAgenda::RESIZETOP ) | 937 | // if ( type == KOAgenda::RESIZETOP ) |
938 | // qDebug("RESIZETOP "); | 938 | // qDebug("RESIZETOP "); |
939 | // if ( type == KOAgenda::RESIZEBOTTOM ) | 939 | // if ( type == KOAgenda::RESIZEBOTTOM ) |
940 | // qDebug("RESIZEBOTTOM "); | 940 | // qDebug("RESIZEBOTTOM "); |
941 | // if ( type == KOAgenda::MOVE ) | 941 | // if ( type == KOAgenda::MOVE ) |
942 | // qDebug("MOVE "); | 942 | // qDebug("MOVE "); |
943 | if ( item->incidence()->type() == "Event" ) { | 943 | if ( item->incidence()->type() == "Event" ) { |
944 | startDt =item->incidence()->dtStart(); | 944 | startDt =item->incidence()->dtStart(); |
945 | endDt = item->incidence()->dtEnd(); | 945 | endDt = item->incidence()->dtEnd(); |
946 | lenInSecs = startDt.secsTo( endDt ); | 946 | lenInSecs = startDt.secsTo( endDt ); |
947 | } | 947 | } |
948 | 948 | ||
949 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); | 949 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); |
950 | 950 | ||
951 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { | 951 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { |
952 | startDate = mSelectedDates[item->mLastMoveXPos]; | 952 | startDate = mSelectedDates[item->mLastMoveXPos]; |
953 | } else { | 953 | } else { |
954 | if (item->cellX() < 0) { | 954 | if (item->cellX() < 0) { |
955 | startDate = (mSelectedDates.first()).addDays(item->cellX()); | 955 | startDate = (mSelectedDates.first()).addDays(item->cellX()); |
956 | } else { | 956 | } else { |
957 | startDate = mSelectedDates[item->cellX()]; | 957 | startDate = mSelectedDates[item->cellX()]; |
958 | } | 958 | } |
959 | } | 959 | } |
960 | startDt.setDate(startDate); | 960 | startDt.setDate(startDate); |
961 | 961 | ||
962 | if (item->incidence()->doesFloat()) { | 962 | if (item->incidence()->doesFloat()) { |
963 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); | 963 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); |
964 | } else { | 964 | } else { |
965 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) | 965 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) |
966 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); | 966 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); |
967 | if ( item->incidence()->type() == "Event" ) { | 967 | if ( item->incidence()->type() == "Event" ) { |
968 | if ( type == KOAgenda::MOVE ) { | 968 | if ( type == KOAgenda::MOVE ) { |
969 | endDt = startDt.addSecs(lenInSecs); | 969 | endDt = startDt.addSecs(lenInSecs); |
970 | 970 | ||
971 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { | 971 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { |
972 | if (item->lastMultiItem()) { | 972 | if (item->lastMultiItem()) { |
973 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 973 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
974 | endDt.setDate(startDate. | 974 | endDt.setDate(startDate. |
975 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 975 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
976 | } else { | 976 | } else { |
977 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 977 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
978 | endDt.setDate(startDate); | 978 | endDt.setDate(startDate); |
979 | } | 979 | } |
980 | } | 980 | } |
981 | } else { | 981 | } else { |
982 | // todo | 982 | // todo |
983 | qDebug("tooooodoooooo "); | ||
984 | if (item->lastMultiItem()) { | 983 | if (item->lastMultiItem()) { |
985 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 984 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
986 | endDt.setDate(startDate. | 985 | endDt.setDate(startDate. |
987 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 986 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
988 | } else { | 987 | } else { |
989 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); | 988 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); |
990 | if ( item->cellYBottom() > 0 ) | 989 | if ( item->cellYBottom() > 0 ) |
991 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 990 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
992 | else | 991 | else |
993 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); | 992 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); |
994 | endDt.setDate(startDate); | 993 | endDt.setDate(startDate); |
995 | } | 994 | } |
996 | } | 995 | } |
997 | } | 996 | } |
998 | if ( item->incidence()->type() == "Event" ) { | 997 | if ( item->incidence()->type() == "Event" ) { |
999 | item->incidence()->setDtStart(startDt); | 998 | item->incidence()->setDtStart(startDt); |
1000 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); | 999 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); |
1001 | } else if ( item->incidence()->type() == "Todo" ) { | 1000 | } else if ( item->incidence()->type() == "Todo" ) { |
1002 | (static_cast<Todo*>(item->incidence()))->setDtDue(endDt); | 1001 | (static_cast<Todo*>(item->incidence()))->setDtDue(endDt); |
1003 | } | 1002 | } |
1004 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); | 1003 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); |
1005 | item->incidence()->setRevision(item->incidence()->revision()+1); | 1004 | item->incidence()->setRevision(item->incidence()->revision()+1); |
1006 | item->setItemDate(startDt.date()); | 1005 | item->setItemDate(startDt.date()); |
1007 | //item->updateItem(); | 1006 | //item->updateItem(); |
1008 | if ( item->incidence()->type() == "Todo" ) { | 1007 | if ( item->incidence()->type() == "Todo" ) { |
1009 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); | 1008 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); |
1010 | 1009 | ||
1011 | } | 1010 | } |
1012 | else | 1011 | else |
1013 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); | 1012 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); |
1014 | item->updateItem(); | 1013 | item->updateItem(); |
1015 | } | 1014 | } |
1016 | 1015 | ||
1017 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) | 1016 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) |
1018 | { | 1017 | { |
1019 | // kdDebug() << "KOAgendaView::selectDates" << endl; | 1018 | // kdDebug() << "KOAgendaView::selectDates" << endl; |
1020 | 1019 | ||
1021 | mSelectedDates.clear(); | 1020 | mSelectedDates.clear(); |
1022 | // qDebug("KOAgendaView::showDates "); | 1021 | // qDebug("KOAgendaView::showDates "); |
1023 | QDate d = start; | 1022 | QDate d = start; |
1024 | while (d <= end) { | 1023 | while (d <= end) { |
1025 | mSelectedDates.append(d); | 1024 | mSelectedDates.append(d); |
1026 | d = d.addDays( 1 ); | 1025 | d = d.addDays( 1 ); |
1027 | } | 1026 | } |
1028 | 1027 | ||
1029 | // and update the view | 1028 | // and update the view |
1030 | fillAgenda(); | 1029 | fillAgenda(); |
1031 | } | 1030 | } |
1032 | 1031 | ||
1033 | 1032 | ||
1034 | void KOAgendaView::showEvents(QPtrList<Event>) | 1033 | void KOAgendaView::showEvents(QPtrList<Event>) |
1035 | { | 1034 | { |
1036 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; | 1035 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; |
1037 | } | 1036 | } |
1038 | 1037 | ||
1039 | void KOAgendaView::changeEventDisplay(Event *, int) | 1038 | void KOAgendaView::changeEventDisplay(Event *, int) |
1040 | { | 1039 | { |
1041 | // qDebug("KOAgendaView::changeEventDisplay "); | 1040 | // qDebug("KOAgendaView::changeEventDisplay "); |
1042 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; | 1041 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; |
1043 | // this should be re-written to be MUCH smarter. Right now we | 1042 | // this should be re-written to be MUCH smarter. Right now we |
1044 | // are just playing dumb. | 1043 | // are just playing dumb. |
1045 | fillAgenda(); | 1044 | fillAgenda(); |
1046 | } | 1045 | } |
1047 | 1046 | ||
1048 | void KOAgendaView::fillAgenda(const QDate &) | 1047 | void KOAgendaView::fillAgenda(const QDate &) |
1049 | { | 1048 | { |
1050 | // qDebug("KOAgendaView::fillAgenda "); | 1049 | // qDebug("KOAgendaView::fillAgenda "); |
1051 | fillAgenda(); | 1050 | fillAgenda(); |
1052 | } | 1051 | } |
1053 | 1052 | ||
1054 | void KOAgendaView::fillAgenda() | 1053 | void KOAgendaView::fillAgenda() |
1055 | { | 1054 | { |
1056 | if ( globalFlagBlockStartup ) | 1055 | if ( globalFlagBlockStartup ) |
1057 | return; | 1056 | return; |
1058 | if ( globalFlagBlockAgenda == 1 ) | 1057 | if ( globalFlagBlockAgenda == 1 ) |
1059 | return; | 1058 | return; |
1060 | //if ( globalFlagBlockAgenda == 2 ) | 1059 | //if ( globalFlagBlockAgenda == 2 ) |
1061 | //globalFlagBlockAgenda = 0; | 1060 | //globalFlagBlockAgenda = 0; |
1062 | // globalFlagBlockPainting = false; | 1061 | // globalFlagBlockPainting = false; |
1063 | if ( globalFlagBlockAgenda == 0 ) | 1062 | if ( globalFlagBlockAgenda == 0 ) |
1064 | globalFlagBlockAgenda = 1; | 1063 | globalFlagBlockAgenda = 1; |
1065 | // clearView(); | 1064 | // clearView(); |
1066 | //qDebug("fillAgenda()++++ "); | 1065 | //qDebug("fillAgenda()++++ "); |
1067 | globalFlagBlockAgendaItemPaint = 1; | 1066 | globalFlagBlockAgendaItemPaint = 1; |
1068 | mAllDayAgenda->changeColumns(mSelectedDates.count()); | 1067 | mAllDayAgenda->changeColumns(mSelectedDates.count()); |
1069 | mAgenda->changeColumns(mSelectedDates.count()); | 1068 | mAgenda->changeColumns(mSelectedDates.count()); |
1070 | qApp->processEvents(); | 1069 | qApp->processEvents(); |
1071 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); | 1070 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); |
1072 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); | 1071 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); |
1073 | setHolidayMasks(); | 1072 | setHolidayMasks(); |
1074 | 1073 | ||
1075 | //mAgenda->hideUnused(); | 1074 | //mAgenda->hideUnused(); |
1076 | //mAllDayAgenda->hideUnused(); | 1075 | //mAllDayAgenda->hideUnused(); |
1077 | 1076 | ||
1078 | // mAgenda->blockNextRepaint( false ); | 1077 | // mAgenda->blockNextRepaint( false ); |
1079 | // mAgenda->viewport()->repaint(); | 1078 | // mAgenda->viewport()->repaint(); |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 6294b98..0ef5ae4 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1066,224 +1066,228 @@ void KOMonthView::updateView() | |||
1066 | mCells[iii]->insertEvent( event ); | 1066 | mCells[iii]->insertEvent( event ); |
1067 | } | 1067 | } |
1068 | } | 1068 | } |
1069 | } | 1069 | } |
1070 | } | 1070 | } |
1071 | // insert due todos | 1071 | // insert due todos |
1072 | QPtrList<Todo> todos = calendar()->todos( ); | 1072 | QPtrList<Todo> todos = calendar()->todos( ); |
1073 | Todo *todo; | 1073 | Todo *todo; |
1074 | for(todo = todos.first(); todo; todo = todos.next()) { | 1074 | for(todo = todos.first(); todo; todo = todos.next()) { |
1075 | //insertTodo( todo ); | 1075 | //insertTodo( todo ); |
1076 | if ( todo->hasDueDate() ) { | 1076 | if ( todo->hasDueDate() ) { |
1077 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 1077 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
1078 | if ( day >= 0 && day < timeSpan + 1) { | 1078 | if ( day >= 0 && day < timeSpan + 1) { |
1079 | mCells[day]->insertTodo( todo ); | 1079 | mCells[day]->insertTodo( todo ); |
1080 | } | 1080 | } |
1081 | } | 1081 | } |
1082 | } | 1082 | } |
1083 | 1083 | ||
1084 | for( i = 0; i < timeSpan+1; ++i ) { | 1084 | for( i = 0; i < timeSpan+1; ++i ) { |
1085 | mCells[i]->finishUpdateCell(); | 1085 | mCells[i]->finishUpdateCell(); |
1086 | } | 1086 | } |
1087 | processSelectionChange(); | 1087 | processSelectionChange(); |
1088 | mCells[0]->setFocus(); | 1088 | mCells[0]->setFocus(); |
1089 | 1089 | ||
1090 | 1090 | ||
1091 | #else | 1091 | #else |
1092 | // old code | 1092 | // old code |
1093 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1093 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1094 | int i; | 1094 | int i; |
1095 | for( i = 0; i < mCells.count(); ++i ) { | 1095 | for( i = 0; i < mCells.count(); ++i ) { |
1096 | mCells[i]->updateCell(); | 1096 | mCells[i]->updateCell(); |
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | //qDebug("KOMonthView::updateView() "); | 1099 | //qDebug("KOMonthView::updateView() "); |
1100 | processSelectionChange(); | 1100 | processSelectionChange(); |
1101 | // qDebug("---------------------------------------------------------------------+ "); | 1101 | // qDebug("---------------------------------------------------------------------+ "); |
1102 | mCells[0]->setFocus(); | 1102 | mCells[0]->setFocus(); |
1103 | #endif | 1103 | #endif |
1104 | 1104 | ||
1105 | //qDebug("update time %d ", ti.elapsed()); | 1105 | //qDebug("update time %d ", ti.elapsed()); |
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1108 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1109 | { | 1109 | { |
1110 | computeLayout(); | 1110 | computeLayout(); |
1111 | mCells[0]->setFocus(); | 1111 | mCells[0]->setFocus(); |
1112 | } | 1112 | } |
1113 | void KOMonthView::computeLayoutWeek() | 1113 | void KOMonthView::computeLayoutWeek() |
1114 | { | 1114 | { |
1115 | 1115 | ||
1116 | int daysToShow; | 1116 | int daysToShow; |
1117 | bool combinedSatSun = false; | 1117 | bool combinedSatSun = false; |
1118 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1118 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1119 | daysToShow = 6; | 1119 | daysToShow = 6; |
1120 | combinedSatSun = true; | 1120 | combinedSatSun = true; |
1121 | } | 1121 | } |
1122 | int tWid = topLevelWidget()->size().width(); | 1122 | int tWid = topLevelWidget()->size().width(); |
1123 | int tHei = topLevelWidget()->size().height(); | 1123 | int tHei = topLevelWidget()->size().height(); |
1124 | 1124 | ||
1125 | int wid = size().width();//e | 1125 | int wid = size().width();//e |
1126 | int hei = size().height()-1; | 1126 | int hei = size().height()-1; |
1127 | 1127 | ||
1128 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1128 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1129 | return; | 1129 | return; |
1130 | 1130 | ||
1131 | if ( wid < hei ) | 1131 | if ( wid < hei ) |
1132 | daysToShow = 2; | 1132 | daysToShow = 2; |
1133 | else | 1133 | else |
1134 | daysToShow = 3; | 1134 | daysToShow = 3; |
1135 | mShowSatSunComp = true; | 1135 | mShowSatSunComp = true; |
1136 | combinedSatSun = true; | 1136 | combinedSatSun = true; |
1137 | 1137 | ||
1138 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | 1138 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); |
1139 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1139 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1140 | int weeklabelwid = fm.width( "888" ); | 1140 | int weeklabelwid = fm.width( "888" ); |
1141 | wid -= weeklabelwid; | 1141 | wid -= weeklabelwid; |
1142 | 1142 | ||
1143 | int colWid = wid / daysToShow; | 1143 | int colWid = wid / daysToShow; |
1144 | int lastCol = wid - ( colWid*6 ); | 1144 | int lastCol = wid - ( colWid*6 ); |
1145 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1145 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
1146 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); | 1146 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); |
1147 | int colModulo = wid % daysToShow; | 1147 | int colModulo = wid % daysToShow; |
1148 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; | 1148 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; |
1149 | //qDebug("rowmod %d ", rowModulo); | 1149 | //qDebug("rowmod %d ", rowModulo); |
1150 | int i; | 1150 | int i; |
1151 | int x,y,w,h; | 1151 | int x,y,w,h; |
1152 | x= 0; | 1152 | x= 0; |
1153 | y= 0; | 1153 | y= 0; |
1154 | w = colWid; | 1154 | w = colWid; |
1155 | h = dayLabelHei ; | 1155 | h = dayLabelHei ; |
1156 | for ( i = 0; i < 7; i++) { | 1156 | for ( i = 0; i < 7; i++) { |
1157 | if ( i && !( i % daysToShow) && i < 6) { | 1157 | if ( i && !( i % daysToShow) && i < 6) { |
1158 | y += hei/(5-daysToShow); | 1158 | y += hei/(5-daysToShow); |
1159 | x = 0; | 1159 | x = 0; |
1160 | w = colWid; | 1160 | w = colWid; |
1161 | } | 1161 | } |
1162 | if ( i == daysToShow-colModulo ) | 1162 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1163 | ++w; | 1163 | ++w; |
1164 | } | ||
1164 | if ( i >= 5 ) { | 1165 | if ( i >= 5 ) { |
1165 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2+1,h); | 1166 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); |
1166 | x -= w/2 ; | 1167 | x -= (w/2 ); |
1167 | } | 1168 | } |
1168 | else | 1169 | else |
1169 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1170 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1170 | x += w; | 1171 | x += w; |
1171 | } | 1172 | } |
1172 | x= 0; | 1173 | x= 0; |
1173 | y= dayLabelHei; | 1174 | y= dayLabelHei; |
1174 | w = colWid; | 1175 | w = colWid; |
1175 | h = cellHei; | 1176 | h = cellHei; |
1176 | for ( i = 0; i < mCells.count(); ++i) { | 1177 | for ( i = 0; i < mCells.count(); ++i) { |
1177 | if ( i > 6 ) { | 1178 | if ( i > 6 ) { |
1178 | mCells[i]->hide(); | 1179 | mCells[i]->hide(); |
1179 | continue; | 1180 | continue; |
1180 | } | 1181 | } |
1181 | 1182 | ||
1182 | w = colWid; | 1183 | w = colWid; |
1183 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1184 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1184 | ++w; | 1185 | ++w; |
1185 | } | 1186 | } |
1186 | if ( i == (daysToShow-1-rowModulo)*7) | 1187 | if ( i == (daysToShow-1-rowModulo)*7) |
1187 | ++h; | 1188 | ++h; |
1188 | 1189 | ||
1189 | if ( i >= 5 ) { | 1190 | if ( i >= 5 ) { |
1190 | if ( i ==5 ) { | 1191 | if ( i ==5 ) { |
1191 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1192 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1192 | x -= w ;y += h/2; | 1193 | x -= w ;y += h/2; |
1193 | } else { | 1194 | } else { |
1195 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { | ||
1196 | ++w; | ||
1197 | } | ||
1194 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1198 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1195 | y -= h/2; | 1199 | y -= h/2; |
1196 | } | 1200 | } |
1197 | } else | 1201 | } else |
1198 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1202 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1199 | 1203 | ||
1200 | 1204 | ||
1201 | x += w; | 1205 | x += w; |
1202 | if ( x + w/2 > wid ) { | 1206 | if ( x + w/2 > wid ) { |
1203 | x = 0; | 1207 | x = 0; |
1204 | y += h+dayLabelHei ; | 1208 | y += h+dayLabelHei ; |
1205 | } | 1209 | } |
1206 | } | 1210 | } |
1207 | y= dayLabelHei; | 1211 | y= dayLabelHei; |
1208 | h = cellHei ; | 1212 | h = cellHei ; |
1209 | mWeekLabels[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); | 1213 | mWeekLabels[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); |
1210 | for ( i = 1; i < 6; i++) { | 1214 | for ( i = 1; i < 6; i++) { |
1211 | mWeekLabels[i]->hide(); | 1215 | mWeekLabels[i]->hide(); |
1212 | } | 1216 | } |
1213 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1217 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1214 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1218 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1215 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1219 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1216 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1220 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; |
1217 | updateDayLabels(); | 1221 | updateDayLabels(); |
1218 | bool forceUpdate = !updatePossible; | 1222 | bool forceUpdate = !updatePossible; |
1219 | updatePossible = true; | 1223 | updatePossible = true; |
1220 | mWeekLabels[mNumWeeks]->setText( i18n("M")); | 1224 | mWeekLabels[mNumWeeks]->setText( i18n("M")); |
1221 | if ( forceUpdate ) | 1225 | if ( forceUpdate ) |
1222 | updateView(); | 1226 | updateView(); |
1223 | } | 1227 | } |
1224 | void KOMonthView::computeLayout() | 1228 | void KOMonthView::computeLayout() |
1225 | { | 1229 | { |
1226 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". | 1230 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". |
1227 | // note this only changes the text if the requested size crosses the | 1231 | // note this only changes the text if the requested size crosses the |
1228 | // threshold between big enough to support the full name and not big | 1232 | // threshold between big enough to support the full name and not big |
1229 | // enough. | 1233 | // enough. |
1230 | if ( mShowWeekView ){ | 1234 | if ( mShowWeekView ){ |
1231 | computeLayoutWeek(); | 1235 | computeLayoutWeek(); |
1232 | return; | 1236 | return; |
1233 | } | 1237 | } |
1234 | int daysToShow = 7; | 1238 | int daysToShow = 7; |
1235 | bool combinedSatSun = false; | 1239 | bool combinedSatSun = false; |
1236 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1240 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1237 | daysToShow = 6; | 1241 | daysToShow = 6; |
1238 | combinedSatSun = true; | 1242 | combinedSatSun = true; |
1239 | } | 1243 | } |
1240 | int tWid = topLevelWidget()->size().width(); | 1244 | int tWid = topLevelWidget()->size().width(); |
1241 | int tHei = topLevelWidget()->size().height(); | 1245 | int tHei = topLevelWidget()->size().height(); |
1242 | 1246 | ||
1243 | int wid = size().width();//e | 1247 | int wid = size().width();//e |
1244 | int hei = size().height()-1; | 1248 | int hei = size().height()-1; |
1245 | 1249 | ||
1246 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1250 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1247 | return; | 1251 | return; |
1248 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | 1252 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); |
1249 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1253 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1250 | int weeklabelwid = fm.width( "888" ); | 1254 | int weeklabelwid = fm.width( "888" ); |
1251 | wid -= weeklabelwid; | 1255 | wid -= weeklabelwid; |
1252 | 1256 | ||
1253 | int colWid = wid / daysToShow; | 1257 | int colWid = wid / daysToShow; |
1254 | int lastCol = wid - ( colWid*6 ); | 1258 | int lastCol = wid - ( colWid*6 ); |
1255 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1259 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
1256 | int cellHei = (hei - dayLabelHei) /6; | 1260 | int cellHei = (hei - dayLabelHei) /6; |
1257 | int colModulo = wid % daysToShow; | 1261 | int colModulo = wid % daysToShow; |
1258 | int rowModulo = (hei- dayLabelHei) % 6; | 1262 | int rowModulo = (hei- dayLabelHei) % 6; |
1259 | //qDebug("rowmod %d ", rowModulo); | 1263 | //qDebug("rowmod %d ", rowModulo); |
1260 | int i; | 1264 | int i; |
1261 | int x,y,w,h; | 1265 | int x,y,w,h; |
1262 | x= 0; | 1266 | x= 0; |
1263 | y= 0; | 1267 | y= 0; |
1264 | w = colWid; | 1268 | w = colWid; |
1265 | h = dayLabelHei ; | 1269 | h = dayLabelHei ; |
1266 | for ( i = 0; i < 7; i++) { | 1270 | for ( i = 0; i < 7; i++) { |
1267 | if ( i == daysToShow-colModulo ) | 1271 | if ( i == daysToShow-colModulo ) |
1268 | ++w; | 1272 | ++w; |
1269 | if ( combinedSatSun ) { | 1273 | if ( combinedSatSun ) { |
1270 | if ( i >= daysToShow-1 ) { | 1274 | if ( i >= daysToShow-1 ) { |
1271 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 1275 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); |
1272 | x -= w/2 ; | 1276 | x -= w/2 ; |
1273 | } | 1277 | } |
1274 | else | 1278 | else |
1275 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1279 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1276 | } else | 1280 | } else |
1277 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1281 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1278 | x += w; | 1282 | x += w; |
1279 | } | 1283 | } |
1280 | x= 0; | 1284 | x= 0; |
1281 | y= dayLabelHei; | 1285 | y= dayLabelHei; |
1282 | w = colWid; | 1286 | w = colWid; |
1283 | h = cellHei ; | 1287 | h = cellHei ; |
1284 | for ( i = 0; i < mCells.count(); ++i) { | 1288 | for ( i = 0; i < mCells.count(); ++i) { |
1285 | mCells[i]->show(); | 1289 | mCells[i]->show(); |
1286 | w = colWid; | 1290 | w = colWid; |
1287 | if ( ((i) % 7) >= 7-colModulo ) { | 1291 | if ( ((i) % 7) >= 7-colModulo ) { |
1288 | ++w; | 1292 | ++w; |
1289 | } | 1293 | } |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 6afd203..8aa0697 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -29,197 +29,194 @@ | |||
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
36 | #include "calendarview.h" | 36 | #include "calendarview.h" |
37 | #include "datenavigator.h" | 37 | #include "datenavigator.h" |
38 | #include "kotodoview.h" | 38 | #include "kotodoview.h" |
39 | #include "koagendaview.h" | 39 | #include "koagendaview.h" |
40 | #include "kodialogmanager.h" | 40 | #include "kodialogmanager.h" |
41 | #include "komonthview.h" | 41 | #include "komonthview.h" |
42 | #include "kolistview.h" | 42 | #include "kolistview.h" |
43 | #include "kowhatsnextview.h" | 43 | #include "kowhatsnextview.h" |
44 | #include "kojournalview.h" | 44 | #include "kojournalview.h" |
45 | #include "kotimespanview.h" | 45 | #include "kotimespanview.h" |
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "navigatorbar.h" | 47 | #include "navigatorbar.h" |
48 | #include "kdatenavigator.h" | 48 | #include "kdatenavigator.h" |
49 | 49 | ||
50 | #include "koviewmanager.h" | 50 | #include "koviewmanager.h" |
51 | //extern bool externFlagMonthviewBlockPainting; | 51 | //extern bool externFlagMonthviewBlockPainting; |
52 | 52 | ||
53 | //bool globalFlagBlockPainting = false; | 53 | //bool globalFlagBlockPainting = false; |
54 | int globalFlagBlockAgenda = 0; | 54 | int globalFlagBlockAgenda = 0; |
55 | int globalFlagBlockLabel = 0; | 55 | int globalFlagBlockLabel = 0; |
56 | int globalFlagBlockAgendaItemPaint = 1; | 56 | int globalFlagBlockAgendaItemPaint = 1; |
57 | int globalFlagBlockAgendaItemUpdate = 1; | 57 | int globalFlagBlockAgendaItemUpdate = 1; |
58 | 58 | ||
59 | 59 | ||
60 | KOViewManager::KOViewManager( CalendarView *mainView ) : | 60 | KOViewManager::KOViewManager( CalendarView *mainView ) : |
61 | QObject(), mMainView( mainView ) | 61 | QObject(), mMainView( mainView ) |
62 | { | 62 | { |
63 | mCurrentView = 0; | 63 | mCurrentView = 0; |
64 | 64 | ||
65 | mWhatsNextView = 0; | 65 | mWhatsNextView = 0; |
66 | mTodoView = 0; | 66 | mTodoView = 0; |
67 | mAgendaView = 0; | 67 | mAgendaView = 0; |
68 | mMonthView = 0; | 68 | mMonthView = 0; |
69 | mListView = 0; | 69 | mListView = 0; |
70 | mJournalView = 0; | 70 | mJournalView = 0; |
71 | mTimeSpanView = 0; | 71 | mTimeSpanView = 0; |
72 | mCurrentAgendaView = 0 ; | 72 | mCurrentAgendaView = 0 ; |
73 | mFlagShowNextxDays = false; | 73 | mFlagShowNextxDays = false; |
74 | } | 74 | } |
75 | 75 | ||
76 | KOViewManager::~KOViewManager() | 76 | KOViewManager::~KOViewManager() |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | KOrg::BaseView *KOViewManager::currentView() | 81 | KOrg::BaseView *KOViewManager::currentView() |
82 | { | 82 | { |
83 | return mCurrentView; | 83 | return mCurrentView; |
84 | } | 84 | } |
85 | 85 | ||
86 | void KOViewManager::readSettings(KConfig *config) | 86 | void KOViewManager::readSettings(KConfig *config) |
87 | { | 87 | { |
88 | config->setGroup("General"); | 88 | config->setGroup("General"); |
89 | QString view = config->readEntry("Current View"); | 89 | QString view = config->readEntry("Current View"); |
90 | if (view == "WhatsNext") showWhatsNextView(); | 90 | if (view == "WhatsNext") showWhatsNextView(); |
91 | else if (view == "Month") showMonthView(); | 91 | else if (view == "Month") showMonthView(); |
92 | else if (view == "List") showListView(); | 92 | else if (view == "List") showListView(); |
93 | else if (view == "Journal") showJournalView(); | 93 | else if (view == "Journal") showJournalView(); |
94 | else if (view == "TimeSpan") showTimeSpanView(); | 94 | else if (view == "TimeSpan") showTimeSpanView(); |
95 | else if (view == "Todo") showTodoView(); | 95 | else if (view == "Todo") showTodoView(); |
96 | else { | 96 | else { |
97 | showAgendaView(); | 97 | showAgendaView(); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | void KOViewManager::showDateView( int view, QDate date) | 101 | void KOViewManager::showDateView( int view, QDate date) |
102 | { | 102 | { |
103 | static int lastMode = 0; | 103 | static int lastMode = 0; |
104 | static int lastCount = 0; | 104 | static int lastCount = 0; |
105 | static bool lastNDMode = false; | 105 | static bool lastNDMode = false; |
106 | static QDate lastDate; | 106 | static QDate lastDate; |
107 | //qDebug("date %d %s", view, date.toString().latin1()); | 107 | //qDebug("date %d %s", view, date.toString().latin1()); |
108 | 108 | ||
109 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); | 109 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); |
110 | bool savemFlagShowNextxDays = mFlagShowNextxDays; | 110 | bool savemFlagShowNextxDays = mFlagShowNextxDays; |
111 | mFlagShowNextxDays = false; | 111 | mFlagShowNextxDays = false; |
112 | if ( view == 3 ) { | 112 | if ( view == 3 ) { |
113 | //mCurrentAgendaView = 1 ; | 113 | //mCurrentAgendaView = 1 ; |
114 | lastDate = mMainView->dateNavigator()->selectedDates().first(); | 114 | lastDate = mMainView->dateNavigator()->selectedDates().first(); |
115 | lastCount = mMainView->dateNavigator()->selectedDates().count(); | 115 | lastCount = mMainView->dateNavigator()->selectedDates().count(); |
116 | lastNDMode = savemFlagShowNextxDays; | 116 | lastNDMode = savemFlagShowNextxDays; |
117 | mMainView->showDay( date ); | 117 | mMainView->showDay( date ); |
118 | } else if (view == 4 ) { | 118 | } else if (view == 4 ) { |
119 | mCurrentAgendaView = 7 ; | 119 | mCurrentAgendaView = 7 ; |
120 | mMainView->dateNavigator()->selectDates( date, 7 ); | 120 | mMainView->dateNavigator()->selectDates( date, 7 ); |
121 | } else if (view == 5 ) { | 121 | } else if (view == 5 ) { |
122 | mCurrentAgendaView = 14 ; | 122 | mCurrentAgendaView = 14 ; |
123 | mMainView->dateNavigator()->selectDates( date, 14); | 123 | mMainView->dateNavigator()->selectDates( date, 14); |
124 | } else if (view == 6 ) { | 124 | } else if (view == 6 ) { |
125 | mMainView->dateNavigator()->blockSignals( true ); | 125 | mMainView->dateNavigator()->selectDates( date, 7 ); |
126 | showMonthView(); | 126 | showMonthView(); |
127 | mMainView->dateNavigator()->selectMonthByDate( date ); | ||
128 | mMainView->dateNavigator()->blockSignals( false ); | ||
129 | mMainView->dateNavigator()->selectDate( date ); | ||
130 | } else if (view == 7 ) { | 127 | } else if (view == 7 ) { |
131 | mMainView->dateNavigator()->selectDate( date ); | 128 | mMainView->dateNavigator()->selectDate( date ); |
132 | showJournalView(); | 129 | showJournalView(); |
133 | } else if (view == 8 ) { | 130 | } else if (view == 8 ) { |
134 | globalFlagBlockAgenda = 1; | 131 | globalFlagBlockAgenda = 1; |
135 | if ( mCurrentAgendaView != 3 ) | 132 | if ( mCurrentAgendaView != 3 ) |
136 | mCurrentAgendaView = -1; | 133 | mCurrentAgendaView = -1; |
137 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 134 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
138 | globalFlagBlockAgenda = 2; | 135 | globalFlagBlockAgenda = 2; |
139 | mMainView->dateNavigator()->selectDates( date , | 136 | mMainView->dateNavigator()->selectDates( date , |
140 | KOPrefs::instance()->mNextXDays ); | 137 | KOPrefs::instance()->mNextXDays ); |
141 | mFlagShowNextxDays = true; | 138 | mFlagShowNextxDays = true; |
142 | mCurrentAgendaView = 3 ; | 139 | mCurrentAgendaView = 3 ; |
143 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) | 140 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) |
144 | if ( lastMode ) { | 141 | if ( lastMode ) { |
145 | mCurrentAgendaView = lastCount ; | 142 | mCurrentAgendaView = lastCount ; |
146 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); | 143 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); |
147 | mFlagShowNextxDays = lastNDMode; | 144 | mFlagShowNextxDays = lastNDMode; |
148 | if ( mFlagShowNextxDays ) { | 145 | if ( mFlagShowNextxDays ) { |
149 | mCurrentAgendaView = 3 ; | 146 | mCurrentAgendaView = 3 ; |
150 | } | 147 | } |
151 | } else | 148 | } else |
152 | showWeekView(); | 149 | showWeekView(); |
153 | } else if (view == 10) { | 150 | } else if (view == 10) { |
154 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); | 151 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); |
155 | } | 152 | } |
156 | lastMode = view; | 153 | lastMode = view; |
157 | } | 154 | } |
158 | 155 | ||
159 | 156 | ||
160 | 157 | ||
161 | void KOViewManager::writeSettings(KConfig *config) | 158 | void KOViewManager::writeSettings(KConfig *config) |
162 | { | 159 | { |
163 | config->setGroup("General"); | 160 | config->setGroup("General"); |
164 | 161 | ||
165 | QString view; | 162 | QString view; |
166 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 163 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
167 | else if (mCurrentView == mMonthView) view = "Month"; | 164 | else if (mCurrentView == mMonthView) view = "Month"; |
168 | else if (mCurrentView == mListView) view = "List"; | 165 | else if (mCurrentView == mListView) view = "List"; |
169 | else if (mCurrentView == mJournalView) view = "Journal"; | 166 | else if (mCurrentView == mJournalView) view = "Journal"; |
170 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 167 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
171 | else if (mCurrentView == mTodoView) view = "Todo"; | 168 | else if (mCurrentView == mTodoView) view = "Todo"; |
172 | else view = "Agenda"; | 169 | else view = "Agenda"; |
173 | 170 | ||
174 | config->writeEntry("Current View",view); | 171 | config->writeEntry("Current View",view); |
175 | 172 | ||
176 | if (mAgendaView) { | 173 | if (mAgendaView) { |
177 | mAgendaView->writeSettings(config); | 174 | mAgendaView->writeSettings(config); |
178 | } | 175 | } |
179 | if (mTimeSpanView) { | 176 | if (mTimeSpanView) { |
180 | mTimeSpanView->writeSettings(config); | 177 | mTimeSpanView->writeSettings(config); |
181 | } | 178 | } |
182 | if (mListView) { | 179 | if (mListView) { |
183 | mListView->writeSettings(config); | 180 | mListView->writeSettings(config); |
184 | } | 181 | } |
185 | if (mTodoView) { | 182 | if (mTodoView) { |
186 | mTodoView->saveLayout(config,"Todo View"); | 183 | mTodoView->saveLayout(config,"Todo View"); |
187 | } | 184 | } |
188 | } | 185 | } |
189 | 186 | ||
190 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 187 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
191 | { | 188 | { |
192 | 189 | ||
193 | //mFlagShowNextxDays = false; | 190 | //mFlagShowNextxDays = false; |
194 | //if(view == mCurrentView) return; | 191 | //if(view == mCurrentView) return; |
195 | if ( view == 0 ) { | 192 | if ( view == 0 ) { |
196 | view = mCurrentView; | 193 | view = mCurrentView; |
197 | if ( view == 0 ) | 194 | if ( view == 0 ) |
198 | return; | 195 | return; |
199 | } | 196 | } |
200 | bool full = fullScreen; | 197 | bool full = fullScreen; |
201 | if(view == mCurrentView && view != mWhatsNextView ) { | 198 | if(view == mCurrentView && view != mWhatsNextView ) { |
202 | if ( mCurrentAgendaView < 0 ) | 199 | if ( mCurrentAgendaView < 0 ) |
203 | return; | 200 | return; |
204 | full = mMainView->leftFrame()->isVisible(); | 201 | full = mMainView->leftFrame()->isVisible(); |
205 | } else { | 202 | } else { |
206 | mCurrentView = view; | 203 | mCurrentView = view; |
207 | // bool full = fullScreen; | 204 | // bool full = fullScreen; |
208 | bool isFull = !mMainView->leftFrame()->isVisible(); | 205 | bool isFull = !mMainView->leftFrame()->isVisible(); |
209 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 206 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
210 | full = true; | 207 | full = true; |
211 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 208 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
212 | full = false; | 209 | full = false; |
213 | } | 210 | } |
214 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 211 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
215 | //raiseCurrentView( full ); | 212 | //raiseCurrentView( full ); |
216 | mMainView->processIncidenceSelection( 0 ); | 213 | mMainView->processIncidenceSelection( 0 ); |
217 | //mMainView->updateView(); | 214 | //mMainView->updateView(); |
218 | raiseCurrentView( full, true ); | 215 | raiseCurrentView( full, true ); |
219 | mMainView->adaptNavigationUnits(); | 216 | mMainView->adaptNavigationUnits(); |
220 | } | 217 | } |
221 | 218 | ||
222 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) | 219 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) |
223 | { | 220 | { |
224 | mCurrentAgendaView = 0; | 221 | mCurrentAgendaView = 0; |
225 | int wid = mMainView->width() ; | 222 | int wid = mMainView->width() ; |