summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-27 22:26:08 (UTC)
committer zautrix <zautrix>2005-07-27 22:26:08 (UTC)
commit0e38cffd7ba745f237c659e1c48080fcb25b126c (patch) (side-by-side diff)
tree6069600e18bae5300c6ce427735457dbfed93141
parent136f9082862e7a56abb3a201e96f5e7386c4f1b9 (diff)
downloadkdepimpi-0e38cffd7ba745f237c659e1c48080fcb25b126c.zip
kdepimpi-0e38cffd7ba745f237c659e1c48080fcb25b126c.tar.gz
kdepimpi-0e38cffd7ba745f237c659e1c48080fcb25b126c.tar.bz2
rec changes
Diffstat (more/less context) (ignore 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.cpp172
-rw-r--r--korganizer/koeventviewer.cpp6
-rw-r--r--korganizer/kolistview.cpp4
-rw-r--r--korganizer/komonthview.cpp6
-rw-r--r--korganizer/kotodoeditor.cpp3
-rw-r--r--korganizer/kowhatsnextview.cpp4
-rw-r--r--libkcal/event.cpp1
-rw-r--r--libkcal/icalformatimpl.cpp24
-rw-r--r--libkcal/incidence.cpp63
-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, 175 insertions, 135 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index a76f2ed..a9d42f0 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3759,7 +3759,7 @@ void CalendarView::deleteEvent(Event *anEvent)
return;
}
- if (anEvent->recurrence()->doesRecur()) {
+ if (anEvent->doesRecur()) {
QDate itemDate = mViewManager->currentSelectionDate();
int km;
if (!itemDate.isValid()) {
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 0dd5ef5..c738f7e 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -579,7 +579,7 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
slotClearSelection();
selectItem(mActionItem);
Incidence *incidence = mActionItem->incidence();
- if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) {
+ if ( incidence->isReadOnly() /*|| incidence->doesRecur() */) {
mActionItem = 0;
} else {
startItemAction(viewportPos);
@@ -999,7 +999,7 @@ void KOAgenda::endItemAction()
if ( !placeItem ) {
placeItem = mActionItem;
}
- if ( placeItem->incidence()->recurrence()->doesRecur() ) {
+ if ( placeItem->incidence()->doesRecur() ) {
Incidence* oldInc = placeItem->incidence();
placeItem->recreateIncidence();
emit addToCalSignal(placeItem->incidence(), oldInc );
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 303a92a..49ad9b8 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -234,7 +234,7 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
else
++yOff;
}
- if (mIncidence->recurrence()->doesRecur()) {
+ if (mIncidence->doesRecur()) {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue );
if ( horLayout )
++xOff;
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index a01323a..04f30bb 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1201,7 +1201,7 @@ void KOAgendaView::fillAgenda()
// kdDebug() << " beginX: " << beginX << " endX: " << endX << endl;
if (event->doesFloat()) {
- if (event->recurrence()->doesRecur()) {
+ if (event->doesRecur()) {
if (event->isMultiDay() ) {
endX = endX - beginX;// endX is now number of days
if ( event->recursOn( currentDate ) ) {
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index ec1154a..057df0d 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -453,7 +453,7 @@ void KODayMatrix::updateViewTimed()
QDate mStartDate = days[0];
QDate endDate = mStartDate.addDays( timeSpan );
for( event = events.first(); event; event = events.next() ) { // for event
- ushort recurType = event->recurrence()->doesRecur();
+ ushort recurType = event->doesRecur();
if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
(recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
continue;
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index de4e4f7..89504db 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -897,100 +897,102 @@ void KOEditorRecurrence::readEvent(Incidence *event)
int month = 0;
setDateTimes( event->dtStart(), dtEnd );
- Recurrence *r = event->recurrence();
- int f = r->frequency();
+
- int recurs = r->doesRecur();
+ int recurs = event->doesRecur();
mEnabledCheck->setChecked( recurs );
setEnabled( recurs );
int recurrenceType = RecurrenceChooser::Weekly;
-
- switch ( recurs ) {
- case Recurrence::rNone:
- setDefaults( event->dtStart(), dtEnd );
- break;
- case Recurrence::rDaily:
- recurrenceType = RecurrenceChooser::Daily;
- mDaily->setFrequency( f );
- break;
- case Recurrence::rWeekly:
- recurrenceType = RecurrenceChooser::Weekly;
- mWeekly->setFrequency( f );
- mWeekly->setDays( r->days() );
- break;
- case Recurrence::rMonthlyPos:
- // we only handle one possibility in the list right now,
- // so I have hardcoded calls with first(). If we make the GUI
- // more extended, this can be changed.
- recurrenceType = RecurrenceChooser::Monthly;
-
- rmp = r->monthPositions();
- if ( rmp.first()->negative )
- count = 5 - rmp.first()->rPos - 1;
- else
- count = rmp.first()->rPos - 1;
- day = 0;
- while ( !rmp.first()->rDays.testBit( day ) ) ++day;
- mMonthly->setByPos( count, day );
-
- mMonthly->setFrequency( f );
-
- break;
- case Recurrence::rMonthlyDay:
- recurrenceType = RecurrenceChooser::Monthly;
-
- rmd = r->monthDays();
- day = *rmd.first() - 1;
- mMonthly->setByDay( day );
-
- mMonthly->setFrequency( f );
-
- break;
- case Recurrence::rYearlyMonth:
- {
- recurrenceType = RecurrenceChooser::Yearly;
- //qDebug("Recurrence::rYearlyMonth: ");
- day = event->dtStart().date().day();
- rmd = r->yearNums();
- if ( rmd.count() > 0 )
- month = *rmd.first();
- else
- month = event->dtStart().date().month() ;
- mYearly->setByMonth( month, day );
+ if ( recurs ) {
+ Recurrence *r = event->recurrence();
+ int f = r->frequency();
+ switch ( recurs ) {
+ case Recurrence::rNone:
+ setDefaults( event->dtStart(), dtEnd );
+ break;
+ case Recurrence::rDaily:
+ recurrenceType = RecurrenceChooser::Daily;
+ mDaily->setFrequency( f );
+ break;
+ case Recurrence::rWeekly:
+ recurrenceType = RecurrenceChooser::Weekly;
+ mWeekly->setFrequency( f );
+ mWeekly->setDays( r->days() );
+ break;
+ case Recurrence::rMonthlyPos:
+ // we only handle one possibility in the list right now,
+ // so I have hardcoded calls with first(). If we make the GUI
+ // more extended, this can be changed.
+ recurrenceType = RecurrenceChooser::Monthly;
+
+ rmp = r->monthPositions();
+ if ( rmp.first()->negative )
+ count = 5 - rmp.first()->rPos - 1;
+ else
+ count = rmp.first()->rPos - 1;
+ day = 0;
+ while ( !rmp.first()->rDays.testBit( day ) ) ++day;
+ mMonthly->setByPos( count, day );
+
+ mMonthly->setFrequency( f );
+
+ break;
+ case Recurrence::rMonthlyDay:
+ recurrenceType = RecurrenceChooser::Monthly;
+
+ rmd = r->monthDays();
+ day = *rmd.first() - 1;
+ mMonthly->setByDay( day );
+
+ mMonthly->setFrequency( f );
+
+ break;
+ case Recurrence::rYearlyMonth:
+ {
+ recurrenceType = RecurrenceChooser::Yearly;
+ //qDebug("Recurrence::rYearlyMonth: ");
+ day = event->dtStart().date().day();
+ rmd = r->yearNums();
+ if ( rmd.count() > 0 )
+ month = *rmd.first();
+ else
+ month = event->dtStart().date().month() ;
+ mYearly->setByMonth( month, day );
#if 0
- //qDebug("2day = %d ",day );
- QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions();
- int month;
- if ( !monthlist.isEmpty() ) {
- month = monthlist.first()->rPos ;
- } else {
- month = event->dtStart().date().month() ;
- }
- mYearly->setByMonth( day, month );
+ //qDebug("2day = %d ",day );
+ QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions();
+ int month;
+ if ( !monthlist.isEmpty() ) {
+ month = monthlist.first()->rPos ;
+ } else {
+ month = event->dtStart().date().month() ;
+ }
+ mYearly->setByMonth( day, month );
#endif
- mYearly->setFrequency( f );
- }
+ mYearly->setFrequency( f );
+ }
- break;
- case Recurrence::rYearlyDay:
- //qDebug("Recurrence::rYearlyDay: ");
- recurrenceType = RecurrenceChooser::Yearly;
- mYearly->setByDay( event->dtStart().date().dayOfYear() );
- mYearly->setFrequency( f );
- break;
- default:
- setDefaults( event->dtStart(), dtEnd );
- break;
+ break;
+ case Recurrence::rYearlyDay:
+ //qDebug("Recurrence::rYearlyDay: ");
+ recurrenceType = RecurrenceChooser::Yearly;
+ mYearly->setByDay( event->dtStart().date().dayOfYear() );
+ mYearly->setFrequency( f );
+ break;
+ default:
+ setDefaults( event->dtStart(), dtEnd );
+ break;
+ }
}
-
mRecurrenceChooser->setType( recurrenceType );
showCurrentRule( recurrenceType );
mRecurrenceRange->setDateTimes( event->dtStart() );
- if ( r->doesRecur() ) {
+ if ( event->doesRecur() ) {
+ Recurrence *r = event->recurrence();
mRecurrenceRange->setDuration( r->duration() );
if ( r->duration() == 0 )
{
@@ -1007,12 +1009,16 @@ void KOEditorRecurrence::readEvent(Incidence *event)
void KOEditorRecurrence::writeEvent( Incidence *event )
{
- Recurrence *r = event->recurrence();
+
- // clear out any old settings;
- r->unsetRecurs();
+ if ( !mEnabledCheck->isChecked() ) {
+ if ( event->doesRecur() )
+ event->recurrence()->unsetRecurs();
+ } else {
+ Recurrence *r = event->recurrence();
- if ( mEnabledCheck->isChecked() ) {
+ // clear out any old settings;
+ r->unsetRecurs();
int duration = mRecurrenceRange->duration();
QDate endDate;
if ( duration == 0 ) endDate = mRecurrenceRange->endDate();
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index a690ab1..db695f5 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -347,9 +347,9 @@ void KOEventViewer::appendEvent(Event *event, int mode )
addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) );
mMailSubject += i18n(" at ") + event->location();
}
- if (event->recurrence()->doesRecur()) {
+ if (event->doesRecur()) {
- QString recurText = event->recurrence()->recurrenceText();
+ QString recurText = event->recurrenceText();
addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
bool ok;
QDate start = QDate::currentDate();
@@ -481,7 +481,7 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
- if (event->recurrence()->doesRecur()) {
+ if (event->doesRecur()) {
QString recurText = event->recurrence()->recurrenceText();
addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index d25f671..e7a5e0e 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -133,7 +133,7 @@ bool ListItemVisitor::visit(Event *e)
} else {
mItem->setText(5, i18n("No"));
}
- mItem->setText(6, e->recurrence()->recurrenceText());
+ mItem->setText(6, e->recurrenceText());
if( ! e->doesRecur() )
mItem->setSortKey( 6, "-" );
mItem->setText(7,"---");
@@ -184,7 +184,7 @@ bool ListItemVisitor::visit(Todo *t)
} else {
mItem->setText(5, i18n("No"));
}
- mItem->setText(6, t->recurrence()->recurrenceText());
+ mItem->setText(6, t->recurrenceText());
if( ! t->doesRecur() )
mItem->setSortKey( 6, "-" );
if (t->hasDueDate()) {
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 498d9b0..eea9a4d 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -787,7 +787,7 @@ int MonthViewCell::insertEvent(Event *event)
}
pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor);
item->setPalette( pal );
- item->setRecur( event->recurrence()->doesRecur() );
+ item->setRecur( event->doesRecur() );
item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() );
item->setMoreInfo( event->description().length() > 0 );
#ifdef DESKTOP_VERSION
@@ -878,7 +878,7 @@ void MonthViewCell::insertTodo(Todo *todo)
}
pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor);
item->setPalette( pal );
- item->setRecur( todo->recurrence()->doesRecur() );
+ item->setRecur( todo->doesRecur() );
item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() );
item->setMoreInfo( todo->description().length() > 0 );
insertItem( item , count());
@@ -1105,6 +1105,8 @@ void MonthViewCell::contextMenu( QListBoxItem *item )
mMonthView->showContextMenu( 0 );
return;
}
+ //selection( item );
+ //qApp->processEvents();
MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
Incidence *incidence = eventItem->incidence();
if ( incidence ) mMonthView->showContextMenu( incidence );
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 100a81b..682f83b 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -377,7 +377,8 @@ void KOTodoEditor::writeTodo(Todo *event)
}
} else {
event->setHasRecurrenceID( false );
- event->recurrence()->unsetRecurs();
+ if ( event->doesRecur() )
+ event->recurrence()->unsetRecurs();
}
}
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index fafcb58..f88403c 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -507,7 +507,7 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
if (!ev->doesFloat()) {
Event *event = static_cast<Event *>(ev);
QDateTime st,end;
- if ( event->recurrence()->doesRecur() ) {
+ if ( event->doesRecur() ) {
QDate recDate= mEventDate;
int days = event->dtStart().date().daysTo (event->dtEnd().date() );
while ( ! event->recursOn( recDate ) ) {
@@ -622,7 +622,7 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
tempText += "i";
needClose =true;
}
- if ( ev->recurrence()->doesRecur() ) {
+ if ( ev->doesRecur() ) {
if ( !needClose)
tempText +="[";
tempText += "r";
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index ad66639..0766fd9 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -173,6 +173,7 @@ void Event::setDuration(int seconds)
}
bool Event::matchTime(QDateTime*startDT, QDateTime* endDT)
{
+ if ( cancelled() ) return false;
if ( ! doesRecur() ) {
if ( doesFloat() ) {
if ( mDtEnd.addDays( 1 ) < *startDT)
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index 4794bc9..f349681 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -372,18 +372,15 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
}
// recurrence rule stuff
- Recurrence *recur = incidence->recurrence();
- if (recur->doesRecur()) {
-
- icalcomponent_add_property(parent,writeRecurrenceRule(recur));
- }
-
- // recurrence excpetion dates
- DateList dateList = incidence->exDates();
- DateList::ConstIterator exIt;
- for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) {
- icalcomponent_add_property(parent,icalproperty_new_exdate(
- writeICalDate(*exIt)));
+ if (incidence->doesRecur()) {
+ icalcomponent_add_property(parent,writeRecurrenceRule(incidence->recurrence()));
+ // recurrence excpetion dates
+ DateList dateList = incidence->exDates();
+ DateList::ConstIterator exIt;
+ for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) {
+ icalcomponent_add_property(parent,icalproperty_new_exdate(
+ writeICalDate(*exIt)));
+ }
}
// attachments
@@ -1295,7 +1292,8 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence)
}
// Cancel backwards compatibility mode for subsequent changes by the application
- incidence->recurrence()->setCompatVersion();
+ if ( readrec )
+ incidence->recurrence()->setCompatVersion();
// add categories
incidence->setCategories(categories);
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index e4bcc5e..4643a3a 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -33,7 +33,7 @@ Incidence::Incidence() :
IncidenceBase(),
mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3)
{
- mRecurrence = new Recurrence(this);
+ mRecurrence = 0;//new Recurrence(this);
mCancelled = false;
recreate();
mHasStartDate = true;
@@ -78,7 +78,10 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
mAlarms.setAutoDelete(true);
mHasRecurrenceID = i.mHasRecurrenceID;
mRecurrenceID = i.mRecurrenceID;
- mRecurrence = new Recurrence( *(i.mRecurrence), this );
+ if ( i.mRecurrence )
+ mRecurrence = new Recurrence( *(i.mRecurrence), this );
+ else
+ mRecurrence = 0;
mHoliday = i.mHoliday ;
mBirthday = i.mBirthday;
mAnniversary = i.mAnniversary;
@@ -93,7 +96,8 @@ Incidence::~Incidence()
if (ev->relatedTo() == this) ev->setRelatedTo(0);
}
if (relatedTo()) relatedTo()->removeRelation(this);
- delete mRecurrence;
+ if ( mRecurrence )
+ delete mRecurrence;
}
@@ -208,10 +212,24 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
} else {
return false;
}
- if (!( *i1.recurrence() == *i2.recurrence()) ) {
- qDebug("recurrence is NOT equal ");
- return false;
+ if ( i1.mRecurrence != 0 && i2.mRecurrence != 0 ) {
+ if (!( *i1.mRecurrence == *i2.mRecurrence) ) {
+ //qDebug("recurrence is NOT equal ");
+ return false;
+ }
+ } else {
+ // one ( or both ) recurrence is 0
+ if ( i1.mRecurrence == 0 ) {
+ if ( i2.mRecurrence != 0 && i2.mRecurrence->doesRecur() != Recurrence::rNone )
+ return false;
+ } else {
+ // i1.mRecurrence != 0
+ // i2.mRecurrence == 0
+ if ( i1.mRecurrence->doesRecur() != Recurrence::rNone )
+ return false;
+ }
}
+
return
// i1.created() == i2.created() &&
stringCompare( i1.description(), i2.description() ) &&
@@ -279,7 +297,8 @@ void Incidence::cloneRelations( Incidence * newInc )
void Incidence::setReadOnly( bool readOnly )
{
IncidenceBase::setReadOnly( readOnly );
- recurrence()->setRecurReadOnly( readOnly);
+ if ( mRecurrence )
+ mRecurrence->setRecurReadOnly( readOnly);
}
void Incidence::setLastModifiedSubInvalid()
{
@@ -330,7 +349,9 @@ void Incidence::setDtStart(const QDateTime &dtStart)
{
QDateTime dt = getEvenTime(dtStart);
- recurrence()->setRecurStart( dt);
+
+ if ( mRecurrence )
+ mRecurrence->setRecurStart( dt);
IncidenceBase::setDtStart( dt );
}
@@ -504,7 +525,7 @@ void Incidence::removeRelation(Incidence *event)
bool Incidence::recursOn(const QDate &qd) const
{
- if (recurrence()->recursOnPure(qd) && !isException(qd)) return true;
+ if (mRecurrence && mRecurrence->recursOnPure(qd) && !isException(qd)) return true;
else return false;
}
@@ -512,7 +533,6 @@ void Incidence::setExDates(const DateList &exDates)
{
if (mReadOnly) return;
mExDates = exDates;
-
recurrence()->setRecurExDatesCount(mExDates.count());
updated();
@@ -698,15 +718,21 @@ bool Incidence::isAlarmEnabled() const
}
return false;
}
-
-Recurrence *Incidence::recurrence() const
+#include <stdlib.h>
+Recurrence *Incidence::recurrence()
{
+ if ( ! mRecurrence ) {
+ mRecurrence = new Recurrence(this);
+ qDebug("creating new recurence ");
+ //abort();
+ }
return mRecurrence;
}
void Incidence::setRecurrence( Recurrence * r)
{
- delete mRecurrence;
- mRecurrence = r;
+ if ( mRecurrence )
+ delete mRecurrence;
+ mRecurrence = r;
}
void Incidence::setLocation(const QString &location)
@@ -720,6 +746,11 @@ QString Incidence::location() const
{
return mLocation;
}
+QString Incidence::recurrenceText() const
+{
+ if ( mRecurrence ) return mRecurrence->recurrenceText();
+ return i18n("No");
+}
ushort Incidence::doesRecur() const
{
@@ -733,12 +764,12 @@ QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const
*ok = false;
if ( doesRecur() ) {
bool last;
- recurrence()->getPreviousDateTime( incidenceStart , &last );
+ mRecurrence->getPreviousDateTime( incidenceStart , &last );
int count = 0;
if ( !last ) {
while ( !last ) {
++count;
- incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last );
+ incidenceStart = mRecurrence->getNextDateTime( incidenceStart, &last );
if ( recursOn( incidenceStart.date() ) ) {
last = true; // exit while llop
} else {
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index d4af9f0..8519f01 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -249,7 +249,7 @@ class Incidence : public IncidenceBase
Return the recurrence rule associated with this incidence. If there is
none, returns an appropriate (non-0) object.
*/
- Recurrence *recurrence() const;
+ Recurrence *recurrence();
void setRecurrence(Recurrence * r);
/**
Forward to Recurrence::doesRecur().
@@ -278,9 +278,11 @@ class Incidence : public IncidenceBase
bool isBirthday() const;
bool isAnniversary() const;
QDateTime lastModifiedSub();
+ QString recurrenceText() const;
void setLastModifiedSubInvalid();
+ Recurrence *mRecurrence;
protected:
QPtrList<Alarm> mAlarms;
QPtrList<Incidence> mRelations;
@@ -309,7 +311,6 @@ protected:
int mPriority; // 1 = highest, 2 = less, etc.
//QPtrList<Alarm> mAlarms;
- Recurrence *mRecurrence;
QString mLocation;
};
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 9359fad..f8f40f1 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -105,7 +105,7 @@ void KIncidenceFormatter::setEvent(Event *event)
mText.append(deTag(event->location())+"<br>");
}
- if (event->recurrence()->doesRecur()) {
+ if (event->doesRecur()) {
QString recurText = event->recurrence()->recurrenceText();
addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
@@ -216,7 +216,7 @@ void KIncidenceFormatter::setTodo(Todo *event )
}
- if (event->recurrence()->doesRecur()) {
+ if (event->doesRecur()) {
QString recurText = event->recurrence()->recurrenceText();
addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp
index 8efc1ea..2e19740 100644
--- a/libkcal/vcalformat.cpp
+++ b/libkcal/vcalformat.cpp
@@ -392,7 +392,7 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
return vtodo;
}
-VObject* VCalFormat::eventToVEvent(const Event *anEvent)
+VObject* VCalFormat::eventToVEvent(Event *anEvent)
{
VObject *vevent;
QString tmpStr;
@@ -459,7 +459,7 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent)
}
// recurrence rule stuff
- if (anEvent->recurrence()->doesRecur()) {
+ if (anEvent->doesRecur()) {
// some more variables
QPtrList<Recurrence::rMonthPos> tmpPositions;
QPtrList<int> tmpDays;
diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h
index c7df017..6dae3d2 100644
--- a/libkcal/vcalformat.h
+++ b/libkcal/vcalformat.h
@@ -74,7 +74,7 @@ class VCalFormat : public CalFormat {
/** translate a Event into a VTodo-type VObject and return pointer */
VObject *eventToVTodo(const Todo *anEvent);
/** translate a Event into a VObject and returns a pointer to it. */
- VObject* eventToVEvent(const Event *anEvent);
+ VObject* eventToVEvent(Event *anEvent);
/** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */
QString qDateToISO(const QDate &);