summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaview.cpp
Unidiff
Diffstat (limited to 'korganizer/koagendaview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 1320a2e..b2b136a 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -536,97 +536,97 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
536 connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), 536 connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
537 SLOT(updateEventDates(KOAgendaItem *, int))); 537 SLOT(updateEventDates(KOAgendaItem *, int)));
538 538
539 // event indicator update 539 // event indicator update
540 connect(mAgenda,SIGNAL(lowerYChanged(int)), 540 connect(mAgenda,SIGNAL(lowerYChanged(int)),
541 SLOT(updateEventIndicatorTop(int))); 541 SLOT(updateEventIndicatorTop(int)));
542 connect(mAgenda,SIGNAL(upperYChanged(int)), 542 connect(mAgenda,SIGNAL(upperYChanged(int)),
543 SLOT(updateEventIndicatorBottom(int))); 543 SLOT(updateEventIndicatorBottom(int)));
544 // drag signals 544 // drag signals
545 /* 545 /*
546 connect(mAgenda,SIGNAL(startDragSignal(Event *)), 546 connect(mAgenda,SIGNAL(startDragSignal(Event *)),
547 SLOT(startDrag(Event *))); 547 SLOT(startDrag(Event *)));
548 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), 548 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)),
549 SLOT(startDrag(Event *))); 549 SLOT(startDrag(Event *)));
550 */ 550 */
551 // synchronize selections 551 // synchronize selections
552 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 552 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
553 mAllDayAgenda, SLOT( deselectItem() ) ); 553 mAllDayAgenda, SLOT( deselectItem() ) );
554 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 554 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
555 mAgenda, SLOT( deselectItem() ) ); 555 mAgenda, SLOT( deselectItem() ) );
556 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 556 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
557 SIGNAL( incidenceSelected( Incidence * ) ) ); 557 SIGNAL( incidenceSelected( Incidence * ) ) );
558 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 558 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
559 SIGNAL( incidenceSelected( Incidence * ) ) ); 559 SIGNAL( incidenceSelected( Incidence * ) ) );
560 connect( mAgenda, SIGNAL( resizedSignal() ), 560 connect( mAgenda, SIGNAL( resizedSignal() ),
561 SLOT( updateConfig( ) ) ); 561 SLOT( updateConfig( ) ) );
562 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), 562 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ),
563 SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); 563 SLOT( addToCalSlot(Incidence *, Incidence * ) ) );
564 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), 564 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ),
565 SLOT( addToCalSlot(Incidence * , Incidence *) ) ); 565 SLOT( addToCalSlot(Incidence * , Incidence *) ) );
566 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 566 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
567 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 567 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
568 568
569 connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) ); 569 connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) );
570 connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) ); 570 connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) );
571 571
572} 572}
573 573
574void KOAgendaView::toggleAllDay() 574void KOAgendaView::toggleAllDay()
575{ 575{
576 if ( mSplitterAgenda->firstHandle() ) 576 if ( mSplitterAgenda->firstHandle() )
577 mSplitterAgenda->firstHandle()->toggle(); 577 mSplitterAgenda->firstHandle()->toggle();
578} 578}
579void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) 579void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld )
580{ 580{
581 calendar()->addIncidence( inc ); 581 calendar()->addIncidence( inc );
582 582
583 if ( incOld ) { 583 if ( incOld ) {
584 if ( incOld->type() == "Todo" ) 584 if ( incOld->typeID() == todoID )
585 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); 585 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED );
586 else 586 else
587 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); 587 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED);
588 } 588 }
589 589
590} 590}
591 591
592KOAgendaView::~KOAgendaView() 592KOAgendaView::~KOAgendaView()
593{ 593{
594 delete mAllAgendaPopup; 594 delete mAllAgendaPopup;
595 //delete mAllDayAgendaPopup; 595 //delete mAllDayAgendaPopup;
596 delete KOAgendaItem::paintPix(); 596 delete KOAgendaItem::paintPix();
597 delete KOAgendaItem::paintPixSel(); 597 delete KOAgendaItem::paintPixSel();
598} 598}
599void KOAgendaView::resizeEvent( QResizeEvent* e ) 599void KOAgendaView::resizeEvent( QResizeEvent* e )
600{ 600{
601 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); 601 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width());
602 bool uc = false; 602 bool uc = false;
603 int ow = e->oldSize().width(); 603 int ow = e->oldSize().width();
604 int oh = e->oldSize().height(); 604 int oh = e->oldSize().height();
605 int w = e->size().width(); 605 int w = e->size().width();
606 int h = e->size().height(); 606 int h = e->size().height();
607 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { 607 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) {
608 if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) 608 if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda )
609 uc = true; 609 uc = true;
610 //qDebug("view changed %d %d %d %d ", ow, oh , w , h); 610 //qDebug("view changed %d %d %d %d ", ow, oh , w , h);
611 } 611 }
612 mUpcomingWidth = e->size().width() ; 612 mUpcomingWidth = e->size().width() ;
613 if ( mBlockUpdating || uc ) { 613 if ( mBlockUpdating || uc ) {
614 mBlockUpdating = false; 614 mBlockUpdating = false;
615 //mAgenda->setMinimumSize(800 , 600 ); 615 //mAgenda->setMinimumSize(800 , 600 );
616 //qDebug("mAgenda->resize+++++++++++++++ "); 616 //qDebug("mAgenda->resize+++++++++++++++ ");
617 updateConfig(); 617 updateConfig();
618 //qDebug("KOAgendaView::Updating now possible "); 618 //qDebug("KOAgendaView::Updating now possible ");
619 } else 619 } else
620 createDayLabels(); 620 createDayLabels();
621 //qDebug("resizeEvent end "); 621 //qDebug("resizeEvent end ");
622 622
623} 623}
624void KOAgendaView::slotDaylabelClicked( int num ) 624void KOAgendaView::slotDaylabelClicked( int num )
625{ 625{
626 626
627 QDate firstDate = mSelectedDates.first(); 627 QDate firstDate = mSelectedDates.first();
628 if ( num == -1 ) 628 if ( num == -1 )
629 emit showDateView( 6, firstDate ); 629 emit showDateView( 6, firstDate );
630 else if (num >= 0 ) { 630 else if (num >= 0 ) {
631 if ( mSelectedDates.count() == 1) 631 if ( mSelectedDates.count() == 1)
632 emit showDateView( 9, firstDate.addDays( num ) ); 632 emit showDateView( 9, firstDate.addDays( num ) );
@@ -922,168 +922,168 @@ void KOAgendaView::updateConfig()
922 922
923 // update config for children 923 // update config for children
924 mTimeLabels->updateConfig(); 924 mTimeLabels->updateConfig();
925 mAgenda->storePosition(); 925 mAgenda->storePosition();
926 mAgenda->updateConfig(); 926 mAgenda->updateConfig();
927 mAllDayAgenda->updateConfig(); 927 mAllDayAgenda->updateConfig();
928 // widget synchronization 928 // widget synchronization
929 //TODO: find a better way, maybe signal/slot 929 //TODO: find a better way, maybe signal/slot
930 mTimeLabels->positionChanged(); 930 mTimeLabels->positionChanged();
931 931
932 // for some reason, this needs to be called explicitly 932 // for some reason, this needs to be called explicitly
933 mTimeLabels->repaint(); 933 mTimeLabels->repaint();
934 934
935 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 935 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
936 936
937 // ToolTips displaying summary of events 937 // ToolTips displaying summary of events
938 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() 938 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance()
939 ->mEnableToolTips); 939 ->mEnableToolTips);
940 940
941 //setHolidayMasks(); 941 //setHolidayMasks();
942 942
943 //createDayLabels(); called by via updateView(); 943 //createDayLabels(); called by via updateView();
944 mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); 944 mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth());
945 updateView(); 945 updateView();
946 mAgenda->restorePosition(); 946 mAgenda->restorePosition();
947} 947}
948 948
949 949
950void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) 950void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
951{ 951{
952 952
953 953
954 int xxx = item->cellX(); 954 int xxx = item->cellX();
955 //qDebug("KOAgendaView::updateEventDates %d %d %d %d %d", xxx, mMinY.at(xxx),mMaxY.at(xxx),item->cellYTop(),item->cellYBottom() ); 955 //qDebug("KOAgendaView::updateEventDates %d %d %d %d %d", xxx, mMinY.at(xxx),mMaxY.at(xxx),item->cellYTop(),item->cellYBottom() );
956 if ( mMinY.at(xxx) > item->cellYTop() ) 956 if ( mMinY.at(xxx) > item->cellYTop() )
957 mMinY.at(xxx) = item->cellYTop(); 957 mMinY.at(xxx) = item->cellYTop();
958 if ( mMaxY.at(xxx) < item->cellYBottom() ) 958 if ( mMaxY.at(xxx) < item->cellYBottom() )
959 mMaxY.at(xxx) = item->cellYBottom(); 959 mMaxY.at(xxx) = item->cellYBottom();
960 960
961 QDateTime startDt,endDt; 961 QDateTime startDt,endDt;
962 QDate startDate; 962 QDate startDate;
963 int lenInSecs; 963 int lenInSecs;
964 // if ( type == KOAgenda::RESIZETOP ) 964 // if ( type == KOAgenda::RESIZETOP )
965 // qDebug("RESIZETOP "); 965 // qDebug("RESIZETOP ");
966 // if ( type == KOAgenda::RESIZEBOTTOM ) 966 // if ( type == KOAgenda::RESIZEBOTTOM )
967 // qDebug("RESIZEBOTTOM "); 967 // qDebug("RESIZEBOTTOM ");
968 // if ( type == KOAgenda::MOVE ) 968 // if ( type == KOAgenda::MOVE )
969 // qDebug("MOVE "); 969 // qDebug("MOVE ");
970 if ( item->incidence()->type() == "Event" ) { 970 if ( item->incidence()->typeID() == eventID ) {
971 startDt =item->incidence()->dtStart(); 971 startDt =item->incidence()->dtStart();
972 endDt = item->incidence()->dtEnd(); 972 endDt = item->incidence()->dtEnd();
973 lenInSecs = startDt.secsTo( endDt ); 973 lenInSecs = startDt.secsTo( endDt );
974 } 974 }
975 975
976 // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); 976 // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED );
977 977
978 if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { 978 if ( item->incidence()->typeID()== todoID && item->mLastMoveXPos > 0 ) {
979 startDate = mSelectedDates[item->mLastMoveXPos]; 979 startDate = mSelectedDates[item->mLastMoveXPos];
980 } else { 980 } else {
981 if (item->cellX() < 0) { 981 if (item->cellX() < 0) {
982 startDate = (mSelectedDates.first()).addDays(item->cellX()); 982 startDate = (mSelectedDates.first()).addDays(item->cellX());
983 } else { 983 } else {
984 startDate = mSelectedDates[item->cellX()]; 984 startDate = mSelectedDates[item->cellX()];
985 } 985 }
986 } 986 }
987 startDt.setDate(startDate); 987 startDt.setDate(startDate);
988 988
989 if (item->incidence()->doesFloat()) { 989 if (item->incidence()->doesFloat()) {
990 endDt.setDate(startDate.addDays(item->cellWidth() - 1)); 990 endDt.setDate(startDate.addDays(item->cellWidth() - 1));
991 } else { 991 } else {
992 if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) 992 if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE )
993 startDt.setTime(mAgenda->gyToTime(item->cellYTop())); 993 startDt.setTime(mAgenda->gyToTime(item->cellYTop()));
994 if ( item->incidence()->type() == "Event" ) { 994 if ( item->incidence()->typeID() == eventID ) {
995 if ( type == KOAgenda::MOVE ) { 995 if ( type == KOAgenda::MOVE ) {
996 endDt = startDt.addSecs(lenInSecs); 996 endDt = startDt.addSecs(lenInSecs);
997 997
998 } else if ( type == KOAgenda::RESIZEBOTTOM ) { 998 } else if ( type == KOAgenda::RESIZEBOTTOM ) {
999 if (item->lastMultiItem()) { 999 if (item->lastMultiItem()) {
1000 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 1000 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
1001 endDt.setDate(startDate. 1001 endDt.setDate(startDate.
1002 addDays(item->lastMultiItem()->cellX() - item->cellX())); 1002 addDays(item->lastMultiItem()->cellX() - item->cellX()));
1003 } else { 1003 } else {
1004 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 1004 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
1005 endDt.setDate(startDate); 1005 endDt.setDate(startDate);
1006 } 1006 }
1007 } 1007 }
1008 } else { 1008 } else {
1009 // todo 1009 // todo
1010 if (item->lastMultiItem()) { 1010 if (item->lastMultiItem()) {
1011 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 1011 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
1012 endDt.setDate(startDate. 1012 endDt.setDate(startDate.
1013 addDays(item->lastMultiItem()->cellX() - item->cellX())); 1013 addDays(item->lastMultiItem()->cellX() - item->cellX()));
1014 } else { 1014 } else {
1015 //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); 1015 //qDebug("tem->cellYBottom() %d",item->cellYBottom() );
1016 if ( item->cellYBottom() > 0 ) 1016 if ( item->cellYBottom() > 0 )
1017 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 1017 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
1018 else 1018 else
1019 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); 1019 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time());
1020 endDt.setDate(startDate); 1020 endDt.setDate(startDate);
1021 } 1021 }
1022 } 1022 }
1023 } 1023 }
1024 if ( item->incidence()->type() == "Event" ) { 1024 if ( item->incidence()->typeID() == eventID ) {
1025 item->incidence()->setDtStart(startDt); 1025 item->incidence()->setDtStart(startDt);
1026 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); 1026 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt);
1027 } else if ( item->incidence()->type() == "Todo" ) { 1027 } else if ( item->incidence()->typeID() == todoID ) {
1028 Todo* to = static_cast<Todo*>(item->incidence()); 1028 Todo* to = static_cast<Todo*>(item->incidence());
1029 1029
1030 to->setDtDue(endDt); 1030 to->setDtDue(endDt);
1031 if ( to->hasStartDate() ) { 1031 if ( to->hasStartDate() ) {
1032 if (to->dtStart() >= to->dtDue() ) 1032 if (to->dtStart() >= to->dtDue() )
1033 to->setDtStart(to->dtDue().addDays( -2 )); 1033 to->setDtStart(to->dtDue().addDays( -2 ));
1034 } 1034 }
1035 1035
1036 } 1036 }
1037 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); 1037 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() );
1038 item->incidence()->setRevision(item->incidence()->revision()+1); 1038 item->incidence()->setRevision(item->incidence()->revision()+1);
1039 item->setItemDate(startDt.date()); 1039 item->setItemDate(startDt.date());
1040 //item->updateItem(); 1040 //item->updateItem();
1041 if ( item->incidence()->type() == "Todo" ) { 1041 if ( item->incidence()->typeID() == todoID ) {
1042 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); 1042 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED );
1043 1043
1044 } 1044 }
1045 else 1045 else
1046 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); 1046 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED);
1047 item->updateItem(); 1047 item->updateItem();
1048} 1048}
1049 1049
1050void KOAgendaView::showDates( const QDate &start, const QDate &end ) 1050void KOAgendaView::showDates( const QDate &start, const QDate &end )
1051{ 1051{
1052 // kdDebug() << "KOAgendaView::selectDates" << endl; 1052 // kdDebug() << "KOAgendaView::selectDates" << endl;
1053 1053
1054 mSelectedDates.clear(); 1054 mSelectedDates.clear();
1055 // qDebug("KOAgendaView::showDates "); 1055 // qDebug("KOAgendaView::showDates ");
1056 QDate d = start; 1056 QDate d = start;
1057 while (d <= end) { 1057 while (d <= end) {
1058 mSelectedDates.append(d); 1058 mSelectedDates.append(d);
1059 d = d.addDays( 1 ); 1059 d = d.addDays( 1 );
1060 } 1060 }
1061 1061
1062 // and update the view 1062 // and update the view
1063 fillAgenda(); 1063 fillAgenda();
1064} 1064}
1065 1065
1066 1066
1067void KOAgendaView::showEvents(QPtrList<Event>) 1067void KOAgendaView::showEvents(QPtrList<Event>)
1068{ 1068{
1069 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; 1069 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl;
1070} 1070}
1071 1071
1072void KOAgendaView::changeEventDisplay(Event *, int) 1072void KOAgendaView::changeEventDisplay(Event *, int)
1073{ 1073{
1074 // qDebug("KOAgendaView::changeEventDisplay "); 1074 // qDebug("KOAgendaView::changeEventDisplay ");
1075 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; 1075 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl;
1076 // 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
1077 // are just playing dumb. 1077 // are just playing dumb.
1078 fillAgenda(); 1078 fillAgenda();
1079} 1079}
1080 1080
1081void KOAgendaView::fillAgenda(const QDate &) 1081void KOAgendaView::fillAgenda(const QDate &)
1082{ 1082{
1083 // qDebug("KOAgendaView::fillAgenda "); 1083 // qDebug("KOAgendaView::fillAgenda ");
1084 fillAgenda(); 1084 fillAgenda();
1085} 1085}
1086 1086
1087void KOAgendaView::fillAgenda() 1087void KOAgendaView::fillAgenda()
1088{ 1088{
1089 if ( globalFlagBlockStartup ) 1089 if ( globalFlagBlockStartup )