summaryrefslogtreecommitdiffstats
path: root/libkcal/incidence.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-08-27 23:01:53 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-08-27 23:01:53 +0000
commitcfa6b4114cea52b167caaaeb417f98f83edd690f (patch)
tree5fb46adfe9f1caf37e2716e79b148176b09574ab /libkcal/incidence.cpp
parenta3e46fcf743ccdac7c2461658898ca254bf64dd6 (diff)
downloadtdepim-cfa6b4114cea52b167caaaeb417f98f83edd690f.tar.gz
tdepim-cfa6b4114cea52b167caaaeb417f98f83edd690f.zip
Initial (i.e. read only) support for RECURRENCE-ID modified incidence series.
Write support requires further debugging and/or compliance checks with respect to Zimbra; there is no obvious reason why it should not be working but Zimbra fails with 409 when saving. User interface support is mostly complete, with event links being tracked across deletes. git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1168937 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkcal/incidence.cpp')
-rw-r--r--libkcal/incidence.cpp106
1 files changed, 103 insertions, 3 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 94995b12..79de6723 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -27,13 +27,15 @@
#include "calformat.h"
#include "incidence.h"
+#include "calendar.h"
using namespace KCal;
Incidence::Incidence() :
IncidenceBase(),
mRelatedTo(0), mStatus(StatusNone), mSecrecy(SecrecyPublic),
- mPriority(0), mRecurrence(0)
+ mPriority(0), mRecurrence(0),
+ mHasRecurrenceID( false ), mChildRecurrenceEvents()
{
recreate();
@@ -59,6 +61,9 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ),Recurrence::Obse
mSecrecy = i.mSecrecy;
mPriority = i.mPriority;
mLocation = i.mLocation;
+ mRecurrenceID = i.mRecurrenceID;
+ mHasRecurrenceID = i.mHasRecurrenceID;
+ mChildRecurrenceEvents = i.mChildRecurrenceEvents;
// Alarms and Attachments are stored in ListBase<...>, which is a TQValueList<...*>.
// We need to really duplicate the objects stored therein, otherwise deleting
@@ -124,6 +129,9 @@ Incidence& Incidence::operator=( const Incidence &i )
mSecrecy = i.mSecrecy;
mPriority = i.mPriority;
mLocation = i.mLocation;
+ mRecurrenceID = i.mRecurrenceID;
+ mHasRecurrenceID = i.mHasRecurrenceID;
+ mChildRecurrenceEvents = i.mChildRecurrenceEvents;
mAlarms.clearAll();
Alarm::List::ConstIterator it;
@@ -413,12 +421,58 @@ bool Incidence::doesRecur() const
bool Incidence::recursOn(const TQDate &qd) const
{
- return ( mRecurrence && mRecurrence->recursOn(qd) );
+ bool doesRecur = false;
+ doesRecur = mRecurrence && mRecurrence->recursOn(qd);
+
+ return doesRecur;
}
bool Incidence::recursAt(const TQDateTime &qdt) const
{
- return ( mRecurrence && mRecurrence->recursAt(qdt) );
+ bool doesRecur = false;
+ doesRecur = mRecurrence && mRecurrence->recursAt(qdt);
+
+ return doesRecur;
+}
+
+bool Incidence::recursOn(const TQDate &qd, Calendar *cal) const
+{
+ bool doesRecur = false;
+ doesRecur = mRecurrence && mRecurrence->recursOn(qd);
+
+ // Make sure that this instance has not been moved through a RECURRENCE-ID statement
+ if (hasRecurrenceID() == false) {
+ IncidenceList il = childIncidences();
+ IncidenceListIterator it;
+ for ( it = il.begin(); it != il.end(); ++it ) {
+ QDateTime modifiedDt = cal->incidence(*it)->recurrenceID();
+ modifiedDt.setTime(QTime());
+ if (QDateTime(qd) == modifiedDt) {
+ doesRecur = false;
+ }
+ }
+ }
+
+ return doesRecur;
+}
+
+bool Incidence::recursAt(const TQDateTime &qdt, Calendar *cal) const
+{
+ bool doesRecur = false;
+ doesRecur = mRecurrence && mRecurrence->recursAt(qdt);
+
+ // Make sure that this instance has not been moved through a RECURRENCE-ID statement
+ if (hasRecurrenceID() == false) {
+ IncidenceList il = childIncidences();
+ IncidenceListIterator it;
+ for ( it = il.begin(); it != il.end(); ++it ) {
+ if (qdt == cal->incidence(*it)->recurrenceID()) {
+ doesRecur = false;
+ }
+ }
+ }
+
+ return doesRecur;
}
/**
@@ -836,6 +890,52 @@ TQString Incidence::schedulingID() const
return mSchedulingID;
}
+bool Incidence::hasRecurrenceID() const
+{
+ return mHasRecurrenceID;
+}
+
+void Incidence::setHasRecurrenceID( bool hasRecurrenceID )
+{
+ if ( mReadOnly ) {
+ return;
+ }
+
+ mHasRecurrenceID = hasRecurrenceID;
+ updated();
+}
+
+TQDateTime Incidence::recurrenceID() const
+{
+ return mRecurrenceID;
+}
+
+void Incidence::setRecurrenceID( const TQDateTime &recurrenceID )
+{
+ if ( mReadOnly ) {
+ return;
+ }
+
+// update();
+ mRecurrenceID = recurrenceID;
+ updated();
+}
+
+void Incidence::addChildIncidence( TQString childIncidence )
+{
+ mChildRecurrenceEvents.append(childIncidence);
+}
+
+void Incidence::deleteChildIncidence( TQString childIncidence )
+{
+ mChildRecurrenceEvents.remove(childIncidence);
+}
+
+IncidenceList Incidence::childIncidences() const
+{
+ return mChildRecurrenceEvents;
+}
+
/** Observer interface for the recurrence class. If the recurrence is changed,
this method will be called for the incidence the recurrence object
belongs to. */