-rw-r--r-- | korganizer/koagendaview.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index c851ab5..a42227c 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -429,96 +429,101 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
429 | 429 | ||
430 | // Create agenda frame | 430 | // Create agenda frame |
431 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); | 431 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); |
432 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 432 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
433 | 433 | ||
434 | // create event indicator bars | 434 | // create event indicator bars |
435 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 435 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
436 | #ifndef DESKTOP_VERSION | 436 | #ifndef DESKTOP_VERSION |
437 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 437 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
438 | #endif | 438 | #endif |
439 | mDayLabelsFrame = new QHBox(agendaFrame); | 439 | mDayLabelsFrame = new QHBox(agendaFrame); |
440 | //topLayout->addWidget(mDayLabelsFrame); | 440 | //topLayout->addWidget(mDayLabelsFrame); |
441 | mDayLabels = new QFrame (mDayLabelsFrame); | 441 | mDayLabels = new QFrame (mDayLabelsFrame); |
442 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); | 442 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); |
443 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); | 443 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); |
444 | agendaLayout->addWidget(mEventIndicatorTop,1,1); | 444 | agendaLayout->addWidget(mEventIndicatorTop,1,1); |
445 | 445 | ||
446 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 446 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
447 | agendaFrame); | 447 | agendaFrame); |
448 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); | 448 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); |
449 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 449 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
450 | agendaLayout->addWidget(dummyAgendaRight,1,2); | 450 | agendaLayout->addWidget(dummyAgendaRight,1,2); |
451 | 451 | ||
452 | // Create time labels | 452 | // Create time labels |
453 | mTimeLabels = new TimeLabels(24,agendaFrame); | 453 | mTimeLabels = new TimeLabels(24,agendaFrame); |
454 | agendaLayout->addWidget(mTimeLabels,2,0); | 454 | agendaLayout->addWidget(mTimeLabels,2,0); |
455 | connect(mTimeLabels,SIGNAL( scaleChanged()), | 455 | connect(mTimeLabels,SIGNAL( scaleChanged()), |
456 | this,SLOT(updateConfig())); | 456 | this,SLOT(updateConfig())); |
457 | 457 | ||
458 | // Create agenda | 458 | // Create agenda |
459 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 459 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
460 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); | 460 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); |
461 | agendaLayout->setColStretch(1,1); | 461 | agendaLayout->setColStretch(1,1); |
462 | mAgenda->setFocusPolicy(NoFocus); | 462 | mAgenda->setFocusPolicy(NoFocus); |
463 | // Create event context menu for agenda | 463 | // Create event context menu for agenda |
464 | mAllAgendaPopup = eventPopup(); | 464 | mAllAgendaPopup = eventPopup(); |
465 | 465 | ||
466 | #if 0 | 466 | #if 0 |
467 | mAllAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 467 | mAllAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
468 | i18n("Toggle Alarm"),mAgenda, | 468 | i18n("Toggle Alarm"),mAgenda, |
469 | SLOT(popupAlarm()),true); | 469 | SLOT(popupAlarm()),true); |
470 | 470 | ||
471 | #endif | 471 | #endif |
472 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 472 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
473 | mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 473 | mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
474 | 474 | ||
475 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 475 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
476 | mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 476 | mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
477 | |||
478 | connect(mAllAgendaPopup,SIGNAL(categoryChanged(Incidence *)), | ||
479 | this,SLOT(categoryChanged(Incidence *))); | ||
480 | |||
481 | |||
477 | mAgenda->setPopup( mAllAgendaPopup ); | 482 | mAgenda->setPopup( mAllAgendaPopup ); |
478 | mAllDayAgenda->setPopup( mAllAgendaPopup ); | 483 | mAllDayAgenda->setPopup( mAllAgendaPopup ); |
479 | // make connections between dependent widgets | 484 | // make connections between dependent widgets |
480 | mTimeLabels->setAgenda(mAgenda); | 485 | mTimeLabels->setAgenda(mAgenda); |
481 | 486 | ||
482 | // Update widgets to reflect user preferences | 487 | // Update widgets to reflect user preferences |
483 | // updateConfig(); | 488 | // updateConfig(); |
484 | 489 | ||
485 | // createDayLabels(); | 490 | // createDayLabels(); |
486 | 491 | ||
487 | // these blank widgets make the All Day Event box line up with the agenda | 492 | // these blank widgets make the All Day Event box line up with the agenda |
488 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 493 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
489 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 494 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
490 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 495 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
491 | 496 | ||
492 | // Scrolling | 497 | // Scrolling |
493 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), | 498 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), |
494 | mTimeLabels, SLOT(positionChanged())); | 499 | mTimeLabels, SLOT(positionChanged())); |
495 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), | 500 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), |
496 | SLOT(setContentsPos(int))); | 501 | SLOT(setContentsPos(int))); |
497 | 502 | ||
498 | connect(mAgenda,SIGNAL(showDateView( int, int)),SLOT(slotShowDateView( int, int ))); | 503 | connect(mAgenda,SIGNAL(showDateView( int, int)),SLOT(slotShowDateView( int, int ))); |
499 | connect(mAllDayAgenda,SIGNAL(showDateView( int, int )), SLOT(slotShowDateView( int, int ) )); | 504 | connect(mAllDayAgenda,SIGNAL(showDateView( int, int )), SLOT(slotShowDateView( int, int ) )); |
500 | 505 | ||
501 | // Create/Show/Edit/Delete Event | 506 | // Create/Show/Edit/Delete Event |
502 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), | 507 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), |
503 | SLOT(newEvent(int,int))); | 508 | SLOT(newEvent(int,int))); |
504 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), | 509 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), |
505 | SLOT(newTodo(int,int))); | 510 | SLOT(newTodo(int,int))); |
506 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 511 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
507 | SLOT(newEvent(int,int,int,int))); | 512 | SLOT(newEvent(int,int,int,int))); |
508 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), | 513 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), |
509 | SLOT(newEventAllDay(int,int))); | 514 | SLOT(newEventAllDay(int,int))); |
510 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), | 515 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), |
511 | SLOT(newTodoAllDay(int,int))); | 516 | SLOT(newTodoAllDay(int,int))); |
512 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 517 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
513 | SLOT(newEventAllDay(int,int))); | 518 | SLOT(newEventAllDay(int,int))); |
514 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 519 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
515 | SLOT(newTimeSpanSelected(int,int,int,int))); | 520 | SLOT(newTimeSpanSelected(int,int,int,int))); |
516 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 521 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
517 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); | 522 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); |
518 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 523 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
519 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 524 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
520 | 525 | ||
521 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 526 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
522 | SIGNAL(editIncidenceSignal(Incidence *))); | 527 | SIGNAL(editIncidenceSignal(Incidence *))); |
523 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 528 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
524 | SIGNAL(editIncidenceSignal(Incidence *))); | 529 | SIGNAL(editIncidenceSignal(Incidence *))); |
@@ -543,97 +548,101 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
543 | SLOT(updateEventIndicatorBottom(int))); | 548 | SLOT(updateEventIndicatorBottom(int))); |
544 | // drag signals | 549 | // drag signals |
545 | /* | 550 | /* |
546 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 551 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
547 | SLOT(startDrag(Event *))); | 552 | SLOT(startDrag(Event *))); |
548 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), | 553 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), |
549 | SLOT(startDrag(Event *))); | 554 | SLOT(startDrag(Event *))); |
550 | */ | 555 | */ |
551 | // synchronize selections | 556 | // synchronize selections |
552 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 557 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
553 | mAllDayAgenda, SLOT( deselectItem() ) ); | 558 | mAllDayAgenda, SLOT( deselectItem() ) ); |
554 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 559 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
555 | mAgenda, SLOT( deselectItem() ) ); | 560 | mAgenda, SLOT( deselectItem() ) ); |
556 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 561 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
557 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 562 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
558 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 563 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
559 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 564 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
560 | connect( mAgenda, SIGNAL( resizedSignal() ), | 565 | connect( mAgenda, SIGNAL( resizedSignal() ), |
561 | SLOT( updateConfig( ) ) ); | 566 | SLOT( updateConfig( ) ) ); |
562 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 567 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
563 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 568 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
564 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 569 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
565 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); | 570 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); |
566 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 571 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
567 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 572 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
568 | 573 | ||
569 | connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) ); | 574 | connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) ); |
570 | connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) ); | 575 | connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) ); |
571 | 576 | ||
572 | } | 577 | } |
573 | 578 | ||
574 | void KOAgendaView::toggleAllDay() | 579 | void KOAgendaView::toggleAllDay() |
575 | { | 580 | { |
576 | if ( mSplitterAgenda->firstHandle() ) | 581 | if ( mSplitterAgenda->firstHandle() ) |
577 | mSplitterAgenda->firstHandle()->toggle(); | 582 | mSplitterAgenda->firstHandle()->toggle(); |
578 | } | 583 | } |
579 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 584 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) |
580 | { | 585 | { |
581 | calendar()->addIncidence( inc ); | 586 | calendar()->addIncidence( inc ); |
582 | 587 | ||
583 | if ( incOld ) { | 588 | if ( incOld ) { |
584 | if ( incOld->typeID() == todoID ) | 589 | if ( incOld->typeID() == todoID ) |
585 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); | 590 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); |
586 | else | 591 | else |
587 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); | 592 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); |
588 | } | 593 | } |
589 | 594 | ||
590 | } | 595 | } |
591 | 596 | void KOAgendaView::categoryChanged(Incidence * inc) | |
597 | { | ||
598 | mAgenda->categoryChanged( inc ); | ||
599 | mAllDayAgenda->categoryChanged( inc ); | ||
600 | } | ||
592 | KOAgendaView::~KOAgendaView() | 601 | KOAgendaView::~KOAgendaView() |
593 | { | 602 | { |
594 | delete mAllAgendaPopup; | 603 | delete mAllAgendaPopup; |
595 | //delete mAllDayAgendaPopup; | 604 | //delete mAllDayAgendaPopup; |
596 | delete KOAgendaItem::paintPix(); | 605 | delete KOAgendaItem::paintPix(); |
597 | delete KOAgendaItem::paintPixSel(); | 606 | delete KOAgendaItem::paintPixSel(); |
598 | } | 607 | } |
599 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 608 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
600 | { | 609 | { |
601 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 610 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
602 | bool uc = false; | 611 | bool uc = false; |
603 | int ow = e->oldSize().width(); | 612 | int ow = e->oldSize().width(); |
604 | int oh = e->oldSize().height(); | 613 | int oh = e->oldSize().height(); |
605 | int w = e->size().width(); | 614 | int w = e->size().width(); |
606 | int h = e->size().height(); | 615 | int h = e->size().height(); |
607 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 616 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
608 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 617 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
609 | uc = true; | 618 | uc = true; |
610 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); | 619 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); |
611 | } | 620 | } |
612 | mUpcomingWidth = e->size().width() ; | 621 | mUpcomingWidth = e->size().width() ; |
613 | if ( mBlockUpdating || uc ) { | 622 | if ( mBlockUpdating || uc ) { |
614 | mBlockUpdating = false; | 623 | mBlockUpdating = false; |
615 | //mAgenda->setMinimumSize(800 , 600 ); | 624 | //mAgenda->setMinimumSize(800 , 600 ); |
616 | //qDebug("mAgenda->resize+++++++++++++++ "); | 625 | //qDebug("mAgenda->resize+++++++++++++++ "); |
617 | updateConfig(); | 626 | updateConfig(); |
618 | //qDebug("KOAgendaView::Updating now possible "); | 627 | //qDebug("KOAgendaView::Updating now possible "); |
619 | } else | 628 | } else |
620 | createDayLabels(); | 629 | createDayLabels(); |
621 | //qDebug("resizeEvent end "); | 630 | //qDebug("resizeEvent end "); |
622 | 631 | ||
623 | } | 632 | } |
624 | void KOAgendaView::slotDaylabelClicked( int num ) | 633 | void KOAgendaView::slotDaylabelClicked( int num ) |
625 | { | 634 | { |
626 | 635 | ||
627 | QDate firstDate = mSelectedDates.first(); | 636 | QDate firstDate = mSelectedDates.first(); |
628 | if ( num == -1 ) | 637 | if ( num == -1 ) |
629 | emit showDateView( 6, firstDate ); | 638 | emit showDateView( 6, firstDate ); |
630 | else if (num >= 0 ) { | 639 | else if (num >= 0 ) { |
631 | if ( mSelectedDates.count() == 1) | 640 | if ( mSelectedDates.count() == 1) |
632 | emit showDateView( 9, firstDate.addDays( num ) ); | 641 | emit showDateView( 9, firstDate.addDays( num ) ); |
633 | else | 642 | else |
634 | emit showDateView( 3, firstDate.addDays( num ) ); | 643 | emit showDateView( 3, firstDate.addDays( num ) ); |
635 | } | 644 | } |
636 | else | 645 | else |
637 | showDateView( 10, firstDate.addDays(1) ); | 646 | showDateView( 10, firstDate.addDays(1) ); |
638 | } | 647 | } |
639 | 648 | ||