-rw-r--r-- | libkcal/incidence.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 0684af2..708ee6b 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -192,52 +192,60 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) | |||
192 | return | 192 | return |
193 | // i1.created() == i2.created() && | 193 | // i1.created() == i2.created() && |
194 | stringCompare( i1.description(), i2.description() ) && | 194 | stringCompare( i1.description(), i2.description() ) && |
195 | stringCompare( i1.summary(), i2.summary() ) && | 195 | stringCompare( i1.summary(), i2.summary() ) && |
196 | i1.categories() == i2.categories() && | 196 | i1.categories() == i2.categories() && |
197 | // no need to compare mRelatedTo | 197 | // no need to compare mRelatedTo |
198 | stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && | 198 | stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && |
199 | // i1.relations() == i2.relations() && | 199 | // i1.relations() == i2.relations() && |
200 | i1.exDates() == i2.exDates() && | 200 | i1.exDates() == i2.exDates() && |
201 | i1.attachments() == i2.attachments() && | 201 | i1.attachments() == i2.attachments() && |
202 | i1.resources() == i2.resources() && | 202 | i1.resources() == i2.resources() && |
203 | i1.secrecy() == i2.secrecy() && | 203 | i1.secrecy() == i2.secrecy() && |
204 | i1.priority() == i2.priority() && | 204 | i1.priority() == i2.priority() && |
205 | i1.cancelled() == i2.cancelled() && | 205 | i1.cancelled() == i2.cancelled() && |
206 | stringCompare( i1.location(), i2.location() ); | 206 | stringCompare( i1.location(), i2.location() ); |
207 | } | 207 | } |
208 | 208 | ||
209 | Incidence* Incidence::recreateCloneException( QDate d ) | 209 | Incidence* Incidence::recreateCloneException( QDate d ) |
210 | { | 210 | { |
211 | Incidence* newInc = clone(); | 211 | Incidence* newInc = clone(); |
212 | newInc->recreate(); | 212 | newInc->recreate(); |
213 | if ( doesRecur() ) { | 213 | if ( doesRecur() ) { |
214 | addExDate( d ); | 214 | addExDate( d ); |
215 | newInc->recurrence()->unsetRecurs(); | 215 | newInc->recurrence()->unsetRecurs(); |
216 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); | 216 | if ( type() == "Event") { |
217 | QTime tim = dtStart().time(); | 217 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); |
218 | newInc->setDtStart( QDateTime(d, tim) ); | 218 | QTime tim = dtStart().time(); |
219 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 219 | newInc->setDtStart( QDateTime(d, tim) ); |
220 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | ||
221 | } else { | ||
222 | int len = dtStart().secsTo( ((Todo*)this)->dtDue()); | ||
223 | QTime tim = ((Todo*)this)->dtDue().time(); | ||
224 | ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); | ||
225 | ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); | ||
226 | ((Todo*)this)->setRecurDates(); | ||
227 | } | ||
220 | } | 228 | } |
221 | return newInc; | 229 | return newInc; |
222 | } | 230 | } |
223 | 231 | ||
224 | void Incidence::recreate() | 232 | void Incidence::recreate() |
225 | { | 233 | { |
226 | setCreated(QDateTime::currentDateTime()); | 234 | setCreated(QDateTime::currentDateTime()); |
227 | 235 | ||
228 | setUid(CalFormat::createUniqueId()); | 236 | setUid(CalFormat::createUniqueId()); |
229 | 237 | ||
230 | setRevision(0); | 238 | setRevision(0); |
231 | setIDStr( ":" ); | 239 | setIDStr( ":" ); |
232 | setLastModified(QDateTime::currentDateTime()); | 240 | setLastModified(QDateTime::currentDateTime()); |
233 | } | 241 | } |
234 | 242 | ||
235 | void Incidence::setReadOnly( bool readOnly ) | 243 | void Incidence::setReadOnly( bool readOnly ) |
236 | { | 244 | { |
237 | IncidenceBase::setReadOnly( readOnly ); | 245 | IncidenceBase::setReadOnly( readOnly ); |
238 | recurrence()->setRecurReadOnly( readOnly); | 246 | recurrence()->setRecurReadOnly( readOnly); |
239 | } | 247 | } |
240 | 248 | ||
241 | void Incidence::setCreated(QDateTime created) | 249 | void Incidence::setCreated(QDateTime created) |
242 | { | 250 | { |
243 | if (mReadOnly) return; | 251 | if (mReadOnly) return; |