-rw-r--r-- | korganizer/koagendaview.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index b9909d6..2996acb 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -443,98 +443,98 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
443 | 443 | ||
444 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 444 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
445 | agendaFrame); | 445 | agendaFrame); |
446 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); | 446 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); |
447 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 447 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
448 | agendaLayout->addWidget(dummyAgendaRight,1,2); | 448 | agendaLayout->addWidget(dummyAgendaRight,1,2); |
449 | 449 | ||
450 | // Create time labels | 450 | // Create time labels |
451 | mTimeLabels = new TimeLabels(24,agendaFrame); | 451 | mTimeLabels = new TimeLabels(24,agendaFrame); |
452 | agendaLayout->addWidget(mTimeLabels,2,0); | 452 | agendaLayout->addWidget(mTimeLabels,2,0); |
453 | connect(mTimeLabels,SIGNAL( scaleChanged()), | 453 | connect(mTimeLabels,SIGNAL( scaleChanged()), |
454 | this,SLOT(updateConfig())); | 454 | this,SLOT(updateConfig())); |
455 | 455 | ||
456 | // Create agenda | 456 | // Create agenda |
457 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 457 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
458 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); | 458 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); |
459 | agendaLayout->setColStretch(1,1); | 459 | agendaLayout->setColStretch(1,1); |
460 | mAgenda->setFocusPolicy(NoFocus); | 460 | mAgenda->setFocusPolicy(NoFocus); |
461 | // Create event context menu for agenda | 461 | // Create event context menu for agenda |
462 | mAgendaPopup = eventPopup(); | 462 | mAgendaPopup = eventPopup(); |
463 | 463 | ||
464 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 464 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
465 | i18n("Toggle Alarm"),mAgenda, | 465 | i18n("Toggle Alarm"),mAgenda, |
466 | SLOT(popupAlarm()),true); | 466 | SLOT(popupAlarm()),true); |
467 | 467 | ||
468 | 468 | ||
469 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 469 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
470 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 470 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
471 | 471 | ||
472 | // make connections between dependent widgets | 472 | // make connections between dependent widgets |
473 | mTimeLabels->setAgenda(mAgenda); | 473 | mTimeLabels->setAgenda(mAgenda); |
474 | 474 | ||
475 | // Update widgets to reflect user preferences | 475 | // Update widgets to reflect user preferences |
476 | // updateConfig(); | 476 | // updateConfig(); |
477 | 477 | ||
478 | // createDayLabels(); | 478 | // createDayLabels(); |
479 | 479 | ||
480 | // these blank widgets make the All Day Event box line up with the agenda | 480 | // these blank widgets make the All Day Event box line up with the agenda |
481 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 481 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
482 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 482 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
483 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 483 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
484 | 484 | ||
485 | // Scrolling | 485 | // Scrolling |
486 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), | 486 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), |
487 | mTimeLabels, SLOT(positionChanged())); | 487 | mTimeLabels, SLOT(positionChanged())); |
488 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), | 488 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), |
489 | SLOT(setContentsPos(int))); | 489 | SLOT(setContentsPos(int))); |
490 | 490 | ||
491 | connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); | 491 | connect(mAgenda,SIGNAL(showDateView( int, int)),SLOT(slotShowDateView( int, int ))); |
492 | connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); | 492 | connect(mAllDayAgenda,SIGNAL(showDateView( int, int )), SLOT(slotShowDateView( int, int ) )); |
493 | 493 | ||
494 | // Create/Show/Edit/Delete Event | 494 | // Create/Show/Edit/Delete Event |
495 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), | 495 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), |
496 | SLOT(newEvent(int,int))); | 496 | SLOT(newEvent(int,int))); |
497 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), | 497 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), |
498 | SLOT(newTodo(int,int))); | 498 | SLOT(newTodo(int,int))); |
499 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 499 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
500 | SLOT(newEvent(int,int,int,int))); | 500 | SLOT(newEvent(int,int,int,int))); |
501 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), | 501 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), |
502 | SLOT(newEventAllDay(int,int))); | 502 | SLOT(newEventAllDay(int,int))); |
503 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), | 503 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), |
504 | SLOT(newTodoAllDay(int,int))); | 504 | SLOT(newTodoAllDay(int,int))); |
505 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 505 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
506 | SLOT(newEventAllDay(int,int))); | 506 | SLOT(newEventAllDay(int,int))); |
507 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 507 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
508 | SLOT(newTimeSpanSelected(int,int,int,int))); | 508 | SLOT(newTimeSpanSelected(int,int,int,int))); |
509 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 509 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
510 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); | 510 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); |
511 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 511 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
512 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 512 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
513 | 513 | ||
514 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 514 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
515 | SIGNAL(editIncidenceSignal(Incidence *))); | 515 | SIGNAL(editIncidenceSignal(Incidence *))); |
516 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 516 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
517 | SIGNAL(editIncidenceSignal(Incidence *))); | 517 | SIGNAL(editIncidenceSignal(Incidence *))); |
518 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 518 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
519 | SIGNAL(showIncidenceSignal(Incidence *))); | 519 | SIGNAL(showIncidenceSignal(Incidence *))); |
520 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 520 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
521 | SIGNAL(showIncidenceSignal(Incidence *))); | 521 | SIGNAL(showIncidenceSignal(Incidence *))); |
522 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 522 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
523 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 523 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
524 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 524 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
525 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 525 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
526 | 526 | ||
527 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 527 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
528 | SLOT(updateEventDates(KOAgendaItem *, int ))); | 528 | SLOT(updateEventDates(KOAgendaItem *, int ))); |
529 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 529 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
530 | SLOT(updateEventDates(KOAgendaItem *, int))); | 530 | SLOT(updateEventDates(KOAgendaItem *, int))); |
531 | 531 | ||
532 | // event indicator update | 532 | // event indicator update |
533 | connect(mAgenda,SIGNAL(lowerYChanged(int)), | 533 | connect(mAgenda,SIGNAL(lowerYChanged(int)), |
534 | SLOT(updateEventIndicatorTop(int))); | 534 | SLOT(updateEventIndicatorTop(int))); |
535 | connect(mAgenda,SIGNAL(upperYChanged(int)), | 535 | connect(mAgenda,SIGNAL(upperYChanged(int)), |
536 | SLOT(updateEventIndicatorBottom(int))); | 536 | SLOT(updateEventIndicatorBottom(int))); |
537 | // drag signals | 537 | // drag signals |
538 | /* | 538 | /* |
539 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 539 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
540 | SLOT(startDrag(Event *))); | 540 | SLOT(startDrag(Event *))); |
@@ -1265,96 +1265,107 @@ void KOAgendaView::fillAgenda() | |||
1265 | // mAgenda->finishUpdate(); | 1265 | // mAgenda->finishUpdate(); |
1266 | //mAllDayAgenda->finishUpdate(); | 1266 | //mAllDayAgenda->finishUpdate(); |
1267 | 1267 | ||
1268 | // repaintAgenda(); | 1268 | // repaintAgenda(); |
1269 | //qApp->processEvents(); | 1269 | //qApp->processEvents(); |
1270 | // globalFlagBlockAgenda = 0; | 1270 | // globalFlagBlockAgenda = 0; |
1271 | } | 1271 | } |
1272 | void KOAgendaView::repaintAgenda() | 1272 | void KOAgendaView::repaintAgenda() |
1273 | { | 1273 | { |
1274 | // mAllDayAgenda->drawContentsToPainter(); | 1274 | // mAllDayAgenda->drawContentsToPainter(); |
1275 | // mAllDayAgenda->viewport()->repaint( false ); | 1275 | // mAllDayAgenda->viewport()->repaint( false ); |
1276 | // mAgenda->drawContentsToPainter(); | 1276 | // mAgenda->drawContentsToPainter(); |
1277 | // mAgenda->viewport()->repaint( false ); | 1277 | // mAgenda->viewport()->repaint( false ); |
1278 | // qApp->processEvents(); | 1278 | // qApp->processEvents(); |
1279 | 1279 | ||
1280 | //qDebug("KOAgendaView::repaintAgenda() "); | 1280 | //qDebug("KOAgendaView::repaintAgenda() "); |
1281 | //qApp->processEvents(); | 1281 | //qApp->processEvents(); |
1282 | mAgenda->viewport()->repaint( false ); | 1282 | mAgenda->viewport()->repaint( false ); |
1283 | mAllDayAgenda->viewport()->repaint( false ); | 1283 | mAllDayAgenda->viewport()->repaint( false ); |
1284 | mAgenda->finishUpdate(); | 1284 | mAgenda->finishUpdate(); |
1285 | mAllDayAgenda->finishUpdate(); | 1285 | mAllDayAgenda->finishUpdate(); |
1286 | } | 1286 | } |
1287 | 1287 | ||
1288 | 1288 | ||
1289 | void KOAgendaView::clearView() | 1289 | void KOAgendaView::clearView() |
1290 | { | 1290 | { |
1291 | // kdDebug() << "ClearView" << endl; | 1291 | // kdDebug() << "ClearView" << endl; |
1292 | mAllDayAgenda->clear(); | 1292 | mAllDayAgenda->clear(); |
1293 | mAgenda->clear(); | 1293 | mAgenda->clear(); |
1294 | } | 1294 | } |
1295 | 1295 | ||
1296 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1296 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1297 | const QDate &td) | 1297 | const QDate &td) |
1298 | { | 1298 | { |
1299 | #ifndef KORG_NOPRINTER | 1299 | #ifndef KORG_NOPRINTER |
1300 | if (fd == td) | 1300 | if (fd == td) |
1301 | calPrinter->preview(CalPrinter::Day, fd, td); | 1301 | calPrinter->preview(CalPrinter::Day, fd, td); |
1302 | else | 1302 | else |
1303 | calPrinter->preview(CalPrinter::Week, fd, td); | 1303 | calPrinter->preview(CalPrinter::Week, fd, td); |
1304 | #endif | 1304 | #endif |
1305 | } | 1305 | } |
1306 | 1306 | ||
1307 | // void KOAgendaView::updateMovedTodo() | 1307 | // void KOAgendaView::updateMovedTodo() |
1308 | // { | 1308 | // { |
1309 | // // updateConfig(); | 1309 | // // updateConfig(); |
1310 | // // emit updateTodoViews(); | 1310 | // // emit updateTodoViews(); |
1311 | // } | 1311 | // } |
1312 | 1312 | ||
1313 | void KOAgendaView::slotShowDateView( int mode , int d ) | ||
1314 | { | ||
1315 | if ( d >= mSelectedDates.count() ) { | ||
1316 | qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() ); | ||
1317 | |||
1318 | } else { | ||
1319 | QDate day = mSelectedDates[d]; | ||
1320 | emit showDateView(mode , day ); | ||
1321 | } | ||
1322 | |||
1323 | } | ||
1313 | void KOAgendaView::newEvent(int gx, int gy) | 1324 | void KOAgendaView::newEvent(int gx, int gy) |
1314 | { | 1325 | { |
1315 | if (!mSelectedDates.count()) return; | 1326 | if (!mSelectedDates.count()) return; |
1316 | 1327 | ||
1317 | QDate day = mSelectedDates[gx]; | 1328 | QDate day = mSelectedDates[gx]; |
1318 | 1329 | ||
1319 | QTime time = mAgenda->gyToTime(gy); | 1330 | QTime time = mAgenda->gyToTime(gy); |
1320 | QDateTime dt(day,time); | 1331 | QDateTime dt(day,time); |
1321 | // if ( dt < QDateTime::currentDateTime () ) | 1332 | // if ( dt < QDateTime::currentDateTime () ) |
1322 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); | 1333 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); |
1323 | emit newEventSignal(dt); | 1334 | emit newEventSignal(dt); |
1324 | } | 1335 | } |
1325 | 1336 | ||
1326 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) | 1337 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) |
1327 | { | 1338 | { |
1328 | if (!mSelectedDates.count()) return; | 1339 | if (!mSelectedDates.count()) return; |
1329 | 1340 | ||
1330 | QDate dayStart = mSelectedDates[gxStart]; | 1341 | QDate dayStart = mSelectedDates[gxStart]; |
1331 | QDate dayEnd = mSelectedDates[gxEnd]; | 1342 | QDate dayEnd = mSelectedDates[gxEnd]; |
1332 | 1343 | ||
1333 | QTime timeStart = mAgenda->gyToTime(gyStart); | 1344 | QTime timeStart = mAgenda->gyToTime(gyStart); |
1334 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); | 1345 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); |
1335 | 1346 | ||
1336 | QDateTime dtStart(dayStart,timeStart); | 1347 | QDateTime dtStart(dayStart,timeStart); |
1337 | QDateTime dtEnd(dayEnd,timeEnd); | 1348 | QDateTime dtEnd(dayEnd,timeEnd); |
1338 | 1349 | ||
1339 | emit newEventSignal(dtStart,dtEnd); | 1350 | emit newEventSignal(dtStart,dtEnd); |
1340 | } | 1351 | } |
1341 | 1352 | ||
1342 | void KOAgendaView::newEventAllDay(int gx, int ) | 1353 | void KOAgendaView::newEventAllDay(int gx, int ) |
1343 | { | 1354 | { |
1344 | if (!mSelectedDates.count()) return; | 1355 | if (!mSelectedDates.count()) return; |
1345 | 1356 | ||
1346 | QDate day = mSelectedDates[gx]; | 1357 | QDate day = mSelectedDates[gx]; |
1347 | 1358 | ||
1348 | emit newEventSignal(day); | 1359 | emit newEventSignal(day); |
1349 | } | 1360 | } |
1350 | void KOAgendaView::newTodoAllDay(int gx, int ) | 1361 | void KOAgendaView::newTodoAllDay(int gx, int ) |
1351 | { | 1362 | { |
1352 | if (!mSelectedDates.count()) return; | 1363 | if (!mSelectedDates.count()) return; |
1353 | 1364 | ||
1354 | QDateTime day (mSelectedDates[gx] ); | 1365 | QDateTime day (mSelectedDates[gx] ); |
1355 | emit newTodoSignal(day, true); | 1366 | emit newTodoSignal(day, true); |
1356 | } | 1367 | } |
1357 | void KOAgendaView::newTodo(int gx, int gy ) | 1368 | void KOAgendaView::newTodo(int gx, int gy ) |
1358 | { | 1369 | { |
1359 | if (!mSelectedDates.count()) return; | 1370 | if (!mSelectedDates.count()) return; |
1360 | QDate dayStart = mSelectedDates[gx]; | 1371 | QDate dayStart = mSelectedDates[gx]; |