author | zautrix <zautrix> | 2005-07-04 21:23:46 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-04 21:23:46 (UTC) |
commit | 35f1ad23e06a0f6014d98c952e8b8652b5cffc49 (patch) (unidiff) | |
tree | 4c3b222a9d2baff7b43c366bb0bfa1fab24a5177 | |
parent | 2767ffda27fa0e88816832d4b2c6efdd0c52a8eb (diff) | |
download | kdepimpi-35f1ad23e06a0f6014d98c952e8b8652b5cffc49.zip kdepimpi-35f1ad23e06a0f6014d98c952e8b8652b5cffc49.tar.gz kdepimpi-35f1ad23e06a0f6014d98c952e8b8652b5cffc49.tar.bz2 |
highlight pix smaller
-rw-r--r-- | korganizer/koagenda.cpp | 225 |
1 files changed, 113 insertions, 112 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 63fdecd..9b817bc 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -1031,1041 +1031,1042 @@ void KOAgenda::endItemAction() | |||
1031 | placeItem = modifiedItem; | 1031 | placeItem = modifiedItem; |
1032 | while ( placeItem ) { | 1032 | while ( placeItem ) { |
1033 | oldconflictItems = placeItem->conflictItems(); | 1033 | oldconflictItems = placeItem->conflictItems(); |
1034 | for ( item=oldconflictItems.first(); item != 0; | 1034 | for ( item=oldconflictItems.first(); item != 0; |
1035 | item=oldconflictItems.next() ) { | 1035 | item=oldconflictItems.next() ) { |
1036 | placeSubCells(item); | 1036 | placeSubCells(item); |
1037 | } | 1037 | } |
1038 | placeSubCells( placeItem ); | 1038 | placeSubCells( placeItem ); |
1039 | placeItem = placeItem->nextMultiItem(); | 1039 | placeItem = placeItem->nextMultiItem(); |
1040 | 1040 | ||
1041 | } | 1041 | } |
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(7); | 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); |
1235 | // for ( item=conflictItems.first(); item != 0; | 1235 | // for ( item=conflictItems.first(); item != 0; |
1236 | // item=conflictItems.next() ) { | 1236 | // item=conflictItems.next() ) { |
1237 | // //item->updateItem(); | 1237 | // //item->updateItem(); |
1238 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); | 1238 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); |
1239 | // } | 1239 | // } |
1240 | // placeItem->updateItem(); | 1240 | // placeItem->updateItem(); |
1241 | } | 1241 | } |
1242 | 1242 | ||
1243 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | 1243 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) |
1244 | { | 1244 | { |
1245 | if ( globalFlagBlockAgenda ) | 1245 | if ( globalFlagBlockAgenda ) |
1246 | return; | 1246 | return; |
1247 | if ( ! mAllDayMode ) { | 1247 | if ( ! mAllDayMode ) { |
1248 | // currently not working for | 1248 | // currently not working for |
1249 | 1249 | ||
1250 | //qDebug("KOAgenda::drawContents "); | 1250 | //qDebug("KOAgenda::drawContents "); |
1251 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) | 1251 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) |
1252 | ;//drawContentsToPainter(); | 1252 | ;//drawContentsToPainter(); |
1253 | 1253 | ||
1254 | QPaintDevice* pd = p->device(); | 1254 | QPaintDevice* pd = p->device(); |
1255 | p->end(); | 1255 | p->end(); |
1256 | int vx, vy; | 1256 | int vx, vy; |
1257 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1257 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1258 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1258 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1259 | mSelectionCellX * mGridSpacingX; | 1259 | mSelectionCellX * mGridSpacingX; |
1260 | contentsToViewport ( cx, cy, vx,vy); | 1260 | contentsToViewport ( cx, cy, vx,vy); |
1261 | //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; | 1261 | //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; |
1262 | 1262 | ||
1263 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { | 1263 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { |
1264 | if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1264 | if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1265 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { | 1265 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { |
1266 | 1266 | ||
1267 | int vxSel, vySel; | 1267 | int vxSel, vySel; |
1268 | contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel); | 1268 | contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel); |
1269 | int off = mSelectionHeight; | 1269 | int off = mSelectionHeight; |
1270 | if ( vySel < 0 ) | 1270 | if ( vySel < 0 ) |
1271 | off += vySel; | 1271 | off += vySel; |
1272 | //qDebug("OFF %d %d %d", off,vySel, vy ); | 1272 | //qDebug("OFF %d %d %d", off,vySel, vy ); |
1273 | bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP); | 1273 | bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP); |
1274 | } else { | 1274 | } else { |
1275 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); | 1275 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); |
1276 | } | 1276 | } |
1277 | } | 1277 | } |
1278 | if ( mSelectionHeight > 0 ) { | 1278 | if ( mSelectionHeight > 0 ) { |
1279 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); | 1279 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); |
1280 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1280 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1281 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1281 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1282 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); | 1282 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); |
1283 | // bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); | 1283 | // bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); |
1284 | int hei = mSelectionHeight; | 1284 | int hei = mSelectionHeight; |
1285 | int offset = 0; | 1285 | int offset = 0; |
1286 | while ( hei > 0 ) { | 1286 | while ( hei > 0 ) { |
1287 | int p_hei = 5; | 1287 | int p_hei = 5; |
1288 | if ( hei < 5 ) p_hei = hei; | 1288 | if ( hei < 5 ) p_hei = hei; |
1289 | hei -= 5; | 1289 | hei -= 5; |
1290 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); | 1290 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); |
1291 | offset += 5; | 1291 | offset += 5; |
1292 | } | 1292 | } |
1293 | } | 1293 | } |
1294 | } | 1294 | } |
1295 | p->begin( pd ); | 1295 | p->begin( pd ); |
1296 | } else { | 1296 | } else { |
1297 | 1297 | ||
1298 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) | 1298 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) |
1299 | ;//drawContentsToPainter(); | 1299 | ;//drawContentsToPainter(); |
1300 | 1300 | ||
1301 | QPaintDevice* pd = p->device(); | 1301 | QPaintDevice* pd = p->device(); |
1302 | p->end(); | 1302 | p->end(); |
1303 | int vx, vy; | 1303 | int vx, vy; |
1304 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1304 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1305 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1305 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1306 | mSelectionCellX * mGridSpacingX; | 1306 | mSelectionCellX * mGridSpacingX; |
1307 | contentsToViewport ( cx, cy, vx,vy); | 1307 | contentsToViewport ( cx, cy, vx,vy); |
1308 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; | 1308 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; |
1309 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) | 1309 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) |
1310 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); | 1310 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); |
1311 | 1311 | ||
1312 | if ( mSelectionHeight > 0 ) { | 1312 | if ( mSelectionHeight > 0 ) { |
1313 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); | 1313 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); |
1314 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1314 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1315 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1315 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1316 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); | 1316 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); |
1317 | //bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); | 1317 | //bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); |
1318 | int hei = mSelectionHeight; | 1318 | int hei = mSelectionHeight; |
1319 | int offset = 0; | 1319 | int offset = 0; |
1320 | while ( hei > 0 ) { | 1320 | while ( hei > 0 ) { |
1321 | int p_hei = 5; | 1321 | int p_hei = 5; |
1322 | if ( hei < 5 ) p_hei = hei; | 1322 | if ( hei < 5 ) p_hei = hei; |
1323 | hei -= 5; | 1323 | hei -= 5; |
1324 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); | 1324 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); |
1325 | offset += 5; | 1325 | offset += 5; |
1326 | } | 1326 | } |
1327 | } | 1327 | } |
1328 | } | 1328 | } |
1329 | p->begin( pd ); | 1329 | p->begin( pd ); |
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | } | 1332 | } |
1333 | 1333 | ||
1334 | void KOAgenda::finishUpdate() | 1334 | void KOAgenda::finishUpdate() |
1335 | { | 1335 | { |
1336 | 1336 | ||
1337 | KOAgendaItem *item; | 1337 | KOAgendaItem *item; |
1338 | globalFlagBlockAgendaItemPaint = 1; | 1338 | globalFlagBlockAgendaItemPaint = 1; |
1339 | // Adjust sub cell geometry of all conflict items of all conflict items of all conflict items ... of the conflict item with the max number of conflictitems | 1339 | // Adjust sub cell geometry of all conflict items of all conflict items of all conflict items ... of the conflict item with the max number of conflictitems |
1340 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1340 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1341 | if ( !item->checkLayout() ) { | 1341 | if ( !item->checkLayout() ) { |
1342 | //qDebug(" conflictitem found "); | 1342 | //qDebug(" conflictitem found "); |
1343 | int newSubCellWidth; | 1343 | int newSubCellWidth; |
1344 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells(); | 1344 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells(); |
1345 | else newSubCellWidth = mGridSpacingX / item->subCells(); | 1345 | else newSubCellWidth = mGridSpacingX / item->subCells(); |
1346 | 1346 | ||
1347 | if (mAllDayMode) { | 1347 | if (mAllDayMode) { |
1348 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); | 1348 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); |
1349 | } else { | 1349 | } else { |
1350 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); | 1350 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); |
1351 | } | 1351 | } |
1352 | int x,y; | 1352 | int x,y; |
1353 | gridToContents(item->cellX(),item->cellYTop(),x,y); | 1353 | gridToContents(item->cellX(),item->cellYTop(),x,y); |
1354 | if (mAllDayMode) { | 1354 | if (mAllDayMode) { |
1355 | y += item->subCell() * newSubCellWidth; | 1355 | y += item->subCell() * newSubCellWidth; |
1356 | } else { | 1356 | } else { |
1357 | x += item->subCell() * newSubCellWidth; | 1357 | x += item->subCell() * newSubCellWidth; |
1358 | } | 1358 | } |
1359 | moveChild(item,x,y); | 1359 | moveChild(item,x,y); |
1360 | } | 1360 | } |
1361 | } | 1361 | } |
1362 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1362 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1363 | if ( !item->isVisible() ) | 1363 | if ( !item->isVisible() ) |
1364 | item->show(); | 1364 | item->show(); |
1365 | 1365 | ||
1366 | } | 1366 | } |
1367 | globalFlagBlockAgendaItemUpdate = 0; | 1367 | globalFlagBlockAgendaItemUpdate = 0; |
1368 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1368 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1369 | item->repaintMe( ); | 1369 | item->repaintMe( ); |
1370 | } | 1370 | } |
1371 | globalFlagBlockAgendaItemUpdate = 1; | 1371 | globalFlagBlockAgendaItemUpdate = 1; |
1372 | qApp->processEvents(); | 1372 | qApp->processEvents(); |
1373 | globalFlagBlockAgendaItemPaint = 0; | 1373 | globalFlagBlockAgendaItemPaint = 0; |
1374 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1374 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1375 | item->repaint( false ); | 1375 | item->repaint( false ); |
1376 | } | 1376 | } |
1377 | 1377 | ||
1378 | } | 1378 | } |
1379 | 1379 | ||
1380 | /* | 1380 | /* |
1381 | Draw grid in the background of the agenda. | 1381 | Draw grid in the background of the agenda. |
1382 | */ | 1382 | */ |
1383 | void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) | 1383 | void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) |
1384 | { | 1384 | { |
1385 | 1385 | ||
1386 | 1386 | ||
1387 | if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) | 1387 | if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) |
1388 | return; | 1388 | return; |
1389 | if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) | 1389 | if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) |
1390 | return; | 1390 | return; |
1391 | int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); | 1391 | int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); |
1392 | if ( ch < 1 ) | 1392 | if ( ch < 1 ) |
1393 | ch = 1; | 1393 | ch = 1; |
1394 | if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { | 1394 | if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { |
1395 | mPaintPixmap.resize( contentsWidth()+42, ch ); | 1395 | mPaintPixmap.resize( contentsWidth()+42, ch ); |
1396 | } | 1396 | } |
1397 | mCurPixWid = contentsWidth(); | 1397 | mCurPixWid = contentsWidth(); |
1398 | mCurPixHei = ch; | 1398 | mCurPixHei = ch; |
1399 | if ( mHighlightPixmap.width() < mGridSpacingX-1 ) { | 1399 | if ( mHighlightPixmap.width() < mGridSpacingX-1 ) { |
1400 | mHighlightPixmap.resize( mGridSpacingX-1, 5 ); | 1400 | mHighlightPixmap.resize( mGridSpacingX-1, 5 ); |
1401 | mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); | 1401 | mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); |
1402 | } | 1402 | } |
1403 | mPixPainter.begin( &mPaintPixmap) ; | 1403 | mPixPainter.begin( &mPaintPixmap) ; |
1404 | //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() ); | 1404 | //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() ); |
1405 | QPainter * p ; | 1405 | QPainter * p ; |
1406 | if (paint == 0) { | 1406 | if (paint == 0) { |
1407 | mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor); | 1407 | mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor); |
1408 | p = &mPixPainter; | 1408 | p = &mPixPainter; |
1409 | } | 1409 | } |
1410 | else | 1410 | else |
1411 | p = paint ; | 1411 | p = paint ; |
1412 | // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); | 1412 | // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); |
1413 | 1413 | ||
1414 | //--cx;++cw; | 1414 | //--cx;++cw; |
1415 | int lGridSpacingY = mGridSpacingY*2; | 1415 | int lGridSpacingY = mGridSpacingY*2; |
1416 | int selDay; | 1416 | int selDay; |
1417 | if ( !backgroundOnly ) | 1417 | QDate curDate = QDate::currentDate(); |
1418 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) | 1418 | if ( !backgroundOnly ) { |
1419 | { | 1419 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) |
1420 | if ( mSelectedDates[selDay] == QDateTime::currentDateTime ().date() && KOPrefs::instance()->mHighlightCurrentDay) { | 1420 | { |
1421 | int x1 = cx; | 1421 | if ( mSelectedDates[selDay] == curDate && KOPrefs::instance()->mHighlightCurrentDay) { |
1422 | int y1 = 0; | 1422 | int x1 = cx; |
1423 | if (y1 < cy) y1 = cy; | 1423 | int y1 = 0; |
1424 | int x2 = cx+cw-1; | 1424 | if (y1 < cy) y1 = cy; |
1425 | int y2 = contentsHeight(); | 1425 | int x2 = cx+cw-1; |
1426 | if (y2 > cy+ch-1) y2=cy+ch-1; | 1426 | int y2 = contentsHeight(); |
1427 | if (x2 >= x1 && y2 >= y1) { | 1427 | if (y2 > cy+ch-1) y2=cy+ch-1; |
1428 | int gxStart = selDay; | 1428 | if (x2 >= x1 && y2 >= y1) { |
1429 | int gxEnd = gxStart ; | 1429 | int gxStart = selDay; |
1430 | int xStart = KOGlobals::self()->reverseLayout() ? | 1430 | int gxEnd = gxStart ; |
1431 | (mColumns - 1 - gxStart)*mGridSpacingX : | 1431 | int xStart = KOGlobals::self()->reverseLayout() ? |
1432 | gxStart*mGridSpacingX; | 1432 | (mColumns - 1 - gxStart)*mGridSpacingX : |
1433 | if (xStart < x1) xStart = x1; | 1433 | gxStart*mGridSpacingX; |
1434 | int xEnd = KOGlobals::self()->reverseLayout() ? | 1434 | if (xStart < x1) xStart = x1; |
1435 | (mColumns - gxStart)*mGridSpacingX-1 : | 1435 | int xEnd = KOGlobals::self()->reverseLayout() ? |
1436 | (gxStart+1)*mGridSpacingX-1; | 1436 | (mColumns - gxStart)*mGridSpacingX-1 : |
1437 | if (xEnd > x2) xEnd = x2; | 1437 | (gxStart+1)*mGridSpacingX-1; |
1438 | if ( KOPrefs::instance()->mUseHighlightLightColor ) | 1438 | if (xEnd > x2) xEnd = x2; |
1439 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1439 | if ( KOPrefs::instance()->mUseHighlightLightColor ) |
1440 | KOPrefs::instance()->mAgendaBgColor.light()); | 1440 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1441 | else | 1441 | KOPrefs::instance()->mAgendaBgColor.light()); |
1442 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1442 | else |
1443 | KOPrefs::instance()->mAgendaBgColor.dark()); | 1443 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1444 | KOPrefs::instance()->mAgendaBgColor.dark()); | ||
1444 | 1445 | ||
1445 | } | 1446 | } |
1446 | } | 1447 | } |
1447 | } | 1448 | } |
1448 | // Highlight working hours | 1449 | } |
1449 | 1450 | // Highlight working hours | |
1450 | if ( !backgroundOnly ) | 1451 | |
1451 | if (mWorkingHoursEnable) { | 1452 | if ( !backgroundOnly ) |
1452 | int x1 = cx; | 1453 | if (mWorkingHoursEnable) { |
1453 | int y1 = mWorkingHoursYTop; | 1454 | int x1 = cx; |
1454 | if (y1 < cy) y1 = cy; | 1455 | int y1 = mWorkingHoursYTop; |
1455 | int x2 = cx+cw-1; | 1456 | if (y1 < cy) y1 = cy; |
1456 | // int x2 = mGridSpacingX * 5 - 1; | 1457 | int x2 = cx+cw-1; |
1457 | // if (x2 > cx+cw-1) x2 = cx + cw - 1; | 1458 | // int x2 = mGridSpacingX * 5 - 1; |
1458 | int y2 = mWorkingHoursYBottom; | 1459 | // if (x2 > cx+cw-1) x2 = cx + cw - 1; |
1459 | if (y2 > cy+ch-1) y2=cy+ch-1; | 1460 | int y2 = mWorkingHoursYBottom; |
1460 | 1461 | if (y2 > cy+ch-1) y2=cy+ch-1; | |
1461 | if (x2 >= x1 && y2 >= y1) { | 1462 | |
1462 | // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); | 1463 | if (x2 >= x1 && y2 >= y1) { |
1463 | int gxStart = x1/mGridSpacingX; | 1464 | // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); |
1464 | int gxEnd = x2/mGridSpacingX; | 1465 | int gxStart = x1/mGridSpacingX; |
1465 | while(gxStart <= gxEnd) { | 1466 | int gxEnd = x2/mGridSpacingX; |
1466 | if (gxStart < int(mHolidayMask->count()) && | 1467 | while(gxStart <= gxEnd) { |
1467 | !mHolidayMask->at(gxStart)) { | 1468 | if (gxStart < int(mHolidayMask->count()) && |
1468 | int xStart = KOGlobals::self()->reverseLayout() ? | 1469 | !mHolidayMask->at(gxStart)) { |
1469 | (mColumns - 1 - gxStart)*mGridSpacingX : | 1470 | int xStart = KOGlobals::self()->reverseLayout() ? |
1470 | gxStart*mGridSpacingX; | 1471 | (mColumns - 1 - gxStart)*mGridSpacingX : |
1471 | if (xStart < x1) xStart = x1; | 1472 | gxStart*mGridSpacingX; |
1472 | int xEnd = KOGlobals::self()->reverseLayout() ? | 1473 | if (xStart < x1) xStart = x1; |
1473 | (mColumns - gxStart)*mGridSpacingX-1 : | 1474 | int xEnd = KOGlobals::self()->reverseLayout() ? |
1474 | (gxStart+1)*mGridSpacingX-1; | 1475 | (mColumns - gxStart)*mGridSpacingX-1 : |
1475 | if (xEnd > x2) xEnd = x2; | 1476 | (gxStart+1)*mGridSpacingX-1; |
1476 | if ( mSelectedDates[gxStart] == QDateTime::currentDateTime ().date()&& KOPrefs::instance()->mHighlightCurrentDay ) { | 1477 | if (xEnd > x2) xEnd = x2; |
1477 | if ( KOPrefs::instance()->mUseHighlightLightColor ) | 1478 | if ( mSelectedDates[gxStart] == curDate && KOPrefs::instance()->mHighlightCurrentDay ) { |
1478 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1479 | if ( KOPrefs::instance()->mUseHighlightLightColor ) |
1479 | KOPrefs::instance()->mWorkingHoursColor.light()); | 1480 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1480 | else | 1481 | KOPrefs::instance()->mWorkingHoursColor.light()); |
1481 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1482 | else |
1482 | KOPrefs::instance()->mWorkingHoursColor.dark()); | 1483 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1483 | } else { | 1484 | KOPrefs::instance()->mWorkingHoursColor.dark()); |
1484 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1485 | } else { |
1485 | KOPrefs::instance()->mWorkingHoursColor); | 1486 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1486 | } | 1487 | KOPrefs::instance()->mWorkingHoursColor); |
1488 | } | ||
1489 | } | ||
1490 | ++gxStart; | ||
1491 | } | ||
1492 | } | ||
1487 | } | 1493 | } |
1488 | ++gxStart; | 1494 | /* |
1495 | int selectionX = KOGlobals::self()->reverseLayout() ? | ||
1496 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | ||
1497 | mSelectionCellX * mGridSpacingX; | ||
1498 | |||
1499 | // Draw selection | ||
1500 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | ||
1501 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | ||
1502 | // TODO: paint only part within cx,cy,cw,ch | ||
1503 | p->fillRect( selectionX, mSelectionYTop, mGridSpacingX, | ||
1504 | mSelectionHeight, KOPrefs::instance()->mHighlightColor ); | ||
1489 | } | 1505 | } |
1490 | } | 1506 | */ |
1491 | } | 1507 | // Draw vertical lines of grid |
1492 | /* | ||
1493 | int selectionX = KOGlobals::self()->reverseLayout() ? | ||
1494 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | ||
1495 | mSelectionCellX * mGridSpacingX; | ||
1496 | |||
1497 | // Draw selection | ||
1498 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | ||
1499 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | ||
1500 | // TODO: paint only part within cx,cy,cw,ch | ||
1501 | p->fillRect( selectionX, mSelectionYTop, mGridSpacingX, | ||
1502 | mSelectionHeight, KOPrefs::instance()->mHighlightColor ); | ||
1503 | } | ||
1504 | */ | ||
1505 | // Draw vertical lines of grid | ||
1506 | 1508 | ||
1507 | int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; | 1509 | int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; |
1508 | if ( mGridSpacingX > 0 ) { | 1510 | if ( mGridSpacingX > 0 ) { |
1509 | while (x < cx + cw) { | 1511 | while (x < cx + cw) { |
1510 | p->drawLine(x,cy,x,cy+ch); | 1512 | p->drawLine(x,cy,x,cy+ch); |
1511 | x+=mGridSpacingX; | 1513 | x+=mGridSpacingX; |
1512 | } | 1514 | } |
1513 | } | 1515 | } |
1514 | // Draw horizontal lines of grid | 1516 | // Draw horizontal lines of grid |
1515 | int y = ((int)(cy/lGridSpacingY))*lGridSpacingY; | 1517 | int y = ((int)(cy/lGridSpacingY))*lGridSpacingY; |
1516 | if ( lGridSpacingY > 0 ) { | 1518 | if ( lGridSpacingY > 0 ) { |
1517 | while (y < cy + ch) { | 1519 | while (y < cy + ch) { |
1518 | p->setPen( SolidLine ); | 1520 | p->setPen( SolidLine ); |
1519 | p->drawLine(cx,y,cx+cw,y); | 1521 | p->drawLine(cx,y,cx+cw,y); |
1520 | y+=lGridSpacingY; | 1522 | y+=lGridSpacingY; |
1521 | p->setPen( DotLine ); | 1523 | p->setPen( DotLine ); |
1522 | p->drawLine(cx,y,cx+cw,y); | 1524 | p->drawLine(cx,y,cx+cw,y); |
1523 | y+=lGridSpacingY; | 1525 | y+=lGridSpacingY; |
1524 | } | 1526 | } |
1525 | p->setPen( SolidLine ); | 1527 | p->setPen( SolidLine ); |
1526 | } | 1528 | } |
1527 | mPixPainter.end() ; | 1529 | mPixPainter.end() ; |
1528 | } | 1530 | } |
1529 | 1531 | ||
1530 | /* | 1532 | /* |
1531 | Convert srcollview contents coordinates to agenda grid coordinates. | 1533 | Convert srcollview contents coordinates to agenda grid coordinates. |
1532 | */ | 1534 | */ |
1533 | void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy) | 1535 | void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy) |
1534 | { | 1536 | { |
1535 | gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX : | 1537 | gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX : |
1536 | x/mGridSpacingX; | 1538 | x/mGridSpacingX; |
1537 | gy = y/mGridSpacingY; | 1539 | gy = y/mGridSpacingY; |
1538 | } | 1540 | } |
1539 | 1541 | ||
1540 | /* | 1542 | /* |
1541 | Convert agenda grid coordinates to scrollview contents coordinates. | 1543 | Convert agenda grid coordinates to scrollview contents coordinates. |
1542 | */ | 1544 | */ |
1543 | void KOAgenda::gridToContents (int gx, int gy, int& x, int& y) | 1545 | void KOAgenda::gridToContents (int gx, int gy, int& x, int& y) |
1544 | { | 1546 | { |
1545 | x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX: | 1547 | x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX: |
1546 | gx*mGridSpacingX; | 1548 | gx*mGridSpacingX; |
1547 | y = gy*mGridSpacingY; | 1549 | y = gy*mGridSpacingY; |
1548 | } | 1550 | } |
1549 | 1551 | ||
1550 | 1552 | ||
1551 | /* | 1553 | /* |
1552 | Return Y coordinate corresponding to time. Coordinates are rounded to fit into | 1554 | Return Y coordinate corresponding to time. Coordinates are rounded to fit into |
1553 | the grid. | 1555 | the grid. |
1554 | */ | 1556 | */ |
1555 | int KOAgenda::timeToY(const QTime &time) | 1557 | int KOAgenda::timeToY(const QTime &time) |
1556 | { | 1558 | { |
1557 | int minutesPerCell = 24 * 60 / mRows; | 1559 | int minutesPerCell = 24 * 60 / mRows; |
1558 | int timeMinutes = time.hour() * 60 + time.minute(); | 1560 | int timeMinutes = time.hour() * 60 + time.minute(); |
1559 | int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell; | 1561 | int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell; |
1560 | return Y; | 1562 | return Y; |
1561 | } | 1563 | } |
1562 | 1564 | ||
1563 | 1565 | ||
1564 | /* | 1566 | /* |
1565 | Return time corresponding to cell y coordinate. Coordinates are rounded to | 1567 | Return time corresponding to cell y coordinate. Coordinates are rounded to |
1566 | fit into the grid. | 1568 | fit into the grid. |
1567 | */ | 1569 | */ |
1568 | QTime KOAgenda::gyToTime(int gy) | 1570 | QTime KOAgenda::gyToTime(int gy) |
1569 | { | 1571 | { |
1570 | 1572 | ||
1571 | int secondsPerCell = 24 * 60 * 60/ mRows; | 1573 | int secondsPerCell = 24 * 60 * 60/ mRows; |
1572 | 1574 | ||
1573 | int timeSeconds = secondsPerCell * gy; | 1575 | int timeSeconds = secondsPerCell * gy; |
1574 | 1576 | ||
1575 | QTime time( 0, 0, 0 ); | 1577 | QTime time( 0, 0, 0 ); |
1576 | if ( timeSeconds < 24 * 60 * 60 ) { | 1578 | if ( timeSeconds < 24 * 60 * 60 ) { |
1577 | time = time.addSecs(timeSeconds); | 1579 | time = time.addSecs(timeSeconds); |
1578 | } else { | 1580 | } else { |
1579 | time.setHMS( 23, 59, 59 ); | 1581 | time.setHMS( 23, 59, 59 ); |
1580 | } | 1582 | } |
1581 | 1583 | ||
1582 | return time; | 1584 | return time; |
1583 | } | 1585 | } |
1584 | 1586 | ||
1585 | void KOAgenda::setStartHour(int startHour) | 1587 | void KOAgenda::setStartHour(int startHour) |
1586 | { | 1588 | { |
1587 | int startCell = startHour * mRows / 24; | 1589 | int startCell = startHour * mRows / 24; |
1588 | setContentsPos(0,startCell * gridSpacingY()); | 1590 | setContentsPos(0,startCell * gridSpacingY()); |
1589 | } | 1591 | } |
1590 | void KOAgenda::hideUnused() | 1592 | void KOAgenda::hideUnused() |
1591 | { | 1593 | { |
1592 | // experimental only | 1594 | // experimental only |
1593 | // return; | 1595 | // return; |
1594 | KOAgendaItem *item; | 1596 | KOAgendaItem *item; |
1595 | for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) { | 1597 | for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) { |
1596 | item->hide(); | 1598 | item->hide(); |
1597 | } | 1599 | } |
1598 | } | 1600 | } |
1599 | 1601 | ||
1600 | 1602 | ||
1601 | KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view) | 1603 | KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view) |
1602 | { | 1604 | { |
1603 | 1605 | ||
1604 | KOAgendaItem *fi; | 1606 | KOAgendaItem *fi; |
1605 | for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) { | 1607 | for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) { |
1606 | if ( fi->incidence() == event ) { | 1608 | if ( fi->incidence() == event ) { |
1607 | mUnusedItems.remove(); | 1609 | mUnusedItems.remove(); |
1608 | fi->init( event, qd ); | 1610 | fi->init( event, qd ); |
1609 | return fi; | 1611 | return fi; |
1610 | } | 1612 | } |
1611 | } | 1613 | } |
1612 | fi=mUnusedItems.first(); | 1614 | fi=mUnusedItems.first(); |
1613 | if ( fi ) { | 1615 | if ( fi ) { |
1614 | mUnusedItems.remove(); | 1616 | mUnusedItems.remove(); |
1615 | fi->init( event, qd ); | 1617 | fi->init( event, qd ); |
1616 | return fi; | 1618 | return fi; |
1617 | } | 1619 | } |
1618 | // qDebug("new KOAgendaItem "); | 1620 | // qDebug("new KOAgendaItem "); |
1619 | 1621 | ||
1620 | KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode ); | 1622 | KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode ); |
1621 | agendaItem->installEventFilter(this); | 1623 | agendaItem->installEventFilter(this); |
1622 | addChild(agendaItem,0,0); | 1624 | addChild(agendaItem,0,0); |
1623 | return agendaItem; | 1625 | return agendaItem; |
1624 | } | 1626 | } |
1625 | KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo ) | 1627 | KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo ) |
1626 | { | 1628 | { |
1627 | KOAgendaItem *item; | 1629 | KOAgendaItem *item; |
1628 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1630 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1629 | if ( item->incidence() == todo ) { | 1631 | if ( item->incidence() == todo ) { |
1630 | mItems.remove(); | 1632 | mItems.remove(); |
1631 | return item; | 1633 | return item; |
1632 | } | 1634 | } |
1633 | } | 1635 | } |
1634 | return 0; | 1636 | return 0; |
1635 | } | 1637 | } |
1636 | 1638 | ||
1637 | 1639 | ||
1638 | void KOAgenda::updateTodo( Todo * todo, int days, bool remove) | 1640 | void KOAgenda::updateTodo( Todo * todo, int days, bool remove) |
1639 | { | 1641 | { |
1640 | // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )|| | 1642 | // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )|| |
1641 | KOAgendaItem *item; | 1643 | KOAgendaItem *item; |
1642 | item = getItemForTodo ( todo ); | 1644 | item = getItemForTodo ( todo ); |
1643 | //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove); | 1645 | //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove); |
1644 | if ( item ) { | 1646 | if ( item ) { |
1645 | blockSignals( true ); | 1647 | blockSignals( true ); |
1646 | //qDebug("item found "); | 1648 | //qDebug("item found "); |
1647 | item->hide(); | 1649 | item->hide(); |
1648 | item->setCellX(-2, -1 ); | 1650 | item->setCellX(-2, -1 ); |
1649 | item->select(false); | 1651 | item->select(false); |
1650 | mUnusedItems.append( item ); | 1652 | mUnusedItems.append( item ); |
1651 | mItems.remove( item ); | 1653 | mItems.remove( item ); |
1652 | QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); | 1654 | QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); |
1653 | KOAgendaItem *itemit; | 1655 | KOAgendaItem *itemit; |
1654 | //globalFlagBlockAgendaItemPaint = 1; | 1656 | //globalFlagBlockAgendaItemPaint = 1; |
1655 | for ( itemit=oldconflictItems.first(); itemit != 0; | 1657 | for ( itemit=oldconflictItems.first(); itemit != 0; |
1656 | itemit=oldconflictItems.next() ) { | 1658 | itemit=oldconflictItems.next() ) { |
1657 | if ( itemit != item ) | 1659 | if ( itemit != item ) |
1658 | placeSubCells(itemit); | 1660 | placeSubCells(itemit); |
1659 | } | 1661 | } |
1660 | qApp->processEvents(); | 1662 | qApp->processEvents(); |
1661 | //globalFlagBlockAgendaItemPaint = 0; | 1663 | //globalFlagBlockAgendaItemPaint = 0; |
1662 | for ( itemit=oldconflictItems.first(); itemit != 0; | 1664 | for ( itemit=oldconflictItems.first(); itemit != 0; |
1663 | itemit=oldconflictItems.next() ) { | 1665 | itemit=oldconflictItems.next() ) { |
1664 | globalFlagBlockAgendaItemUpdate = 0; | 1666 | globalFlagBlockAgendaItemUpdate = 0; |
1665 | if ( itemit != item ) | 1667 | if ( itemit != item ) |
1666 | itemit->repaintMe(); | 1668 | itemit->repaintMe(); |
1667 | globalFlagBlockAgendaItemUpdate = 1; | 1669 | globalFlagBlockAgendaItemUpdate = 1; |
1668 | itemit->repaint(); | 1670 | itemit->repaint(); |
1669 | } | 1671 | } |
1670 | blockSignals( false ); | 1672 | blockSignals( false ); |
1671 | } | 1673 | } |
1672 | if ( remove ) { | 1674 | if ( remove ) { |
1673 | //qDebug("remove****************************************** "); | 1675 | //qDebug("remove****************************************** "); |
1674 | return; | 1676 | return; |
1675 | } | 1677 | } |
1676 | if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) | 1678 | if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) |
1677 | return; | 1679 | return; |
1678 | //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); | 1680 | //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); |
1679 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda ); | 1681 | QDate currentDate = QDate::currentDate(); |
1680 | QDate currentDate; | 1682 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < currentDate)&& ( KOPrefs::instance()->mShowTodoInAgenda ); |
1681 | QDateTime dt; | 1683 | QDateTime dt; |
1682 | if ( todo->hasCompletedDate() ) | 1684 | if ( todo->hasCompletedDate() ) |
1683 | dt = todo->completed(); | 1685 | dt = todo->completed(); |
1684 | else | 1686 | else |
1685 | dt = todo->dtDue(); | 1687 | dt = todo->dtDue(); |
1686 | if ( overdue ) { | 1688 | if ( overdue ) { |
1687 | currentDate = QDate::currentDate(); | ||
1688 | days += todo->dtDue().date().daysTo( currentDate ); | 1689 | days += todo->dtDue().date().daysTo( currentDate ); |
1689 | } | 1690 | } |
1690 | else | 1691 | else |
1691 | currentDate = dt.date(); | 1692 | currentDate = dt.date(); |
1692 | 1693 | ||
1693 | if (( todo->doesFloat() || overdue) && !todo->hasCompletedDate() ) { | 1694 | if (( todo->doesFloat() || overdue) && !todo->hasCompletedDate() ) { |
1694 | if ( ! mAllDayMode ) return; | 1695 | if ( ! mAllDayMode ) return; |
1695 | // aldayagenda | 1696 | // aldayagenda |
1696 | globalFlagBlockAgendaItemPaint = 1; | 1697 | globalFlagBlockAgendaItemPaint = 1; |
1697 | item = insertAllDayItem(todo, currentDate,days, days); | 1698 | item = insertAllDayItem(todo, currentDate,days, days); |
1698 | item->show(); | 1699 | item->show(); |
1699 | 1700 | ||
1700 | } | 1701 | } |
1701 | else { | 1702 | else { |
1702 | if ( mAllDayMode ) return; | 1703 | if ( mAllDayMode ) return; |
1703 | // mAgenda | 1704 | // mAgenda |
1704 | globalFlagBlockAgendaItemPaint = 1; | 1705 | globalFlagBlockAgendaItemPaint = 1; |
1705 | int endY = timeToY(dt.time()) - 1; | 1706 | int endY = timeToY(dt.time()) - 1; |
1706 | int hi = 12/KOPrefs::instance()->mHourSize; | 1707 | int hi = 12/KOPrefs::instance()->mHourSize; |
1707 | int startY = endY - 1-hi; | 1708 | int startY = endY - 1-hi; |
1708 | item = insertItem(todo,currentDate,days,startY,endY); | 1709 | item = insertItem(todo,currentDate,days,startY,endY); |
1709 | item->show(); | 1710 | item->show(); |
1710 | } | 1711 | } |
1711 | qApp->processEvents(); | 1712 | qApp->processEvents(); |
1712 | globalFlagBlockAgendaItemPaint = 0; | 1713 | globalFlagBlockAgendaItemPaint = 0; |
1713 | QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); | 1714 | QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); |
1714 | KOAgendaItem *itemit; | 1715 | KOAgendaItem *itemit; |
1715 | for ( itemit=oldconflictItems.first(); itemit != 0; | 1716 | for ( itemit=oldconflictItems.first(); itemit != 0; |
1716 | itemit=oldconflictItems.next() ) { | 1717 | itemit=oldconflictItems.next() ) { |
1717 | globalFlagBlockAgendaItemUpdate = 0; | 1718 | globalFlagBlockAgendaItemUpdate = 0; |
1718 | itemit->repaintMe(); | 1719 | itemit->repaintMe(); |
1719 | globalFlagBlockAgendaItemUpdate = 1; | 1720 | globalFlagBlockAgendaItemUpdate = 1; |
1720 | itemit->repaint(); | 1721 | itemit->repaint(); |
1721 | } | 1722 | } |
1722 | globalFlagBlockAgendaItemUpdate = 0; | 1723 | globalFlagBlockAgendaItemUpdate = 0; |
1723 | item->repaintMe(); | 1724 | item->repaintMe(); |
1724 | globalFlagBlockAgendaItemUpdate = 1; | 1725 | globalFlagBlockAgendaItemUpdate = 1; |
1725 | item->repaint(); | 1726 | item->repaint(); |
1726 | } | 1727 | } |
1727 | /* | 1728 | /* |
1728 | Insert KOAgendaItem into agenda. | 1729 | Insert KOAgendaItem into agenda. |
1729 | */ | 1730 | */ |
1730 | KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom) | 1731 | KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom) |
1731 | { | 1732 | { |
1732 | if (mAllDayMode) { | 1733 | if (mAllDayMode) { |
1733 | qDebug("KOAgenda: calling insertItem in all-day mode is illegal. "); | 1734 | qDebug("KOAgenda: calling insertItem in all-day mode is illegal. "); |
1734 | return 0; | 1735 | return 0; |
1735 | } | 1736 | } |
1736 | 1737 | ||
1737 | KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); | 1738 | KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); |
1738 | //agendaItem->setFrameStyle(WinPanel|Raised); | 1739 | //agendaItem->setFrameStyle(WinPanel|Raised); |
1739 | 1740 | ||
1740 | int YSize = YBottom - YTop + 1; | 1741 | int YSize = YBottom - YTop + 1; |
1741 | if (YSize < 0) { | 1742 | if (YSize < 0) { |
1742 | YSize = 1; | 1743 | YSize = 1; |
1743 | } | 1744 | } |
1744 | int iheight = mGridSpacingY * YSize; | 1745 | int iheight = mGridSpacingY * YSize; |
1745 | 1746 | ||
1746 | agendaItem->resize(mGridSpacingX,iheight ); | 1747 | agendaItem->resize(mGridSpacingX,iheight ); |
1747 | agendaItem->setCellXY(X,YTop,YBottom); | 1748 | agendaItem->setCellXY(X,YTop,YBottom); |
1748 | agendaItem->setCellXWidth(X); | 1749 | agendaItem->setCellXWidth(X); |
1749 | 1750 | ||
1750 | //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY); | 1751 | //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY); |
1751 | mItems.append(agendaItem); | 1752 | mItems.append(agendaItem); |
1752 | 1753 | ||
1753 | placeSubCells(agendaItem); | 1754 | placeSubCells(agendaItem); |
1754 | 1755 | ||
1755 | //agendaItem->show(); | 1756 | //agendaItem->show(); |
1756 | 1757 | ||
1757 | marcus_bains(); | 1758 | marcus_bains(); |
1758 | 1759 | ||
1759 | return agendaItem; | 1760 | return agendaItem; |
1760 | } | 1761 | } |
1761 | 1762 | ||
1762 | 1763 | ||
1763 | /* | 1764 | /* |
1764 | Insert all-day KOAgendaItem into agenda. | 1765 | Insert all-day KOAgendaItem into agenda. |
1765 | */ | 1766 | */ |
1766 | KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd) | 1767 | KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd) |
1767 | { | 1768 | { |
1768 | if (!mAllDayMode) { | 1769 | if (!mAllDayMode) { |
1769 | return 0; | 1770 | return 0; |
1770 | } | 1771 | } |
1771 | 1772 | ||
1772 | KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); | 1773 | KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); |
1773 | 1774 | ||
1774 | agendaItem->setCellXY(XBegin,0,0); | 1775 | agendaItem->setCellXY(XBegin,0,0); |
1775 | agendaItem->setCellXWidth(XEnd); | 1776 | agendaItem->setCellXWidth(XEnd); |
1776 | agendaItem->resize(mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY); | 1777 | agendaItem->resize(mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY); |
1777 | 1778 | ||
1778 | //addChild(agendaItem,XBegin*mGridSpacingX,0); | 1779 | //addChild(agendaItem,XBegin*mGridSpacingX,0); |
1779 | mItems.append(agendaItem); | 1780 | mItems.append(agendaItem); |
1780 | 1781 | ||
1781 | placeSubCells(agendaItem); | 1782 | placeSubCells(agendaItem); |
1782 | 1783 | ||
1783 | //agendaItem->show(); | 1784 | //agendaItem->show(); |
1784 | 1785 | ||
1785 | return agendaItem; | 1786 | return agendaItem; |
1786 | } | 1787 | } |
1787 | 1788 | ||
1788 | 1789 | ||
1789 | void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, | 1790 | void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, |
1790 | int YTop,int YBottom) | 1791 | int YTop,int YBottom) |
1791 | { | 1792 | { |
1792 | if (mAllDayMode) { | 1793 | if (mAllDayMode) { |
1793 | ; | 1794 | ; |
1794 | return; | 1795 | return; |
1795 | } | 1796 | } |
1796 | 1797 | ||
1797 | int cellX,cellYTop,cellYBottom; | 1798 | int cellX,cellYTop,cellYBottom; |
1798 | QString newtext; | 1799 | QString newtext; |
1799 | int width = XEnd - XBegin + 1; | 1800 | int width = XEnd - XBegin + 1; |
1800 | int count = 0; | 1801 | int count = 0; |
1801 | KOAgendaItem *current = 0; | 1802 | KOAgendaItem *current = 0; |
1802 | QPtrList<KOAgendaItem> multiItems; | 1803 | QPtrList<KOAgendaItem> multiItems; |
1803 | for (cellX = XBegin;cellX <= XEnd;++cellX) { | 1804 | for (cellX = XBegin;cellX <= XEnd;++cellX) { |
1804 | if (cellX == XBegin) cellYTop = YTop; | 1805 | if (cellX == XBegin) cellYTop = YTop; |
1805 | else cellYTop = 0; | 1806 | else cellYTop = 0; |
1806 | if (cellX == XEnd) cellYBottom = YBottom; | 1807 | if (cellX == XEnd) cellYBottom = YBottom; |
1807 | else cellYBottom = rows() - 1; | 1808 | else cellYBottom = rows() - 1; |
1808 | newtext = QString("(%1/%2): ").arg(++count).arg(width); | 1809 | newtext = QString("(%1/%2): ").arg(++count).arg(width); |
1809 | newtext.append(event->summary()); | 1810 | newtext.append(event->summary()); |
1810 | current = insertItem(event,qd,cellX,cellYTop,cellYBottom); | 1811 | current = insertItem(event,qd,cellX,cellYTop,cellYBottom); |
1811 | current->setText(newtext); | 1812 | current->setText(newtext); |
1812 | multiItems.append(current); | 1813 | multiItems.append(current); |
1813 | } | 1814 | } |
1814 | 1815 | ||
1815 | KOAgendaItem *next = 0; | 1816 | KOAgendaItem *next = 0; |
1816 | KOAgendaItem *last = multiItems.last(); | 1817 | KOAgendaItem *last = multiItems.last(); |
1817 | KOAgendaItem *first = multiItems.first(); | 1818 | KOAgendaItem *first = multiItems.first(); |
1818 | KOAgendaItem *setFirst,*setLast; | 1819 | KOAgendaItem *setFirst,*setLast; |
1819 | current = first; | 1820 | current = first; |
1820 | while (current) { | 1821 | while (current) { |
1821 | next = multiItems.next(); | 1822 | next = multiItems.next(); |
1822 | if (current == first) setFirst = 0; | 1823 | if (current == first) setFirst = 0; |
1823 | else setFirst = first; | 1824 | else setFirst = first; |
1824 | if (current == last) setLast = 0; | 1825 | if (current == last) setLast = 0; |
1825 | else setLast = last; | 1826 | else setLast = last; |
1826 | 1827 | ||
1827 | current->setMultiItem(setFirst,next,setLast); | 1828 | current->setMultiItem(setFirst,next,setLast); |
1828 | current = next; | 1829 | current = next; |
1829 | } | 1830 | } |
1830 | 1831 | ||
1831 | marcus_bains(); | 1832 | marcus_bains(); |
1832 | } | 1833 | } |
1833 | 1834 | ||
1834 | 1835 | ||
1835 | //QSizePolicy KOAgenda::sizePolicy() const | 1836 | //QSizePolicy KOAgenda::sizePolicy() const |
1836 | //{ | 1837 | //{ |
1837 | // Thought this would make the all-day event agenda minimum size and the | 1838 | // Thought this would make the all-day event agenda minimum size and the |
1838 | // normal agenda take the remaining space. But it doesn´t work. The QSplitter | 1839 | // normal agenda take the remaining space. But it doesn´t work. The QSplitter |
1839 | // don´t seem to think that an Expanding widget needs more space than a | 1840 | // don´t seem to think that an Expanding widget needs more space than a |
1840 | // Preferred one. | 1841 | // Preferred one. |
1841 | // But it doesn´t hurt, so it stays. | 1842 | // But it doesn´t hurt, so it stays. |
1842 | // if (mAllDayMode) { | 1843 | // if (mAllDayMode) { |
1843 | // return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); | 1844 | // return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); |
1844 | // } else { | 1845 | // } else { |
1845 | // return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); | 1846 | // return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); |
1846 | // } | 1847 | // } |
1847 | //} | 1848 | //} |
1848 | void KOAgenda::finishResize ( ) | 1849 | void KOAgenda::finishResize ( ) |
1849 | { | 1850 | { |
1850 | //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) "); | 1851 | //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) "); |
1851 | if ( globalFlagBlockAgenda == 0 ) { | 1852 | if ( globalFlagBlockAgenda == 0 ) { |
1852 | finishUpdate(); | 1853 | finishUpdate(); |
1853 | //qDebug("finishUpdate() called "); | 1854 | //qDebug("finishUpdate() called "); |
1854 | } | 1855 | } |
1855 | } | 1856 | } |
1856 | /* | 1857 | /* |
1857 | Overridden from QScrollView to provide proper resizing of KOAgendaItems. | 1858 | Overridden from QScrollView to provide proper resizing of KOAgendaItems. |
1858 | */ | 1859 | */ |
1859 | void KOAgenda::resizeEvent ( QResizeEvent *ev ) | 1860 | void KOAgenda::resizeEvent ( QResizeEvent *ev ) |
1860 | { | 1861 | { |
1861 | mSelectionHeight = 0; | 1862 | mSelectionHeight = 0; |
1862 | mResizeTimer.start( 150 , true ); | 1863 | mResizeTimer.start( 150 , true ); |
1863 | computeSizes(); | 1864 | computeSizes(); |
1864 | return; | 1865 | return; |
1865 | 1866 | ||
1866 | } | 1867 | } |
1867 | void KOAgenda::computeSizes() | 1868 | void KOAgenda::computeSizes() |
1868 | { | 1869 | { |
1869 | if ( globalFlagBlockStartup ) | 1870 | if ( globalFlagBlockStartup ) |
1870 | return; | 1871 | return; |
1871 | int frameOffset = frameWidth() * 2 +1; | 1872 | int frameOffset = frameWidth() * 2 +1; |
1872 | if (mAllDayMode) { | 1873 | if (mAllDayMode) { |
1873 | mGridSpacingX = (width()-frameOffset) / mColumns; | 1874 | mGridSpacingX = (width()-frameOffset) / mColumns; |
1874 | mGridSpacingY = height() - 2 * frameWidth() - 1; | 1875 | mGridSpacingY = height() - 2 * frameWidth() - 1; |
1875 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1); | 1876 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1); |
1876 | // mGridSpacingY = height(); | 1877 | // mGridSpacingY = height(); |
1877 | // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 1878 | // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
1878 | 1879 | ||
1879 | KOAgendaItem *item; | 1880 | KOAgendaItem *item; |
1880 | int subCellWidth; | 1881 | int subCellWidth; |
1881 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1882 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1882 | subCellWidth = mGridSpacingY / item->subCells(); | 1883 | subCellWidth = mGridSpacingY / item->subCells(); |
1883 | item->resize(mGridSpacingX * item->cellWidth(),subCellWidth); | 1884 | item->resize(mGridSpacingX * item->cellWidth(),subCellWidth); |
1884 | moveChild(item,KOGlobals::self()->reverseLayout() ? | 1885 | moveChild(item,KOGlobals::self()->reverseLayout() ? |
1885 | (mColumns - 1 - item->cellX()) * mGridSpacingX : | 1886 | (mColumns - 1 - item->cellX()) * mGridSpacingX : |
1886 | item->cellX() * mGridSpacingX, | 1887 | item->cellX() * mGridSpacingX, |
1887 | item->subCell() * subCellWidth); | 1888 | item->subCell() * subCellWidth); |
1888 | } | 1889 | } |
1889 | KOPrefs::instance()->mAllDaySize = mGridSpacingY; | 1890 | KOPrefs::instance()->mAllDaySize = mGridSpacingY; |
1890 | } else { | 1891 | } else { |
1891 | mGridSpacingX = (width() - verticalScrollBar()->width()-frameOffset)/mColumns; | 1892 | mGridSpacingX = (width() - verticalScrollBar()->width()-frameOffset)/mColumns; |
1892 | if (height() > mGridSpacingY * mRows + 1 ) { | 1893 | if (height() > mGridSpacingY * mRows + 1 ) { |
1893 | KOPrefs::instance()->mHourSize = ((height())/mRows)+1; | 1894 | KOPrefs::instance()->mHourSize = ((height())/mRows)+1; |
1894 | mGridSpacingY = KOPrefs::instance()->mHourSize ; | 1895 | mGridSpacingY = KOPrefs::instance()->mHourSize ; |
1895 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 1896 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
1896 | emit resizedSignal(); | 1897 | emit resizedSignal(); |
1897 | } else | 1898 | } else |
1898 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 1899 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
1899 | KOAgendaItem *item; | 1900 | KOAgendaItem *item; |
1900 | int subCellWidth; | 1901 | int subCellWidth; |
1901 | 1902 | ||
1902 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1903 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1903 | subCellWidth = mGridSpacingX / item->subCells(); | 1904 | subCellWidth = mGridSpacingX / item->subCells(); |
1904 | item->resize(subCellWidth,item->height()); | 1905 | item->resize(subCellWidth,item->height()); |
1905 | moveChild(item,(KOGlobals::self()->reverseLayout() ? | 1906 | moveChild(item,(KOGlobals::self()->reverseLayout() ? |
1906 | (mColumns - 1 - item->cellX()) * mGridSpacingX : | 1907 | (mColumns - 1 - item->cellX()) * mGridSpacingX : |
1907 | item->cellX() * mGridSpacingX) + | 1908 | item->cellX() * mGridSpacingX) + |
1908 | item->subCell() * subCellWidth,childY(item)); | 1909 | item->subCell() * subCellWidth,childY(item)); |
1909 | } | 1910 | } |
1910 | } | 1911 | } |
1911 | int cw = contentsWidth(); | 1912 | int cw = contentsWidth(); |
1912 | int ch = contentsHeight(); | 1913 | int ch = contentsHeight(); |
1913 | if ( mAllDayMode ) { | 1914 | if ( mAllDayMode ) { |
1914 | QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); | 1915 | QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); |
1915 | if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) | 1916 | if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) |
1916 | paintPixAll->resize( cw, ch ); | 1917 | paintPixAll->resize( cw, ch ); |
1917 | } else { | 1918 | } else { |
1918 | QPixmap* paintPix = KOAgendaItem::paintPix(); | 1919 | QPixmap* paintPix = KOAgendaItem::paintPix(); |
1919 | if ( paintPix->width() < cw || paintPix->height() < ch ) | 1920 | if ( paintPix->width() < cw || paintPix->height() < ch ) |
1920 | KOAgendaItem::resizePixmap( cw , ch ); | 1921 | KOAgendaItem::resizePixmap( cw , ch ); |
1921 | } | 1922 | } |
1922 | 1923 | ||
1923 | checkScrollBoundaries(); | 1924 | checkScrollBoundaries(); |
1924 | marcus_bains(); | 1925 | marcus_bains(); |
1925 | drawContentsToPainter(); | 1926 | drawContentsToPainter(); |
1926 | viewport()->repaint(false); | 1927 | viewport()->repaint(false); |
1927 | } | 1928 | } |
1928 | 1929 | ||
1929 | void KOAgenda::scrollUp() | 1930 | void KOAgenda::scrollUp() |
1930 | { | 1931 | { |
1931 | scrollBy(0,-mScrollOffset); | 1932 | scrollBy(0,-mScrollOffset); |
1932 | } | 1933 | } |
1933 | 1934 | ||
1934 | 1935 | ||
1935 | void KOAgenda::scrollDown() | 1936 | void KOAgenda::scrollDown() |
1936 | { | 1937 | { |
1937 | scrollBy(0,mScrollOffset); | 1938 | scrollBy(0,mScrollOffset); |
1938 | } | 1939 | } |
1939 | 1940 | ||
1940 | void KOAgenda::popupAlarm() | 1941 | void KOAgenda::popupAlarm() |
1941 | { | 1942 | { |
1942 | if (!mClickedItem) { | 1943 | if (!mClickedItem) { |
1943 | qDebug("KOAgenda::popupAlarm() called without having a clicked item "); | 1944 | qDebug("KOAgenda::popupAlarm() called without having a clicked item "); |
1944 | return; | 1945 | return; |
1945 | } | 1946 | } |
1946 | // TODO: deal correctly with multiple alarms | 1947 | // TODO: deal correctly with multiple alarms |
1947 | Alarm* alarm; | 1948 | Alarm* alarm; |
1948 | QPtrList<Alarm> list(mClickedItem->incidence()->alarms()); | 1949 | QPtrList<Alarm> list(mClickedItem->incidence()->alarms()); |
1949 | for(alarm=list.first();alarm;alarm=list.next()) { | 1950 | for(alarm=list.first();alarm;alarm=list.next()) { |
1950 | alarm->toggleAlarm(); | 1951 | alarm->toggleAlarm(); |
1951 | } | 1952 | } |
1952 | emit itemModified( mClickedItem , KOGlobals::EVENTEDITED ); | 1953 | emit itemModified( mClickedItem , KOGlobals::EVENTEDITED ); |
1953 | mClickedItem->paintMe( true ); | 1954 | mClickedItem->paintMe( true ); |
1954 | mClickedItem->repaint( false ); | 1955 | mClickedItem->repaint( false ); |
1955 | } | 1956 | } |
1956 | 1957 | ||
1957 | /* | 1958 | /* |
1958 | Calculates the minimum width | 1959 | Calculates the minimum width |
1959 | */ | 1960 | */ |
1960 | int KOAgenda::minimumWidth() const | 1961 | int KOAgenda::minimumWidth() const |
1961 | { | 1962 | { |
1962 | // TODO:: develop a way to dynamically determine the minimum width | 1963 | // TODO:: develop a way to dynamically determine the minimum width |
1963 | int min = 100; | 1964 | int min = 100; |
1964 | 1965 | ||
1965 | return min; | 1966 | return min; |
1966 | } | 1967 | } |
1967 | 1968 | ||
1968 | void KOAgenda::updateConfig() | 1969 | void KOAgenda::updateConfig() |
1969 | { | 1970 | { |
1970 | if ( viewport()->backgroundColor() != KOPrefs::instance()->mAgendaBgColor) | 1971 | if ( viewport()->backgroundColor() != KOPrefs::instance()->mAgendaBgColor) |
1971 | viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor); | 1972 | viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor); |
1972 | if ( mAllDayMode ) { | 1973 | if ( mAllDayMode ) { |
1973 | mGridSpacingY = height() - 1 ;// KOPrefs::instance()->mAllDaySize; | 1974 | mGridSpacingY = height() - 1 ;// KOPrefs::instance()->mAllDaySize; |
1974 | //mGridSpacingY = KOPrefs::instance()->mAllDaySize; | 1975 | //mGridSpacingY = KOPrefs::instance()->mAllDaySize; |
1975 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY+1 ); | 1976 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY+1 ); |
1976 | // setMaximumHeight( mGridSpacingY+1 ); | 1977 | // setMaximumHeight( mGridSpacingY+1 ); |
1977 | viewport()->repaint( false ); | 1978 | viewport()->repaint( false ); |
1978 | //setFixedHeight( mGridSpacingY+1 ); | 1979 | //setFixedHeight( mGridSpacingY+1 ); |
1979 | //qDebug("KOPrefs:aaaaa:instance()->mAllDaySize %d ", KOPrefs::instance()->mAllDaySize); | 1980 | //qDebug("KOPrefs:aaaaa:instance()->mAllDaySize %d ", KOPrefs::instance()->mAllDaySize); |
1980 | } | 1981 | } |
1981 | else { | 1982 | else { |
1982 | mGridSpacingY = KOPrefs::instance()->mHourSize; | 1983 | mGridSpacingY = KOPrefs::instance()->mHourSize; |
1983 | calculateWorkingHours(); | 1984 | calculateWorkingHours(); |
1984 | marcus_bains(); | 1985 | marcus_bains(); |
1985 | } | 1986 | } |
1986 | } | 1987 | } |
1987 | 1988 | ||
1988 | void KOAgenda::checkScrollBoundaries() | 1989 | void KOAgenda::checkScrollBoundaries() |
1989 | { | 1990 | { |
1990 | // Invalidate old values to force update | 1991 | // Invalidate old values to force update |
1991 | mOldLowerScrollValue = -1; | 1992 | mOldLowerScrollValue = -1; |
1992 | mOldUpperScrollValue = -1; | 1993 | mOldUpperScrollValue = -1; |
1993 | 1994 | ||
1994 | checkScrollBoundaries(verticalScrollBar()->value()); | 1995 | checkScrollBoundaries(verticalScrollBar()->value()); |
1995 | } | 1996 | } |
1996 | 1997 | ||
1997 | void KOAgenda::checkScrollBoundaries(int v) | 1998 | void KOAgenda::checkScrollBoundaries(int v) |
1998 | { | 1999 | { |
1999 | if ( mGridSpacingY == 0 ) | 2000 | if ( mGridSpacingY == 0 ) |
2000 | return; | 2001 | return; |
2001 | int yMin = v/mGridSpacingY; | 2002 | int yMin = v/mGridSpacingY; |
2002 | int yMax = (v+visibleHeight())/mGridSpacingY; | 2003 | int yMax = (v+visibleHeight())/mGridSpacingY; |
2003 | 2004 | ||
2004 | // kdDebug() << "--- yMin: " << yMin << " yMax: " << yMax << endl; | 2005 | // kdDebug() << "--- yMin: " << yMin << " yMax: " << yMax << endl; |
2005 | 2006 | ||
2006 | if (yMin != mOldLowerScrollValue) { | 2007 | if (yMin != mOldLowerScrollValue) { |
2007 | mOldLowerScrollValue = yMin; | 2008 | mOldLowerScrollValue = yMin; |
2008 | emit lowerYChanged(yMin); | 2009 | emit lowerYChanged(yMin); |
2009 | } | 2010 | } |
2010 | if (yMax != mOldUpperScrollValue) { | 2011 | if (yMax != mOldUpperScrollValue) { |
2011 | mOldUpperScrollValue = yMax; | 2012 | mOldUpperScrollValue = yMax; |
2012 | emit upperYChanged(yMax); | 2013 | emit upperYChanged(yMax); |
2013 | } | 2014 | } |
2014 | } | 2015 | } |
2015 | 2016 | ||
2016 | void KOAgenda::deselectItem() | 2017 | void KOAgenda::deselectItem() |
2017 | { | 2018 | { |
2018 | if (mSelectedItem.isNull()) return; | 2019 | if (mSelectedItem.isNull()) return; |
2019 | mSelectedItem->select(false); | 2020 | mSelectedItem->select(false); |
2020 | mSelectedItem = 0; | 2021 | mSelectedItem = 0; |
2021 | } | 2022 | } |
2022 | 2023 | ||
2023 | void KOAgenda::selectItem(KOAgendaItem *item) | 2024 | void KOAgenda::selectItem(KOAgendaItem *item) |
2024 | { | 2025 | { |
2025 | if ((KOAgendaItem *)mSelectedItem == item) return; | 2026 | if ((KOAgendaItem *)mSelectedItem == item) return; |
2026 | deselectItem(); | 2027 | deselectItem(); |
2027 | if (item == 0) { | 2028 | if (item == 0) { |
2028 | emit incidenceSelected( 0 ); | 2029 | emit incidenceSelected( 0 ); |
2029 | return; | 2030 | return; |
2030 | } | 2031 | } |
2031 | mSelectedItem = item; | 2032 | mSelectedItem = item; |
2032 | mSelectedItem->select(); | 2033 | mSelectedItem->select(); |
2033 | emit incidenceSelected( mSelectedItem->incidence() ); | 2034 | emit incidenceSelected( mSelectedItem->incidence() ); |
2034 | } | 2035 | } |
2035 | 2036 | ||
2036 | // This function seems never be called. | 2037 | // This function seems never be called. |
2037 | void KOAgenda::keyPressEvent( QKeyEvent *kev ) | 2038 | void KOAgenda::keyPressEvent( QKeyEvent *kev ) |
2038 | { | 2039 | { |
2039 | switch(kev->key()) { | 2040 | switch(kev->key()) { |
2040 | case Key_PageDown: | 2041 | case Key_PageDown: |
2041 | verticalScrollBar()->addPage(); | 2042 | verticalScrollBar()->addPage(); |
2042 | break; | 2043 | break; |
2043 | case Key_PageUp: | 2044 | case Key_PageUp: |
2044 | verticalScrollBar()->subtractPage(); | 2045 | verticalScrollBar()->subtractPage(); |
2045 | break; | 2046 | break; |
2046 | case Key_Down: | 2047 | case Key_Down: |
2047 | verticalScrollBar()->addLine(); | 2048 | verticalScrollBar()->addLine(); |
2048 | break; | 2049 | break; |
2049 | case Key_Up: | 2050 | case Key_Up: |
2050 | verticalScrollBar()->subtractLine(); | 2051 | verticalScrollBar()->subtractLine(); |
2051 | break; | 2052 | break; |
2052 | default: | 2053 | default: |
2053 | ; | 2054 | ; |
2054 | } | 2055 | } |
2055 | } | 2056 | } |
2056 | 2057 | ||
2057 | void KOAgenda::calculateWorkingHours() | 2058 | void KOAgenda::calculateWorkingHours() |
2058 | { | 2059 | { |
2059 | // mWorkingHoursEnable = KOPrefs::instance()->mEnableWorkingHours; | 2060 | // mWorkingHoursEnable = KOPrefs::instance()->mEnableWorkingHours; |
2060 | mWorkingHoursEnable = !mAllDayMode; | 2061 | mWorkingHoursEnable = !mAllDayMode; |
2061 | 2062 | ||
2062 | mWorkingHoursYTop = mGridSpacingY * | 2063 | mWorkingHoursYTop = mGridSpacingY * |
2063 | KOPrefs::instance()->mWorkingHoursStart * 4; | 2064 | KOPrefs::instance()->mWorkingHoursStart * 4; |
2064 | mWorkingHoursYBottom = mGridSpacingY * | 2065 | mWorkingHoursYBottom = mGridSpacingY * |
2065 | KOPrefs::instance()->mWorkingHoursEnd * 4 - 1; | 2066 | KOPrefs::instance()->mWorkingHoursEnd * 4 - 1; |
2066 | } | 2067 | } |
2067 | 2068 | ||
2068 | 2069 | ||
2069 | DateList KOAgenda::dateList() const | 2070 | DateList KOAgenda::dateList() const |
2070 | { | 2071 | { |
2071 | return mSelectedDates; | 2072 | return mSelectedDates; |