-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 | |||
@@ -395,196 +395,200 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
395 | mainLayout->setStretchFactor( agendaFrame, 10 ); | 395 | mainLayout->setStretchFactor( agendaFrame, 10 ); |
396 | 396 | ||
397 | agendaFrame->setFocusPolicy(NoFocus); | 397 | agendaFrame->setFocusPolicy(NoFocus); |
398 | #endif | 398 | #endif |
399 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 399 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
400 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 400 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
401 | topLayout->addWidget( mSplitterAgenda ); | 401 | topLayout->addWidget( mSplitterAgenda ); |
402 | mAllDayFrame = new QHBox(mSplitterAgenda); | 402 | mAllDayFrame = new QHBox(mSplitterAgenda); |
403 | mAllDayFrame->setFocusPolicy(NoFocus); | 403 | mAllDayFrame->setFocusPolicy(NoFocus); |
404 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 404 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
405 | agendaFrame->setFocusPolicy(NoFocus); | 405 | agendaFrame->setFocusPolicy(NoFocus); |
406 | 406 | ||
407 | #endif | 407 | #endif |
408 | 408 | ||
409 | // Create all-day agenda widget | 409 | // Create all-day agenda widget |
410 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 410 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); |
411 | 411 | ||
412 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 412 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
413 | mExpandButton->setPixmap( mNotExpandedPixmap ); | 413 | mExpandButton->setPixmap( mNotExpandedPixmap ); |
414 | int widebut = mExpandButton->sizeHint().width(); | 414 | int widebut = mExpandButton->sizeHint().width(); |
415 | if ( QApplication::desktop()->width() < 480 ) | 415 | if ( QApplication::desktop()->width() < 480 ) |
416 | widebut = widebut*2; | 416 | widebut = widebut*2; |
417 | else | 417 | else |
418 | widebut = (widebut*3) / 2; | 418 | widebut = (widebut*3) / 2; |
419 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | 419 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, |
420 | // QSizePolicy::Fixed ) ); | 420 | // QSizePolicy::Fixed ) ); |
421 | mExpandButton->setFixedSize( widebut, widebut); | 421 | mExpandButton->setFixedSize( widebut, widebut); |
422 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 422 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
423 | mExpandButton->setFocusPolicy(NoFocus); | 423 | mExpandButton->setFocusPolicy(NoFocus); |
424 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 424 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
425 | mAllDayAgenda->setFocusPolicy(NoFocus); | 425 | mAllDayAgenda->setFocusPolicy(NoFocus); |
426 | QWidget *dummyAllDayRight = new QWidget(mAllDayFrame); | 426 | QWidget *dummyAllDayRight = new QWidget(mAllDayFrame); |
427 | 427 | ||
428 | // Create event context menu for all day agenda | 428 | // Create event context menu for all day agenda |
429 | mAllDayAgendaPopup = eventPopup(); | 429 | mAllDayAgendaPopup = eventPopup(); |
430 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 430 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
431 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 431 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
432 | 432 | ||
433 | // Create agenda frame | 433 | // Create agenda frame |
434 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); | 434 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); |
435 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 435 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
436 | 436 | ||
437 | // create event indicator bars | 437 | // create event indicator bars |
438 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 438 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
439 | agendaLayout->addWidget(mEventIndicatorTop,0,1); | 439 | agendaLayout->addWidget(mEventIndicatorTop,0,1); |
440 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 440 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
441 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 441 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
442 | agendaFrame); | 442 | agendaFrame); |
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 * ) ) ); |
543 | connect( mAgenda, SIGNAL( resizedSignal() ), | 547 | connect( mAgenda, SIGNAL( resizedSignal() ), |
544 | SLOT( updateConfig( ) ) ); | 548 | SLOT( updateConfig( ) ) ); |
545 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 549 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
546 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 550 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
547 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 551 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
548 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); | 552 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); |
549 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 553 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
550 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 554 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
551 | 555 | ||
552 | 556 | ||
553 | } | 557 | } |
554 | 558 | ||
555 | void KOAgendaView::toggleAllDay() | 559 | void KOAgendaView::toggleAllDay() |
556 | { | 560 | { |
557 | if ( mSplitterAgenda->firstHandle() ) | 561 | if ( mSplitterAgenda->firstHandle() ) |
558 | mSplitterAgenda->firstHandle()->toggle(); | 562 | mSplitterAgenda->firstHandle()->toggle(); |
559 | } | 563 | } |
560 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 564 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) |
561 | { | 565 | { |
562 | calendar()->addIncidence( inc ); | 566 | calendar()->addIncidence( inc ); |
563 | 567 | ||
564 | if ( incOld ) { | 568 | if ( incOld ) { |
565 | if ( incOld->type() == "Todo" ) | 569 | if ( incOld->type() == "Todo" ) |
566 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); | 570 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); |
567 | else | 571 | else |
568 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); | 572 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); |
569 | } | 573 | } |
570 | 574 | ||
571 | } | 575 | } |
572 | 576 | ||
573 | KOAgendaView::~KOAgendaView() | 577 | KOAgendaView::~KOAgendaView() |
574 | { | 578 | { |
575 | delete mAgendaPopup; | 579 | delete mAgendaPopup; |
576 | delete mAllDayAgendaPopup; | 580 | delete mAllDayAgendaPopup; |
577 | delete KOAgendaItem::paintPix(); | 581 | delete KOAgendaItem::paintPix(); |
578 | delete KOAgendaItem::paintPixSel(); | 582 | delete KOAgendaItem::paintPixSel(); |
579 | } | 583 | } |
580 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 584 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
581 | { | 585 | { |
582 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 586 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
583 | bool uc = false; | 587 | bool uc = false; |
584 | int ow = e->oldSize().width(); | 588 | int ow = e->oldSize().width(); |
585 | int oh = e->oldSize().height(); | 589 | int oh = e->oldSize().height(); |
586 | int w = e->size().width(); | 590 | int w = e->size().width(); |
587 | int h = e->size().height(); | 591 | int h = e->size().height(); |
588 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 592 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
589 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 593 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
590 | uc = true; | 594 | uc = true; |
@@ -1190,192 +1194,207 @@ void KOAgendaView::fillAgenda() | |||
1190 | // qApp->processEvents(); | 1194 | // qApp->processEvents(); |
1191 | } | 1195 | } |
1192 | qApp->processEvents(); | 1196 | qApp->processEvents(); |
1193 | //qDebug("qApp->processEvents(); END "); | 1197 | //qDebug("qApp->processEvents(); END "); |
1194 | globalFlagBlockAgenda = 0; | 1198 | globalFlagBlockAgenda = 0; |
1195 | 1199 | ||
1196 | // mAgenda->hideUnused(); | 1200 | // mAgenda->hideUnused(); |
1197 | //mAllDayAgenda->hideUnused(); | 1201 | //mAllDayAgenda->hideUnused(); |
1198 | mAllDayAgenda->drawContentsToPainter(); | 1202 | mAllDayAgenda->drawContentsToPainter(); |
1199 | mAgenda->drawContentsToPainter(); | 1203 | mAgenda->drawContentsToPainter(); |
1200 | repaintAgenda(); | 1204 | repaintAgenda(); |
1201 | // mAgenda->finishUpdate(); | 1205 | // mAgenda->finishUpdate(); |
1202 | //mAllDayAgenda->finishUpdate(); | 1206 | //mAllDayAgenda->finishUpdate(); |
1203 | 1207 | ||
1204 | // repaintAgenda(); | 1208 | // repaintAgenda(); |
1205 | //qApp->processEvents(); | 1209 | //qApp->processEvents(); |
1206 | // globalFlagBlockAgenda = 0; | 1210 | // globalFlagBlockAgenda = 0; |
1207 | } | 1211 | } |
1208 | void KOAgendaView::repaintAgenda() | 1212 | void KOAgendaView::repaintAgenda() |
1209 | { | 1213 | { |
1210 | // mAllDayAgenda->drawContentsToPainter(); | 1214 | // mAllDayAgenda->drawContentsToPainter(); |
1211 | // mAllDayAgenda->viewport()->repaint( false ); | 1215 | // mAllDayAgenda->viewport()->repaint( false ); |
1212 | // mAgenda->drawContentsToPainter(); | 1216 | // mAgenda->drawContentsToPainter(); |
1213 | // mAgenda->viewport()->repaint( false ); | 1217 | // mAgenda->viewport()->repaint( false ); |
1214 | // qApp->processEvents(); | 1218 | // qApp->processEvents(); |
1215 | 1219 | ||
1216 | //qDebug("KOAgendaView::repaintAgenda() "); | 1220 | //qDebug("KOAgendaView::repaintAgenda() "); |
1217 | //qApp->processEvents(); | 1221 | //qApp->processEvents(); |
1218 | mAgenda->viewport()->repaint( false ); | 1222 | mAgenda->viewport()->repaint( false ); |
1219 | mAllDayAgenda->viewport()->repaint( false ); | 1223 | mAllDayAgenda->viewport()->repaint( false ); |
1220 | mAgenda->finishUpdate(); | 1224 | mAgenda->finishUpdate(); |
1221 | mAllDayAgenda->finishUpdate(); | 1225 | mAllDayAgenda->finishUpdate(); |
1222 | } | 1226 | } |
1223 | 1227 | ||
1224 | 1228 | ||
1225 | void KOAgendaView::clearView() | 1229 | void KOAgendaView::clearView() |
1226 | { | 1230 | { |
1227 | // kdDebug() << "ClearView" << endl; | 1231 | // kdDebug() << "ClearView" << endl; |
1228 | mAllDayAgenda->clear(); | 1232 | mAllDayAgenda->clear(); |
1229 | mAgenda->clear(); | 1233 | mAgenda->clear(); |
1230 | } | 1234 | } |
1231 | 1235 | ||
1232 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1236 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1233 | const QDate &td) | 1237 | const QDate &td) |
1234 | { | 1238 | { |
1235 | #ifndef KORG_NOPRINTER | 1239 | #ifndef KORG_NOPRINTER |
1236 | if (fd == td) | 1240 | if (fd == td) |
1237 | calPrinter->preview(CalPrinter::Day, fd, td); | 1241 | calPrinter->preview(CalPrinter::Day, fd, td); |
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) { |
1334 | if ( sizes[0] < 20 ) { | 1353 | if ( sizes[0] < 20 ) { |
1335 | sizes[1] = sizes[1] +20 - sizes[0]; | 1354 | sizes[1] = sizes[1] +20 - sizes[0]; |
1336 | sizes[0] = 20; | 1355 | sizes[0] = 20; |
1337 | } | 1356 | } |
1338 | mSplitterAgenda->setSizes(sizes); | 1357 | mSplitterAgenda->setSizes(sizes); |
1339 | // qDebug("read %d %d ",sizes[0],sizes[1] ); | 1358 | // qDebug("read %d %d ",sizes[0],sizes[1] ); |
1340 | } | 1359 | } |
1341 | //#endif | 1360 | //#endif |
1342 | 1361 | ||
1343 | // updateConfig(); | 1362 | // updateConfig(); |
1344 | } | 1363 | } |
1345 | 1364 | ||
1346 | void KOAgendaView::writeSettings(KConfig *config) | 1365 | void KOAgendaView::writeSettings(KConfig *config) |
1347 | { | 1366 | { |
1348 | // kdDebug() << "KOAgendaView::writeSettings()" << endl; | 1367 | // kdDebug() << "KOAgendaView::writeSettings()" << endl; |
1349 | 1368 | ||
1350 | config->setGroup("Views"); | 1369 | config->setGroup("Views"); |
1351 | 1370 | ||
1352 | //#ifndef KORG_NOSPLITTER | 1371 | //#ifndef KORG_NOSPLITTER |
1353 | QValueList<int> list = mSplitterAgenda->sizes(); | 1372 | QValueList<int> list = mSplitterAgenda->sizes(); |
1354 | config->writeEntry("Separator AgendaView",list); | 1373 | config->writeEntry("Separator AgendaView",list); |
1355 | //qDebug("write %d %d ", list[0],list[1] ); | 1374 | //qDebug("write %d %d ", list[0],list[1] ); |
1356 | //#endif | 1375 | //#endif |
1357 | } | 1376 | } |
1358 | 1377 | ||
1359 | void KOAgendaView::setHolidayMasks() | 1378 | void KOAgendaView::setHolidayMasks() |
1360 | { | 1379 | { |
1361 | mHolidayMask.resize(mSelectedDates.count()); | 1380 | mHolidayMask.resize(mSelectedDates.count()); |
1362 | 1381 | ||
1363 | uint i; | 1382 | uint i; |
1364 | for(i=0;i<mSelectedDates.count();++i) { | 1383 | for(i=0;i<mSelectedDates.count();++i) { |
1365 | QDate date = mSelectedDates[i]; | 1384 | QDate date = mSelectedDates[i]; |
1366 | bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); | 1385 | bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); |
1367 | bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); | 1386 | bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); |
1368 | bool showHoliday = false; | 1387 | bool showHoliday = false; |
1369 | if ( KOPrefs::instance()->mExcludeHolidays ) { | 1388 | if ( KOPrefs::instance()->mExcludeHolidays ) { |
1370 | QPtrList<Event> events = calendar()->events( date, true ); | 1389 | QPtrList<Event> events = calendar()->events( date, true ); |
1371 | Event *event; | 1390 | Event *event; |
1372 | for( event = events.first(); event; event = events.next() ) { | 1391 | for( event = events.first(); event; event = events.next() ) { |
1373 | if ( event->categories().contains("Holiday") || | 1392 | if ( event->categories().contains("Holiday") || |
1374 | event->categories().contains(i18n("Holiday"))) { | 1393 | event->categories().contains(i18n("Holiday"))) { |
1375 | showHoliday = true; | 1394 | showHoliday = true; |
1376 | break; | 1395 | break; |
1377 | } | 1396 | } |
1378 | } | 1397 | } |
1379 | 1398 | ||
1380 | } | 1399 | } |
1381 | 1400 | ||