summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp2
-rw-r--r--korganizer/koagenda.cpp4
-rw-r--r--korganizer/koagendaitem.cpp2
-rw-r--r--korganizer/koagendaview.cpp2
-rw-r--r--korganizer/kodaymatrix.cpp2
-rw-r--r--korganizer/koeditorrecurrence.cpp22
-rw-r--r--korganizer/koeventviewer.cpp6
-rw-r--r--korganizer/kolistview.cpp4
-rw-r--r--korganizer/komonthview.cpp6
-rw-r--r--korganizer/kotodoeditor.cpp1
-rw-r--r--korganizer/kowhatsnextview.cpp4
-rw-r--r--libkcal/event.cpp1
-rw-r--r--libkcal/icalformatimpl.cpp10
-rw-r--r--libkcal/incidence.cpp53
-rw-r--r--libkcal/incidence.h5
-rw-r--r--libkcal/kincidenceformatter.cpp4
-rw-r--r--libkcal/vcalformat.cpp4
-rw-r--r--libkcal/vcalformat.h2
18 files changed, 87 insertions, 47 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index a76f2ed..a9d42f0 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3754,17 +3754,17 @@ void CalendarView::deleteJournal(Journal *jour)
3754 3754
3755void CalendarView::deleteEvent(Event *anEvent) 3755void CalendarView::deleteEvent(Event *anEvent)
3756{ 3756{
3757 if (!anEvent) { 3757 if (!anEvent) {
3758 KNotifyClient::beep(); 3758 KNotifyClient::beep();
3759 return; 3759 return;
3760 } 3760 }
3761 3761
3762 if (anEvent->recurrence()->doesRecur()) { 3762 if (anEvent->doesRecur()) {
3763 QDate itemDate = mViewManager->currentSelectionDate(); 3763 QDate itemDate = mViewManager->currentSelectionDate();
3764 int km; 3764 int km;
3765 if (!itemDate.isValid()) { 3765 if (!itemDate.isValid()) {
3766 //kdDebug() << "Date Not Valid" << endl; 3766 //kdDebug() << "Date Not Valid" << endl;
3767 if (KOPrefs::instance()->mConfirm) { 3767 if (KOPrefs::instance()->mConfirm) {
3768 km = KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + 3768 km = KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) +
3769 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), 3769 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"),
3770 i18n("KO/Pi Confirmation"),i18n("Delete All")); 3770 i18n("KO/Pi Confirmation"),i18n("Delete All"));
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 0dd5ef5..c738f7e 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -574,17 +574,17 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
574 popupMenu(); 574 popupMenu();
575 } else if (me->button() == LeftButton) { 575 } else if (me->button() == LeftButton) {
576 mActionItem = (KOAgendaItem *)object; 576 mActionItem = (KOAgendaItem *)object;
577 if (mActionItem) { 577 if (mActionItem) {
578 emit signalClearSelection(); 578 emit signalClearSelection();
579 slotClearSelection(); 579 slotClearSelection();
580 selectItem(mActionItem); 580 selectItem(mActionItem);
581 Incidence *incidence = mActionItem->incidence(); 581 Incidence *incidence = mActionItem->incidence();
582 if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { 582 if ( incidence->isReadOnly() /*|| incidence->doesRecur() */) {
583 mActionItem = 0; 583 mActionItem = 0;
584 } else { 584 } else {
585 startItemAction(viewportPos); 585 startItemAction(viewportPos);
586 } 586 }
587 } 587 }
588 } 588 }
589 } else { // ---------- viewport() 589 } else { // ---------- viewport()
590 mPopupItem = 0; 590 mPopupItem = 0;
@@ -994,17 +994,17 @@ void KOAgenda::performItemAction(QPoint viewportPos)
994void KOAgenda::endItemAction() 994void KOAgenda::endItemAction()
995{ 995{
996 996
997 if ( mItemMoved ) { 997 if ( mItemMoved ) {
998 KOAgendaItem *placeItem = mActionItem->firstMultiItem(); 998 KOAgendaItem *placeItem = mActionItem->firstMultiItem();
999 if ( !placeItem ) { 999 if ( !placeItem ) {
1000 placeItem = mActionItem; 1000 placeItem = mActionItem;
1001 } 1001 }
1002 if ( placeItem->incidence()->recurrence()->doesRecur() ) { 1002 if ( placeItem->incidence()->doesRecur() ) {
1003 Incidence* oldInc = placeItem->incidence(); 1003 Incidence* oldInc = placeItem->incidence();
1004 placeItem->recreateIncidence(); 1004 placeItem->recreateIncidence();
1005 emit addToCalSignal(placeItem->incidence(), oldInc ); 1005 emit addToCalSignal(placeItem->incidence(), oldInc );
1006 } 1006 }
1007 int type = mActionType; 1007 int type = mActionType;
1008 if ( mAllDayMode ) 1008 if ( mAllDayMode )
1009 type = -1; 1009 type = -1;
1010 KOAgendaItem *modifiedItem = placeItem; 1010 KOAgendaItem *modifiedItem = placeItem;
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 303a92a..49ad9b8 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -229,17 +229,17 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
229 } 229 }
230 if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) { 230 if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) {
231 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); 231 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red );
232 if ( horLayout ) 232 if ( horLayout )
233 ++xOff; 233 ++xOff;
234 else 234 else
235 ++yOff; 235 ++yOff;
236 } 236 }
237 if (mIncidence->recurrence()->doesRecur()) { 237 if (mIncidence->doesRecur()) {
238 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); 238 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue );
239 if ( horLayout ) 239 if ( horLayout )
240 ++xOff; 240 ++xOff;
241 else 241 else
242 ++yOff; 242 ++yOff;
243 } 243 }
244 if (mIncidence->description().length() > 0) { 244 if (mIncidence->description().length() > 0) {
245 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); 245 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen );
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index a01323a..04f30bb 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1196,17 +1196,17 @@ void KOAgendaView::fillAgenda()
1196 // kdDebug() << " Event: " << event->summary() << endl; 1196 // kdDebug() << " Event: " << event->summary() << endl;
1197 1197
1198 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; 1198 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol;
1199 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; 1199 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol;
1200 1200
1201 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; 1201 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl;
1202 1202
1203 if (event->doesFloat()) { 1203 if (event->doesFloat()) {
1204 if (event->recurrence()->doesRecur()) { 1204 if (event->doesRecur()) {
1205 if (event->isMultiDay() ) { 1205 if (event->isMultiDay() ) {
1206 endX = endX - beginX;// endX is now number of days 1206 endX = endX - beginX;// endX is now number of days
1207 if ( event->recursOn( currentDate ) ) { 1207 if ( event->recursOn( currentDate ) ) {
1208 endX += curCol; 1208 endX += curCol;
1209 beginX = curCol; 1209 beginX = curCol;
1210 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1210 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1211 } else { 1211 } else {
1212 //qDebug("days endX %d curCol %d max Col %d %s",endX ,curCol, maxCol, currentDate.toString().latin1()); 1212 //qDebug("days endX %d curCol %d max Col %d %s",endX ,curCol, maxCol, currentDate.toString().latin1());
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index ec1154a..057df0d 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -448,17 +448,17 @@ void KODayMatrix::updateViewTimed()
448 bDays.fill( false); 448 bDays.fill( false);
449 pDays.fill( false); 449 pDays.fill( false);
450 hDays.fill( false); 450 hDays.fill( false);
451 eDays.fill( false); 451 eDays.fill( false);
452 mHolidays.clear(); 452 mHolidays.clear();
453 QDate mStartDate = days[0]; 453 QDate mStartDate = days[0];
454 QDate endDate = mStartDate.addDays( timeSpan ); 454 QDate endDate = mStartDate.addDays( timeSpan );
455 for( event = events.first(); event; event = events.next() ) { // for event 455 for( event = events.first(); event; event = events.next() ) { // for event
456 ushort recurType = event->recurrence()->doesRecur(); 456 ushort recurType = event->doesRecur();
457 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || 457 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
458 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { 458 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
459 continue; 459 continue;
460 } 460 }
461 if ( event->doesRecur() ) { 461 if ( event->doesRecur() ) {
462 bool last; 462 bool last;
463 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); 463 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last );
464 QDateTime incidenceEnd; 464 QDateTime incidenceEnd;
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index de4e4f7..89504db 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -892,26 +892,27 @@ void KOEditorRecurrence::readEvent(Incidence *event)
892 QBitArray rDays( 7 ); 892 QBitArray rDays( 7 );
893 QPtrList<Recurrence::rMonthPos> rmp; 893 QPtrList<Recurrence::rMonthPos> rmp;
894 QPtrList<int> rmd; 894 QPtrList<int> rmd;
895 int day = 0; 895 int day = 0;
896 int count = 0; 896 int count = 0;
897 int month = 0; 897 int month = 0;
898 setDateTimes( event->dtStart(), dtEnd ); 898 setDateTimes( event->dtStart(), dtEnd );
899 899
900 Recurrence *r = event->recurrence();
901 int f = r->frequency();
902 900
903 int recurs = r->doesRecur(); 901
902 int recurs = event->doesRecur();
904 903
905 mEnabledCheck->setChecked( recurs ); 904 mEnabledCheck->setChecked( recurs );
906 setEnabled( recurs ); 905 setEnabled( recurs );
907 906
908 int recurrenceType = RecurrenceChooser::Weekly; 907 int recurrenceType = RecurrenceChooser::Weekly;
909 908 if ( recurs ) {
909 Recurrence *r = event->recurrence();
910 int f = r->frequency();
910 switch ( recurs ) { 911 switch ( recurs ) {
911 case Recurrence::rNone: 912 case Recurrence::rNone:
912 setDefaults( event->dtStart(), dtEnd ); 913 setDefaults( event->dtStart(), dtEnd );
913 break; 914 break;
914 case Recurrence::rDaily: 915 case Recurrence::rDaily:
915 recurrenceType = RecurrenceChooser::Daily; 916 recurrenceType = RecurrenceChooser::Daily;
916 mDaily->setFrequency( f ); 917 mDaily->setFrequency( f );
917 break; 918 break;
@@ -979,45 +980,50 @@ void KOEditorRecurrence::readEvent(Incidence *event)
979 recurrenceType = RecurrenceChooser::Yearly; 980 recurrenceType = RecurrenceChooser::Yearly;
980 mYearly->setByDay( event->dtStart().date().dayOfYear() ); 981 mYearly->setByDay( event->dtStart().date().dayOfYear() );
981 mYearly->setFrequency( f ); 982 mYearly->setFrequency( f );
982 break; 983 break;
983 default: 984 default:
984 setDefaults( event->dtStart(), dtEnd ); 985 setDefaults( event->dtStart(), dtEnd );
985 break; 986 break;
986 } 987 }
987 988 }
988 mRecurrenceChooser->setType( recurrenceType ); 989 mRecurrenceChooser->setType( recurrenceType );
989 showCurrentRule( recurrenceType ); 990 showCurrentRule( recurrenceType );
990 991
991 mRecurrenceRange->setDateTimes( event->dtStart() ); 992 mRecurrenceRange->setDateTimes( event->dtStart() );
992 993
993 if ( r->doesRecur() ) { 994 if ( event->doesRecur() ) {
995 Recurrence *r = event->recurrence();
994 mRecurrenceRange->setDuration( r->duration() ); 996 mRecurrenceRange->setDuration( r->duration() );
995 if ( r->duration() == 0 ) 997 if ( r->duration() == 0 )
996 { 998 {
997 if ( r->endDate() < event->dtStart().date() ) 999 if ( r->endDate() < event->dtStart().date() )
998 mRecurrenceRange->setEndDate( event->dtStart().date() ); 1000 mRecurrenceRange->setEndDate( event->dtStart().date() );
999 else 1001 else
1000 mRecurrenceRange->setEndDate( r->endDate() ); 1002 mRecurrenceRange->setEndDate( r->endDate() );
1001 } else 1003 } else
1002 mRecurrenceRange->setEndDate( event->dtStart().date() ); 1004 mRecurrenceRange->setEndDate( event->dtStart().date() );
1003 } 1005 }
1004 1006
1005 mExceptions->setDates( event->exDates() ); 1007 mExceptions->setDates( event->exDates() );
1006} 1008}
1007 1009
1008void KOEditorRecurrence::writeEvent( Incidence *event ) 1010void KOEditorRecurrence::writeEvent( Incidence *event )
1009{ 1011{
1012
1013
1014 if ( !mEnabledCheck->isChecked() ) {
1015 if ( event->doesRecur() )
1016 event->recurrence()->unsetRecurs();
1017 } else {
1010 Recurrence *r = event->recurrence(); 1018 Recurrence *r = event->recurrence();
1011 1019
1012 // clear out any old settings; 1020 // clear out any old settings;
1013 r->unsetRecurs(); 1021 r->unsetRecurs();
1014
1015 if ( mEnabledCheck->isChecked() ) {
1016 int duration = mRecurrenceRange->duration(); 1022 int duration = mRecurrenceRange->duration();
1017 QDate endDate; 1023 QDate endDate;
1018 if ( duration == 0 ) endDate = mRecurrenceRange->endDate(); 1024 if ( duration == 0 ) endDate = mRecurrenceRange->endDate();
1019 1025
1020 int recurrenceType = mRecurrenceChooser->type(); 1026 int recurrenceType = mRecurrenceChooser->type();
1021 1027
1022 if ( recurrenceType == RecurrenceChooser::Daily ) { 1028 if ( recurrenceType == RecurrenceChooser::Daily ) {
1023 int freq = mDaily->frequency(); 1029 int freq = mDaily->frequency();
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index a690ab1..db695f5 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -342,19 +342,19 @@ void KOEventViewer::appendEvent(Event *event, int mode )
342 mText.append(i18n("<p><b>On:</b> %1</p> ") 342 mText.append(i18n("<p><b>On:</b> %1</p> ")
343 .arg(event->dtStartDateStr( shortDate ))); 343 .arg(event->dtStartDateStr( shortDate )));
344 } 344 }
345 } 345 }
346 if (!event->location().isEmpty()) { 346 if (!event->location().isEmpty()) {
347 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); 347 addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) );
348 mMailSubject += i18n(" at ") + event->location(); 348 mMailSubject += i18n(" at ") + event->location();
349 } 349 }
350 if (event->recurrence()->doesRecur()) { 350 if (event->doesRecur()) {
351 351
352 QString recurText = event->recurrence()->recurrenceText(); 352 QString recurText = event->recurrenceText();
353 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 353 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
354 bool ok; 354 bool ok;
355 QDate start = QDate::currentDate(); 355 QDate start = QDate::currentDate();
356 QDateTime next; 356 QDateTime next;
357 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 357 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
358 if ( ok ) { 358 if ( ok ) {
359 if ( wideScreen ){ 359 if ( wideScreen ){
360 addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) ); 360 addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) );
@@ -476,17 +476,17 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
476 addTag("i",i18n("This todo has been cancelled!")); 476 addTag("i",i18n("This todo has been cancelled!"));
477 mText.append("<br>"); 477 mText.append("<br>");
478 mText += "</font>"; 478 mText += "</font>";
479 mMailSubject += i18n("(cancelled)"); 479 mMailSubject += i18n("(cancelled)");
480 } 480 }
481 481
482 482
483 483
484 if (event->recurrence()->doesRecur()) { 484 if (event->doesRecur()) {
485 485
486 QString recurText = event->recurrence()->recurrenceText(); 486 QString recurText = event->recurrence()->recurrenceText();
487 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); 487 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
488 488
489 } 489 }
490 if (event->hasStartDate()) { 490 if (event->hasStartDate()) {
491 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); 491 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer)));
492 } 492 }
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index d25f671..e7a5e0e 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -128,17 +128,17 @@ bool ListItemVisitor::visit(Event *e)
128 mItem->setText(4,"---"); 128 mItem->setText(4,"---");
129 else 129 else
130 mItem->setText(4,e->dtEndTimeStr()); 130 mItem->setText(4,e->dtEndTimeStr());
131 if ( e->isAlarmEnabled() ) { 131 if ( e->isAlarmEnabled() ) {
132 mItem->setText(5,e->alarms().first()->offsetText() ); 132 mItem->setText(5,e->alarms().first()->offsetText() );
133 } else { 133 } else {
134 mItem->setText(5, i18n("No")); 134 mItem->setText(5, i18n("No"));
135 } 135 }
136 mItem->setText(6, e->recurrence()->recurrenceText()); 136 mItem->setText(6, e->recurrenceText());
137 if( ! e->doesRecur() ) 137 if( ! e->doesRecur() )
138 mItem->setSortKey( 6, "-" ); 138 mItem->setSortKey( 6, "-" );
139 mItem->setText(7,"---"); 139 mItem->setText(7,"---");
140 mItem->setText(8,"---"); 140 mItem->setText(8,"---");
141 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 141 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
142 mItem->setText(10,e->categoriesStr()); 142 mItem->setText(10,e->categoriesStr());
143 mItem->setText(11, KOPrefs::instance()->calName( e->calID() )); 143 mItem->setText(11, KOPrefs::instance()->calName( e->calID() ));
144 mItem->setText(12, KGlobal::locale()->formatDateTime( e->lastModified(), true, true )); 144 mItem->setText(12, KGlobal::locale()->formatDateTime( e->lastModified(), true, true ));
@@ -179,17 +179,17 @@ bool ListItemVisitor::visit(Todo *t)
179 } 179 }
180 mItem->setText(3,"---"); 180 mItem->setText(3,"---");
181 mItem->setText(4,"---"); 181 mItem->setText(4,"---");
182 if ( t->isAlarmEnabled() ) { 182 if ( t->isAlarmEnabled() ) {
183 mItem->setText(5,t->alarms().first()->offsetText() ); 183 mItem->setText(5,t->alarms().first()->offsetText() );
184 } else { 184 } else {
185 mItem->setText(5, i18n("No")); 185 mItem->setText(5, i18n("No"));
186 } 186 }
187 mItem->setText(6, t->recurrence()->recurrenceText()); 187 mItem->setText(6, t->recurrenceText());
188 if( ! t->doesRecur() ) 188 if( ! t->doesRecur() )
189 mItem->setSortKey( 6, "-" ); 189 mItem->setSortKey( 6, "-" );
190 if (t->hasDueDate()) { 190 if (t->hasDueDate()) {
191 mItem->setText(7,t->dtDueDateStr()); 191 mItem->setText(7,t->dtDueDateStr());
192 if (t->doesFloat()) { 192 if (t->doesFloat()) {
193 mItem->setText(8,"---"); 193 mItem->setText(8,"---");
194 } else { 194 } else {
195 mItem->setText(8,t->dtDueTimeStr()); 195 mItem->setText(8,t->dtDueTimeStr());
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 498d9b0..eea9a4d 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -782,17 +782,17 @@ int MonthViewCell::insertEvent(Event *event)
782 } 782 }
783 } 783 }
784 784
785 } else { 785 } else {
786 pal = mStandardPalette ; 786 pal = mStandardPalette ;
787 } 787 }
788 pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); 788 pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor);
789 item->setPalette( pal ); 789 item->setPalette( pal );
790 item->setRecur( event->recurrence()->doesRecur() ); 790 item->setRecur( event->doesRecur() );
791 item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() ); 791 item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() );
792 item->setMoreInfo( event->description().length() > 0 ); 792 item->setMoreInfo( event->description().length() > 0 );
793#ifdef DESKTOP_VERSION 793#ifdef DESKTOP_VERSION
794 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, 794 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails,
795 KOPrefs::instance()->email()); 795 KOPrefs::instance()->email());
796 if ( me != 0 ) { 796 if ( me != 0 ) {
797 if ( me->status() == Attendee::NeedsAction && me->RSVP()) 797 if ( me->status() == Attendee::NeedsAction && me->RSVP())
798 item->setReply(true && multiday < 2); 798 item->setReply(true && multiday < 2);
@@ -873,17 +873,17 @@ void MonthViewCell::insertTodo(Todo *todo)
873 } 873 }
874 } 874 }
875 875
876 } else { 876 } else {
877 pal = mStandardPalette ; 877 pal = mStandardPalette ;
878 } 878 }
879 pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); 879 pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor);
880 item->setPalette( pal ); 880 item->setPalette( pal );
881 item->setRecur( todo->recurrence()->doesRecur() ); 881 item->setRecur( todo->doesRecur() );
882 item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() ); 882 item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() );
883 item->setMoreInfo( todo->description().length() > 0 ); 883 item->setMoreInfo( todo->description().length() > 0 );
884 insertItem( item , count()); 884 insertItem( item , count());
885#ifdef DESKTOP_VERSION 885#ifdef DESKTOP_VERSION
886 mToolTip.append( text ); 886 mToolTip.append( text );
887#endif 887#endif
888} 888}
889void MonthViewCell::repaintfinishUpdateCell() 889void MonthViewCell::repaintfinishUpdateCell()
@@ -1100,16 +1100,18 @@ void MonthViewCell::cellClicked( QListBoxItem *item )
1100 1100
1101void MonthViewCell::contextMenu( QListBoxItem *item ) 1101void MonthViewCell::contextMenu( QListBoxItem *item )
1102{ 1102{
1103 mMonthView->setPopupCell( this ); 1103 mMonthView->setPopupCell( this );
1104 if ( !item ) { 1104 if ( !item ) {
1105 mMonthView->showContextMenu( 0 ); 1105 mMonthView->showContextMenu( 0 );
1106 return; 1106 return;
1107 } 1107 }
1108 //selection( item );
1109 //qApp->processEvents();
1108 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1110 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1109 Incidence *incidence = eventItem->incidence(); 1111 Incidence *incidence = eventItem->incidence();
1110 if ( incidence ) mMonthView->showContextMenu( incidence ); 1112 if ( incidence ) mMonthView->showContextMenu( incidence );
1111} 1113}
1112 1114
1113void MonthViewCell::selection( QListBoxItem *item ) 1115void MonthViewCell::selection( QListBoxItem *item )
1114{ 1116{
1115 if ( !item ) { 1117 if ( !item ) {
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 100a81b..682f83b 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -372,16 +372,17 @@ void KOTodoEditor::writeTodo(Todo *event)
372 addSec = 1; 372 addSec = 1;
373 event->setRecurrenceID( event->dtStart().addSecs( addSec ) ); 373 event->setRecurrenceID( event->dtStart().addSecs( addSec ) );
374 event->setRecurDates(); 374 event->setRecurDates();
375 } else { 375 } else {
376 event->setHasRecurrenceID( false ); 376 event->setHasRecurrenceID( false );
377 } 377 }
378 } else { 378 } else {
379 event->setHasRecurrenceID( false ); 379 event->setHasRecurrenceID( false );
380 if ( event->doesRecur() )
380 event->recurrence()->unsetRecurs(); 381 event->recurrence()->unsetRecurs();
381 } 382 }
382} 383}
383 384
384bool KOTodoEditor::validateInput() 385bool KOTodoEditor::validateInput()
385{ 386{
386 if (!mGeneral->validateInput()) return false; 387 if (!mGeneral->validateInput()) return false;
387 if (!mDetails->validateInput()) return false; 388 if (!mDetails->validateInput()) return false;
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index fafcb58..f88403c 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -502,17 +502,17 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
502 tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; 502 tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": ";
503 else 503 else
504 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 504 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
505 505
506 } else { 506 } else {
507 if (!ev->doesFloat()) { 507 if (!ev->doesFloat()) {
508 Event *event = static_cast<Event *>(ev); 508 Event *event = static_cast<Event *>(ev);
509 QDateTime st,end; 509 QDateTime st,end;
510 if ( event->recurrence()->doesRecur() ) { 510 if ( event->doesRecur() ) {
511 QDate recDate= mEventDate; 511 QDate recDate= mEventDate;
512 int days = event->dtStart().date().daysTo (event->dtEnd().date() ); 512 int days = event->dtStart().date().daysTo (event->dtEnd().date() );
513 while ( ! event->recursOn( recDate ) ) { 513 while ( ! event->recursOn( recDate ) ) {
514 recDate = recDate.addDays( -1 ); 514 recDate = recDate.addDays( -1 );
515 515
516 } 516 }
517 st = QDateTime ( recDate, event->dtStart().time() ); 517 st = QDateTime ( recDate, event->dtStart().time() );
518 end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); 518 end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() );
@@ -617,17 +617,17 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
617 617
618 } 618 }
619 if ( ev->description().length() > 0 ) { 619 if ( ev->description().length() > 0 ) {
620 if ( !needClose) 620 if ( !needClose)
621 tempText +="["; 621 tempText +="[";
622 tempText += "i"; 622 tempText += "i";
623 needClose =true; 623 needClose =true;
624 } 624 }
625 if ( ev->recurrence()->doesRecur() ) { 625 if ( ev->doesRecur() ) {
626 if ( !needClose) 626 if ( !needClose)
627 tempText +="["; 627 tempText +="[";
628 tempText += "r"; 628 tempText += "r";
629 needClose =true; 629 needClose =true;
630 } 630 }
631 if ( needClose ) { 631 if ( needClose ) {
632 tempText += "] "; 632 tempText += "] ";
633 } 633 }
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index ad66639..0766fd9 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -168,16 +168,17 @@ Event::Transparency Event::transparency() const
168 168
169void Event::setDuration(int seconds) 169void Event::setDuration(int seconds)
170{ 170{
171 setHasEndDate(false); 171 setHasEndDate(false);
172 Incidence::setDuration(seconds); 172 Incidence::setDuration(seconds);
173} 173}
174bool Event::matchTime(QDateTime*startDT, QDateTime* endDT) 174bool Event::matchTime(QDateTime*startDT, QDateTime* endDT)
175{ 175{
176 if ( cancelled() ) return false;
176 if ( ! doesRecur() ) { 177 if ( ! doesRecur() ) {
177 if ( doesFloat() ) { 178 if ( doesFloat() ) {
178 if ( mDtEnd.addDays( 1 ) < *startDT) 179 if ( mDtEnd.addDays( 1 ) < *startDT)
179 return false; 180 return false;
180 if ( endDT && mDtStart > * endDT) 181 if ( endDT && mDtStart > * endDT)
181 return false; 182 return false;
182 } else { 183 } else {
183 if ( mDtEnd < *startDT ) 184 if ( mDtEnd < *startDT )
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index 4794bc9..f349681 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -367,29 +367,26 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
367 367
368 // related event 368 // related event
369 if (!incidence->relatedToUid().isEmpty()) { 369 if (!incidence->relatedToUid().isEmpty()) {
370 icalcomponent_add_property(parent,icalproperty_new_relatedto( 370 icalcomponent_add_property(parent,icalproperty_new_relatedto(
371 incidence->relatedToUid().utf8())); 371 incidence->relatedToUid().utf8()));
372 } 372 }
373 373
374 // recurrence rule stuff 374 // recurrence rule stuff
375 Recurrence *recur = incidence->recurrence(); 375 if (incidence->doesRecur()) {
376 if (recur->doesRecur()) { 376 icalcomponent_add_property(parent,writeRecurrenceRule(incidence->recurrence()));
377
378 icalcomponent_add_property(parent,writeRecurrenceRule(recur));
379 }
380
381 // recurrence excpetion dates 377 // recurrence excpetion dates
382 DateList dateList = incidence->exDates(); 378 DateList dateList = incidence->exDates();
383 DateList::ConstIterator exIt; 379 DateList::ConstIterator exIt;
384 for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { 380 for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) {
385 icalcomponent_add_property(parent,icalproperty_new_exdate( 381 icalcomponent_add_property(parent,icalproperty_new_exdate(
386 writeICalDate(*exIt))); 382 writeICalDate(*exIt)));
387 } 383 }
384 }
388 385
389 // attachments 386 // attachments
390 QPtrList<Attachment> attachments = incidence->attachments(); 387 QPtrList<Attachment> attachments = incidence->attachments();
391 for (Attachment *at = attachments.first(); at; at = attachments.next()) 388 for (Attachment *at = attachments.first(); at; at = attachments.next())
392 icalcomponent_add_property(parent,writeAttachment(at)); 389 icalcomponent_add_property(parent,writeAttachment(at));
393 390
394 // alarms 391 // alarms
395 QPtrList<Alarm> alarms = incidence->alarms(); 392 QPtrList<Alarm> alarms = incidence->alarms();
@@ -1290,16 +1287,17 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence)
1290 1287
1291 1288
1292 kp = incidence->nonKDECustomProperty("X-KOPIEXTID"); 1289 kp = incidence->nonKDECustomProperty("X-KOPIEXTID");
1293 if (!kp.isNull()) { 1290 if (!kp.isNull()) {
1294 incidence->setIDStr(kp); 1291 incidence->setIDStr(kp);
1295 } 1292 }
1296 1293
1297 // Cancel backwards compatibility mode for subsequent changes by the application 1294 // Cancel backwards compatibility mode for subsequent changes by the application
1295 if ( readrec )
1298 incidence->recurrence()->setCompatVersion(); 1296 incidence->recurrence()->setCompatVersion();
1299 1297
1300 // add categories 1298 // add categories
1301 incidence->setCategories(categories); 1299 incidence->setCategories(categories);
1302 1300
1303 // iterate through all alarms 1301 // iterate through all alarms
1304 for (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT); 1302 for (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT);
1305 alarm; 1303 alarm;
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index e4bcc5e..4643a3a 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -28,17 +28,17 @@
28#include "todo.h" 28#include "todo.h"
29 29
30using namespace KCal; 30using namespace KCal;
31 31
32Incidence::Incidence() : 32Incidence::Incidence() :
33 IncidenceBase(), 33 IncidenceBase(),
34 mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) 34 mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3)
35{ 35{
36 mRecurrence = new Recurrence(this); 36 mRecurrence = 0;//new Recurrence(this);
37 mCancelled = false; 37 mCancelled = false;
38 recreate(); 38 recreate();
39 mHasStartDate = true; 39 mHasStartDate = true;
40 mAlarms.setAutoDelete(true); 40 mAlarms.setAutoDelete(true);
41 mAttachments.setAutoDelete(true); 41 mAttachments.setAutoDelete(true);
42 mHasRecurrenceID = false; 42 mHasRecurrenceID = false;
43 mHoliday = false; 43 mHoliday = false;
44 mBirthday = false; 44 mBirthday = false;
@@ -73,31 +73,35 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
73 b->setParent( this ); 73 b->setParent( this );
74 mAlarms.append( b ); 74 mAlarms.append( b );
75 75
76 ++it; 76 ++it;
77 } 77 }
78 mAlarms.setAutoDelete(true); 78 mAlarms.setAutoDelete(true);
79 mHasRecurrenceID = i.mHasRecurrenceID; 79 mHasRecurrenceID = i.mHasRecurrenceID;
80 mRecurrenceID = i.mRecurrenceID; 80 mRecurrenceID = i.mRecurrenceID;
81 if ( i.mRecurrence )
81 mRecurrence = new Recurrence( *(i.mRecurrence), this ); 82 mRecurrence = new Recurrence( *(i.mRecurrence), this );
83 else
84 mRecurrence = 0;
82 mHoliday = i.mHoliday ; 85 mHoliday = i.mHoliday ;
83 mBirthday = i.mBirthday; 86 mBirthday = i.mBirthday;
84 mAnniversary = i.mAnniversary; 87 mAnniversary = i.mAnniversary;
85} 88}
86 89
87Incidence::~Incidence() 90Incidence::~Incidence()
88{ 91{
89 92
90 Incidence *ev; 93 Incidence *ev;
91 QPtrList<Incidence> Relations = relations(); 94 QPtrList<Incidence> Relations = relations();
92 for (ev=Relations.first();ev;ev=Relations.next()) { 95 for (ev=Relations.first();ev;ev=Relations.next()) {
93 if (ev->relatedTo() == this) ev->setRelatedTo(0); 96 if (ev->relatedTo() == this) ev->setRelatedTo(0);
94 } 97 }
95 if (relatedTo()) relatedTo()->removeRelation(this); 98 if (relatedTo()) relatedTo()->removeRelation(this);
99 if ( mRecurrence )
96 delete mRecurrence; 100 delete mRecurrence;
97 101
98} 102}
99 103
100bool Incidence::isHoliday() const 104bool Incidence::isHoliday() const
101{ 105{
102 return mHoliday; 106 return mHoliday;
103} 107}
@@ -203,20 +207,34 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
203 if ( i1.hasStartDate() == i2.hasStartDate() ) { 207 if ( i1.hasStartDate() == i2.hasStartDate() ) {
204 if ( i1.hasStartDate() ) { 208 if ( i1.hasStartDate() ) {
205 if ( i1.dtStart() != i2.dtStart() ) 209 if ( i1.dtStart() != i2.dtStart() )
206 return false; 210 return false;
207 } 211 }
208 } else { 212 } else {
209 return false; 213 return false;
210 } 214 }
211 if (!( *i1.recurrence() == *i2.recurrence()) ) { 215 if ( i1.mRecurrence != 0 && i2.mRecurrence != 0 ) {
212 qDebug("recurrence is NOT equal "); 216 if (!( *i1.mRecurrence == *i2.mRecurrence) ) {
217 //qDebug("recurrence is NOT equal ");
218 return false;
219 }
220 } else {
221 // one ( or both ) recurrence is 0
222 if ( i1.mRecurrence == 0 ) {
223 if ( i2.mRecurrence != 0 && i2.mRecurrence->doesRecur() != Recurrence::rNone )
224 return false;
225 } else {
226 // i1.mRecurrence != 0
227 // i2.mRecurrence == 0
228 if ( i1.mRecurrence->doesRecur() != Recurrence::rNone )
213 return false; 229 return false;
214 } 230 }
231 }
232
215 return 233 return
216 // i1.created() == i2.created() && 234 // i1.created() == i2.created() &&
217 stringCompare( i1.description(), i2.description() ) && 235 stringCompare( i1.description(), i2.description() ) &&
218 stringCompare( i1.summary(), i2.summary() ) && 236 stringCompare( i1.summary(), i2.summary() ) &&
219 i1.categories() == i2.categories() && 237 i1.categories() == i2.categories() &&
220 // no need to compare mRelatedTo 238 // no need to compare mRelatedTo
221 stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && 239 stringCompare( i1.relatedToUid(), i2.relatedToUid() ) &&
222 // i1.relations() == i2.relations() && 240 // i1.relations() == i2.relations() &&
@@ -274,17 +292,18 @@ void Incidence::cloneRelations( Incidence * newInc )
274 cloneInc->recreate(); 292 cloneInc->recreate();
275 cloneInc->setRelatedTo( newInc ); 293 cloneInc->setRelatedTo( newInc );
276 inc->cloneRelations( cloneInc ); 294 inc->cloneRelations( cloneInc );
277 } 295 }
278} 296}
279void Incidence::setReadOnly( bool readOnly ) 297void Incidence::setReadOnly( bool readOnly )
280{ 298{
281 IncidenceBase::setReadOnly( readOnly ); 299 IncidenceBase::setReadOnly( readOnly );
282 recurrence()->setRecurReadOnly( readOnly); 300 if ( mRecurrence )
301 mRecurrence->setRecurReadOnly( readOnly);
283} 302}
284void Incidence::setLastModifiedSubInvalid() 303void Incidence::setLastModifiedSubInvalid()
285{ 304{
286 mLastModifiedSub = QDateTime(); 305 mLastModifiedSub = QDateTime();
287 if ( mRelatedTo ) 306 if ( mRelatedTo )
288 mRelatedTo->setLastModifiedSubInvalid(); 307 mRelatedTo->setLastModifiedSubInvalid();
289} 308}
290QDateTime Incidence::lastModifiedSub() 309QDateTime Incidence::lastModifiedSub()
@@ -325,17 +344,19 @@ int Incidence::revision() const
325{ 344{
326 return mRevision; 345 return mRevision;
327} 346}
328 347
329void Incidence::setDtStart(const QDateTime &dtStart) 348void Incidence::setDtStart(const QDateTime &dtStart)
330{ 349{
331 350
332 QDateTime dt = getEvenTime(dtStart); 351 QDateTime dt = getEvenTime(dtStart);
333 recurrence()->setRecurStart( dt); 352
353 if ( mRecurrence )
354 mRecurrence->setRecurStart( dt);
334 IncidenceBase::setDtStart( dt ); 355 IncidenceBase::setDtStart( dt );
335} 356}
336 357
337void Incidence::setDescription(const QString &description) 358void Incidence::setDescription(const QString &description)
338{ 359{
339 if (mReadOnly) return; 360 if (mReadOnly) return;
340 mDescription = description; 361 mDescription = description;
341 updated(); 362 updated();
@@ -499,25 +520,24 @@ void Incidence::removeRelation(Incidence *event)
499{ 520{
500 setLastModifiedSubInvalid(); 521 setLastModifiedSubInvalid();
501 mRelations.removeRef(event); 522 mRelations.removeRef(event);
502// if (event->getRelatedTo() == this) event->setRelatedTo(0); 523// if (event->getRelatedTo() == this) event->setRelatedTo(0);
503} 524}
504 525
505bool Incidence::recursOn(const QDate &qd) const 526bool Incidence::recursOn(const QDate &qd) const
506{ 527{
507 if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; 528 if (mRecurrence && mRecurrence->recursOnPure(qd) && !isException(qd)) return true;
508 else return false; 529 else return false;
509} 530}
510 531
511void Incidence::setExDates(const DateList &exDates) 532void Incidence::setExDates(const DateList &exDates)
512{ 533{
513 if (mReadOnly) return; 534 if (mReadOnly) return;
514 mExDates = exDates; 535 mExDates = exDates;
515
516 recurrence()->setRecurExDatesCount(mExDates.count()); 536 recurrence()->setRecurExDatesCount(mExDates.count());
517 537
518 updated(); 538 updated();
519} 539}
520 540
521void Incidence::addExDate(const QDate &date) 541void Incidence::addExDate(const QDate &date)
522{ 542{
523 if (mReadOnly) return; 543 if (mReadOnly) return;
@@ -693,57 +713,68 @@ bool Incidence::isAlarmEnabled() const
693{ 713{
694 Alarm* alarm; 714 Alarm* alarm;
695 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { 715 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
696 if (alarm->enabled()) 716 if (alarm->enabled())
697 return true; 717 return true;
698 } 718 }
699 return false; 719 return false;
700} 720}
701 721#include <stdlib.h>
702Recurrence *Incidence::recurrence() const 722Recurrence *Incidence::recurrence()
703{ 723{
724 if ( ! mRecurrence ) {
725 mRecurrence = new Recurrence(this);
726 qDebug("creating new recurence ");
727 //abort();
728 }
704 return mRecurrence; 729 return mRecurrence;
705} 730}
706void Incidence::setRecurrence( Recurrence * r) 731void Incidence::setRecurrence( Recurrence * r)
707{ 732{
733 if ( mRecurrence )
708 delete mRecurrence; 734 delete mRecurrence;
709 mRecurrence = r; 735 mRecurrence = r;
710} 736}
711 737
712void Incidence::setLocation(const QString &location) 738void Incidence::setLocation(const QString &location)
713{ 739{
714 if (mReadOnly) return; 740 if (mReadOnly) return;
715 mLocation = location; 741 mLocation = location;
716 updated(); 742 updated();
717} 743}
718 744
719QString Incidence::location() const 745QString Incidence::location() const
720{ 746{
721 return mLocation; 747 return mLocation;
722} 748}
749QString Incidence::recurrenceText() const
750{
751 if ( mRecurrence ) return mRecurrence->recurrenceText();
752 return i18n("No");
753}
723 754
724ushort Incidence::doesRecur() const 755ushort Incidence::doesRecur() const
725{ 756{
726 if ( mRecurrence ) return mRecurrence->doesRecur(); 757 if ( mRecurrence ) return mRecurrence->doesRecur();
727 else return Recurrence::rNone; 758 else return Recurrence::rNone;
728} 759}
729 760
730QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const 761QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const
731{ 762{
732 QDateTime incidenceStart = dt; 763 QDateTime incidenceStart = dt;
733 *ok = false; 764 *ok = false;
734 if ( doesRecur() ) { 765 if ( doesRecur() ) {
735 bool last; 766 bool last;
736 recurrence()->getPreviousDateTime( incidenceStart , &last ); 767 mRecurrence->getPreviousDateTime( incidenceStart , &last );
737 int count = 0; 768 int count = 0;
738 if ( !last ) { 769 if ( !last ) {
739 while ( !last ) { 770 while ( !last ) {
740 ++count; 771 ++count;
741 incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last ); 772 incidenceStart = mRecurrence->getNextDateTime( incidenceStart, &last );
742 if ( recursOn( incidenceStart.date() ) ) { 773 if ( recursOn( incidenceStart.date() ) ) {
743 last = true; // exit while llop 774 last = true; // exit while llop
744 } else { 775 } else {
745 if ( last ) { // no alarm on last recurrence 776 if ( last ) { // no alarm on last recurrence
746 return QDateTime (); 777 return QDateTime ();
747 } 778 }
748 int year = incidenceStart.date().year(); 779 int year = incidenceStart.date().year();
749 // workaround for bug in recurrence 780 // workaround for bug in recurrence
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index d4af9f0..8519f01 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -244,17 +244,17 @@ class Incidence : public IncidenceBase
244 void clearAlarms(); 244 void clearAlarms();
245 /** return whether any alarm associated with this incidence is enabled */ 245 /** return whether any alarm associated with this incidence is enabled */
246 bool isAlarmEnabled() const; 246 bool isAlarmEnabled() const;
247 247
248 /** 248 /**
249 Return the recurrence rule associated with this incidence. If there is 249 Return the recurrence rule associated with this incidence. If there is
250 none, returns an appropriate (non-0) object. 250 none, returns an appropriate (non-0) object.
251 */ 251 */
252 Recurrence *recurrence() const; 252 Recurrence *recurrence();
253 void setRecurrence(Recurrence * r); 253 void setRecurrence(Recurrence * r);
254 /** 254 /**
255 Forward to Recurrence::doesRecur(). 255 Forward to Recurrence::doesRecur().
256 */ 256 */
257 ushort doesRecur() const; 257 ushort doesRecur() const;
258 258
259 /** set the event's/todo's location. Do _not_ use it with journal */ 259 /** set the event's/todo's location. Do _not_ use it with journal */
260 void setLocation(const QString &location); 260 void setLocation(const QString &location);
@@ -273,19 +273,21 @@ class Incidence : public IncidenceBase
273 273
274 void setRecurrenceID(QDateTime); 274 void setRecurrenceID(QDateTime);
275 QDateTime recurrenceID () const; 275 QDateTime recurrenceID () const;
276 QDateTime dtStart() const; 276 QDateTime dtStart() const;
277 bool isHoliday() const; 277 bool isHoliday() const;
278 bool isBirthday() const; 278 bool isBirthday() const;
279 bool isAnniversary() const; 279 bool isAnniversary() const;
280 QDateTime lastModifiedSub(); 280 QDateTime lastModifiedSub();
281 QString recurrenceText() const;
281 void setLastModifiedSubInvalid(); 282 void setLastModifiedSubInvalid();
282 283
283 284
285 Recurrence *mRecurrence;
284protected: 286protected:
285 QPtrList<Alarm> mAlarms; 287 QPtrList<Alarm> mAlarms;
286 QPtrList<Incidence> mRelations; 288 QPtrList<Incidence> mRelations;
287 QDateTime mRecurrenceID; 289 QDateTime mRecurrenceID;
288 bool mHasRecurrenceID; 290 bool mHasRecurrenceID;
289 private: 291 private:
290 void checkCategories(); 292 void checkCategories();
291 bool mHoliday, mBirthday, mAnniversary; 293 bool mHoliday, mBirthday, mAnniversary;
@@ -304,17 +306,16 @@ protected:
304 QPtrList<Attachment> mAttachments; 306 QPtrList<Attachment> mAttachments;
305 QStringList mResources; 307 QStringList mResources;
306 bool mHasStartDate; // if todo has associated start date 308 bool mHasStartDate; // if todo has associated start date
307 309
308 int mSecrecy; 310 int mSecrecy;
309 int mPriority; // 1 = highest, 2 = less, etc. 311 int mPriority; // 1 = highest, 2 = less, etc.
310 312
311 //QPtrList<Alarm> mAlarms; 313 //QPtrList<Alarm> mAlarms;
312 Recurrence *mRecurrence;
313 314
314 QString mLocation; 315 QString mLocation;
315}; 316};
316 317
317bool operator==( const Incidence&, const Incidence& ); 318bool operator==( const Incidence&, const Incidence& );
318 319
319} 320}
320 321
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 9359fad..f8f40f1 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -100,17 +100,17 @@ void KIncidenceFormatter::setEvent(Event *event)
100 .arg(event->dtStartDateStr( shortDate ))); 100 .arg(event->dtStartDateStr( shortDate )));
101 } 101 }
102 } 102 }
103 if (!event->location().isEmpty()) { 103 if (!event->location().isEmpty()) {
104 addTag("b",i18n("Location: ")); 104 addTag("b",i18n("Location: "));
105 mText.append(deTag(event->location())+"<br>"); 105 mText.append(deTag(event->location())+"<br>");
106 } 106 }
107 107
108 if (event->recurrence()->doesRecur()) { 108 if (event->doesRecur()) {
109 109
110 QString recurText = event->recurrence()->recurrenceText(); 110 QString recurText = event->recurrence()->recurrenceText();
111 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 111 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
112 112
113 bool ok; 113 bool ok;
114 QDate start = QDate::currentDate(); 114 QDate start = QDate::currentDate();
115 QDateTime next; 115 QDateTime next;
116 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 116 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
@@ -211,17 +211,17 @@ void KIncidenceFormatter::setTodo(Todo *event )
211 if (event->cancelled ()) { 211 if (event->cancelled ()) {
212 mText +="<font color=\"#B00000\">"; 212 mText +="<font color=\"#B00000\">";
213 addTag("i",i18n("This todo has been cancelled!")); 213 addTag("i",i18n("This todo has been cancelled!"));
214 mText.append("<br>"); 214 mText.append("<br>");
215 mText += "</font>"; 215 mText += "</font>";
216 } 216 }
217 217
218 218
219 if (event->recurrence()->doesRecur()) { 219 if (event->doesRecur()) {
220 220
221 QString recurText = event->recurrence()->recurrenceText(); 221 QString recurText = event->recurrence()->recurrenceText();
222 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); 222 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
223 } 223 }
224 224
225 if (event->hasStartDate()) { 225 if (event->hasStartDate()) {
226 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate))); 226 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate)));
227 } 227 }
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp
index 8efc1ea..2e19740 100644
--- a/libkcal/vcalformat.cpp
+++ b/libkcal/vcalformat.cpp
@@ -387,17 +387,17 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
387 addPropValue(vtodo, XPilotIdProp, tmpStr.local8Bit()); 387 addPropValue(vtodo, XPilotIdProp, tmpStr.local8Bit());
388 tmpStr.sprintf("%i",anEvent->syncStatus()); 388 tmpStr.sprintf("%i",anEvent->syncStatus());
389 addPropValue(vtodo, XPilotStatusProp, tmpStr.local8Bit()); 389 addPropValue(vtodo, XPilotStatusProp, tmpStr.local8Bit());
390 } 390 }
391 391
392 return vtodo; 392 return vtodo;
393} 393}
394 394
395VObject* VCalFormat::eventToVEvent(const Event *anEvent) 395VObject* VCalFormat::eventToVEvent(Event *anEvent)
396{ 396{
397 VObject *vevent; 397 VObject *vevent;
398 QString tmpStr; 398 QString tmpStr;
399 399
400 vevent = newVObject(VCEventProp); 400 vevent = newVObject(VCEventProp);
401 401
402 // start and end time 402 // start and end time
403 tmpStr = qDateTimeToISO(anEvent->dtStart(), 403 tmpStr = qDateTimeToISO(anEvent->dtStart(),
@@ -454,17 +454,17 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent)
454 VObject *aProp = addPropValue(vevent, VCAttendeeProp, tmpStr.local8Bit()); 454 VObject *aProp = addPropValue(vevent, VCAttendeeProp, tmpStr.local8Bit());
455 addPropValue(aProp, VCRoleProp, writeRole(curAttendee->role())); 455 addPropValue(aProp, VCRoleProp, writeRole(curAttendee->role()));
456 addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE"); 456 addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE");
457 addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status())); 457 addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status()));
458 } 458 }
459 } 459 }
460 460
461 // recurrence rule stuff 461 // recurrence rule stuff
462 if (anEvent->recurrence()->doesRecur()) { 462 if (anEvent->doesRecur()) {
463 // some more variables 463 // some more variables
464 QPtrList<Recurrence::rMonthPos> tmpPositions; 464 QPtrList<Recurrence::rMonthPos> tmpPositions;
465 QPtrList<int> tmpDays; 465 QPtrList<int> tmpDays;
466 int *tmpDay; 466 int *tmpDay;
467 Recurrence::rMonthPos *tmpPos; 467 Recurrence::rMonthPos *tmpPos;
468 QString tmpStr2; 468 QString tmpStr2;
469 int i; 469 int i;
470 470
diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h
index c7df017..6dae3d2 100644
--- a/libkcal/vcalformat.h
+++ b/libkcal/vcalformat.h
@@ -69,17 +69,17 @@ class VCalFormat : public CalFormat {
69 protected: 69 protected:
70 /** translates a VObject of the TODO type into a Event */ 70 /** translates a VObject of the TODO type into a Event */
71 Todo *VTodoToEvent(VObject *vtodo); 71 Todo *VTodoToEvent(VObject *vtodo);
72 /** translates a VObject into a Event and returns a pointer to it. */ 72 /** translates a VObject into a Event and returns a pointer to it. */
73 Event *VEventToEvent(VObject *vevent); 73 Event *VEventToEvent(VObject *vevent);
74 /** translate a Event into a VTodo-type VObject and return pointer */ 74 /** translate a Event into a VTodo-type VObject and return pointer */
75 VObject *eventToVTodo(const Todo *anEvent); 75 VObject *eventToVTodo(const Todo *anEvent);
76 /** translate a Event into a VObject and returns a pointer to it. */ 76 /** translate a Event into a VObject and returns a pointer to it. */
77 VObject* eventToVEvent(const Event *anEvent); 77 VObject* eventToVEvent(Event *anEvent);
78 78
79 /** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */ 79 /** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */
80 QString qDateToISO(const QDate &); 80 QString qDateToISO(const QDate &);
81 /** takes a QDateTime and returns a string in format YYYYMMDDTHHMMSS */ 81 /** takes a QDateTime and returns a string in format YYYYMMDDTHHMMSS */
82 QString qDateTimeToISO(const QDateTime &, bool zulu=TRUE); 82 QString qDateTimeToISO(const QDateTime &, bool zulu=TRUE);
83 /** takes a string in the format YYYYMMDDTHHMMSS and returns a 83 /** takes a string in the format YYYYMMDDTHHMMSS and returns a
84 * valid QDateTime. */ 84 * valid QDateTime. */
85 QDateTime ISOToQDateTime(const QString & dtStr); 85 QDateTime ISOToQDateTime(const QString & dtStr);