summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-07-09 23:58:28 (UTC)
committer zautrix <zautrix>2005-07-09 23:58:28 (UTC)
commit2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b (patch) (unidiff)
treee57782981707d6932940d0489fc942bfeab40dd6 /libkcal
parent47370b5d0dea0f29bb929ba13cf45186095c762d (diff)
downloadkdepimpi-2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b.zip
kdepimpi-2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b.tar.gz
kdepimpi-2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b.tar.bz2
fixxx
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidence.cpp28
-rw-r--r--libkcal/incidence.h3
-rw-r--r--libkcal/incidencebase.cpp4
-rw-r--r--libkcal/incidencebase.h1
4 files changed, 32 insertions, 4 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 11f7ecc..e4bcc5e 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -272,25 +272,45 @@ void Incidence::cloneRelations( Incidence * newInc )
272 for (inc=Relations.first();inc;inc=Relations.next()) { 272 for (inc=Relations.first();inc;inc=Relations.next()) {
273 cloneInc = inc->clone(); 273 cloneInc = inc->clone();
274 cloneInc->recreate(); 274 cloneInc->recreate();
275 cloneInc->setRelatedTo( newInc ); 275 cloneInc->setRelatedTo( newInc );
276 inc->cloneRelations( cloneInc ); 276 inc->cloneRelations( cloneInc );
277 } 277 }
278} 278}
279void Incidence::setReadOnly( bool readOnly ) 279void Incidence::setReadOnly( bool readOnly )
280{ 280{
281 IncidenceBase::setReadOnly( readOnly ); 281 IncidenceBase::setReadOnly( readOnly );
282 recurrence()->setRecurReadOnly( readOnly); 282 recurrence()->setRecurReadOnly( readOnly);
283} 283}
284 284void Incidence::setLastModifiedSubInvalid()
285{
286 mLastModifiedSub = QDateTime();
287 if ( mRelatedTo )
288 mRelatedTo->setLastModifiedSubInvalid();
289}
290QDateTime Incidence::lastModifiedSub()
291{
292 if ( !mRelations.count() )
293 return lastModified();
294 if ( mLastModifiedSub.isValid() )
295 return mLastModifiedSub;
296 mLastModifiedSub = lastModified();
297 Incidence * inc;
298 QPtrList<Incidence> Relations = relations();
299 for (inc=Relations.first();inc;inc=Relations.next()) {
300 if ( inc->lastModifiedSub() > mLastModifiedSub )
301 mLastModifiedSub = inc->lastModifiedSub();
302 }
303 return mLastModifiedSub;
304}
285void Incidence::setCreated(QDateTime created) 305void Incidence::setCreated(QDateTime created)
286{ 306{
287 if (mReadOnly) return; 307 if (mReadOnly) return;
288 mCreated = getEvenTime(created); 308 mCreated = getEvenTime(created);
289} 309}
290 310
291QDateTime Incidence::created() const 311QDateTime Incidence::created() const
292{ 312{
293 return mCreated; 313 return mCreated;
294} 314}
295 315
296void Incidence::setRevision(int rev) 316void Incidence::setRevision(int rev)
@@ -459,35 +479,35 @@ void Incidence::addRelationsToList(QPtrList<Incidence> *rel)
459{ 479{
460 Incidence* inc; 480 Incidence* inc;
461 QPtrList<Incidence> Relations = relations(); 481 QPtrList<Incidence> Relations = relations();
462 for (inc=Relations.first();inc;inc=Relations.next()) { 482 for (inc=Relations.first();inc;inc=Relations.next()) {
463 inc->addRelationsToList( rel ); 483 inc->addRelationsToList( rel );
464 } 484 }
465 if ( rel->findRef( this ) == -1 ) 485 if ( rel->findRef( this ) == -1 )
466 rel->append( this ); 486 rel->append( this );
467} 487}
468 488
469void Incidence::addRelation(Incidence *event) 489void Incidence::addRelation(Incidence *event)
470{ 490{
491 setLastModifiedSubInvalid();
471 if( mRelations.findRef( event ) == -1 ) { 492 if( mRelations.findRef( event ) == -1 ) {
472 mRelations.append(event); 493 mRelations.append(event);
473 //updated(); 494 //updated();
474 } 495 }
475} 496}
476 497
477void Incidence::removeRelation(Incidence *event) 498void Incidence::removeRelation(Incidence *event)
478{ 499{
479 500 setLastModifiedSubInvalid();
480 mRelations.removeRef(event); 501 mRelations.removeRef(event);
481
482// if (event->getRelatedTo() == this) event->setRelatedTo(0); 502// if (event->getRelatedTo() == this) event->setRelatedTo(0);
483} 503}
484 504
485bool Incidence::recursOn(const QDate &qd) const 505bool Incidence::recursOn(const QDate &qd) const
486{ 506{
487 if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; 507 if (recurrence()->recursOnPure(qd) && !isException(qd)) return true;
488 else return false; 508 else return false;
489} 509}
490 510
491void Incidence::setExDates(const DateList &exDates) 511void Incidence::setExDates(const DateList &exDates)
492{ 512{
493 if (mReadOnly) return; 513 if (mReadOnly) return;
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index c88ba2f..d4af9f0 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -268,39 +268,42 @@ class Incidence : public IncidenceBase
268 bool cancelled() const; 268 bool cancelled() const;
269 void setCancelled( bool b ); 269 void setCancelled( bool b );
270 270
271 bool hasRecurrenceID() const; 271 bool hasRecurrenceID() const;
272 void setHasRecurrenceID( bool b ); 272 void setHasRecurrenceID( bool b );
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();
281 void setLastModifiedSubInvalid();
280 282
281 283
282protected: 284protected:
283 QPtrList<Alarm> mAlarms; 285 QPtrList<Alarm> mAlarms;
284 QPtrList<Incidence> mRelations; 286 QPtrList<Incidence> mRelations;
285 QDateTime mRecurrenceID; 287 QDateTime mRecurrenceID;
286 bool mHasRecurrenceID; 288 bool mHasRecurrenceID;
287 private: 289 private:
288 void checkCategories(); 290 void checkCategories();
289 bool mHoliday, mBirthday, mAnniversary; 291 bool mHoliday, mBirthday, mAnniversary;
290 int mRevision; 292 int mRevision;
291 bool mCancelled; 293 bool mCancelled;
292 294
293 // base components of jounal, event and todo 295 // base components of jounal, event and todo
294 QDateTime mCreated; 296 QDateTime mCreated;
297 QDateTime mLastModifiedSub;
295 QString mDescription; 298 QString mDescription;
296 QString mSummary; 299 QString mSummary;
297 QStringList mCategories; 300 QStringList mCategories;
298 Incidence *mRelatedTo; 301 Incidence *mRelatedTo;
299 QString mRelatedToUid; 302 QString mRelatedToUid;
300 DateList mExDates; 303 DateList mExDates;
301 QPtrList<Attachment> mAttachments; 304 QPtrList<Attachment> mAttachments;
302 QStringList mResources; 305 QStringList mResources;
303 bool mHasStartDate; // if todo has associated start date 306 bool mHasStartDate; // if todo has associated start date
304 307
305 int mSecrecy; 308 int mSecrecy;
306 int mPriority; // 1 = highest, 2 = less, etc. 309 int mPriority; // 1 = highest, 2 = less, etc.
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 1a19f3e..022dead 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -182,31 +182,35 @@ bool IncidenceBase::alarmEnabled() const
182 182
183 183
184void IncidenceBase::setUid(const QString &uid) 184void IncidenceBase::setUid(const QString &uid)
185{ 185{
186 mUid = uid; 186 mUid = uid;
187 updated(); 187 updated();
188} 188}
189 189
190QString IncidenceBase::uid() const 190QString IncidenceBase::uid() const
191{ 191{
192 return mUid; 192 return mUid;
193} 193}
194void IncidenceBase::setLastModifiedSubInvalid()
195{
194 196
197}
195void IncidenceBase::setLastModified(const QDateTime &lm) 198void IncidenceBase::setLastModified(const QDateTime &lm)
196{ 199{
197 if ( blockLastModified ) return; 200 if ( blockLastModified ) return;
198 // DON'T! updated() because we call this from 201 // DON'T! updated() because we call this from
199 // Calendar::updateEvent(). 202 // Calendar::updateEvent().
200 mLastModified = getEvenTime(lm); 203 mLastModified = getEvenTime(lm);
204 setLastModifiedSubInvalid();
201 //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); 205 //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1());
202} 206}
203 207
204QDateTime IncidenceBase::lastModified() const 208QDateTime IncidenceBase::lastModified() const
205{ 209{
206 return mLastModified; 210 return mLastModified;
207} 211}
208 212
209void IncidenceBase::setOrganizer(const QString &o) 213void IncidenceBase::setOrganizer(const QString &o)
210{ 214{
211 // we don't check for readonly here, because it is 215 // we don't check for readonly here, because it is
212 // possible that by setting the organizer we are changing 216 // possible that by setting the organizer we are changing
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h
index bed73db..665c1f6 100644
--- a/libkcal/incidencebase.h
+++ b/libkcal/incidencebase.h
@@ -140,24 +140,25 @@ class IncidenceBase : public CustomProperties
140 140
141 void registerObserver( Observer * ); 141 void registerObserver( Observer * );
142 void unRegisterObserver( Observer * ); 142 void unRegisterObserver( Observer * );
143 void updated(); 143 void updated();
144 void setCalID( int id ); 144 void setCalID( int id );
145 int calID() const; 145 int calID() const;
146 void setCalEnabled( bool ); 146 void setCalEnabled( bool );
147 bool calEnabled() const; 147 bool calEnabled() const;
148 void setAlarmEnabled( bool ); 148 void setAlarmEnabled( bool );
149 bool alarmEnabled() const; 149 bool alarmEnabled() const;
150 bool isTagged() const; 150 bool isTagged() const;
151 void setTagged( bool ); 151 void setTagged( bool );
152 virtual void setLastModifiedSubInvalid();
152 protected: 153 protected:
153 bool blockLastModified; 154 bool blockLastModified;
154 bool mIsTagged; 155 bool mIsTagged;
155 QDateTime mDtStart; 156 QDateTime mDtStart;
156 bool mReadOnly; 157 bool mReadOnly;
157 QDateTime getEvenTime( QDateTime ); 158 QDateTime getEvenTime( QDateTime );
158 159
159 private: 160 private:
160 // base components 161 // base components
161 QString mOrganizer; 162 QString mOrganizer;
162 QString mUid; 163 QString mUid;
163 int mCalID; 164 int mCalID;