summaryrefslogtreecommitdiffabout
path: root/korganizer/koagenda.cpp
Unidiff
Diffstat (limited to 'korganizer/koagenda.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index a72e470..195b1fa 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1058,69 +1058,96 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem)
1058 } 1058 }
1059 } 1059 }
1060 1060
1061 if (conflictItems.count() > 0) { 1061 if (conflictItems.count() > 0) {
1062 // Look for unused sub cell and insert item 1062 // Look for unused sub cell and insert item
1063 int i; 1063 int i;
1064 for(i=0;i<maxSubCells;++i) { 1064 for(i=0;i<maxSubCells;++i) {
1065 if (!subCellDict.find(i)) { 1065 if (!subCellDict.find(i)) {
1066 placeItem->setSubCell(i); 1066 placeItem->setSubCell(i);
1067 break; 1067 break;
1068 } 1068 }
1069 } 1069 }
1070 if (i == maxSubCells) { 1070 if (i == maxSubCells) {
1071 placeItem->setSubCell(maxSubCells); 1071 placeItem->setSubCell(maxSubCells);
1072 maxSubCells++; // add new item to number of sub cells 1072 maxSubCells++; // add new item to number of sub cells
1073 } 1073 }
1074 1074
1075 // Prepare for sub cell geometry adjustment 1075 // Prepare for sub cell geometry adjustment
1076 int newSubCellWidth; 1076 int newSubCellWidth;
1077 if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; 1077 if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells;
1078 else newSubCellWidth = mGridSpacingX / maxSubCells; 1078 else newSubCellWidth = mGridSpacingX / maxSubCells;
1079 conflictItems.append(placeItem); 1079 conflictItems.append(placeItem);
1080 1080
1081 1081
1082 // Adjust sub cell geometry of all items 1082 // Adjust sub cell geometry of all direct conflict items
1083 for ( item=conflictItems.first(); item != 0; 1083 for ( item=conflictItems.first(); item != 0;
1084 item=conflictItems.next() ) { 1084 item=conflictItems.next() ) {
1085 item->setSubCells(maxSubCells); 1085 item->setSubCells(maxSubCells);
1086 if (mAllDayMode) { 1086 if (mAllDayMode) {
1087 item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); 1087 item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth);
1088 } else { 1088 } else {
1089 item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); 1089 item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY);
1090 } 1090 }
1091 int x,y; 1091 int x,y;
1092 gridToContents(item->cellX(),item->cellYTop(),x,y); 1092 gridToContents(item->cellX(),item->cellYTop(),x,y);
1093 if (mAllDayMode) { 1093 if (mAllDayMode) {
1094 y += item->subCell() * newSubCellWidth; 1094 y += item->subCell() * newSubCellWidth;
1095 } else { 1095 } else {
1096 x += item->subCell() * newSubCellWidth; 1096 x += item->subCell() * newSubCellWidth;
1097 } 1097 }
1098 moveChild(item,x,y); 1098 moveChild(item,x,y);
1099 // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); 1099 // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y);
1100 //item->updateItem(); 1100 //item->updateItem();
1101 } 1101 }
1102 1102 // Adjust sub cell geometry of all conflict items of all conflict items
1103 for ( item=conflictItems.first(); item != 0;
1104 item=conflictItems.next() ) {
1105 if ( placeItem != item ) {
1106 KOAgendaItem *item2;
1107 QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems();
1108 for ( item2=conflictItems2.first(); item2 != 0;
1109 item2=conflictItems2.next() ) {
1110 if ( item2->subCells() != maxSubCells) {
1111 item2->setSubCells(maxSubCells);
1112 if (mAllDayMode) {
1113 item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth);
1114 } else {
1115 item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY);
1116 }
1117 int x,y;
1118 gridToContents(item2->cellX(),item2->cellYTop(),x,y);
1119 if (mAllDayMode) {
1120 y += item2->subCell() * newSubCellWidth;
1121 } else {
1122 x += item2->subCell() * newSubCellWidth;
1123 }
1124 moveChild(item2,x,y);
1125 //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() );
1126 }
1127 }
1128 }
1129 }
1103 } else { 1130 } else {
1104 placeItem->setSubCell(0); 1131 placeItem->setSubCell(0);
1105 placeItem->setSubCells(1); 1132 placeItem->setSubCells(1);
1106 if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); 1133 if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY);
1107 else placeItem->resize(mGridSpacingX,placeItem->height()); 1134 else placeItem->resize(mGridSpacingX,placeItem->height());
1108 int x,y; 1135 int x,y;
1109 gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); 1136 gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y);
1110 moveChild(placeItem,x,y); 1137 moveChild(placeItem,x,y);
1111 } 1138 }
1112 placeItem->setConflictItems(conflictItems); 1139 placeItem->setConflictItems(conflictItems);
1113 // for ( item=conflictItems.first(); item != 0; 1140 // for ( item=conflictItems.first(); item != 0;
1114// item=conflictItems.next() ) { 1141// item=conflictItems.next() ) {
1115// //item->updateItem(); 1142// //item->updateItem();
1116// //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); 1143// //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() );
1117// } 1144// }
1118// placeItem->updateItem(); 1145// placeItem->updateItem();
1119} 1146}
1120 1147
1121void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) 1148void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
1122{ 1149{
1123 if ( globalFlagBlockAgenda ) 1150 if ( globalFlagBlockAgenda )
1124 return; 1151 return;
1125 //qDebug("KOAgenda::drawContents "); 1152 //qDebug("KOAgenda::drawContents ");
1126 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) 1153 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() )