summaryrefslogtreecommitdiffabout
Side-by-side diff
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
@@ -3761,3 +3761,3 @@ void CalendarView::deleteEvent(Event *anEvent)
- if (anEvent->recurrence()->doesRecur()) {
+ if (anEvent->doesRecur()) {
QDate itemDate = mViewManager->currentSelectionDate();
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 0dd5ef5..c738f7e 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -581,3 +581,3 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
Incidence *incidence = mActionItem->incidence();
- if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) {
+ if ( incidence->isReadOnly() /*|| incidence->doesRecur() */) {
mActionItem = 0;
@@ -1001,3 +1001,3 @@ void KOAgenda::endItemAction()
}
- if ( placeItem->incidence()->recurrence()->doesRecur() ) {
+ if ( placeItem->incidence()->doesRecur() ) {
Incidence* oldInc = placeItem->incidence();
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 303a92a..49ad9b8 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -236,3 +236,3 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
}
- 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 );
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index a01323a..04f30bb 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1203,3 +1203,3 @@ void KOAgendaView::fillAgenda()
if (event->doesFloat()) {
- if (event->recurrence()->doesRecur()) {
+ if (event->doesRecur()) {
if (event->isMultiDay() ) {
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index ec1154a..057df0d 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -455,3 +455,3 @@ void KODayMatrix::updateViewTimed()
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) ||
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index de4e4f7..89504db 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -899,6 +899,5 @@ void KOEditorRecurrence::readEvent(Incidence *event)
- Recurrence *r = event->recurrence();
- int f = r->frequency();
- int recurs = r->doesRecur();
+
+ int recurs = event->doesRecur();
@@ -908,3 +907,5 @@ void KOEditorRecurrence::readEvent(Incidence *event)
int recurrenceType = RecurrenceChooser::Weekly;
-
+ if ( recurs ) {
+ Recurrence *r = event->recurrence();
+ int f = r->frequency();
switch ( recurs ) {
@@ -986,3 +987,3 @@ void KOEditorRecurrence::readEvent(Incidence *event)
}
-
+ }
mRecurrenceChooser->setType( recurrenceType );
@@ -992,3 +993,4 @@ void KOEditorRecurrence::readEvent(Incidence *event)
- if ( r->doesRecur() ) {
+ if ( event->doesRecur() ) {
+ Recurrence *r = event->recurrence();
mRecurrenceRange->setDuration( r->duration() );
@@ -1009,2 +1011,8 @@ void KOEditorRecurrence::writeEvent( Incidence *event )
{
+
+
+ if ( !mEnabledCheck->isChecked() ) {
+ if ( event->doesRecur() )
+ event->recurrence()->unsetRecurs();
+ } else {
Recurrence *r = event->recurrence();
@@ -1013,4 +1021,2 @@ void KOEditorRecurrence::writeEvent( Incidence *event )
r->unsetRecurs();
-
- if ( mEnabledCheck->isChecked() ) {
int duration = mRecurrenceRange->duration();
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index a690ab1..db695f5 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -349,5 +349,5 @@ void KOEventViewer::appendEvent(Event *event, int mode )
}
- 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>");
@@ -483,3 +483,3 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
- if (event->recurrence()->doesRecur()) {
+ if (event->doesRecur()) {
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index d25f671..e7a5e0e 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -135,3 +135,3 @@ bool ListItemVisitor::visit(Event *e)
}
- mItem->setText(6, e->recurrence()->recurrenceText());
+ mItem->setText(6, e->recurrenceText());
if( ! e->doesRecur() )
@@ -186,3 +186,3 @@ bool ListItemVisitor::visit(Todo *t)
}
- mItem->setText(6, t->recurrence()->recurrenceText());
+ mItem->setText(6, t->recurrenceText());
if( ! t->doesRecur() )
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 498d9b0..eea9a4d 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -789,3 +789,3 @@ int MonthViewCell::insertEvent(Event *event)
item->setPalette( pal );
- item->setRecur( event->recurrence()->doesRecur() );
+ item->setRecur( event->doesRecur() );
item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() );
@@ -880,3 +880,3 @@ void MonthViewCell::insertTodo(Todo *todo)
item->setPalette( pal );
- item->setRecur( todo->recurrence()->doesRecur() );
+ item->setRecur( todo->doesRecur() );
item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() );
@@ -1107,2 +1107,4 @@ void MonthViewCell::contextMenu( QListBoxItem *item )
}
+ //selection( item );
+ //qApp->processEvents();
MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 100a81b..682f83b 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -379,2 +379,3 @@ void KOTodoEditor::writeTodo(Todo *event)
event->setHasRecurrenceID( false );
+ 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
@@ -509,3 +509,3 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
QDateTime st,end;
- if ( event->recurrence()->doesRecur() ) {
+ if ( event->doesRecur() ) {
QDate recDate= mEventDate;
@@ -624,3 +624,3 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
}
- if ( ev->recurrence()->doesRecur() ) {
+ if ( ev->doesRecur() ) {
if ( !needClose)
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index ad66639..0766fd9 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -175,2 +175,3 @@ bool Event::matchTime(QDateTime*startDT, QDateTime* endDT)
{
+ if ( cancelled() ) return false;
if ( ! doesRecur() ) {
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index 4794bc9..f349681 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -374,8 +374,4 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
// recurrence rule stuff
- Recurrence *recur = incidence->recurrence();
- if (recur->doesRecur()) {
-
- icalcomponent_add_property(parent,writeRecurrenceRule(recur));
- }
-
+ if (incidence->doesRecur()) {
+ icalcomponent_add_property(parent,writeRecurrenceRule(incidence->recurrence()));
// recurrence excpetion dates
@@ -387,2 +383,3 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
}
+ }
@@ -1297,2 +1294,3 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence)
// Cancel backwards compatibility mode for subsequent changes by the application
+ if ( readrec )
incidence->recurrence()->setCompatVersion();
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index e4bcc5e..4643a3a 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -35,3 +35,3 @@ Incidence::Incidence() :
{
- mRecurrence = new Recurrence(this);
+ mRecurrence = 0;//new Recurrence(this);
mCancelled = false;
@@ -80,3 +80,6 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
mRecurrenceID = i.mRecurrenceID;
+ if ( i.mRecurrence )
mRecurrence = new Recurrence( *(i.mRecurrence), this );
+ else
+ mRecurrence = 0;
mHoliday = i.mHoliday ;
@@ -95,2 +98,3 @@ Incidence::~Incidence()
if (relatedTo()) relatedTo()->removeRelation(this);
+ if ( mRecurrence )
delete mRecurrence;
@@ -210,6 +214,20 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
}
- if (!( *i1.recurrence() == *i2.recurrence()) ) {
- qDebug("recurrence is NOT equal ");
+ 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
@@ -281,3 +299,4 @@ void Incidence::setReadOnly( bool readOnly )
IncidenceBase::setReadOnly( readOnly );
- recurrence()->setRecurReadOnly( readOnly);
+ if ( mRecurrence )
+ mRecurrence->setRecurReadOnly( readOnly);
}
@@ -332,3 +351,5 @@ void Incidence::setDtStart(const QDateTime &dtStart)
QDateTime dt = getEvenTime(dtStart);
- recurrence()->setRecurStart( dt);
+
+ if ( mRecurrence )
+ mRecurrence->setRecurStart( dt);
IncidenceBase::setDtStart( dt );
@@ -506,3 +527,3 @@ 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;
@@ -514,3 +535,2 @@ void Incidence::setExDates(const DateList &exDates)
mExDates = exDates;
-
recurrence()->setRecurExDatesCount(mExDates.count());
@@ -700,5 +720,10 @@ bool Incidence::isAlarmEnabled() const
}
-
-Recurrence *Incidence::recurrence() const
+#include <stdlib.h>
+Recurrence *Incidence::recurrence()
{
+ if ( ! mRecurrence ) {
+ mRecurrence = new Recurrence(this);
+ qDebug("creating new recurence ");
+ //abort();
+ }
return mRecurrence;
@@ -707,2 +732,3 @@ void Incidence::setRecurrence( Recurrence * r)
{
+ if ( mRecurrence )
delete mRecurrence;
@@ -722,2 +748,7 @@ QString Incidence::location() const
}
+QString Incidence::recurrenceText() const
+{
+ if ( mRecurrence ) return mRecurrence->recurrenceText();
+ return i18n("No");
+}
@@ -735,3 +766,3 @@ QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const
bool last;
- recurrence()->getPreviousDateTime( incidenceStart , &last );
+ mRecurrence->getPreviousDateTime( incidenceStart , &last );
int count = 0;
@@ -740,3 +771,3 @@ QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const
++count;
- incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last );
+ incidenceStart = mRecurrence->getNextDateTime( incidenceStart, &last );
if ( recursOn( incidenceStart.date() ) ) {
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index d4af9f0..8519f01 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -251,3 +251,3 @@ class Incidence : public IncidenceBase
*/
- Recurrence *recurrence() const;
+ Recurrence *recurrence();
void setRecurrence(Recurrence * r);
@@ -280,2 +280,3 @@ class Incidence : public IncidenceBase
QDateTime lastModifiedSub();
+ QString recurrenceText() const;
void setLastModifiedSubInvalid();
@@ -283,2 +284,3 @@ class Incidence : public IncidenceBase
+ Recurrence *mRecurrence;
protected:
@@ -311,3 +313,2 @@ protected:
//QPtrList<Alarm> mAlarms;
- Recurrence *mRecurrence;
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 9359fad..f8f40f1 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -107,3 +107,3 @@ void KIncidenceFormatter::setEvent(Event *event)
- if (event->recurrence()->doesRecur()) {
+ if (event->doesRecur()) {
@@ -218,3 +218,3 @@ void KIncidenceFormatter::setTodo(Todo *event )
- if (event->recurrence()->doesRecur()) {
+ if (event->doesRecur()) {
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp
index 8efc1ea..2e19740 100644
--- a/libkcal/vcalformat.cpp
+++ b/libkcal/vcalformat.cpp
@@ -394,3 +394,3 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
-VObject* VCalFormat::eventToVEvent(const Event *anEvent)
+VObject* VCalFormat::eventToVEvent(Event *anEvent)
{
@@ -461,3 +461,3 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent)
// recurrence rule stuff
- if (anEvent->recurrence()->doesRecur()) {
+ if (anEvent->doesRecur()) {
// some more variables
diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h
index c7df017..6dae3d2 100644
--- a/libkcal/vcalformat.h
+++ b/libkcal/vcalformat.h
@@ -76,3 +76,3 @@ class VCalFormat : public CalFormat {
/** translate a Event into a VObject and returns a pointer to it. */
- VObject* eventToVEvent(const Event *anEvent);
+ VObject* eventToVEvent(Event *anEvent);