-rw-r--r-- | korganizer/koagendaview.cpp | 47 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 1 |
2 files changed, 45 insertions, 3 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index c018dc7..f8301f8 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -399,70 +399,70 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
399 | agendaFrame->setFocusPolicy(NoFocus); | 399 | agendaFrame->setFocusPolicy(NoFocus); |
400 | #endif | 400 | #endif |
401 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 401 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
402 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 402 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
403 | topLayout->addWidget( mSplitterAgenda ); | 403 | topLayout->addWidget( mSplitterAgenda ); |
404 | mAllDayFrame = new QHBox(mSplitterAgenda); | 404 | mAllDayFrame = new QHBox(mSplitterAgenda); |
405 | mAllDayFrame->setFocusPolicy(NoFocus); | 405 | mAllDayFrame->setFocusPolicy(NoFocus); |
406 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 406 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
407 | agendaFrame->setFocusPolicy(NoFocus); | 407 | agendaFrame->setFocusPolicy(NoFocus); |
408 | 408 | ||
409 | #endif | 409 | #endif |
410 | 410 | ||
411 | // Create all-day agenda widget | 411 | // Create all-day agenda widget |
412 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 412 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); |
413 | 413 | ||
414 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 414 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
415 | mExpandButton->setPixmap( mNotExpandedPixmap ); | 415 | mExpandButton->setPixmap( mNotExpandedPixmap ); |
416 | int widebut = mExpandButton->sizeHint().width(); | 416 | int widebut = mExpandButton->sizeHint().width(); |
417 | if ( QApplication::desktop()->width() < 480 ) | 417 | if ( QApplication::desktop()->width() < 480 ) |
418 | widebut = widebut*2; | 418 | widebut = widebut*2; |
419 | else | 419 | else |
420 | widebut = (widebut*3) / 2; | 420 | widebut = (widebut*3) / 2; |
421 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | 421 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, |
422 | // QSizePolicy::Fixed ) ); | 422 | // QSizePolicy::Fixed ) ); |
423 | mExpandButton->setFixedSize( widebut, widebut); | 423 | mExpandButton->setFixedSize( widebut, widebut); |
424 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 424 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
425 | mExpandButton->setFocusPolicy(NoFocus); | 425 | mExpandButton->setFocusPolicy(NoFocus); |
426 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 426 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
427 | mAllDayAgenda->setFocusPolicy(NoFocus); | 427 | mAllDayAgenda->setFocusPolicy(NoFocus); |
428 | QVBox *dummyAllDayRight = new QVBox(mAllDayFrame); | 428 | QVBox *dummyAllDayRight = new QVBox(mAllDayFrame); |
429 | 429 | ||
430 | QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight); | 430 | QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight); |
431 | QLabel * dummyAllDayRightL = new QLabel ( dummyAllDayRight ); | 431 | mDummyAllDayRightL = new QLabel ( dummyAllDayRight ); |
432 | 432 | ||
433 | dummyAllDayRightB->setFlat( true ); | 433 | dummyAllDayRightB->setFlat( true ); |
434 | dummyAllDayRightB->setFocusPolicy(NoFocus); | 434 | dummyAllDayRightB->setFocusPolicy(NoFocus); |
435 | // dummyAllDayRightB->setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); | 435 | // dummyAllDayRightB->setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); |
436 | //dummyAllDayRightB->setFixedHeight( dummyAllDayRightB->sizeHint().height()/2 ); | 436 | dummyAllDayRightB->setFixedHeight( (dummyAllDayRightB->sizeHint().height()/4)*3 ); |
437 | QPopupMenu * wpo = new QPopupMenu (this); | 437 | QPopupMenu * wpo = new QPopupMenu (this); |
438 | wpo->insertItem( i18n("W#"), 0 ); | 438 | wpo->insertItem( i18n("W#"), 0 ); |
439 | int i; | 439 | int i; |
440 | for ( i = 1; i < 53; i++ ) | 440 | for ( i = 1; i < 53; i++ ) |
441 | wpo->insertItem( QString::number( i ),i ); | 441 | wpo->insertItem( QString::number( i ),i ); |
442 | //Qt bug - we must add some empty fields... | 442 | //Qt bug - we must add some empty fields... |
443 | for ( i = 53; i < 54; ++i ) { | 443 | for ( i = 53; i < 54; ++i ) { |
444 | wpo->insertItem( "", 52 ); | 444 | wpo->insertItem( "", 52 ); |
445 | } | 445 | } |
446 | dummyAllDayRightB->setPopup( wpo ); | 446 | dummyAllDayRightB->setPopup( wpo ); |
447 | 447 | ||
448 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); | 448 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); |
449 | 449 | ||
450 | // Create event context menu for all day agenda | 450 | // Create event context menu for all day agenda |
451 | mAllDayAgendaPopup = eventPopup(); | 451 | mAllDayAgendaPopup = eventPopup(); |
452 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 452 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
453 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 453 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
454 | 454 | ||
455 | // Create agenda frame | 455 | // Create agenda frame |
456 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); | 456 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); |
457 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 457 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
458 | 458 | ||
459 | // create event indicator bars | 459 | // create event indicator bars |
460 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 460 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
461 | agendaLayout->addWidget(mEventIndicatorTop,0,1); | 461 | agendaLayout->addWidget(mEventIndicatorTop,0,1); |
462 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 462 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
463 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 463 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
464 | agendaFrame); | 464 | agendaFrame); |
465 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); | 465 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); |
466 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 466 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
467 | agendaLayout->addWidget(dummyAgendaRight,0,2); | 467 | agendaLayout->addWidget(dummyAgendaRight,0,2); |
468 | 468 | ||
@@ -549,64 +549,77 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
549 | SLOT(updateEventDates(KOAgendaItem *, int))); | 549 | SLOT(updateEventDates(KOAgendaItem *, int))); |
550 | 550 | ||
551 | // event indicator update | 551 | // event indicator update |
552 | connect(mAgenda,SIGNAL(lowerYChanged(int)), | 552 | connect(mAgenda,SIGNAL(lowerYChanged(int)), |
553 | SLOT(updateEventIndicatorTop(int))); | 553 | SLOT(updateEventIndicatorTop(int))); |
554 | connect(mAgenda,SIGNAL(upperYChanged(int)), | 554 | connect(mAgenda,SIGNAL(upperYChanged(int)), |
555 | SLOT(updateEventIndicatorBottom(int))); | 555 | SLOT(updateEventIndicatorBottom(int))); |
556 | // drag signals | 556 | // drag signals |
557 | /* | 557 | /* |
558 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 558 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
559 | SLOT(startDrag(Event *))); | 559 | SLOT(startDrag(Event *))); |
560 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), | 560 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), |
561 | SLOT(startDrag(Event *))); | 561 | SLOT(startDrag(Event *))); |
562 | */ | 562 | */ |
563 | // synchronize selections | 563 | // synchronize selections |
564 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 564 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
565 | mAllDayAgenda, SLOT( deselectItem() ) ); | 565 | mAllDayAgenda, SLOT( deselectItem() ) ); |
566 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 566 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
567 | mAgenda, SLOT( deselectItem() ) ); | 567 | mAgenda, SLOT( deselectItem() ) ); |
568 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 568 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
569 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 569 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
570 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 570 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
571 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 571 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
572 | connect( mAgenda, SIGNAL( resizedSignal() ), | 572 | connect( mAgenda, SIGNAL( resizedSignal() ), |
573 | SLOT( updateConfig( ) ) ); | 573 | SLOT( updateConfig( ) ) ); |
574 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 574 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
575 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 575 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
576 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 576 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
577 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); | 577 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); |
578 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 578 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
579 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 579 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
580 | 580 | ||
581 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; | ||
582 | QFontMetrics fm ( dlf ); | ||
583 | QString dayTest = "30"; | ||
584 | int wid = fm.width( dayTest ); | ||
585 | int maxWid = dummyAllDayRight->width(); | ||
586 | int fontPoint = dlf.pointSize(); | ||
587 | while ( wid > maxWid ) { | ||
588 | --fontPoint; | ||
589 | dlf.setPointSize( fontPoint ); | ||
590 | QFontMetrics f( dlf ); | ||
591 | wid = f.width( dayTest ); | ||
592 | } | ||
593 | mDummyAllDayRightL->setFont( dlf ); | ||
581 | 594 | ||
582 | } | 595 | } |
583 | 596 | ||
584 | void KOAgendaView::toggleAllDay() | 597 | void KOAgendaView::toggleAllDay() |
585 | { | 598 | { |
586 | if ( mSplitterAgenda->firstHandle() ) | 599 | if ( mSplitterAgenda->firstHandle() ) |
587 | mSplitterAgenda->firstHandle()->toggle(); | 600 | mSplitterAgenda->firstHandle()->toggle(); |
588 | } | 601 | } |
589 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 602 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) |
590 | { | 603 | { |
591 | calendar()->addIncidence( inc ); | 604 | calendar()->addIncidence( inc ); |
592 | 605 | ||
593 | if ( incOld ) { | 606 | if ( incOld ) { |
594 | if ( incOld->type() == "Todo" ) | 607 | if ( incOld->type() == "Todo" ) |
595 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); | 608 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); |
596 | else | 609 | else |
597 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); | 610 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); |
598 | } | 611 | } |
599 | 612 | ||
600 | } | 613 | } |
601 | 614 | ||
602 | KOAgendaView::~KOAgendaView() | 615 | KOAgendaView::~KOAgendaView() |
603 | { | 616 | { |
604 | delete mAgendaPopup; | 617 | delete mAgendaPopup; |
605 | delete mAllDayAgendaPopup; | 618 | delete mAllDayAgendaPopup; |
606 | delete KOAgendaItem::paintPix(); | 619 | delete KOAgendaItem::paintPix(); |
607 | delete KOAgendaItem::paintPixSel(); | 620 | delete KOAgendaItem::paintPixSel(); |
608 | } | 621 | } |
609 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 622 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
610 | { | 623 | { |
611 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 624 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
612 | bool uc = false; | 625 | bool uc = false; |
@@ -889,65 +902,66 @@ DateList KOAgendaView::selectedDates() | |||
889 | { | 902 | { |
890 | DateList selected; | 903 | DateList selected; |
891 | QDate qd; | 904 | QDate qd; |
892 | 905 | ||
893 | qd = mAgenda->selectedIncidenceDate(); | 906 | qd = mAgenda->selectedIncidenceDate(); |
894 | if (qd.isValid()) selected.append(qd); | 907 | if (qd.isValid()) selected.append(qd); |
895 | 908 | ||
896 | qd = mAllDayAgenda->selectedIncidenceDate(); | 909 | qd = mAllDayAgenda->selectedIncidenceDate(); |
897 | if (qd.isValid()) selected.append(qd); | 910 | if (qd.isValid()) selected.append(qd); |
898 | 911 | ||
899 | return selected; | 912 | return selected; |
900 | } | 913 | } |
901 | 914 | ||
902 | 915 | ||
903 | void KOAgendaView::updateView() | 916 | void KOAgendaView::updateView() |
904 | { | 917 | { |
905 | if ( mBlockUpdating ) | 918 | if ( mBlockUpdating ) |
906 | return; | 919 | return; |
907 | // kdDebug() << "KOAgendaView::updateView()" << endl; | 920 | // kdDebug() << "KOAgendaView::updateView()" << endl; |
908 | fillAgenda(); | 921 | fillAgenda(); |
909 | 922 | ||
910 | } | 923 | } |
911 | 924 | ||
912 | 925 | ||
913 | /* | 926 | /* |
914 | Update configuration settings for the agenda view. This method is not | 927 | Update configuration settings for the agenda view. This method is not |
915 | complete. | 928 | complete. |
916 | */ | 929 | */ |
917 | void KOAgendaView::updateConfig() | 930 | void KOAgendaView::updateConfig() |
918 | { | 931 | { |
919 | if ( mBlockUpdating ) | 932 | if ( mBlockUpdating ) |
920 | return; | 933 | return; |
921 | // kdDebug() << "KOAgendaView::updateConfig()" << endl; | 934 | |
935 | |||
922 | 936 | ||
923 | // update config for children | 937 | // update config for children |
924 | mTimeLabels->updateConfig(); | 938 | mTimeLabels->updateConfig(); |
925 | mAgenda->storePosition(); | 939 | mAgenda->storePosition(); |
926 | mAgenda->updateConfig(); | 940 | mAgenda->updateConfig(); |
927 | mAllDayAgenda->updateConfig(); | 941 | mAllDayAgenda->updateConfig(); |
928 | // widget synchronization | 942 | // widget synchronization |
929 | //TODO: find a better way, maybe signal/slot | 943 | //TODO: find a better way, maybe signal/slot |
930 | mTimeLabels->positionChanged(); | 944 | mTimeLabels->positionChanged(); |
931 | 945 | ||
932 | // for some reason, this needs to be called explicitly | 946 | // for some reason, this needs to be called explicitly |
933 | mTimeLabels->repaint(); | 947 | mTimeLabels->repaint(); |
934 | 948 | ||
935 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 949 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
936 | 950 | ||
937 | // ToolTips displaying summary of events | 951 | // ToolTips displaying summary of events |
938 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() | 952 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() |
939 | ->mEnableToolTips); | 953 | ->mEnableToolTips); |
940 | 954 | ||
941 | //setHolidayMasks(); | 955 | //setHolidayMasks(); |
942 | 956 | ||
943 | //createDayLabels(); called by via updateView(); | 957 | //createDayLabels(); called by via updateView(); |
944 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); | 958 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); |
945 | updateView(); | 959 | updateView(); |
946 | mAgenda->restorePosition(); | 960 | mAgenda->restorePosition(); |
947 | } | 961 | } |
948 | 962 | ||
949 | 963 | ||
950 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) | 964 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) |
951 | { | 965 | { |
952 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; | 966 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; |
953 | //qDebug("KOAgendaView::updateEventDates "); | 967 | //qDebug("KOAgendaView::updateEventDates "); |
@@ -1055,64 +1069,91 @@ void KOAgendaView::showEvents(QPtrList<Event>) | |||
1055 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; | 1069 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; |
1056 | } | 1070 | } |
1057 | 1071 | ||
1058 | void KOAgendaView::changeEventDisplay(Event *, int) | 1072 | void KOAgendaView::changeEventDisplay(Event *, int) |
1059 | { | 1073 | { |
1060 | // qDebug("KOAgendaView::changeEventDisplay "); | 1074 | // qDebug("KOAgendaView::changeEventDisplay "); |
1061 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; | 1075 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; |
1062 | // this should be re-written to be MUCH smarter. Right now we | 1076 | // this should be re-written to be MUCH smarter. Right now we |
1063 | // are just playing dumb. | 1077 | // are just playing dumb. |
1064 | fillAgenda(); | 1078 | fillAgenda(); |
1065 | } | 1079 | } |
1066 | 1080 | ||
1067 | void KOAgendaView::fillAgenda(const QDate &) | 1081 | void KOAgendaView::fillAgenda(const QDate &) |
1068 | { | 1082 | { |
1069 | // qDebug("KOAgendaView::fillAgenda "); | 1083 | // qDebug("KOAgendaView::fillAgenda "); |
1070 | fillAgenda(); | 1084 | fillAgenda(); |
1071 | } | 1085 | } |
1072 | 1086 | ||
1073 | void KOAgendaView::fillAgenda() | 1087 | void KOAgendaView::fillAgenda() |
1074 | { | 1088 | { |
1075 | if ( globalFlagBlockStartup ) | 1089 | if ( globalFlagBlockStartup ) |
1076 | return; | 1090 | return; |
1077 | if ( globalFlagBlockAgenda == 1 ) | 1091 | if ( globalFlagBlockAgenda == 1 ) |
1078 | return; | 1092 | return; |
1079 | //if ( globalFlagBlockAgenda == 2 ) | 1093 | //if ( globalFlagBlockAgenda == 2 ) |
1080 | //globalFlagBlockAgenda = 0; | 1094 | //globalFlagBlockAgenda = 0; |
1081 | // globalFlagBlockPainting = false; | 1095 | // globalFlagBlockPainting = false; |
1082 | if ( globalFlagBlockAgenda == 0 ) | 1096 | if ( globalFlagBlockAgenda == 0 ) |
1083 | globalFlagBlockAgenda = 1; | 1097 | globalFlagBlockAgenda = 1; |
1084 | // clearView(); | 1098 | // clearView(); |
1085 | //qDebug("fillAgenda()++++ "); | 1099 | //qDebug("fillAgenda()++++ "); |
1086 | globalFlagBlockAgendaItemPaint = 1; | 1100 | globalFlagBlockAgendaItemPaint = 1; |
1101 | |||
1102 | int weekNum = 0; | ||
1103 | QDate seda = mSelectedDates.first(); | ||
1104 | QDate d = QDate ( seda.year(), 1,1); | ||
1105 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday | ||
1106 | if ( seda.addDays(6).year() != seda.year() ) { | ||
1107 | if ( seda.year() != d.year() ) { | ||
1108 | if ( d.dayOfWeek() > 4 ) | ||
1109 | d = QDate ( seda.year(), 1,1); | ||
1110 | else | ||
1111 | weekNum = 1; | ||
1112 | } else { | ||
1113 | QDate dd( seda.year()+1, 1,1); | ||
1114 | if ( dd.dayOfWeek() <= 4 ) | ||
1115 | weekNum = 1; | ||
1116 | } | ||
1117 | } | ||
1118 | if ( weekNum == 0 ){ | ||
1119 | int dow = d.dayOfWeek(); | ||
1120 | if ( dow <= 4 ) | ||
1121 | d = d.addDays( 1-dow ); | ||
1122 | else // 5,6,7 | ||
1123 | d = d.addDays( 8-dow ); | ||
1124 | // we have the first week of the year.we are on monday | ||
1125 | weekNum = d.daysTo( seda ) / 7 +1; | ||
1126 | } | ||
1127 | mDummyAllDayRightL->setText( QString::number( weekNum) ); | ||
1087 | mAllDayAgenda->changeColumns(mSelectedDates.count()); | 1128 | mAllDayAgenda->changeColumns(mSelectedDates.count()); |
1088 | mAgenda->changeColumns(mSelectedDates.count()); | 1129 | mAgenda->changeColumns(mSelectedDates.count()); |
1089 | qApp->processEvents(); | 1130 | qApp->processEvents(); |
1090 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); | 1131 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); |
1091 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); | 1132 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); |
1092 | setHolidayMasks(); | 1133 | setHolidayMasks(); |
1093 | 1134 | ||
1094 | //mAgenda->hideUnused(); | 1135 | //mAgenda->hideUnused(); |
1095 | //mAllDayAgenda->hideUnused(); | 1136 | //mAllDayAgenda->hideUnused(); |
1096 | 1137 | ||
1097 | // mAgenda->blockNextRepaint( false ); | 1138 | // mAgenda->blockNextRepaint( false ); |
1098 | // mAgenda->viewport()->repaint(); | 1139 | // mAgenda->viewport()->repaint(); |
1099 | // mAgenda->blockNextRepaint( true ); | 1140 | // mAgenda->blockNextRepaint( true ); |
1100 | mMinY.resize(mSelectedDates.count()); | 1141 | mMinY.resize(mSelectedDates.count()); |
1101 | mMaxY.resize(mSelectedDates.count()); | 1142 | mMaxY.resize(mSelectedDates.count()); |
1102 | 1143 | ||
1103 | QPtrList<Event> dayEvents; | 1144 | QPtrList<Event> dayEvents; |
1104 | 1145 | ||
1105 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1146 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1106 | // Therefore, gtodoset all of them. | 1147 | // Therefore, gtodoset all of them. |
1107 | QPtrList<Todo> todos = calendar()->todos(); | 1148 | QPtrList<Todo> todos = calendar()->todos(); |
1108 | 1149 | ||
1109 | mAgenda->setDateList(mSelectedDates); | 1150 | mAgenda->setDateList(mSelectedDates); |
1110 | 1151 | ||
1111 | QDate today = QDate::currentDate(); | 1152 | QDate today = QDate::currentDate(); |
1112 | 1153 | ||
1113 | DateList::ConstIterator dit; | 1154 | DateList::ConstIterator dit; |
1114 | int curCol = 0; | 1155 | int curCol = 0; |
1115 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 1156 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
1116 | QDate currentDate = *dit; | 1157 | QDate currentDate = *dit; |
1117 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() | 1158 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() |
1118 | // << endl; | 1159 | // << endl; |
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index 4a058ce..ba9bc93 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h | |||
@@ -187,64 +187,65 @@ class KOAgendaView : public KOEventView { | |||
187 | 187 | ||
188 | void clearSelection(); | 188 | void clearSelection(); |
189 | 189 | ||
190 | void newTodo(int gx,int gy); | 190 | void newTodo(int gx,int gy); |
191 | void newEvent(int gx,int gy); | 191 | void newEvent(int gx,int gy); |
192 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); | 192 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); |
193 | void newEventAllDay(int gx, int gy); | 193 | void newEventAllDay(int gx, int gy); |
194 | void newTodoAllDay(int gx, int gy); | 194 | void newTodoAllDay(int gx, int gy); |
195 | 195 | ||
196 | void startDrag(Event *); | 196 | void startDrag(Event *); |
197 | 197 | ||
198 | void readSettings(); | 198 | void readSettings(); |
199 | void readSettings(KConfig *); | 199 | void readSettings(KConfig *); |
200 | void writeSettings(KConfig *); | 200 | void writeSettings(KConfig *); |
201 | 201 | ||
202 | void setContentsPos(int y); | 202 | void setContentsPos(int y); |
203 | 203 | ||
204 | void setExpandedButton( bool expanded ); | 204 | void setExpandedButton( bool expanded ); |
205 | void scrollOneHourUp(); | 205 | void scrollOneHourUp(); |
206 | void scrollOneHourDown(); | 206 | void scrollOneHourDown(); |
207 | void addToCalSlot(Incidence *, Incidence *); | 207 | void addToCalSlot(Incidence *, Incidence *); |
208 | 208 | ||
209 | signals: | 209 | signals: |
210 | void showDateView( int, QDate ); | 210 | void showDateView( int, QDate ); |
211 | void newTodoSignal( QDateTime ,bool ); | 211 | void newTodoSignal( QDateTime ,bool ); |
212 | void toggleExpand(); | 212 | void toggleExpand(); |
213 | void selectWeekNum( int ); | 213 | void selectWeekNum( int ); |
214 | void todoMoved( Todo *, int ); | 214 | void todoMoved( Todo *, int ); |
215 | void incidenceChanged(Incidence * , int ); | 215 | void incidenceChanged(Incidence * , int ); |
216 | // void cloneIncidenceSignal(Incidence *); | 216 | // void cloneIncidenceSignal(Incidence *); |
217 | 217 | ||
218 | protected: | 218 | protected: |
219 | QLabel * mDummyAllDayRightL; | ||
219 | KOAgendaButton* getNewDaylabel(); | 220 | KOAgendaButton* getNewDaylabel(); |
220 | bool mBlockUpdating; | 221 | bool mBlockUpdating; |
221 | int mUpcomingWidth; | 222 | int mUpcomingWidth; |
222 | /** Fill agenda beginning with date startDate */ | 223 | /** Fill agenda beginning with date startDate */ |
223 | void fillAgenda(const QDate &startDate); | 224 | void fillAgenda(const QDate &startDate); |
224 | void resizeEvent( QResizeEvent* e ); | 225 | void resizeEvent( QResizeEvent* e ); |
225 | /** Fill agenda using the current set value for the start date */ | 226 | /** Fill agenda using the current set value for the start date */ |
226 | void fillAgenda(); | 227 | void fillAgenda(); |
227 | 228 | ||
228 | /** Create labels for the selected dates. */ | 229 | /** Create labels for the selected dates. */ |
229 | void createDayLabels(); | 230 | void createDayLabels(); |
230 | 231 | ||
231 | /** | 232 | /** |
232 | Set the masks on the agenda widgets indicating, which days are holidays. | 233 | Set the masks on the agenda widgets indicating, which days are holidays. |
233 | */ | 234 | */ |
234 | void setHolidayMasks(); | 235 | void setHolidayMasks(); |
235 | 236 | ||
236 | protected slots: | 237 | protected slots: |
237 | void slotDaylabelClicked( int ); | 238 | void slotDaylabelClicked( int ); |
238 | /** Update event belonging to agenda item */ | 239 | /** Update event belonging to agenda item */ |
239 | void updateEventDates(KOAgendaItem *item, int mode = -1); | 240 | void updateEventDates(KOAgendaItem *item, int mode = -1); |
240 | //void updateMovedTodo(); | 241 | //void updateMovedTodo(); |
241 | 242 | ||
242 | void updateEventIndicatorTop(int newY); | 243 | void updateEventIndicatorTop(int newY); |
243 | void updateEventIndicatorBottom(int newY); | 244 | void updateEventIndicatorBottom(int newY); |
244 | 245 | ||
245 | /** Updates data for selected timespan */ | 246 | /** Updates data for selected timespan */ |
246 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); | 247 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); |
247 | /** Updates data for selected timespan for all day event*/ | 248 | /** Updates data for selected timespan for all day event*/ |
248 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); | 249 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); |
249 | 250 | ||
250 | private: | 251 | private: |