-rw-r--r-- | korganizer/koagendaview.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 8d32152..95388ef 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -476,113 +476,115 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
476 | 476 | ||
477 | // Create day name labels for agenda columns | 477 | // Create day name labels for agenda columns |
478 | // Create agenda splitter | 478 | // Create agenda splitter |
479 | 479 | ||
480 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 480 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
481 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 481 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
482 | topLayout->addWidget( mSplitterAgenda ); | 482 | topLayout->addWidget( mSplitterAgenda ); |
483 | mAllDayFrame = new QHBox(mSplitterAgenda); | 483 | mAllDayFrame = new QHBox(mSplitterAgenda); |
484 | mAllDayFrame->setFocusPolicy(NoFocus); | 484 | mAllDayFrame->setFocusPolicy(NoFocus); |
485 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 485 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
486 | agendaFrame->setFocusPolicy(NoFocus); | 486 | agendaFrame->setFocusPolicy(NoFocus); |
487 | 487 | ||
488 | // Create all-day agenda widget | 488 | // Create all-day agenda widget |
489 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 489 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); |
490 | 490 | ||
491 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 491 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
492 | mExpandButton->setPixmap( expandPix ); | 492 | mExpandButton->setPixmap( expandPix ); |
493 | int widebut = mExpandButton->sizeHint().width()+4; | 493 | int widebut = mExpandButton->sizeHint().width()+4; |
494 | int heibut = mExpandButton->sizeHint().height()+4; | 494 | int heibut = mExpandButton->sizeHint().height()+4; |
495 | if ( heibut > widebut ) | 495 | if ( heibut > widebut ) |
496 | widebut = heibut ; | 496 | widebut = heibut ; |
497 | 497 | ||
498 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | 498 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, |
499 | // QSizePolicy::Fixed ) ); | 499 | // QSizePolicy::Fixed ) ); |
500 | mExpandButton->setFixedSize( widebut, widebut); | 500 | mExpandButton->setFixedSize( widebut, widebut); |
501 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 501 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
502 | mExpandButton->setFocusPolicy(NoFocus); | 502 | mExpandButton->setFocusPolicy(NoFocus); |
503 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 503 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
504 | mAllDayAgenda->setFocusPolicy(NoFocus); | 504 | mAllDayAgenda->setFocusPolicy(NoFocus); |
505 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); | 505 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); |
506 | 506 | ||
507 | // Create event context menu for all day agenda | 507 | // Create event context menu for all day agenda |
508 | mAllDayAgendaPopup = eventPopup(); | 508 | //mAllDayAgendaPopup = eventPopup(); |
509 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | ||
510 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | ||
511 | 509 | ||
512 | // Create agenda frame | 510 | // Create agenda frame |
513 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); | 511 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); |
514 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 512 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
515 | 513 | ||
516 | // create event indicator bars | 514 | // create event indicator bars |
517 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 515 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
518 | #ifndef DESKTOP_VERSION | 516 | #ifndef DESKTOP_VERSION |
519 | // FIX | 517 | // FIX |
520 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 518 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
521 | #endif | 519 | #endif |
522 | mDayLabelsFrame = new QHBox(agendaFrame); | 520 | mDayLabelsFrame = new QHBox(agendaFrame); |
523 | //topLayout->addWidget(mDayLabelsFrame); | 521 | //topLayout->addWidget(mDayLabelsFrame); |
524 | mDayLabels = new QFrame (mDayLabelsFrame); | 522 | mDayLabels = new QFrame (mDayLabelsFrame); |
525 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); | 523 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); |
526 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); | 524 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); |
527 | agendaLayout->addWidget(mEventIndicatorTop,1,1); | 525 | agendaLayout->addWidget(mEventIndicatorTop,1,1); |
528 | 526 | ||
529 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 527 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
530 | agendaFrame); | 528 | agendaFrame); |
531 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); | 529 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); |
532 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 530 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
533 | agendaLayout->addWidget(dummyAgendaRight,1,2); | 531 | agendaLayout->addWidget(dummyAgendaRight,1,2); |
534 | 532 | ||
535 | // Create time labels | 533 | // Create time labels |
536 | mTimeLabels = new TimeLabels(24,agendaFrame); | 534 | mTimeLabels = new TimeLabels(24,agendaFrame); |
537 | agendaLayout->addWidget(mTimeLabels,2,0); | 535 | agendaLayout->addWidget(mTimeLabels,2,0); |
538 | connect(mTimeLabels,SIGNAL( scaleChanged()), | 536 | connect(mTimeLabels,SIGNAL( scaleChanged()), |
539 | this,SLOT(updateConfig())); | 537 | this,SLOT(updateConfig())); |
540 | 538 | ||
541 | // Create agenda | 539 | // Create agenda |
542 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 540 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
543 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); | 541 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); |
544 | agendaLayout->setColStretch(1,1); | 542 | agendaLayout->setColStretch(1,1); |
545 | mAgenda->setFocusPolicy(NoFocus); | 543 | mAgenda->setFocusPolicy(NoFocus); |
546 | // Create event context menu for agenda | 544 | // Create event context menu for agenda |
547 | mAgendaPopup = eventPopup(); | 545 | mAllAgendaPopup = eventPopup(); |
548 | 546 | ||
549 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 547 | mAllAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
550 | i18n("Toggle Alarm"),mAgenda, | 548 | i18n("Toggle Alarm"),mAgenda, |
551 | SLOT(popupAlarm()),true); | 549 | SLOT(popupAlarm()),true); |
552 | 550 | ||
553 | 551 | ||
554 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 552 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
555 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 553 | mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
556 | 554 | ||
555 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | ||
556 | mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | ||
557 | mAgenda->setPopup( mAllAgendaPopup ); | ||
558 | mAllDayAgenda->setPopup( mAllAgendaPopup ); | ||
557 | // make connections between dependent widgets | 559 | // make connections between dependent widgets |
558 | mTimeLabels->setAgenda(mAgenda); | 560 | mTimeLabels->setAgenda(mAgenda); |
559 | 561 | ||
560 | // Update widgets to reflect user preferences | 562 | // Update widgets to reflect user preferences |
561 | // updateConfig(); | 563 | // updateConfig(); |
562 | 564 | ||
563 | // createDayLabels(); | 565 | // createDayLabels(); |
564 | 566 | ||
565 | // these blank widgets make the All Day Event box line up with the agenda | 567 | // these blank widgets make the All Day Event box line up with the agenda |
566 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 568 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
567 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 569 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
568 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 570 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
569 | 571 | ||
570 | // Scrolling | 572 | // Scrolling |
571 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), | 573 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), |
572 | mTimeLabels, SLOT(positionChanged())); | 574 | mTimeLabels, SLOT(positionChanged())); |
573 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), | 575 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), |
574 | SLOT(setContentsPos(int))); | 576 | SLOT(setContentsPos(int))); |
575 | 577 | ||
576 | connect(mAgenda,SIGNAL(showDateView( int, int)),SLOT(slotShowDateView( int, int ))); | 578 | connect(mAgenda,SIGNAL(showDateView( int, int)),SLOT(slotShowDateView( int, int ))); |
577 | connect(mAllDayAgenda,SIGNAL(showDateView( int, int )), SLOT(slotShowDateView( int, int ) )); | 579 | connect(mAllDayAgenda,SIGNAL(showDateView( int, int )), SLOT(slotShowDateView( int, int ) )); |
578 | 580 | ||
579 | // Create/Show/Edit/Delete Event | 581 | // Create/Show/Edit/Delete Event |
580 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), | 582 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), |
581 | SLOT(newEvent(int,int))); | 583 | SLOT(newEvent(int,int))); |
582 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), | 584 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), |
583 | SLOT(newTodo(int,int))); | 585 | SLOT(newTodo(int,int))); |
584 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 586 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
585 | SLOT(newEvent(int,int,int,int))); | 587 | SLOT(newEvent(int,int,int,int))); |
586 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), | 588 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), |
587 | SLOT(newEventAllDay(int,int))); | 589 | SLOT(newEventAllDay(int,int))); |
588 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), | 590 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), |
@@ -638,66 +640,66 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
638 | connect( mAgenda, SIGNAL( resizedSignal() ), | 640 | connect( mAgenda, SIGNAL( resizedSignal() ), |
639 | SLOT( updateConfig( ) ) ); | 641 | SLOT( updateConfig( ) ) ); |
640 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 642 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
641 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 643 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
642 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 644 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
643 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); | 645 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); |
644 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 646 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
645 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 647 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
646 | 648 | ||
647 | 649 | ||
648 | } | 650 | } |
649 | 651 | ||
650 | void KOAgendaView::toggleAllDay() | 652 | void KOAgendaView::toggleAllDay() |
651 | { | 653 | { |
652 | if ( mSplitterAgenda->firstHandle() ) | 654 | if ( mSplitterAgenda->firstHandle() ) |
653 | mSplitterAgenda->firstHandle()->toggle(); | 655 | mSplitterAgenda->firstHandle()->toggle(); |
654 | } | 656 | } |
655 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 657 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) |
656 | { | 658 | { |
657 | calendar()->addIncidence( inc ); | 659 | calendar()->addIncidence( inc ); |
658 | 660 | ||
659 | if ( incOld ) { | 661 | if ( incOld ) { |
660 | if ( incOld->type() == "Todo" ) | 662 | if ( incOld->type() == "Todo" ) |
661 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); | 663 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); |
662 | else | 664 | else |
663 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); | 665 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); |
664 | } | 666 | } |
665 | 667 | ||
666 | } | 668 | } |
667 | 669 | ||
668 | KOAgendaView::~KOAgendaView() | 670 | KOAgendaView::~KOAgendaView() |
669 | { | 671 | { |
670 | delete mAgendaPopup; | 672 | delete mAllAgendaPopup; |
671 | delete mAllDayAgendaPopup; | 673 | //delete mAllDayAgendaPopup; |
672 | delete KOAgendaItem::paintPix(); | 674 | delete KOAgendaItem::paintPix(); |
673 | delete KOAgendaItem::paintPixSel(); | 675 | delete KOAgendaItem::paintPixSel(); |
674 | } | 676 | } |
675 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 677 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
676 | { | 678 | { |
677 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 679 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
678 | bool uc = false; | 680 | bool uc = false; |
679 | int ow = e->oldSize().width(); | 681 | int ow = e->oldSize().width(); |
680 | int oh = e->oldSize().height(); | 682 | int oh = e->oldSize().height(); |
681 | int w = e->size().width(); | 683 | int w = e->size().width(); |
682 | int h = e->size().height(); | 684 | int h = e->size().height(); |
683 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 685 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
684 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 686 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
685 | uc = true; | 687 | uc = true; |
686 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); | 688 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); |
687 | } | 689 | } |
688 | mUpcomingWidth = e->size().width() ; | 690 | mUpcomingWidth = e->size().width() ; |
689 | if ( mBlockUpdating || uc ) { | 691 | if ( mBlockUpdating || uc ) { |
690 | mBlockUpdating = false; | 692 | mBlockUpdating = false; |
691 | //mAgenda->setMinimumSize(800 , 600 ); | 693 | //mAgenda->setMinimumSize(800 , 600 ); |
692 | //qDebug("mAgenda->resize+++++++++++++++ "); | 694 | //qDebug("mAgenda->resize+++++++++++++++ "); |
693 | updateConfig(); | 695 | updateConfig(); |
694 | //qDebug("KOAgendaView::Updating now possible "); | 696 | //qDebug("KOAgendaView::Updating now possible "); |
695 | } else | 697 | } else |
696 | createDayLabels(); | 698 | createDayLabels(); |
697 | //qDebug("resizeEvent end "); | 699 | //qDebug("resizeEvent end "); |
698 | 700 | ||
699 | } | 701 | } |
700 | void KOAgendaView::slotDaylabelClicked( int num ) | 702 | void KOAgendaView::slotDaylabelClicked( int num ) |
701 | { | 703 | { |
702 | 704 | ||
703 | QDate firstDate = mSelectedDates.first(); | 705 | QDate firstDate = mSelectedDates.first(); |