summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaview.cpp
Unidiff
Diffstat (limited to 'korganizer/koagendaview.cpp') (more/less context) (show 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
@@ -572,25 +572,25 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
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();
@@ -958,49 +958,49 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
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 }
@@ -1012,42 +1012,42 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
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