summaryrefslogtreecommitdiffabout
path: root/libkcal
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 /libkcal
parent136f9082862e7a56abb3a201e96f5e7386c4f1b9 (diff)
downloadkdepimpi-0e38cffd7ba745f237c659e1c48080fcb25b126c.zip
kdepimpi-0e38cffd7ba745f237c659e1c48080fcb25b126c.tar.gz
kdepimpi-0e38cffd7ba745f237c659e1c48080fcb25b126c.tar.bz2
rec changes
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-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
7 files changed, 67 insertions, 36 deletions
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,14 +374,11 @@ 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)));
+ }
}
@@ -1297,3 +1294,4 @@ 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();
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;
- mRecurrence = new Recurrence( *(i.mRecurrence), this );
+ if ( i.mRecurrence )
+ mRecurrence = new Recurrence( *(i.mRecurrence), this );
+ else
+ mRecurrence = 0;
mHoliday = i.mHoliday ;
@@ -95,3 +98,4 @@ Incidence::~Incidence()
if (relatedTo()) relatedTo()->removeRelation(this);
- delete mRecurrence;
+ 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 ");
- 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
@@ -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,4 +732,5 @@ void Incidence::setRecurrence( Recurrence * r)
{
- delete mRecurrence;
- mRecurrence = r;
+ if ( mRecurrence )
+ delete mRecurrence;
+ mRecurrence = r;
}
@@ -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);