-rw-r--r-- | korganizer/koagenda.cpp | 2 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 31 |
2 files changed, 2 insertions, 31 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index f860f7d..94c3b22 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -1042,193 +1042,193 @@ void KOAgenda::endItemAction() | |||
1042 | placeItem = modifiedItem; | 1042 | placeItem = modifiedItem; |
1043 | while ( placeItem ) { | 1043 | while ( placeItem ) { |
1044 | oldconflictItems = placeItem->conflictItems(); | 1044 | oldconflictItems = placeItem->conflictItems(); |
1045 | for ( item=oldconflictItems.first(); item != 0; | 1045 | for ( item=oldconflictItems.first(); item != 0; |
1046 | item=oldconflictItems.next() ) { | 1046 | item=oldconflictItems.next() ) { |
1047 | globalFlagBlockAgendaItemUpdate = 0; | 1047 | globalFlagBlockAgendaItemUpdate = 0; |
1048 | item->repaintMe(); | 1048 | item->repaintMe(); |
1049 | globalFlagBlockAgendaItemUpdate = 1; | 1049 | globalFlagBlockAgendaItemUpdate = 1; |
1050 | item->repaint(false); | 1050 | item->repaint(false); |
1051 | } | 1051 | } |
1052 | placeItem = placeItem->nextMultiItem(); | 1052 | placeItem = placeItem->nextMultiItem(); |
1053 | } | 1053 | } |
1054 | /* | 1054 | /* |
1055 | 1055 | ||
1056 | oldconflictItems = modifiedItem->conflictItems(); | 1056 | oldconflictItems = modifiedItem->conflictItems(); |
1057 | for ( item=oldconflictItems.first(); item != 0; | 1057 | for ( item=oldconflictItems.first(); item != 0; |
1058 | item=oldconflictItems.next() ) { | 1058 | item=oldconflictItems.next() ) { |
1059 | globalFlagBlockAgendaItemUpdate = 0; | 1059 | globalFlagBlockAgendaItemUpdate = 0; |
1060 | item->paintMe(false); | 1060 | item->paintMe(false); |
1061 | globalFlagBlockAgendaItemUpdate = 1; | 1061 | globalFlagBlockAgendaItemUpdate = 1; |
1062 | item->repaint(false); | 1062 | item->repaint(false); |
1063 | } | 1063 | } |
1064 | */ | 1064 | */ |
1065 | 1065 | ||
1066 | 1066 | ||
1067 | } | 1067 | } |
1068 | 1068 | ||
1069 | } | 1069 | } |
1070 | 1070 | ||
1071 | mScrollUpTimer.stop(); | 1071 | mScrollUpTimer.stop(); |
1072 | mScrollDownTimer.stop(); | 1072 | mScrollDownTimer.stop(); |
1073 | setCursor( arrowCursor ); | 1073 | setCursor( arrowCursor ); |
1074 | mActionItem = 0; | 1074 | mActionItem = 0; |
1075 | mActionType = NOP; | 1075 | mActionType = NOP; |
1076 | mItemMoved = 0; | 1076 | mItemMoved = 0; |
1077 | 1077 | ||
1078 | } | 1078 | } |
1079 | 1079 | ||
1080 | void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) | 1080 | void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) |
1081 | { | 1081 | { |
1082 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; | 1082 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; |
1083 | // QPoint point = viewport()->mapToGlobal(viewportPos); | 1083 | // QPoint point = viewport()->mapToGlobal(viewportPos); |
1084 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; | 1084 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; |
1085 | // point = clipper()->mapFromGlobal(point); | 1085 | // point = clipper()->mapFromGlobal(point); |
1086 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; | 1086 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; |
1087 | 1087 | ||
1088 | int x,y; | 1088 | int x,y; |
1089 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 1089 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
1090 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; | 1090 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; |
1091 | int gx,gy; | 1091 | int gx,gy; |
1092 | contentsToGrid(x,y,gx,gy); | 1092 | contentsToGrid(x,y,gx,gy); |
1093 | 1093 | ||
1094 | // Change cursor to resize cursor if appropriate | 1094 | // Change cursor to resize cursor if appropriate |
1095 | if (mAllDayMode) { | 1095 | if (mAllDayMode) { |
1096 | int gridDistanceX = (x - gx * mGridSpacingX); | 1096 | int gridDistanceX = (x - gx * mGridSpacingX); |
1097 | if (gridDistanceX < mResizeBorderWidth && | 1097 | if (gridDistanceX < mResizeBorderWidth && |
1098 | moveItem->cellX() == gx) { | 1098 | moveItem->cellX() == gx) { |
1099 | setCursor(sizeHorCursor); | 1099 | setCursor(sizeHorCursor); |
1100 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && | 1100 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && |
1101 | moveItem->cellXWidth() == gx) { | 1101 | moveItem->cellXWidth() == gx) { |
1102 | setCursor(sizeHorCursor); | 1102 | setCursor(sizeHorCursor); |
1103 | } else { | 1103 | } else { |
1104 | setCursor(arrowCursor); | 1104 | setCursor(arrowCursor); |
1105 | } | 1105 | } |
1106 | } else { | 1106 | } else { |
1107 | int gridDistanceY = (y - gy * mGridSpacingY); | 1107 | int gridDistanceY = (y - gy * mGridSpacingY); |
1108 | if (gridDistanceY < mResizeBorderWidth && | 1108 | if (gridDistanceY < mResizeBorderWidth && |
1109 | moveItem->cellYTop() == gy && | 1109 | moveItem->cellYTop() == gy && |
1110 | !moveItem->firstMultiItem()) { | 1110 | !moveItem->firstMultiItem()) { |
1111 | setCursor(sizeVerCursor); | 1111 | setCursor(sizeVerCursor); |
1112 | } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && | 1112 | } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && |
1113 | moveItem->cellYBottom() == gy && | 1113 | moveItem->cellYBottom() == gy && |
1114 | !moveItem->lastMultiItem()) { | 1114 | !moveItem->lastMultiItem()) { |
1115 | setCursor(sizeVerCursor); | 1115 | setCursor(sizeVerCursor); |
1116 | } else { | 1116 | } else { |
1117 | setCursor(arrowCursor); | 1117 | setCursor(arrowCursor); |
1118 | } | 1118 | } |
1119 | } | 1119 | } |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | 1122 | ||
1123 | /* | 1123 | /* |
1124 | Place item in cell and take care that multiple items using the same cell do | 1124 | Place item in cell and take care that multiple items using the same cell do |
1125 | not overlap. This method is not yet optimal. It doesn´t use the maximum space | 1125 | not overlap. This method is not yet optimal. It doesn´t use the maximum space |
1126 | it can get in all cases. | 1126 | it can get in all cases. |
1127 | At the moment the method has a bug: When an item is placed only the sub cell | 1127 | At the moment the method has a bug: When an item is placed only the sub cell |
1128 | widths of the items are changed, which are within the Y region the item to | 1128 | widths of the items are changed, which are within the Y region the item to |
1129 | place spans. When the sub cell width change of one of this items affects a | 1129 | place spans. When the sub cell width change of one of this items affects a |
1130 | cell, where other items are, which do not overlap in Y with the item to place, | 1130 | cell, where other items are, which do not overlap in Y with the item to place, |
1131 | the display gets corrupted, although the corruption looks quite nice. | 1131 | the display gets corrupted, although the corruption looks quite nice. |
1132 | */ | 1132 | */ |
1133 | void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | 1133 | void KOAgenda::placeSubCells(KOAgendaItem *placeItem) |
1134 | { | 1134 | { |
1135 | 1135 | ||
1136 | QPtrList<KOAgendaItem> conflictItems; | 1136 | QPtrList<KOAgendaItem> conflictItems; |
1137 | int maxSubCells = 0; | 1137 | int maxSubCells = 0; |
1138 | QIntDict<KOAgendaItem> subCellDict(5); | 1138 | QIntDict<KOAgendaItem> subCellDict(7); |
1139 | 1139 | ||
1140 | KOAgendaItem *item; | 1140 | KOAgendaItem *item; |
1141 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1141 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1142 | if (item != placeItem) { | 1142 | if (item != placeItem) { |
1143 | if (placeItem->cellX() <= item->cellXWidth() && | 1143 | if (placeItem->cellX() <= item->cellXWidth() && |
1144 | placeItem->cellXWidth() >= item->cellX()) { | 1144 | placeItem->cellXWidth() >= item->cellX()) { |
1145 | if ((placeItem->cellYTop() <= item->cellYBottom()) && | 1145 | if ((placeItem->cellYTop() <= item->cellYBottom()) && |
1146 | (placeItem->cellYBottom() >= item->cellYTop())) { | 1146 | (placeItem->cellYBottom() >= item->cellYTop())) { |
1147 | conflictItems.append(item); | 1147 | conflictItems.append(item); |
1148 | if (item->subCells() > maxSubCells) | 1148 | if (item->subCells() > maxSubCells) |
1149 | maxSubCells = item->subCells(); | 1149 | maxSubCells = item->subCells(); |
1150 | subCellDict.insert(item->subCell(),item); | 1150 | subCellDict.insert(item->subCell(),item); |
1151 | } | 1151 | } |
1152 | } | 1152 | } |
1153 | } | 1153 | } |
1154 | } | 1154 | } |
1155 | 1155 | ||
1156 | if (conflictItems.count() > 0) { | 1156 | if (conflictItems.count() > 0) { |
1157 | // Look for unused sub cell and insert item | 1157 | // Look for unused sub cell and insert item |
1158 | int i; | 1158 | int i; |
1159 | for(i=0;i<maxSubCells;++i) { | 1159 | for(i=0;i<maxSubCells;++i) { |
1160 | if (!subCellDict.find(i)) { | 1160 | if (!subCellDict.find(i)) { |
1161 | placeItem->setSubCell(i); | 1161 | placeItem->setSubCell(i); |
1162 | break; | 1162 | break; |
1163 | } | 1163 | } |
1164 | } | 1164 | } |
1165 | if (i == maxSubCells) { | 1165 | if (i == maxSubCells) { |
1166 | placeItem->setSubCell(maxSubCells); | 1166 | placeItem->setSubCell(maxSubCells); |
1167 | maxSubCells++; // add new item to number of sub cells | 1167 | maxSubCells++; // add new item to number of sub cells |
1168 | } | 1168 | } |
1169 | 1169 | ||
1170 | // Prepare for sub cell geometry adjustment | 1170 | // Prepare for sub cell geometry adjustment |
1171 | int newSubCellWidth; | 1171 | int newSubCellWidth; |
1172 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; | 1172 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; |
1173 | else newSubCellWidth = mGridSpacingX / maxSubCells; | 1173 | else newSubCellWidth = mGridSpacingX / maxSubCells; |
1174 | conflictItems.append(placeItem); | 1174 | conflictItems.append(placeItem); |
1175 | 1175 | ||
1176 | 1176 | ||
1177 | // Adjust sub cell geometry of all direct conflict items | 1177 | // Adjust sub cell geometry of all direct conflict items |
1178 | for ( item=conflictItems.first(); item != 0; | 1178 | for ( item=conflictItems.first(); item != 0; |
1179 | item=conflictItems.next() ) { | 1179 | item=conflictItems.next() ) { |
1180 | item->setSubCells(maxSubCells); | 1180 | item->setSubCells(maxSubCells); |
1181 | if (mAllDayMode) { | 1181 | if (mAllDayMode) { |
1182 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); | 1182 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); |
1183 | } else { | 1183 | } else { |
1184 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); | 1184 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); |
1185 | } | 1185 | } |
1186 | int x,y; | 1186 | int x,y; |
1187 | gridToContents(item->cellX(),item->cellYTop(),x,y); | 1187 | gridToContents(item->cellX(),item->cellYTop(),x,y); |
1188 | if (mAllDayMode) { | 1188 | if (mAllDayMode) { |
1189 | y += item->subCell() * newSubCellWidth; | 1189 | y += item->subCell() * newSubCellWidth; |
1190 | } else { | 1190 | } else { |
1191 | x += item->subCell() * newSubCellWidth; | 1191 | x += item->subCell() * newSubCellWidth; |
1192 | } | 1192 | } |
1193 | moveChild(item,x,y); | 1193 | moveChild(item,x,y); |
1194 | // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); | 1194 | // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); |
1195 | //item->updateItem(); | 1195 | //item->updateItem(); |
1196 | } | 1196 | } |
1197 | // Adjust sub cell geometry of all conflict items of all conflict items | 1197 | // Adjust sub cell geometry of all conflict items of all conflict items |
1198 | for ( item=conflictItems.first(); item != 0; | 1198 | for ( item=conflictItems.first(); item != 0; |
1199 | item=conflictItems.next() ) { | 1199 | item=conflictItems.next() ) { |
1200 | if ( placeItem != item ) { | 1200 | if ( placeItem != item ) { |
1201 | KOAgendaItem *item2; | 1201 | KOAgendaItem *item2; |
1202 | QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); | 1202 | QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); |
1203 | for ( item2=conflictItems2.first(); item2 != 0; | 1203 | for ( item2=conflictItems2.first(); item2 != 0; |
1204 | item2=conflictItems2.next() ) { | 1204 | item2=conflictItems2.next() ) { |
1205 | if ( item2->subCells() != maxSubCells) { | 1205 | if ( item2->subCells() != maxSubCells) { |
1206 | item2->setSubCells(maxSubCells); | 1206 | item2->setSubCells(maxSubCells); |
1207 | if (mAllDayMode) { | 1207 | if (mAllDayMode) { |
1208 | item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth); | 1208 | item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth); |
1209 | } else { | 1209 | } else { |
1210 | item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY); | 1210 | item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY); |
1211 | } | 1211 | } |
1212 | int x,y; | 1212 | int x,y; |
1213 | gridToContents(item2->cellX(),item2->cellYTop(),x,y); | 1213 | gridToContents(item2->cellX(),item2->cellYTop(),x,y); |
1214 | if (mAllDayMode) { | 1214 | if (mAllDayMode) { |
1215 | y += item2->subCell() * newSubCellWidth; | 1215 | y += item2->subCell() * newSubCellWidth; |
1216 | } else { | 1216 | } else { |
1217 | x += item2->subCell() * newSubCellWidth; | 1217 | x += item2->subCell() * newSubCellWidth; |
1218 | } | 1218 | } |
1219 | moveChild(item2,x,y); | 1219 | moveChild(item2,x,y); |
1220 | //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() ); | 1220 | //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() ); |
1221 | } | 1221 | } |
1222 | } | 1222 | } |
1223 | } | 1223 | } |
1224 | } | 1224 | } |
1225 | } else { | 1225 | } else { |
1226 | placeItem->setSubCell(0); | 1226 | placeItem->setSubCell(0); |
1227 | placeItem->setSubCells(1); | 1227 | placeItem->setSubCells(1); |
1228 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); | 1228 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); |
1229 | else placeItem->resize(mGridSpacingX,placeItem->height()); | 1229 | else placeItem->resize(mGridSpacingX,placeItem->height()); |
1230 | int x,y; | 1230 | int x,y; |
1231 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); | 1231 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); |
1232 | moveChild(placeItem,x,y); | 1232 | moveChild(placeItem,x,y); |
1233 | } | 1233 | } |
1234 | placeItem->setConflictItems(conflictItems); | 1234 | placeItem->setConflictItems(conflictItems); |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index a42227c..5a63b35 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -1028,416 +1028,387 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) | |||
1028 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 1028 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
1029 | else | 1029 | else |
1030 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); | 1030 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); |
1031 | endDt.setDate(startDate); | 1031 | endDt.setDate(startDate); |
1032 | } | 1032 | } |
1033 | } | 1033 | } |
1034 | } | 1034 | } |
1035 | if ( item->incidence()->typeID() == eventID ) { | 1035 | if ( item->incidence()->typeID() == eventID ) { |
1036 | item->incidence()->setDtStart(startDt); | 1036 | item->incidence()->setDtStart(startDt); |
1037 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); | 1037 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); |
1038 | } else if ( item->incidence()->typeID() == todoID ) { | 1038 | } else if ( item->incidence()->typeID() == todoID ) { |
1039 | Todo* to = static_cast<Todo*>(item->incidence()); | 1039 | Todo* to = static_cast<Todo*>(item->incidence()); |
1040 | 1040 | ||
1041 | to->setDtDue(endDt); | 1041 | to->setDtDue(endDt); |
1042 | if ( to->hasStartDate() ) { | 1042 | if ( to->hasStartDate() ) { |
1043 | if (to->dtStart() >= to->dtDue() ) | 1043 | if (to->dtStart() >= to->dtDue() ) |
1044 | to->setDtStart(to->dtDue().addDays( -2 )); | 1044 | to->setDtStart(to->dtDue().addDays( -2 )); |
1045 | } | 1045 | } |
1046 | 1046 | ||
1047 | } | 1047 | } |
1048 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); | 1048 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); |
1049 | item->incidence()->setRevision(item->incidence()->revision()+1); | 1049 | item->incidence()->setRevision(item->incidence()->revision()+1); |
1050 | item->setItemDate(startDt.date()); | 1050 | item->setItemDate(startDt.date()); |
1051 | //item->updateItem(); | 1051 | //item->updateItem(); |
1052 | if ( item->incidence()->typeID() == todoID ) { | 1052 | if ( item->incidence()->typeID() == todoID ) { |
1053 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); | 1053 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); |
1054 | 1054 | ||
1055 | } | 1055 | } |
1056 | else | 1056 | else |
1057 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); | 1057 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); |
1058 | item->updateItem(); | 1058 | item->updateItem(); |
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) | 1061 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) |
1062 | { | 1062 | { |
1063 | // kdDebug() << "KOAgendaView::selectDates" << endl; | 1063 | // kdDebug() << "KOAgendaView::selectDates" << endl; |
1064 | 1064 | ||
1065 | mSelectedDates.clear(); | 1065 | mSelectedDates.clear(); |
1066 | // qDebug("KOAgendaView::showDates "); | 1066 | // qDebug("KOAgendaView::showDates "); |
1067 | QDate d = start; | 1067 | QDate d = start; |
1068 | while (d <= end) { | 1068 | while (d <= end) { |
1069 | mSelectedDates.append(d); | 1069 | mSelectedDates.append(d); |
1070 | d = d.addDays( 1 ); | 1070 | d = d.addDays( 1 ); |
1071 | } | 1071 | } |
1072 | 1072 | ||
1073 | // and update the view | 1073 | // and update the view |
1074 | fillAgenda(); | 1074 | fillAgenda(); |
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | 1077 | ||
1078 | void KOAgendaView::showEvents(QPtrList<Event>) | 1078 | void KOAgendaView::showEvents(QPtrList<Event>) |
1079 | { | 1079 | { |
1080 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; | 1080 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; |
1081 | } | 1081 | } |
1082 | 1082 | ||
1083 | void KOAgendaView::changeEventDisplay(Event *, int) | 1083 | void KOAgendaView::changeEventDisplay(Event *, int) |
1084 | { | 1084 | { |
1085 | // qDebug("KOAgendaView::changeEventDisplay "); | 1085 | // qDebug("KOAgendaView::changeEventDisplay "); |
1086 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; | 1086 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; |
1087 | // this should be re-written to be MUCH smarter. Right now we | 1087 | // this should be re-written to be MUCH smarter. Right now we |
1088 | // are just playing dumb. | 1088 | // are just playing dumb. |
1089 | fillAgenda(); | 1089 | fillAgenda(); |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | void KOAgendaView::fillAgenda(const QDate &) | 1092 | void KOAgendaView::fillAgenda(const QDate &) |
1093 | { | 1093 | { |
1094 | // qDebug("KOAgendaView::fillAgenda "); | 1094 | // qDebug("KOAgendaView::fillAgenda "); |
1095 | fillAgenda(); | 1095 | fillAgenda(); |
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | void KOAgendaView::fillAgenda() | 1098 | void KOAgendaView::fillAgenda() |
1099 | { | 1099 | { |
1100 | if ( globalFlagBlockStartup ) | 1100 | if ( globalFlagBlockStartup ) |
1101 | return; | 1101 | return; |
1102 | if ( globalFlagBlockAgenda == 1 ) | 1102 | if ( globalFlagBlockAgenda == 1 ) |
1103 | return; | 1103 | return; |
1104 | static bool onlyOne = false; | 1104 | static bool onlyOne = false; |
1105 | if ( onlyOne ) | 1105 | if ( onlyOne ) |
1106 | return; | 1106 | return; |
1107 | onlyOne = true; | 1107 | onlyOne = true; |
1108 | //if ( globalFlagBlockAgenda == 2 ) | 1108 | //if ( globalFlagBlockAgenda == 2 ) |
1109 | //globalFlagBlockAgenda = 0; | 1109 | //globalFlagBlockAgenda = 0; |
1110 | // globalFlagBlockPainting = false; | 1110 | // globalFlagBlockPainting = false; |
1111 | if ( globalFlagBlockAgenda == 0 ) | 1111 | if ( globalFlagBlockAgenda == 0 ) |
1112 | globalFlagBlockAgenda = 1; | 1112 | globalFlagBlockAgenda = 1; |
1113 | // clearView(); | 1113 | // clearView(); |
1114 | //qDebug("fillAgenda()++++ "); | 1114 | //qDebug("fillAgenda()++++ "); |
1115 | globalFlagBlockAgendaItemPaint = 1; | 1115 | globalFlagBlockAgendaItemPaint = 1; |
1116 | 1116 | ||
1117 | mAllDayAgenda->changeColumns(mSelectedDates.count()); | 1117 | mAllDayAgenda->changeColumns(mSelectedDates.count()); |
1118 | mAgenda->changeColumns(mSelectedDates.count()); | 1118 | mAgenda->changeColumns(mSelectedDates.count()); |
1119 | qApp->processEvents(); | 1119 | qApp->processEvents(); |
1120 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); | 1120 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); |
1121 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); | 1121 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); |
1122 | setHolidayMasks(); | 1122 | setHolidayMasks(); |
1123 | 1123 | ||
1124 | //mAgenda->hideUnused(); | ||
1125 | //mAllDayAgenda->hideUnused(); | ||
1126 | |||
1127 | // mAgenda->blockNextRepaint( false ); | ||
1128 | // mAgenda->viewport()->repaint(); | ||
1129 | // mAgenda->blockNextRepaint( true ); | ||
1130 | mMinY.resize(mSelectedDates.count()); | 1124 | mMinY.resize(mSelectedDates.count()); |
1131 | mMaxY.resize(mSelectedDates.count()); | 1125 | mMaxY.resize(mSelectedDates.count()); |
1132 | 1126 | ||
1133 | QPtrList<Event> dayEvents; | 1127 | QPtrList<Event> dayEvents; |
1134 | 1128 | ||
1135 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1129 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1136 | // Therefore, gtodoset all of them. | 1130 | // Therefore, gtodoset all of them. |
1137 | QPtrList<Todo> todos = calendar()->todos(); | 1131 | QPtrList<Todo> todos = calendar()->todos(); |
1138 | 1132 | ||
1139 | mAgenda->setDateList(mSelectedDates); | 1133 | mAgenda->setDateList(mSelectedDates); |
1140 | 1134 | ||
1141 | QDate today = QDate::currentDate(); | 1135 | QDate today = QDate::currentDate(); |
1142 | 1136 | ||
1143 | DateList::ConstIterator dit; | 1137 | DateList::ConstIterator dit; |
1144 | int curCol = 0; | 1138 | int curCol = 0; |
1145 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 1139 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
1146 | QDate currentDate = *dit; | 1140 | QDate currentDate = *dit; |
1147 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() | 1141 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() |
1148 | // << endl; | 1142 | // << endl; |
1149 | 1143 | ||
1150 | dayEvents = calendar()->events(currentDate,true); | 1144 | dayEvents = calendar()->events(currentDate,false); |
1151 | 1145 | ||
1152 | // Default values, which can never be reached | 1146 | // Default values, which can never be reached |
1153 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; | 1147 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; |
1154 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; | 1148 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; |
1155 | 1149 | ||
1156 | unsigned int numEvent; | 1150 | unsigned int numEvent; |
1157 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { | 1151 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { |
1158 | Event *event = dayEvents.at(numEvent); | 1152 | Event *event = dayEvents.at(numEvent); |
1159 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) | 1153 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) |
1160 | if ( event->uid().left(15) == QString("last-syncEvent-") ) | 1154 | if ( event->uid().left(15) == QString("last-syncEvent-") ) |
1161 | continue; | 1155 | continue; |
1162 | // kdDebug() << " Event: " << event->summary() << endl; | 1156 | // kdDebug() << " Event: " << event->summary() << endl; |
1163 | 1157 | ||
1164 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; | 1158 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; |
1165 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; | 1159 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; |
1166 | 1160 | ||
1167 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; | 1161 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; |
1168 | 1162 | ||
1169 | if (event->doesFloat()) { | 1163 | if (event->doesFloat()) { |
1170 | if (event->recurrence()->doesRecur()) { | 1164 | if (event->recurrence()->doesRecur()) { |
1171 | if (event->isMultiDay() ) { | 1165 | if (event->isMultiDay() ) { |
1172 | endX = endX - beginX;// endX is now number of days | 1166 | endX = endX - beginX;// endX is now number of days |
1173 | if ( event->recursOn( currentDate ) ) { | 1167 | if ( event->recursOn( currentDate ) ) { |
1174 | endX += curCol; | 1168 | endX += curCol; |
1175 | beginX = curCol; | 1169 | beginX = curCol; |
1176 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1170 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1177 | } else { | 1171 | } else { |
1178 | //qDebug("days %d %s",endX , currentDate.toString().latin1()); | 1172 | //qDebug("days %d %s",endX , currentDate.toString().latin1()); |
1179 | QDate dateit = currentDate.addDays( -endX ); | 1173 | QDate dateit = currentDate.addDays( -endX ); |
1180 | if ( event->recursOn( dateit ) ) { | 1174 | if ( event->recursOn( dateit ) ) { |
1181 | //qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() ); | 1175 | //qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() ); |
1182 | if ( curCol-endX < 0 ) { | 1176 | if ( curCol-endX < 0 ) { |
1183 | mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); | 1177 | mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); |
1184 | } | 1178 | } |
1185 | } | 1179 | } |
1186 | } | 1180 | } |
1187 | } else { | 1181 | } else { |
1188 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); | 1182 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); |
1189 | } | 1183 | } |
1190 | 1184 | ||
1191 | } else { | 1185 | } else { |
1192 | if (beginX <= 0 && curCol == 0) { | 1186 | if (beginX <= 0 && curCol == 0) { |
1193 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1187 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1194 | } else if (beginX == curCol) { | 1188 | } else if (beginX == curCol) { |
1195 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1189 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1196 | } | 1190 | } |
1197 | } | 1191 | } |
1198 | } else if (event->isMultiDay()) { | 1192 | } else if (event->isMultiDay()) { |
1199 | if ( event->doesRecur () ) { | 1193 | if ( event->doesRecur () ) { |
1200 | QDate dateit = currentDate; | 1194 | QDate dateit = currentDate; |
1201 | int count = 0; | 1195 | int count = 0; |
1202 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; | 1196 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; |
1203 | while (! event->recursOn( dateit ) && count <= max ) { | 1197 | while (! event->recursOn( dateit ) && count <= max ) { |
1204 | ++count; | 1198 | ++count; |
1205 | dateit = dateit.addDays( -1 ); | 1199 | dateit = dateit.addDays( -1 ); |
1206 | } | 1200 | } |
1207 | bool ok; | 1201 | bool ok; |
1208 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); | 1202 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); |
1209 | if ( ok ) | 1203 | if ( ok ) |
1210 | { | 1204 | { |
1211 | int secs = event->dtStart().secsTo( event->dtEnd() ); | 1205 | int secs = event->dtStart().secsTo( event->dtEnd() ); |
1212 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; | 1206 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; |
1213 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; | 1207 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; |
1214 | endX = currentDate.daysTo(nextOcend.date()) + curCol; | 1208 | endX = currentDate.daysTo(nextOcend.date()) + curCol; |
1215 | 1209 | ||
1216 | } | 1210 | } |
1217 | } | 1211 | } |
1218 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1212 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1219 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1213 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1220 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); | 1214 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); |
1221 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { | 1215 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { |
1222 | //qDebug("insert!!! "); | 1216 | //qDebug("insert!!! "); |
1223 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); | 1217 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); |
1224 | } | 1218 | } |
1225 | if (beginX == curCol) { | 1219 | if (beginX == curCol) { |
1226 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1220 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1227 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1221 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1228 | } else if (endX == curCol) { | 1222 | } else if (endX == curCol) { |
1229 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1223 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1230 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1224 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1231 | } else { | 1225 | } else { |
1232 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1226 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1233 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1227 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1234 | } | 1228 | } |
1235 | } else { | 1229 | } else { |
1236 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1230 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1237 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1231 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1238 | if (endY < startY) endY = startY; | 1232 | if (endY < startY) endY = startY; |
1239 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); | 1233 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); |
1240 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1234 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1241 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1235 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1242 | } | 1236 | } |
1243 | } | 1237 | } |
1244 | // ---------- [display Todos -------------- | 1238 | // ---------- [display Todos -------------- |
1245 | unsigned int numTodo; | 1239 | unsigned int numTodo; |
1246 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { | 1240 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { |
1247 | Todo *todo = todos.at(numTodo); | 1241 | Todo *todo = todos.at(numTodo); |
1248 | 1242 | ||
1249 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date | 1243 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date |
1250 | if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) continue; | 1244 | if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) continue; |
1251 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1245 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1252 | // Already completed items can be displayed on their original due date | 1246 | // Already completed items can be displayed on their original due date |
1253 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda | 1247 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda |
1254 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; | 1248 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; |
1255 | bool fillIn = false; | 1249 | bool fillIn = false; |
1256 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) | 1250 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) |
1257 | fillIn = true; | 1251 | fillIn = true; |
1258 | if ( ! fillIn && !todo->hasCompletedDate() ) | 1252 | if ( ! fillIn && !todo->hasCompletedDate() ) |
1259 | fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); | 1253 | fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); |
1260 | if ( fillIn ) { | 1254 | if ( fillIn ) { |
1261 | if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue | 1255 | if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue |
1262 | if ( KOPrefs::instance()->mShowTodoInAgenda ) | 1256 | if ( KOPrefs::instance()->mShowTodoInAgenda ) |
1263 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); | 1257 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); |
1264 | } | 1258 | } |
1265 | else { | 1259 | else { |
1266 | QDateTime dt; | 1260 | QDateTime dt; |
1267 | if ( todo->hasCompletedDate() ) | 1261 | if ( todo->hasCompletedDate() ) |
1268 | dt = todo->completed(); | 1262 | dt = todo->completed(); |
1269 | else | 1263 | else |
1270 | dt = todo->dtDue();; | 1264 | dt = todo->dtDue();; |
1271 | 1265 | ||
1272 | 1266 | ||
1273 | int endY = mAgenda->timeToY(dt.time()) - 1; | 1267 | int endY = mAgenda->timeToY(dt.time()) - 1; |
1274 | int hi = (18/KOPrefs::instance()->mHourSize); | 1268 | int hi = (18/KOPrefs::instance()->mHourSize); |
1275 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); | 1269 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); |
1276 | int startY = endY -hi; | 1270 | int startY = endY -hi; |
1277 | 1271 | ||
1278 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); | 1272 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); |
1279 | 1273 | ||
1280 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1274 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1281 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1275 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1282 | } | 1276 | } |
1283 | } | 1277 | } |
1284 | } | 1278 | } |
1285 | // ---------- display Todos] -------------- | 1279 | // ---------- display Todos] -------------- |
1286 | 1280 | ||
1287 | ++curCol; | 1281 | ++curCol; |
1288 | } | 1282 | } |
1289 | mAgenda->hideUnused(); | 1283 | mAgenda->hideUnused(); |
1290 | mAllDayAgenda->hideUnused(); | 1284 | mAllDayAgenda->hideUnused(); |
1291 | mAgenda->checkScrollBoundaries(); | 1285 | mAgenda->checkScrollBoundaries(); |
1292 | |||
1293 | deleteSelectedDateTime(); | 1286 | deleteSelectedDateTime(); |
1294 | |||
1295 | createDayLabels(); | 1287 | createDayLabels(); |
1296 | emit incidenceSelected( 0 ); | 1288 | emit incidenceSelected( 0 ); |
1297 | 1289 | ||
1298 | if ( globalFlagBlockAgenda == 2 ) { | 1290 | if ( globalFlagBlockAgenda == 2 ) { |
1299 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 1291 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
1300 | setStartHour( KOPrefs::instance()->mDayBegins ); | 1292 | setStartHour( KOPrefs::instance()->mDayBegins ); |
1301 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 1293 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
1302 | setStartHour( QTime::currentTime ().hour() ); | 1294 | setStartHour( QTime::currentTime ().hour() ); |
1303 | // qApp->processEvents(); | ||
1304 | } | 1295 | } |
1305 | qApp->processEvents(); | 1296 | qApp->processEvents(); |
1306 | //qDebug("qApp->processEvents(); END "); | ||
1307 | globalFlagBlockAgenda = 0; | 1297 | globalFlagBlockAgenda = 0; |
1308 | |||
1309 | // mAgenda->hideUnused(); | ||
1310 | //mAllDayAgenda->hideUnused(); | ||
1311 | mAllDayAgenda->drawContentsToPainter(); | 1298 | mAllDayAgenda->drawContentsToPainter(); |
1312 | mAgenda->drawContentsToPainter(); | 1299 | mAgenda->drawContentsToPainter(); |
1313 | repaintAgenda(); | 1300 | repaintAgenda(); |
1314 | onlyOne = false; | 1301 | onlyOne = false; |
1315 | // mAgenda->finishUpdate(); | ||
1316 | //mAllDayAgenda->finishUpdate(); | ||
1317 | |||
1318 | // repaintAgenda(); | ||
1319 | //qApp->processEvents(); | ||
1320 | // globalFlagBlockAgenda = 0; | ||
1321 | } | 1302 | } |
1322 | void KOAgendaView::repaintAgenda() | 1303 | void KOAgendaView::repaintAgenda() |
1323 | { | 1304 | { |
1324 | // mAllDayAgenda->drawContentsToPainter(); | ||
1325 | // mAllDayAgenda->viewport()->repaint( false ); | ||
1326 | // mAgenda->drawContentsToPainter(); | ||
1327 | // mAgenda->viewport()->repaint( false ); | ||
1328 | // qApp->processEvents(); | ||
1329 | |||
1330 | //qDebug("KOAgendaView::repaintAgenda() "); | ||
1331 | //qApp->processEvents(); | ||
1332 | mAgenda->viewport()->repaint( false ); | 1305 | mAgenda->viewport()->repaint( false ); |
1333 | mAllDayAgenda->viewport()->repaint( false ); | 1306 | mAllDayAgenda->viewport()->repaint( false ); |
1334 | mAgenda->finishUpdate(); | 1307 | mAgenda->finishUpdate(); |
1335 | mAllDayAgenda->finishUpdate(); | 1308 | mAllDayAgenda->finishUpdate(); |
1336 | } | 1309 | } |
1337 | 1310 | ||
1338 | 1311 | ||
1339 | void KOAgendaView::clearView() | 1312 | void KOAgendaView::clearView() |
1340 | { | 1313 | { |
1341 | // kdDebug() << "ClearView" << endl; | ||
1342 | mAllDayAgenda->clear(); | 1314 | mAllDayAgenda->clear(); |
1343 | mAgenda->clear(); | 1315 | mAgenda->clear(); |
1344 | } | 1316 | } |
1345 | void KOAgendaView::clearList() | 1317 | void KOAgendaView::clearList() |
1346 | { | 1318 | { |
1347 | // kdDebug() << "ClearView" << endl; | ||
1348 | clearView(); | 1319 | clearView(); |
1349 | mAllDayAgenda->hideUnused(); | 1320 | mAllDayAgenda->hideUnused(); |
1350 | mAgenda->hideUnused(); | 1321 | mAgenda->hideUnused(); |
1351 | } | 1322 | } |
1352 | 1323 | ||
1353 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1324 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1354 | const QDate &td) | 1325 | const QDate &td) |
1355 | { | 1326 | { |
1356 | #ifndef KORG_NOPRINTER | 1327 | #ifndef KORG_NOPRINTER |
1357 | if (fd == td) | 1328 | if (fd == td) |
1358 | calPrinter->preview(CalPrinter::Day, fd, td); | 1329 | calPrinter->preview(CalPrinter::Day, fd, td); |
1359 | else | 1330 | else |
1360 | calPrinter->preview(CalPrinter::Week, fd, td); | 1331 | calPrinter->preview(CalPrinter::Week, fd, td); |
1361 | #endif | 1332 | #endif |
1362 | } | 1333 | } |
1363 | 1334 | ||
1364 | // void KOAgendaView::updateMovedTodo() | 1335 | // void KOAgendaView::updateMovedTodo() |
1365 | // { | 1336 | // { |
1366 | // // updateConfig(); | 1337 | // // updateConfig(); |
1367 | // // emit updateTodoViews(); | 1338 | // // emit updateTodoViews(); |
1368 | // } | 1339 | // } |
1369 | 1340 | ||
1370 | void KOAgendaView::slotShowDateView( int mode , int d ) | 1341 | void KOAgendaView::slotShowDateView( int mode , int d ) |
1371 | { | 1342 | { |
1372 | if ( d >= mSelectedDates.count() ) { | 1343 | if ( d >= mSelectedDates.count() ) { |
1373 | qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() ); | 1344 | qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() ); |
1374 | 1345 | ||
1375 | } else { | 1346 | } else { |
1376 | QDate day = mSelectedDates[d]; | 1347 | QDate day = mSelectedDates[d]; |
1377 | emit showDateView(mode , day ); | 1348 | emit showDateView(mode , day ); |
1378 | } | 1349 | } |
1379 | 1350 | ||
1380 | } | 1351 | } |
1381 | void KOAgendaView::newEvent(int gx, int gy) | 1352 | void KOAgendaView::newEvent(int gx, int gy) |
1382 | { | 1353 | { |
1383 | if (!mSelectedDates.count()) return; | 1354 | if (!mSelectedDates.count()) return; |
1384 | 1355 | ||
1385 | QDate day = mSelectedDates[gx]; | 1356 | QDate day = mSelectedDates[gx]; |
1386 | 1357 | ||
1387 | QTime time = mAgenda->gyToTime(gy); | 1358 | QTime time = mAgenda->gyToTime(gy); |
1388 | QDateTime dt(day,time); | 1359 | QDateTime dt(day,time); |
1389 | // if ( dt < QDateTime::currentDateTime () ) | 1360 | // if ( dt < QDateTime::currentDateTime () ) |
1390 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); | 1361 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); |
1391 | emit newEventSignal(dt); | 1362 | emit newEventSignal(dt); |
1392 | } | 1363 | } |
1393 | 1364 | ||
1394 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) | 1365 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) |
1395 | { | 1366 | { |
1396 | if (!mSelectedDates.count()) return; | 1367 | if (!mSelectedDates.count()) return; |
1397 | 1368 | ||
1398 | QDate dayStart = mSelectedDates[gxStart]; | 1369 | QDate dayStart = mSelectedDates[gxStart]; |
1399 | QDate dayEnd = mSelectedDates[gxEnd]; | 1370 | QDate dayEnd = mSelectedDates[gxEnd]; |
1400 | 1371 | ||
1401 | QTime timeStart = mAgenda->gyToTime(gyStart); | 1372 | QTime timeStart = mAgenda->gyToTime(gyStart); |
1402 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); | 1373 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); |
1403 | 1374 | ||
1404 | QDateTime dtStart(dayStart,timeStart); | 1375 | QDateTime dtStart(dayStart,timeStart); |
1405 | QDateTime dtEnd(dayEnd,timeEnd); | 1376 | QDateTime dtEnd(dayEnd,timeEnd); |
1406 | 1377 | ||
1407 | emit newEventSignal(dtStart,dtEnd); | 1378 | emit newEventSignal(dtStart,dtEnd); |
1408 | } | 1379 | } |
1409 | 1380 | ||
1410 | void KOAgendaView::newEventAllDay(int gx, int ) | 1381 | void KOAgendaView::newEventAllDay(int gx, int ) |
1411 | { | 1382 | { |
1412 | if (!mSelectedDates.count()) return; | 1383 | if (!mSelectedDates.count()) return; |
1413 | 1384 | ||
1414 | QDate day = mSelectedDates[gx]; | 1385 | QDate day = mSelectedDates[gx]; |
1415 | 1386 | ||
1416 | emit newEventSignal(day); | 1387 | emit newEventSignal(day); |
1417 | } | 1388 | } |
1418 | void KOAgendaView::newTodoAllDay(int gx, int ) | 1389 | void KOAgendaView::newTodoAllDay(int gx, int ) |
1419 | { | 1390 | { |
1420 | if (!mSelectedDates.count()) return; | 1391 | if (!mSelectedDates.count()) return; |
1421 | 1392 | ||
1422 | QDateTime day (mSelectedDates[gx] ); | 1393 | QDateTime day (mSelectedDates[gx] ); |
1423 | emit newTodoSignal(day, true); | 1394 | emit newTodoSignal(day, true); |
1424 | } | 1395 | } |
1425 | void KOAgendaView::newTodo(int gx, int gy ) | 1396 | void KOAgendaView::newTodo(int gx, int gy ) |
1426 | { | 1397 | { |
1427 | if (!mSelectedDates.count()) return; | 1398 | if (!mSelectedDates.count()) return; |
1428 | QDate dayStart = mSelectedDates[gx]; | 1399 | QDate dayStart = mSelectedDates[gx]; |
1429 | QTime timeStart = mAgenda->gyToTime(gy); | 1400 | QTime timeStart = mAgenda->gyToTime(gy); |
1430 | QDateTime dt (dayStart,timeStart); | 1401 | QDateTime dt (dayStart,timeStart); |
1431 | emit newTodoSignal( dt, false ); | 1402 | emit newTodoSignal( dt, false ); |
1432 | } | 1403 | } |
1433 | 1404 | ||
1434 | void KOAgendaView::updateEventIndicatorTop(int newY) | 1405 | void KOAgendaView::updateEventIndicatorTop(int newY) |
1435 | { | 1406 | { |
1436 | uint i; | 1407 | uint i; |
1437 | for(i=0;i<mMinY.size();++i) { | 1408 | for(i=0;i<mMinY.size();++i) { |
1438 | if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); | 1409 | if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); |
1439 | else mEventIndicatorTop->enableColumn(i,false); | 1410 | else mEventIndicatorTop->enableColumn(i,false); |
1440 | } | 1411 | } |
1441 | 1412 | ||
1442 | mEventIndicatorTop->update(); | 1413 | mEventIndicatorTop->update(); |
1443 | } | 1414 | } |