author | zautrix <zautrix> | 2005-01-29 15:23:10 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-29 15:23:10 (UTC) |
commit | c6548bb194a5e73b9b72505c2e952ef6346dec46 (patch) (unidiff) | |
tree | 74039fb5cd5f1a64f6a7844c9ece030e6d76de87 /korganizer/koagendaview.cpp | |
parent | f542fb5846520683e6241a522921e3d5eb24b833 (diff) | |
download | kdepimpi-c6548bb194a5e73b9b72505c2e952ef6346dec46.zip kdepimpi-c6548bb194a5e73b9b72505c2e952ef6346dec46.tar.gz kdepimpi-c6548bb194a5e73b9b72505c2e952ef6346dec46.tar.bz2 |
todo
-rw-r--r-- | korganizer/koagendaview.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index f54f7bc..60ae41f 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -443,100 +443,104 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
443 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); | 443 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); |
444 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 444 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
445 | agendaLayout->addWidget(dummyAgendaRight,0,2); | 445 | agendaLayout->addWidget(dummyAgendaRight,0,2); |
446 | 446 | ||
447 | // Create time labels | 447 | // Create time labels |
448 | mTimeLabels = new TimeLabels(24,agendaFrame); | 448 | mTimeLabels = new TimeLabels(24,agendaFrame); |
449 | agendaLayout->addWidget(mTimeLabels,1,0); | 449 | agendaLayout->addWidget(mTimeLabels,1,0); |
450 | connect(mTimeLabels,SIGNAL( scaleChanged()), | 450 | connect(mTimeLabels,SIGNAL( scaleChanged()), |
451 | this,SLOT(updateConfig())); | 451 | this,SLOT(updateConfig())); |
452 | 452 | ||
453 | // Create agenda | 453 | // Create agenda |
454 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 454 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
455 | agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); | 455 | agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); |
456 | agendaLayout->setColStretch(1,1); | 456 | agendaLayout->setColStretch(1,1); |
457 | mAgenda->setFocusPolicy(NoFocus); | 457 | mAgenda->setFocusPolicy(NoFocus); |
458 | // Create event context menu for agenda | 458 | // Create event context menu for agenda |
459 | mAgendaPopup = eventPopup(); | 459 | mAgendaPopup = eventPopup(); |
460 | 460 | ||
461 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 461 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
462 | i18n("Toggle Alarm"),mAgenda, | 462 | i18n("Toggle Alarm"),mAgenda, |
463 | SLOT(popupAlarm()),true); | 463 | SLOT(popupAlarm()),true); |
464 | 464 | ||
465 | 465 | ||
466 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 466 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
467 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 467 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
468 | 468 | ||
469 | // make connections between dependent widgets | 469 | // make connections between dependent widgets |
470 | mTimeLabels->setAgenda(mAgenda); | 470 | mTimeLabels->setAgenda(mAgenda); |
471 | 471 | ||
472 | // Update widgets to reflect user preferences | 472 | // Update widgets to reflect user preferences |
473 | // updateConfig(); | 473 | // updateConfig(); |
474 | 474 | ||
475 | // createDayLabels(); | 475 | // createDayLabels(); |
476 | 476 | ||
477 | // these blank widgets make the All Day Event box line up with the agenda | 477 | // these blank widgets make the All Day Event box line up with the agenda |
478 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 478 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
479 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 479 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
480 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 480 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
481 | 481 | ||
482 | // Scrolling | 482 | // Scrolling |
483 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), | 483 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), |
484 | mTimeLabels, SLOT(positionChanged())); | 484 | mTimeLabels, SLOT(positionChanged())); |
485 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), | 485 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), |
486 | SLOT(setContentsPos(int))); | 486 | SLOT(setContentsPos(int))); |
487 | 487 | ||
488 | // Create/Show/Edit/Delete Event | 488 | // Create/Show/Edit/Delete Event |
489 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), | 489 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), |
490 | SLOT(newEvent(int,int))); | 490 | SLOT(newEvent(int,int))); |
491 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), | ||
492 | SLOT(newTodo(int,int))); | ||
491 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 493 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
492 | SLOT(newEvent(int,int,int,int))); | 494 | SLOT(newEvent(int,int,int,int))); |
493 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), | 495 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), |
494 | SLOT(newEventAllDay(int,int))); | 496 | SLOT(newEventAllDay(int,int))); |
497 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), | ||
498 | SLOT(newTodoAllDay(int,int))); | ||
495 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 499 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
496 | SLOT(newEventAllDay(int,int))); | 500 | SLOT(newEventAllDay(int,int))); |
497 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 501 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
498 | SLOT(newTimeSpanSelected(int,int,int,int))); | 502 | SLOT(newTimeSpanSelected(int,int,int,int))); |
499 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 503 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
500 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); | 504 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); |
501 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 505 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
502 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 506 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
503 | 507 | ||
504 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 508 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
505 | SIGNAL(editIncidenceSignal(Incidence *))); | 509 | SIGNAL(editIncidenceSignal(Incidence *))); |
506 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 510 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
507 | SIGNAL(editIncidenceSignal(Incidence *))); | 511 | SIGNAL(editIncidenceSignal(Incidence *))); |
508 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 512 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
509 | SIGNAL(showIncidenceSignal(Incidence *))); | 513 | SIGNAL(showIncidenceSignal(Incidence *))); |
510 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 514 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
511 | SIGNAL(showIncidenceSignal(Incidence *))); | 515 | SIGNAL(showIncidenceSignal(Incidence *))); |
512 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 516 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
513 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 517 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
514 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 518 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
515 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 519 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
516 | 520 | ||
517 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 521 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
518 | SLOT(updateEventDates(KOAgendaItem *, int ))); | 522 | SLOT(updateEventDates(KOAgendaItem *, int ))); |
519 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 523 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
520 | SLOT(updateEventDates(KOAgendaItem *, int))); | 524 | SLOT(updateEventDates(KOAgendaItem *, int))); |
521 | 525 | ||
522 | // event indicator update | 526 | // event indicator update |
523 | connect(mAgenda,SIGNAL(lowerYChanged(int)), | 527 | connect(mAgenda,SIGNAL(lowerYChanged(int)), |
524 | SLOT(updateEventIndicatorTop(int))); | 528 | SLOT(updateEventIndicatorTop(int))); |
525 | connect(mAgenda,SIGNAL(upperYChanged(int)), | 529 | connect(mAgenda,SIGNAL(upperYChanged(int)), |
526 | SLOT(updateEventIndicatorBottom(int))); | 530 | SLOT(updateEventIndicatorBottom(int))); |
527 | // drag signals | 531 | // drag signals |
528 | /* | 532 | /* |
529 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 533 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
530 | SLOT(startDrag(Event *))); | 534 | SLOT(startDrag(Event *))); |
531 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), | 535 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), |
532 | SLOT(startDrag(Event *))); | 536 | SLOT(startDrag(Event *))); |
533 | */ | 537 | */ |
534 | // synchronize selections | 538 | // synchronize selections |
535 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 539 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
536 | mAllDayAgenda, SLOT( deselectItem() ) ); | 540 | mAllDayAgenda, SLOT( deselectItem() ) ); |
537 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 541 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
538 | mAgenda, SLOT( deselectItem() ) ); | 542 | mAgenda, SLOT( deselectItem() ) ); |
539 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 543 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
540 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 544 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
541 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 545 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
542 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 546 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
@@ -1238,96 +1242,111 @@ void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, | |||
1238 | else | 1242 | else |
1239 | calPrinter->preview(CalPrinter::Week, fd, td); | 1243 | calPrinter->preview(CalPrinter::Week, fd, td); |
1240 | #endif | 1244 | #endif |
1241 | } | 1245 | } |
1242 | 1246 | ||
1243 | // void KOAgendaView::updateMovedTodo() | 1247 | // void KOAgendaView::updateMovedTodo() |
1244 | // { | 1248 | // { |
1245 | // // updateConfig(); | 1249 | // // updateConfig(); |
1246 | // // emit updateTodoViews(); | 1250 | // // emit updateTodoViews(); |
1247 | // } | 1251 | // } |
1248 | 1252 | ||
1249 | void KOAgendaView::newEvent(int gx, int gy) | 1253 | void KOAgendaView::newEvent(int gx, int gy) |
1250 | { | 1254 | { |
1251 | if (!mSelectedDates.count()) return; | 1255 | if (!mSelectedDates.count()) return; |
1252 | 1256 | ||
1253 | QDate day = mSelectedDates[gx]; | 1257 | QDate day = mSelectedDates[gx]; |
1254 | 1258 | ||
1255 | QTime time = mAgenda->gyToTime(gy); | 1259 | QTime time = mAgenda->gyToTime(gy); |
1256 | QDateTime dt(day,time); | 1260 | QDateTime dt(day,time); |
1257 | // if ( dt < QDateTime::currentDateTime () ) | 1261 | // if ( dt < QDateTime::currentDateTime () ) |
1258 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); | 1262 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); |
1259 | emit newEventSignal(dt); | 1263 | emit newEventSignal(dt); |
1260 | } | 1264 | } |
1261 | 1265 | ||
1262 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) | 1266 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) |
1263 | { | 1267 | { |
1264 | if (!mSelectedDates.count()) return; | 1268 | if (!mSelectedDates.count()) return; |
1265 | 1269 | ||
1266 | QDate dayStart = mSelectedDates[gxStart]; | 1270 | QDate dayStart = mSelectedDates[gxStart]; |
1267 | QDate dayEnd = mSelectedDates[gxEnd]; | 1271 | QDate dayEnd = mSelectedDates[gxEnd]; |
1268 | 1272 | ||
1269 | QTime timeStart = mAgenda->gyToTime(gyStart); | 1273 | QTime timeStart = mAgenda->gyToTime(gyStart); |
1270 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); | 1274 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); |
1271 | 1275 | ||
1272 | QDateTime dtStart(dayStart,timeStart); | 1276 | QDateTime dtStart(dayStart,timeStart); |
1273 | QDateTime dtEnd(dayEnd,timeEnd); | 1277 | QDateTime dtEnd(dayEnd,timeEnd); |
1274 | 1278 | ||
1275 | emit newEventSignal(dtStart,dtEnd); | 1279 | emit newEventSignal(dtStart,dtEnd); |
1276 | } | 1280 | } |
1277 | 1281 | ||
1278 | void KOAgendaView::newEventAllDay(int gx, int ) | 1282 | void KOAgendaView::newEventAllDay(int gx, int ) |
1279 | { | 1283 | { |
1280 | if (!mSelectedDates.count()) return; | 1284 | if (!mSelectedDates.count()) return; |
1281 | 1285 | ||
1282 | QDate day = mSelectedDates[gx]; | 1286 | QDate day = mSelectedDates[gx]; |
1283 | 1287 | ||
1284 | emit newEventSignal(day); | 1288 | emit newEventSignal(day); |
1285 | } | 1289 | } |
1290 | void KOAgendaView::newTodoAllDay(int gx, int ) | ||
1291 | { | ||
1292 | if (!mSelectedDates.count()) return; | ||
1293 | |||
1294 | QDateTime day (mSelectedDates[gx] ); | ||
1295 | emit newTodoSignal(day, true); | ||
1296 | } | ||
1297 | void KOAgendaView::newTodo(int gx, int gy ) | ||
1298 | { | ||
1299 | if (!mSelectedDates.count()) return; | ||
1300 | QDate dayStart = mSelectedDates[gx]; | ||
1301 | QTime timeStart = mAgenda->gyToTime(gy); | ||
1302 | QDateTime dt (dayStart,timeStart); | ||
1303 | emit newTodoSignal( dt, false ); | ||
1304 | } | ||
1286 | 1305 | ||
1287 | void KOAgendaView::updateEventIndicatorTop(int newY) | 1306 | void KOAgendaView::updateEventIndicatorTop(int newY) |
1288 | { | 1307 | { |
1289 | uint i; | 1308 | uint i; |
1290 | for(i=0;i<mMinY.size();++i) { | 1309 | for(i=0;i<mMinY.size();++i) { |
1291 | if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); | 1310 | if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); |
1292 | else mEventIndicatorTop->enableColumn(i,false); | 1311 | else mEventIndicatorTop->enableColumn(i,false); |
1293 | } | 1312 | } |
1294 | 1313 | ||
1295 | mEventIndicatorTop->update(); | 1314 | mEventIndicatorTop->update(); |
1296 | } | 1315 | } |
1297 | 1316 | ||
1298 | void KOAgendaView::updateEventIndicatorBottom(int newY) | 1317 | void KOAgendaView::updateEventIndicatorBottom(int newY) |
1299 | { | 1318 | { |
1300 | uint i; | 1319 | uint i; |
1301 | for(i=0;i<mMaxY.size();++i) { | 1320 | for(i=0;i<mMaxY.size();++i) { |
1302 | if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true); | 1321 | if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true); |
1303 | else mEventIndicatorBottom->enableColumn(i,false); | 1322 | else mEventIndicatorBottom->enableColumn(i,false); |
1304 | } | 1323 | } |
1305 | 1324 | ||
1306 | mEventIndicatorBottom->update(); | 1325 | mEventIndicatorBottom->update(); |
1307 | } | 1326 | } |
1308 | 1327 | ||
1309 | void KOAgendaView::startDrag(Event *event) | 1328 | void KOAgendaView::startDrag(Event *event) |
1310 | { | 1329 | { |
1311 | #ifndef KORG_NODND | 1330 | #ifndef KORG_NODND |
1312 | DndFactory factory( calendar() ); | 1331 | DndFactory factory( calendar() ); |
1313 | ICalDrag *vd = factory.createDrag(event,this); | 1332 | ICalDrag *vd = factory.createDrag(event,this); |
1314 | if (vd->drag()) { | 1333 | if (vd->drag()) { |
1315 | kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; | 1334 | kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; |
1316 | } | 1335 | } |
1317 | #endif | 1336 | #endif |
1318 | } | 1337 | } |
1319 | 1338 | ||
1320 | void KOAgendaView::readSettings() | 1339 | void KOAgendaView::readSettings() |
1321 | { | 1340 | { |
1322 | readSettings(KOGlobals::config()); | 1341 | readSettings(KOGlobals::config()); |
1323 | } | 1342 | } |
1324 | 1343 | ||
1325 | void KOAgendaView::readSettings(KConfig *config) | 1344 | void KOAgendaView::readSettings(KConfig *config) |
1326 | { | 1345 | { |
1327 | // kdDebug() << "KOAgendaView::readSettings()" << endl; | 1346 | // kdDebug() << "KOAgendaView::readSettings()" << endl; |
1328 | 1347 | ||
1329 | config->setGroup("Views"); | 1348 | config->setGroup("Views"); |
1330 | 1349 | ||
1331 | //#ifndef KORG_NOSPLITTER | 1350 | //#ifndef KORG_NOSPLITTER |
1332 | QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); | 1351 | QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); |
1333 | if (sizes.count() == 2) { | 1352 | if (sizes.count() == 2) { |