summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp2
-rw-r--r--korganizer/koagendaview.cpp31
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
@@ -1114,49 +1114,49 @@ void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos)
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*/
1133void KOAgenda::placeSubCells(KOAgendaItem *placeItem) 1133void 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;
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index a42227c..5a63b35 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1100,75 +1100,69 @@ void KOAgendaView::fillAgenda()
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;
@@ -1268,104 +1262,81 @@ void KOAgendaView::fillAgenda()
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}
1322void KOAgendaView::repaintAgenda() 1303void 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
1339void KOAgendaView::clearView() 1312void KOAgendaView::clearView()
1340{ 1313{
1341 // kdDebug() << "ClearView" << endl;
1342 mAllDayAgenda->clear(); 1314 mAllDayAgenda->clear();
1343 mAgenda->clear(); 1315 mAgenda->clear();
1344} 1316}
1345void KOAgendaView::clearList() 1317void 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
1353void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1324void 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
1370void KOAgendaView::slotShowDateView( int mode , int d ) 1341void KOAgendaView::slotShowDateView( int mode , int d )
1371{ 1342{