8 commits - CMakeLists.txt schemas/ical src/CMakeLists.txt src/containers src/incidence_p.h src/kolabconfiguration.cpp src/kolabconfiguration.h src/kolabcontact.cpp src/kolabcontact.h src/kolabcontainers.cpp src/kolabcontainers.h src/kolabevent.cpp src/kolabevent.h src/kolabevent_p.h src/kolabformat.cpp src/kolabformat.h src/kolabformat.i src/kolabjournal.cpp src/kolabjournal.h src/kolabnote.cpp src/kolabnote.h src/kolabtodo.cpp src/kolabtodo.h src/xcalconversions.h src/xcardconversions.h tests/bindingstest.cpp tests/bindingstest.h
Christian Mollekopf
mollekopf at kolabsys.com
Thu Jun 28 17:56:54 CEST 2012
CMakeLists.txt | 1
schemas/ical/kolabformat-xcal.xsd | 39 +
src/CMakeLists.txt | 35 +
src/containers/incidence_p.h | 65 ++
src/containers/kolabconfiguration.cpp | 121 +++++
src/containers/kolabconfiguration.h | 100 ++++
src/containers/kolabcontact.cpp | 506 ++++++++++++++++++++++
src/containers/kolabcontact.h | 412 ++++++++++++++++++
src/containers/kolabcontainers.cpp | 767 ++++++++++++++++++++++++++++++++++
src/containers/kolabcontainers.h | 415 ++++++++++++++++++
src/containers/kolabevent.cpp | 326 ++++++++++++++
src/containers/kolabevent.h | 124 +++++
src/containers/kolabevent_p.h | 42 +
src/containers/kolabfreebusy.cpp | 195 ++++++++
src/containers/kolabfreebusy.h | 103 ++++
src/containers/kolabfreebusy_p.h | 55 ++
src/containers/kolabjournal.cpp | 191 ++++++++
src/containers/kolabjournal.h | 87 +++
src/containers/kolabnote.cpp | 185 ++++++++
src/containers/kolabnote.h | 75 +++
src/containers/kolabtodo.cpp | 327 ++++++++++++++
src/containers/kolabtodo.h | 122 +++++
src/incidence_p.h | 65 --
src/kolabconfiguration.cpp | 121 -----
src/kolabconfiguration.h | 100 ----
src/kolabcontact.cpp | 506 ----------------------
src/kolabcontact.h | 412 ------------------
src/kolabcontainers.cpp | 767 ----------------------------------
src/kolabcontainers.h | 408 ------------------
src/kolabevent.cpp | 326 --------------
src/kolabevent.h | 124 -----
src/kolabevent_p.h | 42 -
src/kolabformat.cpp | 13
src/kolabformat.h | 4
src/kolabformat.i | 28 -
src/kolabjournal.cpp | 191 --------
src/kolabjournal.h | 87 ---
src/kolabnote.cpp | 185 --------
src/kolabnote.h | 75 ---
src/kolabtodo.cpp | 327 --------------
src/kolabtodo.h | 122 -----
src/xcalconversions.h | 201 ++++++++
src/xcardconversions.h | 1
tests/bindingstest.cpp | 40 +
tests/bindingstest.h | 1
45 files changed, 4551 insertions(+), 3888 deletions(-)
New commits:
commit 57b3e3cf20ad99b82cee6343c04b5ddd0ab55037
Merge: 190f786 bbb2c32
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Thu Jun 28 17:56:35 2012 +0200
Merge branch 'master' of ssh://git.kolab.org/git/libkolabxml
commit 190f78607ca23d40df45d2f3b3d85cc0e07648c6
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Thu Jun 28 17:55:51 2012 +0200
some typechecking for f/b, less verbosity
diff --git a/src/xcalconversions.h b/src/xcalconversions.h
index dfdb273..c36cc42 100644
--- a/src/xcalconversions.h
+++ b/src/xcalconversions.h
@@ -1651,7 +1651,7 @@ template < > struct IncidenceTrait <Kolab::Freebusy>
icalendar_2_0::KolabFreebusy::properties_type &prop = vfreebusy.properties();
if (fb.start().isValid() && fb.end().isValid()) {
- if (fb.start().isUTC() && fb.end().isUTC()) {
+ if ((fb.start().isUTC() || fb.start().isDateOnly()) && (fb.end().isUTC() || fb.end().isDateOnly())) {
prop.dtstart(fromDate<icalendar_2_0::KolabFreebusy::properties_type::dtstart_type>(fb.start()));
prop.dtend(fromDate<icalendar_2_0::KolabFreebusy::properties_type::dtend_type>(fb.end()));
} else {
@@ -1684,16 +1684,22 @@ template < > struct IncidenceTrait <Kolab::Freebusy>
continue;
}
params.baseParameter().push_back(icalendar_2_0::FbtypeParamType(fbtype));
- params.baseParameter().push_back(icalendar_2_0::XFBevent(fbPeriod.eventUid(), fbPeriod.eventSummary(), fbPeriod.eventLocation()));
+ if (!fbPeriod.eventUid().empty() || fbPeriod.eventSummary().empty() || fbPeriod.eventLocation().empty()) {
+ params.baseParameter().push_back(icalendar_2_0::XFBevent(fbPeriod.eventUid(), fbPeriod.eventSummary(), fbPeriod.eventLocation()));
+ }
fb.parameters(params);
- std::cout << "serializing period";
+
BOOST_FOREACH (const Kolab::Period &period, fbPeriod.periods()) {
+ if (period.start.isDateOnly() || period.end.isDateOnly()) {
+ WARNING("Period is date-only but must be date-time");
+ continue;
+ }
if (!period.start.isUTC() || !period.end.isUTC()) {
WARNING("Period is not in UTC, but it MUST be, skipping");
continue;
}
- icalendar_2_0::PeriodType p(fromDateTime(period.start));
- p.end(fromDateTime(period.end));
+ icalendar_2_0::PeriodType p(Shared::fromDateTime(period.start));
+ p.end(Shared::fromDateTime(period.end));
fb.period().push_back(p);
}
diff --git a/tests/bindingstest.cpp b/tests/bindingstest.cpp
index c3c8ea4..bfdf883 100644
--- a/tests/bindingstest.cpp
+++ b/tests/bindingstest.cpp
@@ -102,7 +102,7 @@ void BindingsTest::noteCompletness()
const std::string &result = Kolab::writeNote(note);
QCOMPARE(Kolab::error(), Kolab::NoError);
- std::cout << result << std::endl;
+// std::cout << result << std::endl;
const Kolab::Note &re = Kolab::readNote(result, false);
QCOMPARE(Kolab::error(), Kolab::NoError);
commit 27716001fccf8e2236a0af8de5251ecccb0f5627
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Thu Jun 28 17:54:19 2012 +0200
xcard timestamp reading
diff --git a/src/xcardconversions.h b/src/xcardconversions.h
index 70ac33a..dd23c3b 100644
--- a/src/xcardconversions.h
+++ b/src/xcardconversions.h
@@ -1123,6 +1123,7 @@ boost::shared_ptr<T> deserializeCard(const std::string& s, bool isUrl)
boost::shared_ptr<T> card = readCard<T>(vcards->vcard());
card->setUid(Shared::fromURN(vcards->vcard().uid().uri()));
card->setName(vcards->vcard().fn().text());
+ card->setLastModified(toDateTime(vcards->vcard().rev().timestamp()));
setProductId( vcards->vcard().prodid().text() );
// setFormatVersion( vcards->vcard().version().text() );
diff --git a/tests/bindingstest.cpp b/tests/bindingstest.cpp
index d6040a8..c3c8ea4 100644
--- a/tests/bindingstest.cpp
+++ b/tests/bindingstest.cpp
@@ -569,6 +569,7 @@ void BindingsTest::contactCompletness()
Kolab::Contact e = Kolab::readContact(result, false);
QVERIFY(Kolab::error() == Kolab::NoError);
QCOMPARE(e.uid(), c.uid());
+ QVERIFY(e.lastModified().isValid());
QCOMPARE(e.categories(), c.categories());
QCOMPARE(e.name(), c.name());
QCOMPARE(e.nameComponents(), c.nameComponents());
commit df421767f90c5a212521d2025b60569bc0d94b08
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Sat Jun 23 19:08:48 2012 +0200
Correct fbtype strings
diff --git a/src/xcalconversions.h b/src/xcalconversions.h
index 43b7b54..dfdb273 100644
--- a/src/xcalconversions.h
+++ b/src/xcalconversions.h
@@ -109,8 +109,8 @@ const char* const END = "END";
//Freebusy
const char* const BUSY = "BUSY";
-const char* const BUSY_TENTATIVE = "BUSY_TENTATIVE";
-const char* const BUSY_OUTOFOFFICE = "BUSY_OUTOFOFFICE";
+const char* const BUSY_TENTATIVE = "BUSY-TENTATIVE";
+const char* const BUSY_OUTOFOFFICE = "X-OUT-OF-OFFICE";
using namespace Kolab::Utils;
using namespace Kolab::Shared;
commit 516c9204e5176d90d3417f555a2c3ecafec740d5
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Sat Jun 23 15:53:59 2012 +0200
Comment for datetime ranges
diff --git a/src/containers/kolabcontainers.h b/src/containers/kolabcontainers.h
index 5f8318d..7bd1d2b 100644
--- a/src/containers/kolabcontainers.h
+++ b/src/containers/kolabcontainers.h
@@ -23,6 +23,13 @@
namespace Kolab {
+/**
+* - months: 1-12
+* - days: 1-31
+* - hour: 0-23
+* - minute: 0-59
+* - second: 0-59
+*/
class cDateTime {
public:
cDateTime();
commit fc9fcee0a45f5518b6e55495f3d6177b8b37a492
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Sat Jun 23 15:53:38 2012 +0200
Freebusy serialization
diff --git a/schemas/ical/kolabformat-xcal.xsd b/schemas/ical/kolabformat-xcal.xsd
index 0a0e9fd..6960df9 100644
--- a/schemas/ical/kolabformat-xcal.xsd
+++ b/schemas/ical/kolabformat-xcal.xsd
@@ -22,6 +22,19 @@
</xs:complexType>
<xs:element name="x-uid" type="XuidParamType" substitutionGroup="baseParameter"/>
+ <xs:complexType name="XFBevent" mixed="false">
+ <xs:complexContent>
+ <xs:extension base="BaseParameterType">
+ <xs:sequence>
+ <xs:element name="uid" type="xs:string"/>
+ <xs:element name="summary" type="xs:string"/>
+ <xs:element name="location" type="xs:string"/>
+ </xs:sequence>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="x-event" type="XFBevent" substitutionGroup="baseParameter"/>
+
<!-- -->
<xs:complexType name="KolabVersion" >
@@ -48,10 +61,10 @@
</xs:complexType>
<xs:complexType name="ContactType">
- <xs:complexContent mixed="false">
- <xs:extension base="CalAddressPropertyType"/>
- </xs:complexContent>
- </xs:complexType>
+ <xs:complexContent mixed="false">
+ <xs:extension base="CalAddressPropertyType"/>
+ </xs:complexContent>
+ </xs:complexType>
<!-- 3.6.6 Alarm Component -->
<xs:complexType name="ValarmType" mixed="false">
@@ -179,6 +192,23 @@
</xs:complexType>
</xs:element>
</xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="KolabFreebusy" >
+ <xs:sequence>
+ <xs:element name="properties">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="uid" type="UidPropType"/>
+ <xs:element name="dtstamp" type="DtstampPropType"/>
+ <xs:element name="dtstart" type="DtstartPropType" minOccurs="0"/>
+ <xs:element name="dtend" type="DtendPropType" minOccurs="0"/>
+ <xs:element name="organizer" type="OrganizerPropType" minOccurs="0"/>
+ <xs:element name="freebusy" type="FreebusyPropType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
</xs:complexType>
<xs:complexType name="VcalendarType" mixed="false">
@@ -198,6 +228,7 @@
<xs:element name="vevent" type="KolabEvent" maxOccurs="unbounded"/>
<xs:element name="vtodo" type="KolabTodo" maxOccurs="unbounded"/>
<xs:element name="vjournal" type="KolabJournal" maxOccurs="unbounded"/>
+ <xs:element name="vfreebusy" type="KolabFreebusy" maxOccurs="unbounded"/>
</xs:choice>
</xs:complexType>
</xs:element>
diff --git a/src/containers/kolabfreebusy.cpp b/src/containers/kolabfreebusy.cpp
index 5508a45..78d19c0 100644
--- a/src/containers/kolabfreebusy.cpp
+++ b/src/containers/kolabfreebusy.cpp
@@ -50,6 +50,9 @@ FreebusyPeriod::~FreebusyPeriod()
bool FreebusyPeriod::operator==(const FreebusyPeriod &other) const
{
return d->type == other.type() &&
+ d->eventUid == other.eventUid() &&
+ d->eventSummary == other.eventSummary() &&
+ d->eventLocation == other.eventLocation() &&
d->periods == other.periods();
}
@@ -78,6 +81,28 @@ std::vector< Period > FreebusyPeriod::periods() const
return d->periods;
}
+void FreebusyPeriod::setEvent(const std::string& uid, const std::string& summary, const std::string& location)
+{
+ d->eventUid = uid;
+ d->eventSummary = summary;
+ d->eventLocation = location;
+}
+
+std::string FreebusyPeriod::eventUid() const
+{
+ return d->eventUid;
+}
+
+std::string FreebusyPeriod::eventSummary() const
+{
+ return d->eventSummary;
+}
+
+std::string FreebusyPeriod::eventLocation() const
+{
+ return d->eventLocation;
+}
+
diff --git a/src/containers/kolabfreebusy.h b/src/containers/kolabfreebusy.h
index b244d2c..f4ee41f 100644
--- a/src/containers/kolabfreebusy.h
+++ b/src/containers/kolabfreebusy.h
@@ -52,7 +52,11 @@ public:
void setType(FBType t);
FBType type() const;
- void setEvent(const std::string &summary, const std::string &uid, const std::string &location);
+ void setEvent(const std::string &uid, const std::string &summary, const std::string &location);
+ std::string eventUid() const;
+ std::string eventSummary() const;
+ std::string eventLocation() const;
+
void setPeriods(const std::vector<Period> &);
std::vector<Period> periods() const;
private:
diff --git a/src/containers/kolabfreebusy_p.h b/src/containers/kolabfreebusy_p.h
index c64c380..d63f1a7 100644
--- a/src/containers/kolabfreebusy_p.h
+++ b/src/containers/kolabfreebusy_p.h
@@ -32,6 +32,7 @@ struct FreebusyPeriod::Private
FBType type;
std::string eventUid;
std::string eventSummary;
+ std::string eventLocation;
std::vector< Period > periods;
};
diff --git a/src/kolabformat.cpp b/src/kolabformat.cpp
index b2e406b..20eb11d 100644
--- a/src/kolabformat.cpp
+++ b/src/kolabformat.cpp
@@ -113,6 +113,19 @@ std::string writeJournal(const Kolab::Journal &j, const std::string& productId)
return XCAL::serializeIncidence<XCAL::IncidenceTrait<Kolab::Journal> >(j, productId);
}
+Kolab::Freebusy readFreebusy(const std::string& s, bool isUrl)
+{
+ XCAL::IncidenceTrait<Kolab::Freebusy>::IncidencePtr ptr = XCAL::deserializeIncidence<XCAL::IncidenceTrait<Kolab::Freebusy> >(s, isUrl);
+ if (!ptr.get()) {
+ return Kolab::Freebusy();
+ }
+ return *ptr;
+}
+
+std::string writeFreebusy(const Freebusy &f, const std::string& productId)
+{
+ return XCAL::serializeFreebusy<XCAL::IncidenceTrait<Kolab::Freebusy> >(f, productId);
+}
Kolab::Contact readContact(const std::string& s, bool isUrl)
{
diff --git a/src/kolabformat.h b/src/kolabformat.h
index 5aa8e69..3ed55e8 100644
--- a/src/kolabformat.h
+++ b/src/kolabformat.h
@@ -107,6 +107,9 @@ std::string writeTodo(const Kolab::Todo &, const std::string& productId = std::s
Kolab::Journal readJournal(const std::string& s, bool isUrl);
std::string writeJournal(const Kolab::Journal &, const std::string& productId = std::string());
+Kolab::Freebusy readFreebusy(const std::string& s, bool isUrl);
+std::string writeFreebusy(const Kolab::Freebusy &, const std::string& productId = std::string());
+
Kolab::Contact readContact(const std::string& s, bool isUrl);
std::string writeContact(const Kolab::Contact &, const std::string& productId = std::string());
diff --git a/src/xcalconversions.h b/src/xcalconversions.h
index 0759ef3..43b7b54 100644
--- a/src/xcalconversions.h
+++ b/src/xcalconversions.h
@@ -39,6 +39,7 @@
#include "kolabtodo.h"
#include "kolabevent.h"
#include "kolabjournal.h"
+#include <kolabfreebusy.h>
#include "utils.h"
#include "base64.h"
#include "shared_conversions.h"
@@ -106,6 +107,11 @@ const char* const ROOM = "ROOM";
const char* const START = "START";
const char* const END = "END";
+//Freebusy
+const char* const BUSY = "BUSY";
+const char* const BUSY_TENTATIVE = "BUSY_TENTATIVE";
+const char* const BUSY_OUTOFOFFICE = "BUSY_OUTOFOFFICE";
+
using namespace Kolab::Utils;
using namespace Kolab::Shared;
@@ -1634,6 +1640,148 @@ template < > struct IncidenceTrait <Kolab::Journal>
};
+template < > struct IncidenceTrait <Kolab::Freebusy>
+{
+ typedef icalendar_2_0::KolabFreebusy KolabType;
+ typedef Kolab::Freebusy IncidenceType;
+ typedef boost::shared_ptr<Kolab::Freebusy> IncidencePtr;
+
+ static void writeIncidence(icalendar_2_0::KolabFreebusy& vfreebusy, const Kolab::Freebusy &fb)
+ {
+ icalendar_2_0::KolabFreebusy::properties_type &prop = vfreebusy.properties();
+
+ if (fb.start().isValid() && fb.end().isValid()) {
+ if (fb.start().isUTC() && fb.end().isUTC()) {
+ prop.dtstart(fromDate<icalendar_2_0::KolabFreebusy::properties_type::dtstart_type>(fb.start()));
+ prop.dtend(fromDate<icalendar_2_0::KolabFreebusy::properties_type::dtend_type>(fb.end()));
+ } else {
+ WARNING("Start/end is not in UTC, but it MUST be, skipping");
+ }
+ }
+
+ if (fb.organizer().isValid()) {
+ prop.organizer(fromContactReference<icalendar_2_0::KolabFreebusy::properties_type::organizer_type>(fb.organizer()));
+ }
+ if (!fb.periods().empty()) {
+ BOOST_FOREACH (const Kolab::FreebusyPeriod &fbPeriod, fb.periods()) {
+ icalendar_2_0::KolabFreebusy::properties_type::freebusy_type fb;
+
+ icalendar_2_0::BasePropertyType::parameters_type params;
+ std::string fbtype;
+ switch (fbPeriod.type()) {
+ case FreebusyPeriod::Busy:
+ fbtype = BUSY;
+ break;
+ case FreebusyPeriod::Tentative:
+ fbtype = BUSY_TENTATIVE;
+ break;
+ case FreebusyPeriod::OutOfOffice:
+ fbtype = BUSY_OUTOFOFFICE;
+ break;
+ case FreebusyPeriod::Invalid:
+ default:
+ WARNING("Invalid fb type");
+ continue;
+ }
+ params.baseParameter().push_back(icalendar_2_0::FbtypeParamType(fbtype));
+ params.baseParameter().push_back(icalendar_2_0::XFBevent(fbPeriod.eventUid(), fbPeriod.eventSummary(), fbPeriod.eventLocation()));
+ fb.parameters(params);
+ std::cout << "serializing period";
+ BOOST_FOREACH (const Kolab::Period &period, fbPeriod.periods()) {
+ if (!period.start.isUTC() || !period.end.isUTC()) {
+ WARNING("Period is not in UTC, but it MUST be, skipping");
+ continue;
+ }
+ icalendar_2_0::PeriodType p(fromDateTime(period.start));
+ p.end(fromDateTime(period.end));
+ fb.period().push_back(p);
+ }
+
+ prop.freebusy().push_back(fb);
+ }
+ }
+ }
+
+ static void addIncidence(icalendar_2_0::VcalendarType::components_type &components, icalendar_2_0::KolabFreebusy inc)
+ {
+ components.vfreebusy().push_back(inc);
+ }
+
+ static void readIncidence(Kolab::Freebusy &freebusy, const icalendar_2_0::KolabFreebusy& vfreebusy)
+ {
+ const icalendar_2_0::KolabFreebusy::properties_type &prop = vfreebusy.properties();
+
+ freebusy.setUid(toString(prop.uid()));
+ freebusy.setTimestamp(*toDate(prop.dtstamp()));
+
+ if (prop.dtstart()) {
+ freebusy.setStart(*toDate(*prop.dtstart()));
+ }
+ if (prop.dtend()) {
+ freebusy.setEnd(*toDate(*prop.dtend()));
+ }
+ if (prop.organizer()) {
+ freebusy.setOrganizer(toContactReference(*prop.organizer()));
+ }
+ if (!prop.freebusy().empty()) {
+ std::vector<Kolab::FreebusyPeriod> fbperiods;
+
+
+ BOOST_FOREACH(icalendar_2_0::FreebusyPropType aProp, prop.freebusy()) {
+ Kolab::FreebusyPeriod fbPeriod;
+ fbPeriod.setType(Kolab::FreebusyPeriod::Busy);
+ if (aProp.parameters()) {
+ const icalendar_2_0::FreebusyPropType::parameters_type ¶meters = *aProp.parameters();
+ for (icalendar_2_0::FreebusyPropType::parameters_type::baseParameter_const_iterator it(parameters.baseParameter().begin()); it != parameters.baseParameter().end(); it++) {
+ if (const icalendar_2_0::FbtypeParamType * p = dynamic_cast<const icalendar_2_0::FbtypeParamType*> (&*it)) {
+ if (p->text() == BUSY) {
+ fbPeriod.setType(Kolab::FreebusyPeriod::Busy);
+ } else if (p->text() == BUSY_OUTOFOFFICE) {
+ fbPeriod.setType(Kolab::FreebusyPeriod::OutOfOffice);
+ } else if (p->text() == BUSY_TENTATIVE) {
+ fbPeriod.setType(Kolab::FreebusyPeriod::Tentative);
+ } else {
+ WARNING("Invalid fb type, default to busy");
+ }
+ }
+ if (const icalendar_2_0::XFBevent * p = dynamic_cast<const icalendar_2_0::XFBevent*> (&*it)) {
+ fbPeriod.setEvent(p->uid(), p->summary(), p->location());
+ }
+
+ }
+ }
+
+ std::vector <Kolab::Period > periods;
+ BOOST_FOREACH(icalendar_2_0::FreebusyPropType::period_type period, aProp.period()) {
+ if (!period.end()) {
+ WARNING("Period end date is required and duration is not supported, skipping period");
+ continue;
+ }
+ periods.push_back(Kolab::Period(*Shared::toDate(period.start()), *Shared::toDate(*period.end())));
+ }
+ fbPeriod.setPeriods(periods);
+
+ fbperiods.push_back(fbPeriod);
+ }
+
+
+ freebusy.setPeriods(fbperiods);
+ }
+
+ }
+
+ static icalendar_2_0::VcalendarType::components_type::vfreebusy_const_iterator begin(const icalendar_2_0::VcalendarType::components_type &components)
+ {
+ return components.vfreebusy().begin();
+ }
+
+ static icalendar_2_0::VcalendarType::components_type::vfreebusy_const_iterator end(const icalendar_2_0::VcalendarType::components_type &components)
+ {
+ return components.vfreebusy().end();
+ }
+
+};
+
//////////////////////////////////=========================================
@@ -1759,6 +1907,53 @@ typename T::IncidencePtr deserializeIncidence(const std::string& s, bool isUrl)
return IncidencePtr();
}
+template <typename T>
+std::string serializeFreebusy(const Kolab::Freebusy &incidence, const std::string productid = std::string()) {
+
+ using namespace icalendar_2_0;
+ typedef typename T::KolabType KolabType;
+
+ clearErrors();
+
+ try {
+
+ typename KolabType::properties_type::uid_type uid( getUID(incidence.uid()));
+ setCreatedUid(uid.text());
+ typename KolabType::properties_type::dtstamp_type dtstamp;
+ dtstamp.date_time(fromDateTime(timestamp()));
+ typename KolabType::properties_type eventProps(uid, dtstamp);
+
+ KolabType inc(eventProps);
+
+ T::writeIncidence(inc, incidence);
+
+ VcalendarType::components_type components;
+ T::addIncidence(components, inc);
+
+ VcalendarType::properties_type::prodid_type prodid(getProductId(productid));
+ VcalendarType::properties_type::version_type version(XCAL_VERSION);
+ VcalendarType::properties_type::x_kolab_version_type x_kolab_version(KOLAB_FORMAT_VERSION);
+
+ VcalendarType::properties_type properties(prodid, version, x_kolab_version);
+
+ VcalendarType vcalendar(properties, components);
+
+ IcalendarType icalendar(vcalendar);
+
+ xml_schema::namespace_infomap map;
+ map[""].name = XCAL_NAMESPACE;
+
+ std::ostringstream ostringstream;
+ icalendar_2_0::icalendar(ostringstream, icalendar, map);
+ return ostringstream.str();
+ } catch (const xml_schema::exception& e) {
+ CRITICAL("failed to write Incidence");
+ } catch (...) {
+ CRITICAL("Unhandled exception");
+ }
+ return std::string();
+}
+
}
}//Namespace
diff --git a/tests/bindingstest.cpp b/tests/bindingstest.cpp
index 164bdd7..d6040a8 100644
--- a/tests/bindingstest.cpp
+++ b/tests/bindingstest.cpp
@@ -102,7 +102,7 @@ void BindingsTest::noteCompletness()
const std::string &result = Kolab::writeNote(note);
QCOMPARE(Kolab::error(), Kolab::NoError);
-// std::cout << result << std::endl;
+ std::cout << result << std::endl;
const Kolab::Note &re = Kolab::readNote(result, false);
QCOMPARE(Kolab::error(), Kolab::NoError);
@@ -413,7 +413,42 @@ void BindingsTest::journalCompletness()
QCOMPARE(ev.attendees(), re.attendees());
QCOMPARE(ev.attachments(), re.attachments());
QCOMPARE(ev.customProperties(), re.customProperties());
-
+}
+
+void BindingsTest::freebusyCompletness()
+{
+ Kolab::Freebusy ev;
+ ev.setUid("UID");
+ ev.setStart(Kolab::cDateTime(2006,1,6,12,0,0, true));
+ ev.setEnd(Kolab::cDateTime(2006,1,6,12,0,0, true));
+ ev.setOrganizer(Kolab::ContactReference(Kolab::ContactReference::EmailReference, "mail", "name"));
+
+ std::vector<Kolab::FreebusyPeriod> fbperiods;
+ Kolab::FreebusyPeriod fbp;
+ fbp.setType(Kolab::FreebusyPeriod::OutOfOffice);
+ fbp.setEvent("summary", "uid", "location");
+ std::vector<Kolab::Period> periods;
+ periods.push_back(Kolab::Period(Kolab::cDateTime(2006,1,6,12,0,0, true),Kolab::cDateTime(2007,1,6,12,0,0, true)));
+ periods.push_back(Kolab::Period(Kolab::cDateTime(2006,1,6,12,0,0, true),Kolab::cDateTime(2007,1,6,12,0,0, true)));
+ fbp.setPeriods(periods);
+ fbperiods.push_back(fbp);
+ fbperiods.push_back(fbp);
+ ev.setPeriods(fbperiods);
+
+
+ std::string result = Kolab::writeFreebusy(ev);
+ QVERIFY(Kolab::error() == Kolab::NoError);
+// std::cout << result << endl;
+ Kolab::Freebusy re = Kolab::readFreebusy(result, false);
+ QVERIFY(Kolab::error() == Kolab::NoError);
+
+
+ QCOMPARE(ev.uid(), re.uid());
+ QVERIFY(re.timestamp().isValid()); //TODO can we check this better?
+ QCOMPARE(ev.start(), re.start());
+ QCOMPARE(ev.end(), re.end());
+ QCOMPARE(ev.organizer(), re.organizer());
+ QCOMPARE(ev.periods(), re.periods());
}
void BindingsTest::contactCompletness()
diff --git a/tests/bindingstest.h b/tests/bindingstest.h
index c58ff9f..6bbeb78 100644
--- a/tests/bindingstest.h
+++ b/tests/bindingstest.h
@@ -29,6 +29,7 @@ class BindingsTest : public QObject
void eventDuration();
void todoCompletness();
void journalCompletness();
+ void freebusyCompletness();
void contactCompletness();
void distlistCompletness();
commit 07ab2f5e03e0f655dbc8af6935482f15d44cdbc5
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Thu Jun 21 17:10:04 2012 +0200
Freebusy containers
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a203450..dfb2721 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -14,6 +14,7 @@ add_library(kolabxml SHARED
containers/kolabjournal.cpp
containers/kolabcontact.cpp
containers/kolabconfiguration.cpp
+ containers/kolabfreebusy.cpp
utils.cpp base64.cpp
../compiled/XMLParserWrapper.cpp
../compiled/grammar-input-stream.cxx
@@ -52,6 +53,7 @@ install( FILES
containers/kolabnote.h
containers/kolabcontainers.h
containers/kolabconfiguration.h
+ containers/kolabfreebusy.h
global_definitions.h
DESTINATION ${INCLUDE_INSTALL_DIR})
diff --git a/src/containers/kolabfreebusy.cpp b/src/containers/kolabfreebusy.cpp
new file mode 100644
index 0000000..5508a45
--- /dev/null
+++ b/src/containers/kolabfreebusy.cpp
@@ -0,0 +1,170 @@
+/*
+ <one line to give the library's name and an idea of what it does.>
+ Copyright (C) 2012 Christian Mollekopf <chrigi_1 at fastmail.fm>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+
+#include "kolabfreebusy.h"
+#include "kolabfreebusy_p.h"
+
+namespace Kolab {
+
+
+
+FreebusyPeriod::FreebusyPeriod()
+: d(new FreebusyPeriod::Private())
+{
+
+}
+
+FreebusyPeriod::FreebusyPeriod(const FreebusyPeriod &other)
+: d(new FreebusyPeriod::Private())
+{
+ *d = *other.d;
+}
+
+void FreebusyPeriod::operator=(const FreebusyPeriod &other)
+{
+ *d = *other.d;
+}
+
+FreebusyPeriod::~FreebusyPeriod()
+{
+
+}
+
+bool FreebusyPeriod::operator==(const FreebusyPeriod &other) const
+{
+ return d->type == other.type() &&
+ d->periods == other.periods();
+}
+
+bool FreebusyPeriod::isValid() const
+{
+ return d->type == Invalid;
+}
+
+void FreebusyPeriod::setType(FBType t)
+{
+ d->type = t;
+}
+
+FreebusyPeriod::FBType FreebusyPeriod::type() const
+{
+ return d->type;
+}
+
+void FreebusyPeriod::setPeriods(const std::vector< Period > &periods)
+{
+ d->periods = periods;
+}
+
+std::vector< Period > FreebusyPeriod::periods() const
+{
+ return d->periods;
+}
+
+
+
+
+Freebusy::Freebusy()
+: d(new Freebusy::Private())
+{
+}
+
+Freebusy::Freebusy(const Freebusy &other)
+: d(new Freebusy::Private())
+{
+ *d = *other.d;
+}
+
+Freebusy::~Freebusy()
+{
+}
+
+void Freebusy::operator=(const Freebusy &other)
+{
+ *d = *other.d;
+}
+
+bool Freebusy::isValid() const
+{
+ return !d->uid.empty();
+}
+
+void Freebusy::setUid(const std::string &uid)
+{
+ d->uid = uid;
+}
+
+std::string Freebusy::uid() const
+{
+ return d->uid;
+}
+
+void Freebusy::setTimestamp(const cDateTime &t)
+{
+ d->timestamp = t;
+}
+
+cDateTime Freebusy::timestamp() const
+{
+ return d->timestamp;
+}
+
+void Freebusy::setStart(const cDateTime &s)
+{
+ d->start = s;
+}
+
+cDateTime Freebusy::start() const
+{
+ return d->start;
+}
+
+void Freebusy::setEnd(const cDateTime &e)
+{
+ d->end = e;
+}
+
+cDateTime Freebusy::end() const
+{
+ return d->end;
+}
+
+void Freebusy::setOrganizer(const ContactReference &c)
+{
+ d->organizer = c;
+}
+
+ContactReference Freebusy::organizer() const
+{
+ return d->organizer;
+}
+
+void Freebusy::setPeriods(const std::vector< FreebusyPeriod > &periods)
+{
+ d->periods = periods;
+}
+
+std::vector< FreebusyPeriod > Freebusy::periods() const
+{
+ return d->periods;
+}
+
+
+}
\ No newline at end of file
diff --git a/src/containers/kolabfreebusy.h b/src/containers/kolabfreebusy.h
new file mode 100644
index 0000000..b244d2c
--- /dev/null
+++ b/src/containers/kolabfreebusy.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2012 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef KOLABFREEBUSY_H
+#define KOLABFREEBUSY_H
+
+#include <string>
+#include <vector>
+#include <boost/scoped_ptr.hpp>
+#include "kolabcontainers.h"
+namespace Kolab {
+
+struct Period {
+ Period(){};
+ Period(const cDateTime& s, const cDateTime &e): start(s), end(e){};
+ bool operator==(const Period &other) const { return start == other.start && end == other.end; };
+ bool isValid() const { return start.isValid() && end.isValid(); };
+ cDateTime start;
+ cDateTime end;
+};
+
+class FreebusyPeriod {
+public:
+ FreebusyPeriod();
+ ~FreebusyPeriod();
+ FreebusyPeriod(const FreebusyPeriod &);
+ void operator=(const FreebusyPeriod &);
+ bool operator==(const FreebusyPeriod &) const;
+
+ bool isValid() const;
+
+ enum FBType {
+ Invalid,
+ Busy,
+ Tentative,
+ OutOfOffice
+ };
+ void setType(FBType t);
+ FBType type() const;
+
+ void setEvent(const std::string &summary, const std::string &uid, const std::string &location);
+ void setPeriods(const std::vector<Period> &);
+ std::vector<Period> periods() const;
+private:
+ struct Private;
+ boost::scoped_ptr<Private> d;
+};
+
+class Freebusy {
+public:
+ Freebusy();
+ ~Freebusy();
+ Freebusy(const Freebusy &);
+ void operator=(const Freebusy &);
+// bool operator==(const Freebusy &) const;
+
+ bool isValid() const;
+
+ void setUid(const std::string &);
+ std::string uid() const;
+
+ void setTimestamp(const cDateTime &);
+ cDateTime timestamp() const;
+
+ void setStart(const cDateTime &);
+ cDateTime start() const;
+
+ void setEnd(const cDateTime &);
+ cDateTime end() const;
+
+ void setOrganizer(const ContactReference &);
+ ContactReference organizer() const;
+
+ void setPeriods(const std::vector<FreebusyPeriod> &);
+ std::vector<FreebusyPeriod> periods() const;
+
+private:
+ struct Private;
+ boost::scoped_ptr<Private> d;
+};
+
+}
+
+#endif
+
diff --git a/src/containers/kolabfreebusy_p.h b/src/containers/kolabfreebusy_p.h
new file mode 100644
index 0000000..c64c380
--- /dev/null
+++ b/src/containers/kolabfreebusy_p.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef FREEBUSY_P
+#define FREEBUSY_P
+
+#include "kolabcontainers.h"
+#include "kolabfreebusy.h"
+
+namespace Kolab {
+
+struct FreebusyPeriod::Private
+{
+ Private()
+ : type(Invalid)
+ {}
+
+ FBType type;
+ std::string eventUid;
+ std::string eventSummary;
+ std::vector< Period > periods;
+};
+
+class Freebusy;
+
+struct Freebusy::Private
+{
+ Private() {}
+
+ std::string uid;
+ cDateTime timestamp;
+ cDateTime start;
+ cDateTime end;
+ ContactReference organizer;
+ std::vector< FreebusyPeriod > periods;
+};
+
+}
+
+#endif
diff --git a/src/kolabformat.h b/src/kolabformat.h
index 404b1a6..5aa8e69 100644
--- a/src/kolabformat.h
+++ b/src/kolabformat.h
@@ -26,6 +26,7 @@
#include "kolabcontact.h"
#include "kolabnote.h"
#include "kolabconfiguration.h"
+#include "kolabfreebusy.h"
#include "global_definitions.h"
namespace Kolab {
commit a1adb3a394f7d1d0a08406c9ad16909348e3e6c1
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Tue Jun 19 22:07:21 2012 +0200
Moved containers to subdirectory.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7347288..1ac1a61 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -167,6 +167,7 @@ ADD_CUSTOM_TARGET(generate_bindings ALL DEPENDS ${SCHEMA_SOURCEFILES})
include_directories(
./
compiled
+ src/containers
${CMAKE_CURRENT_BINARY_DIR}
${Boost_INCLUDE_DIRS}
${XSDCXX_INCLUDE_DIRS}
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2f635d6..a203450 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -5,7 +5,20 @@ SET_SOURCE_FILES_PROPERTIES(${SCHEMA_SOURCEFILES} PROPERTIES GENERATED 1)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wp,-D_FORTIFY_SOURCE=2 -O2" ) #always generate shared libraries with -fPIC, -D_FORTIFY_SOURCE=2 enables some extra checking
# Library with serialization/deserialization code and kolab-containers
-add_library(kolabxml SHARED kolabformat.cpp kolabcontainers.cpp kolabnote.cpp kolabevent.cpp kolabtodo.cpp kolabjournal.cpp kolabcontact.cpp kolabconfiguration.cpp utils.cpp base64.cpp ../compiled/XMLParserWrapper.cpp ../compiled/grammar-input-stream.cxx ${SCHEMA_SOURCEFILES})
+add_library(kolabxml SHARED
+ kolabformat.cpp
+ containers/kolabcontainers.cpp
+ containers/kolabnote.cpp
+ containers/kolabevent.cpp
+ containers/kolabtodo.cpp
+ containers/kolabjournal.cpp
+ containers/kolabcontact.cpp
+ containers/kolabconfiguration.cpp
+ utils.cpp base64.cpp
+ ../compiled/XMLParserWrapper.cpp
+ ../compiled/grammar-input-stream.cxx
+ ${SCHEMA_SOURCEFILES}
+)
add_dependencies(kolabxml generate_bindings)
target_link_libraries(kolabxml ${XERCES_C} ${Boost_LIBRARIES} ${UUID})
@@ -30,15 +43,15 @@ install(TARGETS kolabxml EXPORT LibkolabxmlExport
install( FILES
kolabformat.h
- kolabevent.h
- kolabevent_p.h
- incidence_p.h
- kolabtodo.h
- kolabjournal.h
- kolabcontact.h
- kolabnote.h
- kolabcontainers.h
- kolabconfiguration.h
+ containers/kolabevent.h
+ containers/kolabevent_p.h
+ containers/incidence_p.h
+ containers/kolabtodo.h
+ containers/kolabjournal.h
+ containers/kolabcontact.h
+ containers/kolabnote.h
+ containers/kolabcontainers.h
+ containers/kolabconfiguration.h
global_definitions.h
DESTINATION ${INCLUDE_INSTALL_DIR})
diff --git a/src/containers/incidence_p.h b/src/containers/incidence_p.h
new file mode 100644
index 0000000..8602feb
--- /dev/null
+++ b/src/containers/incidence_p.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef INCIDENCE_P
+#define INCIDENCE_P
+
+#include "kolabcontainers.h"
+
+namespace Kolab {
+
+ struct PrivateIncidence
+ {
+ PrivateIncidence()
+ : sequence(0),
+ classification(ClassPublic),
+ thisAndFuture(false),
+ priority(0),
+ status(StatusUndefined){}
+
+ std::string uid;
+ cDateTime created;
+ cDateTime lastModified;
+ int sequence;
+ Classification classification;
+ std::vector< std::string > categories;
+ std::vector< std::string > relatedTo;
+ cDateTime start;
+
+ cDateTime recurrenceID;
+ bool thisAndFuture;
+ std::string summary;
+ std::string description;
+ std::string location;
+ int priority;
+ Status status;
+ RecurrenceRule rrule;
+ std::vector< cDateTime > recurrenceDates;
+ std::vector< cDateTime > exceptionDates;
+ ContactReference organizer;
+ Duration duration;
+
+ std::vector<Attendee> attendees;
+ std::vector<Attachment> attachments;
+ std::vector<CustomProperty> customProperties;
+
+ std::vector<Alarm> alarms;
+ };
+
+}
+
+#endif
diff --git a/src/containers/kolabconfiguration.cpp b/src/containers/kolabconfiguration.cpp
new file mode 100644
index 0000000..2129371
--- /dev/null
+++ b/src/containers/kolabconfiguration.cpp
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2012 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "kolabconfiguration.h"
+
+namespace Kolab {
+
+struct Configuration::Private {
+ Private(): type(Invalid){}
+
+ std::vector<CategoryColor> categoryColor;
+ Dictionary dictionary;
+ ConfigurationType type;
+ std::string uid;
+ cDateTime created;
+ cDateTime lastModified;
+};
+
+Configuration::Configuration()
+: d(new Configuration::Private)
+{
+}
+
+Configuration::Configuration(const std::vector<CategoryColor> &c)
+: d(new Configuration::Private)
+{
+ d->categoryColor = c;
+ d->type = TypeCategoryColor;
+}
+
+Configuration::Configuration(const Dictionary &dict)
+: d(new Configuration::Private)
+{
+ d->dictionary = dict;
+ d->type = TypeDictionary;
+}
+
+Configuration::Configuration(const Configuration &other)
+: d(new Configuration::Private)
+{
+ *d = *other.d;
+}
+
+Configuration::~Configuration()
+{
+
+}
+
+void Configuration::operator=(const Configuration &other)
+{
+ *d = *other.d;
+}
+
+bool Configuration::isValid() const
+{
+ return d->type != Invalid;
+}
+
+void Configuration::setUid(const std::string &uid)
+{
+ d->uid = uid;
+}
+
+std::string Configuration::uid() const
+{
+ return d->uid;
+}
+
+void Configuration::setCreated(const cDateTime &created)
+{
+ d->created = created;
+}
+
+cDateTime Configuration::created() const
+{
+ return d->created;
+}
+
+void Configuration::setLastModified(const cDateTime &lastModified)
+{
+ d->lastModified = lastModified;
+}
+
+cDateTime Configuration::lastModified() const
+{
+ return d->lastModified;
+}
+
+
+Configuration::ConfigurationType Configuration::type() const
+{
+ return d->type;
+}
+
+std::vector<CategoryColor> Configuration::categoryColor() const
+{
+ return d->categoryColor;
+}
+
+Dictionary Configuration::dictionary() const
+{
+ return d->dictionary;
+}
+
+
+
+} //Namespace
diff --git a/src/containers/kolabconfiguration.h b/src/containers/kolabconfiguration.h
new file mode 100644
index 0000000..d29ff1e
--- /dev/null
+++ b/src/containers/kolabconfiguration.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2012 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef KOLABCONFIGURATION_H
+#define KOLABCONFIGURATION_H
+#include <string>
+#include <vector>
+#include <boost/scoped_ptr.hpp>
+#include "kolabcontainers.h"
+
+namespace Kolab {
+
+struct Dictionary {
+ Dictionary(){}
+ Dictionary(const std::string &c): mLanguage(c){}
+
+ bool operator==(const Dictionary &other) const {
+ return mLanguage == other.mLanguage && mEntries == other.mEntries;
+ }
+
+ std::string language() const { return mLanguage; }
+
+ void setEntries(const std::vector<std::string> &e){ mEntries = e; }
+ std::vector<std::string> entries() const { return mEntries; }
+private:
+ std::string mLanguage;
+ std::vector<std::string> mEntries;
+};
+
+struct CategoryColor {
+ CategoryColor(){}
+ CategoryColor(const std::string &c): mCategory(c) {}
+
+ bool operator==(const CategoryColor &other) const {
+ return mCategory == other.mCategory && mColor == other.mColor && mSubcategories == other.mSubcategories;
+ }
+
+ std::string category() const { return mCategory; }
+
+ void setColor(const std::string &c) { mColor = c; }
+ std::string color() const { return mColor; }
+
+ void setSubcategories(const std::vector<CategoryColor> &c) { mSubcategories = c; }
+ std::vector<CategoryColor> subcategories() const { return mSubcategories; }
+private:
+ std::string mCategory;
+ std::string mColor;
+ std::vector<CategoryColor> mSubcategories;
+};
+
+class Configuration {
+public:
+ Configuration();
+ Configuration(const std::vector<CategoryColor> &);
+ Configuration(const Dictionary &);
+ Configuration(const Configuration &);
+ ~Configuration();
+ void operator=(const Configuration &);
+
+ bool isValid() const;
+
+ void setUid(const std::string &);
+ std::string uid() const;
+
+ void setCreated(const cDateTime &);
+ cDateTime created() const;
+
+ void setLastModified(const cDateTime &);
+ cDateTime lastModified() const;
+
+ enum ConfigurationType {
+ Invalid,
+ TypeDictionary,
+ TypeCategoryColor
+ };
+ ConfigurationType type() const;
+ std::vector<CategoryColor> categoryColor() const;
+ Dictionary dictionary() const;
+private:
+ struct Private;
+ boost::scoped_ptr<Private> d;
+};
+
+} //Namespace
+
+#endif // KOLABCONFIGURATION_H
diff --git a/src/containers/kolabcontact.cpp b/src/containers/kolabcontact.cpp
new file mode 100644
index 0000000..528b13d
--- /dev/null
+++ b/src/containers/kolabcontact.cpp
@@ -0,0 +1,506 @@
+/*
+ * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "kolabcontact.h"
+
+namespace Kolab {
+
+struct DistList::Private
+{
+ Private() {}
+
+ std::string uid;
+ cDateTime lastModified;
+ std::vector< std::string > categories;
+
+ std::string name;
+ std::vector<ContactReference> members;
+ std::vector<CustomProperty> customProperties;
+};
+
+DistList::DistList()
+: d(new DistList::Private())
+{
+
+}
+
+DistList::DistList(const DistList &other)
+: d(new DistList::Private())
+{
+ *d = *other.d;
+}
+
+DistList::~DistList()
+{
+
+}
+
+void DistList::operator=(const Kolab::DistList &other)
+{
+ *d = *other.d;
+}
+
+bool DistList::isValid() const
+{
+ return !d->uid.empty();
+}
+
+void DistList::setUid(const std::string &uid)
+{
+ d->uid = uid;
+}
+
+std::string DistList::uid() const
+{
+ return d->uid;
+}
+
+void DistList::setLastModified(const Kolab::cDateTime &dt)
+{
+ d->lastModified = dt;
+}
+
+cDateTime DistList::lastModified() const
+{
+ return d->lastModified;
+}
+
+void DistList::setName(const std::string &name)
+{
+ d->name = name;
+}
+
+std::string DistList::name() const
+{
+ return d->name;
+}
+
+void DistList::setMembers(const std::vector< ContactReference > &members)
+{
+ d->members = members;
+}
+
+std::vector< ContactReference > DistList::members() const
+{
+ return d->members;
+}
+
+void DistList::setCustomProperties(const std::vector< CustomProperty >& c)
+{
+ d->customProperties = c;
+}
+
+std::vector< CustomProperty > DistList::customProperties() const
+{
+ return d->customProperties;
+}
+
+
+
+
+
+
+struct Contact::Private
+{
+ Private()
+ : addressPreferredIndex(-1),
+ gender(NotSet),
+ telephonesPreferredIndex(-1),
+ imAddressPreferredIndex(-1),
+ emailAddressPreferredIndex(-1)
+ {}
+
+ std::string uid;
+ cDateTime created;
+ cDateTime lastModified;
+ std::vector< std::string > categories;
+
+ std::string name;
+ NameComponents nameComponents;
+ std::string note;
+ std::string freeBusyUrl;
+ std::vector< std::string > titles;
+ std::vector<Affiliation> affiliations;
+ std::vector<Url> urls;
+ std::vector<Address> addresses;
+ int addressPreferredIndex;
+ std::vector<std::string> nickNames;
+ std::vector<Related> relateds;
+ cDateTime bDay;
+ cDateTime anniversary;
+ std::string photo;
+ std::string photoMimetype;
+ Gender gender;
+ std::vector<std::string> languages;
+ std::vector<Telephone> telephones;
+ int telephonesPreferredIndex;
+ std::vector<std::string> imAddresses;
+ int imAddressPreferredIndex;
+ std::vector<std::string> emailAddresses;
+ int emailAddressPreferredIndex;
+ std::vector<Geo> gpsPos;
+ std::vector<Key> keys;
+ Crypto crypto;
+ std::vector<CustomProperty> customProperties;
+};
+
+Contact::Contact()
+: d(new Contact::Private())
+{
+
+}
+
+Contact::Contact(const Contact &other)
+: d(new Contact::Private())
+{
+ *d = *other.d;
+}
+
+Contact::~Contact()
+{
+
+}
+
+void Contact::operator=(const Kolab::Contact &other)
+{
+ *d = *other.d;
+}
+
+bool Contact::isValid() const
+{
+ return !d->uid.empty();
+}
+
+void Contact::setUid(const std::string &uid)
+{
+ d->uid = uid;
+}
+
+std::string Contact::uid() const
+{
+ return d->uid;
+}
+
+void Contact::setLastModified(const Kolab::cDateTime &dt)
+{
+ d->lastModified = dt;
+}
+
+cDateTime Contact::lastModified() const
+{
+ return d->lastModified;
+}
+
+void Contact::setCategories(const std::vector< std::string > &cat)
+{
+ d->categories = cat;
+}
+
+void Contact::addCategory(const std::string &cat)
+{
+ d->categories.push_back(cat);
+}
+
+std::vector< std::string > Contact::categories() const
+{
+ return d->categories;
+}
+
+void Contact::setName(const std::string &name)
+{
+ d->name = name;
+}
+
+std::string Contact::name() const
+{
+ return d->name;
+}
+
+void Contact::setNameComponents(const Kolab::NameComponents &nc)
+{
+ d->nameComponents = nc;
+}
+
+NameComponents Contact::nameComponents() const
+{
+ return d->nameComponents;
+}
+
+void Contact::setNote(const std::string ¬e)
+{
+ d->note = note;
+}
+
+std::string Contact::note() const
+{
+ return d->note;
+}
+
+void Contact::setFreeBusyUrl(const std::string &url)
+{
+ d->freeBusyUrl = url;
+}
+
+std::string Contact::freeBusyUrl() const
+{
+ return d->freeBusyUrl;
+}
+
+void Contact::setTitles(const std::vector< std::string >& titles)
+{
+ d->titles = titles;
+}
+
+std::vector< std::string > Contact::titles() const
+{
+ return d->titles;
+}
+
+
+void Contact::setAffiliations(const std::vector< Affiliation > &a)
+{
+ d->affiliations = a;
+}
+
+std::vector< Affiliation > Contact::affiliations() const
+{
+ return d->affiliations;
+}
+
+void Contact::setUrls(const std::vector<Url> &urls)
+{
+ d->urls = urls;
+}
+
+std::vector< Url > Contact::urls() const
+{
+ return d->urls;
+}
+
+void Contact::setAddresses(const std::vector< Address > &ad, int preferred)
+{
+ d->addresses = ad;
+ d->addressPreferredIndex = preferred;
+}
+
+std::vector< Address > Contact::addresses() const
+{
+ return d->addresses;
+}
+
+int Contact::addressPreferredIndex() const
+{
+ return d->addressPreferredIndex;
+}
+
+
+void Contact::setNickNames(const std::vector< std::string > &n)
+{
+ d->nickNames = n;
+}
+
+std::vector< std::string > Contact::nickNames() const
+{
+ return d->nickNames;
+}
+
+void Contact::setRelateds(const std::vector< Related > &relateds)
+{
+ d->relateds = relateds;
+}
+
+std::vector< Related > Contact::relateds() const
+{
+ return d->relateds;
+}
+
+void Contact::setBDay(const Kolab::cDateTime &bday)
+{
+ d->bDay = bday;
+}
+
+cDateTime Contact::bDay() const
+{
+ return d->bDay;
+}
+
+void Contact::setAnniversary(const Kolab::cDateTime& dt)
+{
+ d->anniversary = dt;
+}
+
+cDateTime Contact::anniversary() const
+{
+ return d->anniversary;
+}
+
+void Contact::setPhoto(const std::string& data, const std::string& mimetype)
+{
+ d->photo = data;
+ d->photoMimetype = mimetype;
+}
+
+std::string Contact::photo() const
+{
+ return d->photo;
+}
+
+std::string Contact::photoMimetype() const
+{
+ return d->photoMimetype;
+}
+
+void Contact::setGender(Contact::Gender g)
+{
+ d->gender = g;
+}
+
+Contact::Gender Contact::gender() const
+{
+ return d->gender;
+}
+
+void Contact::setLanguages(const std::vector< std::string >& l)
+{
+ d->languages = l;
+}
+
+std::vector< std::string > Contact::languages() const
+{
+ return d->languages;
+}
+
+void Contact::setTelephones(const std::vector< Telephone >& tel, int preferredIndex)
+{
+ d->telephonesPreferredIndex = preferredIndex;
+ d->telephones = tel;
+}
+
+std::vector< Telephone > Contact::telephones() const
+{
+ return d->telephones;
+}
+
+int Contact::telephonesPreferredIndex() const
+{
+ return d->telephonesPreferredIndex;
+}
+
+void Contact::setIMaddresses(const std::vector< std::string > &adr, int preferredIndex)
+{
+ d->imAddresses = adr;
+ d->imAddressPreferredIndex = preferredIndex;
+}
+
+std::vector< std::string > Contact::imAddresses() const
+{
+ return d->imAddresses;
+}
+
+int Contact::imAddressPreferredIndex() const
+{
+ return d->imAddressPreferredIndex;
+}
+
+void Contact::setEmailAddresses(const std::vector< std::string >& email, int preferredIndex)
+{
+ d->emailAddresses = email;
+ d->emailAddressPreferredIndex = preferredIndex;
+}
+
+std::vector< std::string > Contact::emailAddresses() const
+{
+ return d->emailAddresses;
+}
+
+int Contact::emailAddressPreferredIndex() const
+{
+ return d->emailAddressPreferredIndex;
+}
+
+void Contact::setGPSpos(const std::vector< Geo >& pos)
+{
+ d->gpsPos = pos;
+}
+
+std::vector< Geo > Contact::gpsPos() const
+{
+ return d->gpsPos;
+}
+
+void Contact::setKeys(const std::vector<Key> &keys)
+{
+ d->keys = keys;
+}
+
+std::vector<Key> Contact::keys() const
+{
+ return d->keys;
+}
+
+void Contact::setCrypto(const Kolab::Crypto& c)
+{
+ d->crypto = c;
+}
+
+Crypto Contact::crypto() const
+{
+ return d->crypto;
+}
+
+void Contact::setCustomProperties(const std::vector< CustomProperty >& c)
+{
+ d->customProperties = c;
+}
+
+std::vector< CustomProperty > Contact::customProperties() const
+{
+ return d->customProperties;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+} //Namespace
+
diff --git a/src/containers/kolabcontact.h b/src/containers/kolabcontact.h
new file mode 100644
index 0000000..86306ba
--- /dev/null
+++ b/src/containers/kolabcontact.h
@@ -0,0 +1,412 @@
+/*
+ * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef KOLABCONTACT_H
+#define KOLABCONTACT_H
+
+#include <string>
+#include <vector>
+#include <boost/scoped_ptr.hpp>
+#include "kolabcontainers.h"
+
+namespace Kolab {
+
+struct NameComponents {
+ bool operator==(const NameComponents &other) const { return mSurnames == other.mSurnames &&
+ mGiven == other.mGiven &&
+ mAdditional == other.mAdditional &&
+ mPrefixes == other.mPrefixes &&
+ mSuffixes == other.mSuffixes;
+ };
+ void setSurnames(const std::vector<std::string> &s) { mSurnames = s; };
+ std::vector<std::string> surnames() const { return mSurnames; };
+ void setGiven(const std::vector<std::string> &s) { mGiven = s; };
+ std::vector<std::string> given() const { return mGiven; };
+ void setAdditional(const std::vector<std::string> &s) { mAdditional = s; };
+ std::vector<std::string> additional() const { return mAdditional; };
+ void setPrefixes(const std::vector<std::string> &s) { mPrefixes = s; };
+ std::vector<std::string> prefixes() const { return mPrefixes; };
+ void setSuffixes(const std::vector<std::string> &s) { mSuffixes = s; };
+ std::vector<std::string> suffixes() const { return mSuffixes; };
+ bool isValid() const { return !(mSurnames.empty() && mGiven.empty() && mAdditional.empty() && mPrefixes.empty() && mSuffixes.empty()); };
+private:
+ std::vector<std::string> mSurnames;
+ std::vector<std::string> mGiven;
+ std::vector<std::string> mAdditional;
+ std::vector<std::string> mPrefixes;
+ std::vector<std::string> mSuffixes;
+};
+
+struct Related {
+
+ enum DescriptionType {
+ Invalid,
+ Text,
+ Uid
+ };
+ Related(): mType(Invalid), mRelationType(NoRelation) {};
+ Related(DescriptionType t, const std::string &textOrUri, int relationType = NoRelation)
+ : mType(t), mRelationType(relationType)
+ {
+ if (t == Text) {
+ mText = textOrUri;
+ } else {
+ mUri = textOrUri;
+ }
+ };
+ bool operator==(const Related &other) const { return mType == other.mType &&
+ mUri == other.mUri &&
+ mText == other.mText &&
+ mRelationType == other.mRelationType;
+ };
+ DescriptionType type() const { return mType; };
+ std::string uri() const { return mUri; };
+ std::string text() const { return mText; };
+ enum RelationType {
+ NoRelation = 0,
+ Child = 0x01,
+ Spouse = 0x02,
+ Manager = 0x04,
+ Assistant = 0x08,
+ };
+ void setRelationTypes(int t) { mRelationType = t; };
+ int relationTypes() const { return mRelationType; };
+private:
+ DescriptionType mType;
+ std::string mUri;
+ std::string mText;
+ int mRelationType;
+};
+
+struct Address {
+
+ Address(): mTypes(0) {};
+ enum Type {
+ Work = 0x01,
+ Home = 0x02
+ };
+ bool operator==(const Address &other) const { return mTypes == other.mTypes &&
+ mLabel == other.mLabel &&
+ mStreet == other.mStreet &&
+ mLocality == other.mLocality &&
+ mRegion == other.mRegion &&
+ mCode == other.mCode &&
+ mCountry == other.mCountry;
+ };
+ void setTypes(int t) { mTypes = t; };
+ int types() const { return mTypes; };
+
+ void setLabel(const std::string &s) { mLabel = s; };
+ std::string label() const { return mLabel; }
+
+ void setStreet(const std::string &s) { mStreet = s; };
+ std::string street() const { return mStreet; };
+
+ void setLocality(const std::string &s) { mLocality = s; };
+ std::string locality() const { return mLocality; };
+
+ void setRegion(const std::string &s) { mRegion = s; };
+ std::string region() const { return mRegion; };
+
+ void setCode(const std::string &s) { mCode = s; };
+ std::string code() const { return mCode; };
+
+ void setCountry(const std::string &s) { mCountry = s; };
+ std::string country() const { return mCountry; };
+private:
+ int mTypes;
+ std::string mLabel;
+ std::string mStreet;
+ std::string mLocality;
+ std::string mRegion;
+ std::string mCode;
+ std::string mCountry;
+};
+
+struct Affiliation {
+ bool operator==(const Affiliation &other) const { return mOrg == other.mOrg &&
+ mOrgUnits == other.mOrgUnits &&
+ mLogo == other.mLogo &&
+ mLogoMimetype == other.mLogoMimetype &&
+ mRoles == other.mRoles &&
+ mRelateds == other.mRelateds &&
+ mOffices == other.mOffices;
+ };
+ void setOrganisation(const std::string &org) { mOrg = org; };
+ std::string organisation() const { return mOrg; };
+ void setOrganisationalUnits(const std::vector<std::string> &units) { mOrgUnits = units; };
+ std::vector<std::string> organisationalUnits() const { return mOrgUnits; };
+ void setLogo(const std::string &l, const std::string mimetype) { mLogo = l; mLogoMimetype = mimetype; };
+ std::string logo() const { return mLogo; };
+ std::string logoMimetype() const { return mLogoMimetype; };
+
+ void setRoles(const std::vector<std::string> &roles) { mRoles = roles; };
+ std::vector<std::string> roles() const { return mRoles; };
+ void setRelateds(const std::vector<Related> &relateds) { mRelateds = relateds; };
+ std::vector<Related> relateds() const { return mRelateds; };
+ void setAddresses(const std::vector<Address> &offices) { mOffices = offices; };
+ std::vector<Address> addresses() const { return mOffices; };
+private:
+ std::string mOrg;
+ std::vector<std::string> mOrgUnits;
+ std::string mLogo;
+ std::string mLogoMimetype;
+ std::vector<std::string> mRoles;
+ std::vector<Related> mRelateds;
+ std::vector<Address> mOffices;
+};
+
+struct Telephone {
+ enum Type {
+ Work = 0x01,
+ Home = 0x02,
+ Text = 0x04,
+ Voice = 0x08,
+ Fax = 0x10,
+ Cell = 0x20,
+ Video = 0x40,
+ Pager = 0x80,
+ Textphone = 0x100,
+ Car = 0x200
+ };
+ Telephone(): mType(0){};
+ bool operator==(const Telephone &other) const { return mNumber == other.mNumber &&
+ mType == other.mType;
+ };
+ void setTypes(int t) { mType = t; };
+ int types() const { return mType; };
+ void setNumber(const std::string &n) { mNumber = n; };
+ std::string number() const { return mNumber; };
+private:
+ std::string mNumber;
+ int mType;
+};
+
+struct Crypto {
+ enum CryptoTypes {
+ PGPinline = 0x01,
+ PGPmime = 0x02,
+ SMIME = 0x04,
+ SMIMEopaque = 0x08
+ };
+
+ enum CryptoPref {
+ Ask,
+ Never,
+ Always,
+ IfPossible
+ };
+ Crypto(): mCryptoTypes(0), mSignPref(Ask), mEncryptPref(Ask){};
+ bool operator==(const Crypto &other) const { return mCryptoTypes == other.mCryptoTypes &&
+ mSignPref == other.mSignPref &&
+ mEncryptPref == other.mEncryptPref; };
+ bool isValid() const { return mCryptoTypes; };
+
+ void setAllowed(int cryptoTypes) { mCryptoTypes = cryptoTypes; };
+ int allowed() const { return mCryptoTypes; };
+ void setSignPref(CryptoPref p) { mSignPref = p; };
+ CryptoPref signPref() const { return mSignPref; };
+ void setEncryptPref(CryptoPref p) { mEncryptPref = p; };
+ CryptoPref encryptPref() const { return mEncryptPref; };
+private:
+ int mCryptoTypes;
+ CryptoPref mSignPref;
+ CryptoPref mEncryptPref;
+};
+
+struct Geo {
+ Geo(): latitude(0.0), longitude(0.0) {};
+ Geo(double lat, double lon)
+ : latitude(lat), longitude(lon) {};
+
+ bool operator==(const Geo &other) const{ return (longitude == other.longitude && latitude == other.latitude);};
+ double latitude;
+ double longitude;
+};
+
+struct Url {
+ enum UrlTypes {
+ NoType = 0,
+ Blog
+ };
+ Url(): mType(NoType) {};
+ Url(const std::string &u, int t = NoType): mUrl(u), mType(t) {};
+
+ bool operator==(const Url &other) const{ return (mType == other.mType && mUrl == other.mUrl);};
+
+ int type() const { return mType; };
+ std::string url() const { return mUrl; };
+private:
+ std::string mUrl;
+ int mType;
+};
+
+struct Key {
+ enum KeyType {
+ Invalid,
+ PGP,
+ PKCS7_MIME
+ };
+ Key(): keytype(Invalid) {};
+ Key(const std::string &k, KeyType type)
+ : mKey(k), keytype(type) {};
+
+ bool operator==(const Key &other) const{ return (mKey == other.mKey && keytype == other.keytype);};
+
+ KeyType type() const { return keytype; };
+ std::string key() const { return mKey; };
+
+private:
+ std::string mKey;
+ KeyType keytype;
+};
+
+
+class DistList {
+public:
+ DistList();
+ ~DistList();
+ DistList(const DistList &);
+ void operator=(const DistList &);
+
+ bool isValid() const;
+
+ void setUid(const std::string &);
+ std::string uid() const;
+
+ void setLastModified(const cDateTime &);
+ cDateTime lastModified() const;
+
+ void setName(const std::string &);
+ std::string name() const;
+
+ void setMembers(const std::vector<ContactReference> &);
+ std::vector<ContactReference> members() const;
+
+ void setCustomProperties(const std::vector<CustomProperty> &);
+ std::vector<CustomProperty> customProperties() const;
+
+private:
+ struct Private;
+ boost::scoped_ptr<Private> d;
+};
+
+class Contact {
+public:
+ Contact();
+ ~Contact();
+ Contact(const Contact &);
+ void operator=(const Contact &);
+
+ bool isValid() const;
+
+ void setUid(const std::string &);
+ std::string uid() const;
+
+ void setLastModified(const cDateTime &);
+ cDateTime lastModified() const;
+
+ void setCategories(const std::vector<std::string> &);
+ void addCategory(const std::string &);
+ std::vector<std::string> categories() const;
+
+ void setName(const std::string &);
+ std::string name() const;
+
+ void setNameComponents(const NameComponents &);
+ NameComponents nameComponents() const;
+
+ void setNote(const std::string &);
+ std::string note() const;
+
+ void setFreeBusyUrl(const std::string &);
+ std::string freeBusyUrl() const;
+
+ void setTitles(const std::vector<std::string> &titles);
+ std::vector<std::string> titles() const;
+
+ void setAffiliations(const std::vector<Affiliation> &);
+ std::vector<Affiliation> affiliations() const;
+
+ void setUrls(const std::vector<Url> &);
+ std::vector<Url> urls() const;
+
+ void setAddresses(const std::vector<Address> &, int preferred = -1);
+ std::vector<Address> addresses() const;
+ int addressPreferredIndex() const;
+
+ void setNickNames(const std::vector< std::string > &);
+ std::vector< std::string > nickNames() const;
+
+ void setRelateds(const std::vector<Related> &);
+ std::vector<Related> relateds() const;
+
+ void setBDay(const cDateTime &);
+ cDateTime bDay() const;
+
+ void setAnniversary(const cDateTime &);
+ cDateTime anniversary() const;
+
+ void setPhoto(const std::string &data, const std::string &mimetype);
+ std::string photo() const;
+ std::string photoMimetype() const;
+
+ enum Gender {
+ NotSet,
+ NotSpecified,
+ Male,
+ Female
+ };
+
+ void setGender(Gender);
+ Gender gender() const;
+
+ void setLanguages(const std::vector<std::string> &);
+ std::vector<std::string> languages() const;
+
+ void setTelephones(const std::vector<Telephone> &, int preferredIndex = -1);
+ std::vector<Telephone> telephones() const;
+ int telephonesPreferredIndex() const;
+
+ void setIMaddresses(const std::vector<std::string> &, int preferredIndex = -1);
+ std::vector<std::string> imAddresses() const;
+ int imAddressPreferredIndex() const;
+
+ void setEmailAddresses(const std::vector<std::string> &, int preferredIndex = -1);
+ std::vector<std::string> emailAddresses() const;
+ int emailAddressPreferredIndex() const;
+
+ void setGPSpos(const std::vector<Geo> &);
+ std::vector<Geo> gpsPos() const;
+
+ void setKeys(const std::vector<Key> &);
+ std::vector<Key> keys() const;
+
+ void setCrypto(const Crypto &);
+ Crypto crypto() const;
+
+ void setCustomProperties(const std::vector<CustomProperty> &);
+ std::vector<CustomProperty> customProperties() const;
+
+private:
+ struct Private;
+ boost::scoped_ptr<Private> d;
+};
+
+} //Namespace
+
+#endif // KOLABCONTACT_H
diff --git a/src/containers/kolabcontainers.cpp b/src/containers/kolabcontainers.cpp
new file mode 100644
index 0000000..47c76e3
--- /dev/null
+++ b/src/containers/kolabcontainers.cpp
@@ -0,0 +1,767 @@
+/*
+ * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "kolabcontainers.h"
+#include "incidence_p.h"
+
+namespace Kolab {
+
+struct cDateTime::Private {
+ Private()
+ : year(-1),
+ month(-1),
+ day(-1),
+ hour(-1),
+ minute(-1),
+ second(-1),
+ isUtc(false){}
+
+ int year;
+ int month;
+ int day;
+ int hour;
+ int minute;
+ int second;
+ bool isUtc;
+ std::string timezone;
+};
+
+cDateTime::cDateTime()
+: d(new cDateTime::Private())
+{
+
+}
+
+cDateTime::cDateTime(int year, int month, int day, int hour, int minute, int second, bool isUtc)
+: d(new cDateTime::Private())
+{
+ d->year = year;
+ d->month = month;
+ d->day = day;
+ d->hour = hour;
+ d->minute = minute;
+ d->second = second;
+ d->isUtc = isUtc;
+}
+
+cDateTime::cDateTime(const std::string& timezone, int year, int month, int day, int hour, int minute, int second)
+: d(new cDateTime::Private())
+{
+ d->year = year;
+ d->month = month;
+ d->day = day;
+ d->hour = hour;
+ d->minute = minute;
+ d->second = second;
+ d->timezone = timezone;
+}
+
+cDateTime::cDateTime(int year, int month, int day)
+: d(new cDateTime::Private())
+{
+ d->year = year;
+ d->month = month;
+ d->day = day;
+}
+
+cDateTime::cDateTime(const Kolab::cDateTime &other)
+: d(new cDateTime::Private())
+{
+ *d = *other.d;
+}
+
+cDateTime::~cDateTime()
+{
+
+}
+
+
+void cDateTime::operator=(const Kolab::cDateTime &other)
+{
+ *d = *other.d;
+}
+
+bool cDateTime::operator==(const Kolab::cDateTime &other) const
+{
+ if ( d->year == other.year() &&
+ d->month == other.month() &&
+ d->day == other.day() &&
+ d->hour == other.hour() &&
+ d->minute == other.minute() &&
+ d->second== other.second() &&
+ d->isUtc== other.isUTC() &&
+ d->timezone== other.timezone()) {
+ return true;
+ }
+ return false;
+}
+
+
+
+int cDateTime::year() const
+{
+ return d->year;
+}
+
+int cDateTime::month() const
+{
+ return d->month;
+}
+
+int cDateTime::day() const
+{
+ return d->day;
+}
+
+int cDateTime::hour() const
+{
+ return d->hour;
+}
+
+int cDateTime::minute() const
+{
+ return d->minute;
+}
+
+int cDateTime::second() const
+{
+ return d->second;
+}
+
+bool cDateTime::isDateOnly() const
+{
+ if ((d->hour < 0) && (d->minute < 0) && (d->second < 0)) {
+ return true;
+ }
+ return false;
+}
+
+void cDateTime::setDate(int year, int month, int day)
+{
+ d->year = year;
+ d->month = month;
+ d->day = day;
+}
+void cDateTime::setTime(int hour, int minute, int second)
+{
+ d->hour = hour;
+ d->minute = minute;
+ d->second = second;
+}
+void cDateTime::setTimezone(const std::string &tz)
+{
+ d->timezone = tz;
+}
+void cDateTime::setUTC(bool utc)
+{
+ d->isUtc = utc;
+}
+
+bool cDateTime::isUTC() const
+{
+ return d->isUtc;
+}
+
+std::string cDateTime::timezone() const
+{
+ return d->timezone;
+}
+
+bool cDateTime::isValid() const
+{
+ return (d->year >= 0 && d->month >= 0 && d->day >= 0);
+}
+
+struct RecurrenceRule::Private
+{
+ Private()
+ : freq(FreqNone),
+ weekstart(Monday),
+ count(-1),
+ interval(1){};
+
+ Frequency freq;
+ Weekday weekstart;
+ cDateTime end;
+ int count;
+ int interval;
+ std::vector<int> bysecond;
+ std::vector<int> byminute;
+ std::vector<int> byhour;
+ std::vector<DayPos> byday;
+ std::vector<int> bymonthday;
+ std::vector<int> byyearday;
+ std::vector<int> byweekno;
+ std::vector<int> bymonth;
+};
+
+RecurrenceRule::RecurrenceRule()
+: d(new RecurrenceRule::Private)
+{
+
+}
+
+RecurrenceRule::RecurrenceRule(const Kolab::RecurrenceRule &other)
+: d(new RecurrenceRule::Private)
+{
+ *d = *other.d;
+}
+
+void RecurrenceRule::operator=(const Kolab::RecurrenceRule &other)
+{
+ *d = *other.d;
+}
+
+bool RecurrenceRule::operator==(const Kolab::RecurrenceRule &other) const
+{
+ if ( d->freq == other.frequency() &&
+ d->weekstart == other.weekStart() &&
+ d->end == other.end() &&
+ d->count == other.count() &&
+ d->interval == other.interval() &&
+ d->bysecond == other.bysecond() &&
+ d->byminute == other.byminute() &&
+ d->byhour == other.byhour() &&
+ d->byday == other.byday() &&
+ d->bymonthday == other.bymonthday() &&
+ d->byyearday == other.byyearday() &&
+ d->byweekno == other.byweekno() &&
+ d->bymonth == other.bymonth()) {
+ return true;
+ }
+ return false;
+}
+
+RecurrenceRule::~RecurrenceRule()
+{
+
+}
+
+void RecurrenceRule::setFrequency(RecurrenceRule::Frequency freq)
+{
+ d->freq = freq;
+}
+
+RecurrenceRule::Frequency RecurrenceRule::frequency() const
+{
+ return d->freq;
+}
+
+void RecurrenceRule::setWeekStart(Kolab::Weekday weekstart)
+{
+ d->weekstart = weekstart;
+}
+
+Kolab::Weekday RecurrenceRule::weekStart() const
+{
+ return d->weekstart;
+}
+
+void RecurrenceRule::setEnd(const Kolab::cDateTime &end)
+{
+ d->end = end;
+}
+
+cDateTime RecurrenceRule::end() const
+{
+ return d->end;
+}
+
+void RecurrenceRule::setCount(int count)
+{
+ d->count = count;
+}
+
+int RecurrenceRule::count() const
+{
+ return d->count;
+}
+
+void RecurrenceRule::setInterval(int interval)
+{
+ d->interval = interval;
+}
+
+int RecurrenceRule::interval() const
+{
+ return d->interval;
+}
+
+void RecurrenceRule::setBysecond(const std::vector< int >&by)
+{
+ d->bysecond = by;
+}
+
+
+std::vector< int > RecurrenceRule::bysecond() const
+{
+ return d->bysecond;
+}
+
+void RecurrenceRule::setByminute(const std::vector< int > &by)
+{
+ d->byminute = by;
+}
+
+std::vector< int > RecurrenceRule::byminute() const
+{
+ return d->byminute;
+}
+
+void RecurrenceRule::setByhour(const std::vector< int > &by)
+{
+ d->byhour = by;
+}
+
+std::vector< int > RecurrenceRule::byhour() const
+{
+ return d->byhour;
+}
+
+void RecurrenceRule::setByday(const std::vector< DayPos > &by)
+{
+ d->byday = by;
+}
+
+std::vector< DayPos > RecurrenceRule::byday() const
+{
+ return d->byday;
+}
+
+void RecurrenceRule::setBymonthday(const std::vector< int > &by)
+{
+ d->bymonthday = by;
+}
+
+std::vector< int > RecurrenceRule::bymonthday() const
+{
+ return d->bymonthday;
+}
+
+void RecurrenceRule::setByyearday(const std::vector< int > &by)
+{
+ d->byyearday = by;
+}
+
+std::vector< int > RecurrenceRule::byyearday() const
+{
+ return d->byyearday;
+}
+
+void RecurrenceRule::setByweekno(const std::vector< int > &by)
+{
+ d->byweekno = by;
+}
+
+std::vector< int > RecurrenceRule::byweekno() const
+{
+ return d->byweekno;
+}
+
+void RecurrenceRule::setBymonth(const std::vector< int > &by)
+{
+ d->bymonth = by;
+}
+
+std::vector< int > RecurrenceRule::bymonth() const
+{
+ return d->bymonth;
+}
+
+bool RecurrenceRule::isValid() const
+{
+ if (d->freq == FreqNone) {
+ return false;
+ }
+ return true;
+}
+
+
+
+struct Attendee::Private
+{
+ Private()
+ : partStat(PartNeedsAction),
+ role(Required),
+ rsvp(false),
+ cutype(CutypeIndividual)
+ {};
+
+ ContactReference contact;
+ PartStatus partStat;
+ Role role;
+ bool rsvp;
+ std::vector<ContactReference> delegatedTo;
+ std::vector<ContactReference> delegatedFrom;
+ Cutype cutype;
+};
+
+Attendee::Attendee()
+: d(new Attendee::Private)
+{
+
+}
+
+Attendee::Attendee(const ContactReference& contact)
+: d(new Attendee::Private)
+{
+ d->contact = contact;
+}
+
+Attendee::Attendee(const Kolab::Attendee &other)
+: d(new Attendee::Private)
+{
+ *d = *other.d;
+}
+
+void Attendee::operator=(const Kolab::Attendee &other)
+{
+ *d = *other.d;
+}
+
+Attendee::~Attendee()
+{
+
+}
+
+bool Attendee::operator==(const Kolab::Attendee &other) const
+{
+ if ( d->contact == other.contact() &&
+ d->partStat == other.partStat() &&
+ d->role == other.role() &&
+ d->rsvp == other.rsvp() &&
+ d->delegatedTo == other.delegatedTo() &&
+ d->delegatedFrom == other.delegatedFrom() &&
+ d->cutype == other.cutype()
+ ) {
+ return true;
+ }
+ return false;
+}
+
+bool Attendee::isValid() const
+{
+ return d->contact.isValid();
+};
+
+void Attendee::setContact(const ContactReference &c)
+{
+ d->contact = c;
+}
+
+ContactReference Attendee::contact() const
+{
+ return d->contact;
+}
+
+
+void Attendee::setPartStat(PartStatus partStat)
+{
+ d->partStat = partStat;
+}
+
+PartStatus Attendee::partStat() const
+{
+ return d->partStat;
+}
+
+void Attendee::setRole(Role role)
+{
+ d->role = role;
+}
+
+Role Attendee::role() const
+{
+ return d->role;
+}
+
+void Attendee::setRSVP(bool rsvp)
+{
+ d->rsvp = rsvp;
+}
+
+bool Attendee::rsvp() const
+{
+ return d->rsvp;
+}
+
+void Attendee::setDelegatedTo(const std::vector< ContactReference > &del)
+{
+ d->delegatedTo = del;
+}
+
+std::vector< ContactReference > Attendee::delegatedTo() const
+{
+ return d->delegatedTo;
+}
+
+void Attendee::setDelegatedFrom(const std::vector< ContactReference > &del)
+{
+ d->delegatedFrom = del;
+}
+
+std::vector< ContactReference > Attendee::delegatedFrom() const
+{
+ return d->delegatedFrom;
+}
+
+void Attendee::setCutype(Cutype type)
+{
+ d->cutype = type;
+}
+
+Cutype Attendee::cutype() const
+{
+ return d->cutype;
+}
+
+
+struct Attachment::Private
+{
+ std::string uri;
+ std::string data;
+ std::string mimetype;
+ std::string label;
+};
+
+Attachment::Attachment()
+: d(new Attachment::Private)
+{
+}
+
+Attachment::Attachment(const Kolab::Attachment &other)
+: d(new Attachment::Private)
+{
+ *d = *other.d;
+}
+
+void Attachment::operator=(const Kolab::Attachment &other)
+{
+ *d = *other.d;
+}
+
+Attachment::~Attachment()
+{
+}
+
+bool Attachment::operator==(const Kolab::Attachment &other) const
+{
+ return ( d->uri == other.uri() &&
+ d->data == other.data() &&
+ d->label == other.label() &&
+ d->mimetype == other.mimetype() );
+}
+
+void Attachment::setUri(const std::string &uri, const std::string& mimetype)
+{
+ d->uri = uri;
+ d->mimetype = mimetype;
+}
+
+std::string Attachment::uri() const
+{
+ return d->uri;
+}
+
+std::string Attachment::mimetype() const
+{
+ return d->mimetype;
+}
+
+void Attachment::setLabel(const std::string &label)
+{
+ d->label = label;
+}
+
+std::string Attachment::label() const
+{
+ return d->label;
+}
+
+void Attachment::setData(const std::string &data, const std::string& mimetype)
+{
+ d->data = data;
+ d->mimetype = mimetype;
+}
+
+std::string Attachment::data() const
+{
+ return d->data;
+}
+
+bool Attachment::isValid() const
+{
+ return !d->mimetype.empty(); //TODO use isValid variable
+}
+
+
+
+struct Alarm::Private
+{
+ Private(): relativeTo(Start),
+ numrepeat(0),
+ type(Alarm::InvalidAlarm) {};
+ std::string text;
+ Attachment audioFile;
+ std::string summary;
+ std::vector<ContactReference> attendees;
+ cDateTime start;
+ Duration relativeDuration;
+ Relative relativeTo;
+ Duration duration;
+ int numrepeat;
+ Type type;
+
+};
+
+Alarm::Alarm()
+: d(new Alarm::Private)
+{
+}
+
+Alarm::Alarm(const std::string &text)
+: d(new Alarm::Private)
+{
+ d->text = text;
+ d->type = DisplayAlarm;
+}
+
+
+Alarm::Alarm(const Kolab::Attachment& audio)
+: d(new Alarm::Private)
+{
+ d->audioFile = audio;
+ d->type = AudioAlarm;
+}
+
+Alarm::Alarm(const std::string& summary, const std::string& description, const std::vector<ContactReference> attendees)
+: d(new Alarm::Private)
+{
+ d->summary = summary;
+ d->text = description;
+ d->attendees = attendees;
+ d->type = EMailAlarm;
+
+}
+
+Alarm::Alarm(const Kolab::Alarm &other)
+: d(new Alarm::Private)
+{
+ *d = *other.d;
+}
+
+void Alarm::operator=(const Kolab::Alarm &other)
+{
+ *d = *other.d;
+}
+
+Alarm::~Alarm()
+{
+}
+
+bool Alarm::operator==(const Kolab::Alarm &other) const
+{
+ return ( d->text == other.description() &&
+ d->text == other.description() &&
+ d->audioFile == other.audioFile() &&
+ d->summary == other.summary() &&
+ d->attendees == other.attendees() &&
+ d->start == other.start() &&
+ d->relativeDuration == other.relativeStart() &&
+ d->relativeTo == other.relativeTo() &&
+ d->duration == other.duration() &&
+ d->numrepeat == other.numrepeat() );
+}
+
+std::string Alarm::text() const
+{
+ return d->text;
+}
+
+Attachment Alarm::audioFile() const
+{
+ return d->audioFile;
+}
+
+std::string Alarm::summary() const
+{
+ return d->summary;
+}
+
+std::string Alarm::description() const
+{
+ return d->text;
+}
+
+std::vector<ContactReference> Alarm::attendees() const
+{
+ return d->attendees;
+}
+
+void Alarm::setStart(const Kolab::cDateTime &start)
+{
+ d->start = start;
+}
+
+cDateTime Alarm::start() const
+{
+ return d->start;
+}
+
+void Alarm::setRelativeStart(const Kolab::Duration &duration, Relative relativeTo)
+{
+ d->relativeDuration = duration;
+ d->relativeTo = relativeTo;
+}
+
+Duration Alarm::relativeStart() const
+{
+ return d->relativeDuration;
+}
+
+Relative Alarm::relativeTo() const
+{
+ return d->relativeTo;
+}
+
+void Alarm::setDuration(const Kolab::Duration &duration, int numrepeat)
+{
+ d->numrepeat = numrepeat;
+ d->duration = duration;
+}
+
+Duration Alarm::duration() const
+{
+ return d->duration;
+}
+
+int Alarm::numrepeat() const
+{
+ return d->numrepeat;
+}
+
+Alarm::Type Alarm::type() const
+{
+ return d->type;
+}
+
+
+
+
+
+
+}//Namespace
diff --git a/src/containers/kolabcontainers.h b/src/containers/kolabcontainers.h
new file mode 100644
index 0000000..5f8318d
--- /dev/null
+++ b/src/containers/kolabcontainers.h
@@ -0,0 +1,408 @@
+/*
+ * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef KOLAB_CONTAINERS_H
+#define KOLAB_CONTAINERS_H
+#include <string>
+#include <vector>
+#include <boost/scoped_ptr.hpp>
+
+namespace Kolab {
+
+class cDateTime {
+public:
+ cDateTime();
+ cDateTime(int year, int month, int day, int hour, int minute, int second, bool isUtc=false);
+ cDateTime(const std::string &timezone, int year, int month, int day, int hour, int minute, int second);
+ cDateTime(int year, int month, int day);
+ ~cDateTime();
+ cDateTime(const cDateTime &);
+ void operator=(const cDateTime &);
+ bool operator==(const cDateTime &) const;
+
+
+ void setDate(int year, int month, int day);
+ int year() const;
+ int month() const;
+ int day() const;
+
+ bool isDateOnly() const;
+
+ void setTime(int hour, int minute, int second);
+ int hour() const;
+ int minute() const;
+ int second() const;
+
+ void setUTC(bool);
+ bool isUTC() const;
+ void setTimezone(const std::string &);
+ std::string timezone() const;
+
+ bool isValid() const;
+private:
+ struct Private;
+ boost::scoped_ptr<Private> d;
+};
+
+enum Classification {
+ ClassPublic,
+ ClassPrivate,
+ ClassConfidential
+};
+
+enum Status {
+ StatusUndefined,
+ StatusNeedsAction,
+ StatusCompleted,
+ StatusInProcess,
+ StatusCancelled,
+ StatusTentative,
+ StatusConfirmed,
+ StatusDraft,
+ StatusFinal
+};
+
+enum Weekday {
+ Monday,
+ Tuesday,
+ Wednesday,
+ Thursday,
+ Friday,
+ Saturday,
+ Sunday
+};
+
+struct DayPos {
+ DayPos(): mIsValid(false){};
+ DayPos(int occurrence, Weekday weekday): mOccurrence(occurrence), mWeekday(weekday), mIsValid(true){};
+ bool operator==(const DayPos &other) const { return mOccurrence == other.mOccurrence && mWeekday == other.mWeekday; };
+ int occurence() const { return mOccurrence; };
+ Weekday weekday() const { return mWeekday; };
+ bool isValid() { return mIsValid; };
+private:
+ int mOccurrence;
+ Weekday mWeekday;
+ bool mIsValid;
+};
+
+class Attachment {
+public:
+ Attachment();
+ Attachment(const Kolab::Attachment &);
+ ~Attachment();
+
+ void operator=(const Attachment &);
+ bool operator==(const Attachment &) const;
+
+ void setUri(const std::string &uri, const std::string &mimetype);
+ std::string uri() const;
+
+ ///Un-encoded binary content, Implies embedded, will be encoded
+ void setData(const std::string &, const std::string &mimetype);
+ ///Decoded binary content.
+ std::string data() const;
+ //TODO add possibility to set already encoded data and uri to be embedded as performance/convenience improvement?
+// ///Base64 encoded binary content, Implies embedded
+// void setEncodedData(const std::string &, const std::string &mimetype);
+
+ std::string mimetype() const;
+
+ ///User visible label
+ void setLabel(const std::string &);
+ std::string label() const;
+
+ bool isValid() const;
+private:
+ struct Private;
+ boost::scoped_ptr<Private> d;
+};
+
+enum Relative {
+ Start,
+ End
+};
+
+struct Duration {
+ Duration():mWeeks(0), mDays(0), mHours(0), mMinutes(0), mSeconds(0), mNegative(false), valid(false){};
+ Duration(int weeks, bool negative = false): mWeeks(weeks), mDays(0), mHours(0), mMinutes(0), mSeconds(0), mNegative(negative), valid(true){};
+ Duration(int days, int hours, int minutes, int seconds, bool negative = false): mWeeks(0), mDays(days), mHours(hours), mMinutes(minutes), mSeconds(seconds), mNegative(negative), valid(true){};
+ bool operator==(const Duration &other) const{ return (/*mWeeks == other.mWeeks &&
+ mDays == other.mDays &&
+ mHours == other.mHours &&
+ mMinutes == other.mMinutes &&
+ mSeconds == other.mSeconds &&
+ mNegative == other.mNegative &&*/
+ ( ((((mWeeks * 7 + mDays) * 24 + mHours) * 60 + mMinutes) * 60 + mSeconds) ==
+ ((((other.mWeeks * 7 + other.mDays) * 24 + other.mHours) * 60 + other.mMinutes) * 60 + other.mSeconds) ) &&
+ valid == other.valid );};
+ int weeks() const { return mWeeks; };
+ int days() const { return mDays; };
+ int hours() const { return mHours; };
+ int minutes() const { return mMinutes; };
+ int seconds() const { return mSeconds; };
+
+ bool isNegative() const { return mNegative; };
+ bool isValid() const { return valid; };
+private:
+ int mWeeks;
+ int mDays;
+ int mHours;
+ int mMinutes;
+ int mSeconds;
+ bool mNegative;
+ bool valid;
+};
+
+struct ContactReference {
+ enum ReferenceType {
+ Invalid,
+ EmailReference,
+ UidReference,
+ EmailAndUidReference
+ };
+ ContactReference(): mType(Invalid) {};
+ ///For xCal
+ ContactReference(const std::string &email, const std::string &name = std::string(), const std::string &uid = std::string()): mType(EmailAndUidReference), mEmail(email), mUid(uid), mName(name) {};
+ ///For xCard
+ ContactReference(ReferenceType type, const std::string &emailOrUID, const std::string &name = std::string()): mType(type), mName(name) {
+ if (type == EmailReference) {
+ mEmail = emailOrUID;
+ } else {
+ mUid = emailOrUID;
+ }
+ };
+ bool operator==(const ContactReference &other) const { return mEmail == other.mEmail &&
+ mName == other.mName &&
+ mUid == other.mUid;
+ };
+
+ bool isValid() const { return mType != Invalid; };
+
+ void setName(const std::string &name) { mName = name; };
+
+ std::string email() const { return mEmail; };
+ std::string uid() const { return mUid; };
+ std::string name() const { return mName; };
+
+ ReferenceType type() const { return mType; };
+
+private:
+ ReferenceType mType;
+ std::string mEmail;
+ std::string mUid;
+ std::string mName;
+};
+
+class Alarm {
+public:
+ enum Type {
+ InvalidAlarm,
+ EMailAlarm,
+ DisplayAlarm,
+ AudioAlarm
+ };
+
+ Alarm();
+ Alarm(const Alarm &);
+ ~Alarm();
+
+ void operator=(const Alarm &);
+ bool operator==(const Alarm &other) const;
+
+ ///EMail Alarm, @param attendees accepts only email + name and no uid
+ Alarm(const std::string &summary, const std::string &description, const std::vector<ContactReference> attendees);
+ std::string summary() const;
+ std::string description() const;
+ std::vector<ContactReference> attendees() const;
+
+ ///Display Alarm
+ Alarm(const std::string &text);
+ std::string text() const;
+
+ ///Audio Alarm
+ Alarm(const Attachment &audio);
+ Attachment audioFile() const;
+
+ void setRelativeStart(const Duration &, Relative);
+ Duration relativeStart() const;
+ Relative relativeTo() const;
+
+ void setStart(const cDateTime &);
+ cDateTime start() const;
+
+ void setDuration(const Duration &, int numrepeat);
+ Duration duration() const;
+ int numrepeat() const;
+
+ Type type() const;
+
+private:
+ struct Private;
+ boost::scoped_ptr<Private> d;
+};
+
+
+class RecurrenceRule {
+public:
+
+ RecurrenceRule();
+ RecurrenceRule(const RecurrenceRule &);
+ ~RecurrenceRule();
+
+ void operator=(const RecurrenceRule &);
+ bool operator==(const RecurrenceRule &other) const;
+
+ enum Frequency {
+ FreqNone,
+ Yearly,
+ Monthly,
+ Weekly,
+ Daily,
+ Hourly,
+ Minutely,
+ Secondly
+ };
+
+ void setFrequency(Frequency);
+ Frequency frequency() const;
+
+ void setWeekStart(Weekday);
+ Weekday weekStart() const;
+
+ void setEnd(const cDateTime &);
+ cDateTime end() const;
+
+ void setCount(int count);
+ int count() const;
+
+ void setInterval(int);
+ int interval() const;
+
+ void setBysecond(const std::vector<int> &);
+ std::vector<int> bysecond() const;
+
+ void setByminute(const std::vector<int> &);
+ std::vector<int> byminute() const;
+
+ void setByhour(const std::vector<int> &);
+ std::vector<int> byhour() const;
+
+ void setByday(const std::vector<DayPos> &);
+ std::vector<DayPos> byday() const;
+
+ void setBymonthday(const std::vector<int> &);
+ std::vector<int> bymonthday() const;
+
+ void setByyearday(const std::vector<int> &);
+ std::vector<int> byyearday() const;
+
+ void setByweekno(const std::vector<int> &);
+ std::vector<int> byweekno() const;
+
+ void setBymonth(const std::vector<int> &);
+ std::vector<int> bymonth() const;
+
+ bool isValid() const;
+
+private:
+ struct Private;
+ boost::scoped_ptr<Private> d;
+};
+
+
+enum PartStatus {
+ PartNeedsAction,
+ PartAccepted,
+ PartDeclined,
+ PartTentative,
+ PartDelegated
+};
+
+enum Role {
+ Required,
+ Chair,
+ Optional,
+ NonParticipant
+};
+
+enum Cutype {
+ CutypeUnknown,
+ CutypeGroup,
+ CutypeIndividual,
+ CutypeResource,
+ CutypeRoom
+};
+
+class Attendee {
+public:
+ Attendee();
+ Attendee(const ContactReference &contact);
+ Attendee(const Attendee &);
+ ~Attendee();
+
+ void operator=(const Attendee &);
+ bool operator==(const Attendee &) const;
+
+ bool isValid() const;
+
+ void setContact(const ContactReference &);
+ ContactReference contact() const;
+
+ void setPartStat(PartStatus);
+ PartStatus partStat() const;
+
+ void setRole(Role);
+ Role role() const;
+
+ void setRSVP(bool);
+ bool rsvp() const;
+
+ void setDelegatedTo(const std::vector<ContactReference> &);
+ std::vector<ContactReference> delegatedTo() const;
+
+ void setDelegatedFrom(const std::vector<ContactReference> &);
+ std::vector<ContactReference> delegatedFrom() const;
+
+ void setCutype(Cutype);
+ Cutype cutype() const;
+private:
+ struct Private;
+ boost::scoped_ptr<Private> d;
+};
+
+struct CustomProperty {
+ CustomProperty(){};
+ CustomProperty(const std::string &i, const std::string &v)
+ : identifier(i), value(v) {};
+
+ bool operator==(const CustomProperty &other) const{ return (identifier == other.identifier && value == other.value);};
+ std::string identifier;
+ std::string value;
+};
+
+//WARNING this function copies the vector and does not modify it
+template <typename T>
+std::vector<T> operator<< ( std::vector<T> v, const T &s)
+{
+ v.push_back(s);
+ return v;
+}
+
+
+}
+
+#endif
diff --git a/src/containers/kolabevent.cpp b/src/containers/kolabevent.cpp
new file mode 100644
index 0000000..f70346a
--- /dev/null
+++ b/src/containers/kolabevent.cpp
@@ -0,0 +1,326 @@
+/*
+ * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "kolabevent.h"
+#include "kolabevent_p.h"
+
+namespace Kolab {
+
+Event::Event()
+: d(new Event::Private())
+{
+// std::cout << "ctor" << std::endl;
+}
+
+Event::Event(const Event &other)
+: d(new Event::Private())
+{
+ *d = *other.d;
+// std::cout << "cctor" << std::endl;
+}
+
+Event::~Event()
+{
+// std::cout << "dtor" << std::endl;
+}
+
+void Event::operator=(const Kolab::Event &other)
+{
+ *d = *other.d;
+}
+
+bool Event::isValid() const
+{
+ return !d->uid.empty();
+}
+
+void Event::setUid(const std::string &uid)
+{
+ d->uid = uid;
+}
+
+std::string Event::uid() const
+{
+ return d->uid;
+}
+
+void Event::setCreated(const Kolab::cDateTime &created)
+{
+ d->created = created;
+}
+
+cDateTime Event::created() const
+{
+ return d->created;
+}
+
+void Event::setLastModified(const Kolab::cDateTime &lastMod)
+{
+ d->lastModified = lastMod;
+}
+
+cDateTime Event::lastModified() const
+{
+ return d->lastModified;
+}
+
+void Event::setSequence(int sequence)
+{
+ d->sequence = sequence;
+}
+
+int Event::sequence() const
+{
+ return d->sequence;
+}
+
+void Event::setClassification(Classification class_)
+{
+ d->classification = class_;
+}
+
+Classification Event::classification() const
+{
+ return d->classification;
+}
+
+void Event::setCategories(const std::vector< std::string > &categories)
+{
+ d->categories = categories;
+}
+
+void Event::addCategory(const std::string &cat)
+{
+ d->categories.push_back(cat);
+}
+
+std::vector< std::string > Event::categories() const
+{
+ return d->categories;
+}
+
+void Event::setStart(const Kolab::cDateTime &start)
+{
+ d->start = start;
+}
+
+cDateTime Event::start() const
+{
+ return d->start;
+}
+
+void Event::setEnd(const Kolab::cDateTime &end)
+{
+ d->end = end;
+}
+
+cDateTime Event::end() const
+{
+ return d->end;
+}
+
+void Event::setDuration(const Duration &duration)
+{
+ d->duration = duration;
+}
+
+Duration Event::duration() const
+{
+ return d->duration;
+}
+
+
+void Event::setRecurrenceID(const Kolab::cDateTime &rID, bool thisandfuture)
+{
+ d->recurrenceID = rID;
+ d->thisAndFuture = thisandfuture;
+}
+
+cDateTime Event::recurrenceID() const
+{
+ return d->recurrenceID;
+}
+
+bool Event::thisAndFuture() const
+{
+ return d->thisAndFuture;
+}
+
+void Event::setSummary(const std::string &summary)
+{
+ d->summary = summary;
+}
+
+std::string Event::summary() const
+{
+ return d->summary;
+}
+
+void Event::setDescription(const std::string &description)
+{
+ d->description = description;
+}
+
+std::string Event::description() const
+{
+ return d->description;
+}
+
+void Event::setPriority(int priority)
+{
+ d->priority = priority;
+}
+
+int Event::priority() const
+{
+ return d->priority;
+}
+
+void Event::setStatus(Status status)
+{
+ d->status = status;
+}
+
+Status Event::status() const
+{
+ return d->status;
+}
+
+void Event::setLocation(const std::string &location)
+{
+ d->location = location;
+}
+
+std::string Event::location() const
+{
+ return d->location;
+}
+
+void Event::setRecurrenceRule(const Kolab::RecurrenceRule &rrule)
+{
+ d->rrule = rrule;
+}
+
+RecurrenceRule Event::recurrenceRule() const
+{
+ return d->rrule;
+}
+
+void Event::setRecurrenceDates(const std::vector< cDateTime > &dates)
+{
+ d->recurrenceDates = dates;
+}
+
+void Event::addRecurrenceDate(const Kolab::cDateTime &dt)
+{
+ d->recurrenceDates.push_back(dt);
+}
+
+std::vector< cDateTime > Event::recurrenceDates() const
+{
+ return d->recurrenceDates;
+}
+
+void Event::setExceptionDates(const std::vector< cDateTime > &dates)
+{
+ d->exceptionDates = dates;
+}
+
+void Event::addExceptionDate(const Kolab::cDateTime &dt)
+{
+ d->exceptionDates.push_back(dt);
+}
+
+std::vector< cDateTime > Event::exceptionDates() const
+{
+ return d->exceptionDates;
+}
+
+void Event::setTransparency(bool isTransparent)
+{
+ d->isTransparent = isTransparent;
+}
+
+bool Event::transparency() const
+{
+ return d->isTransparent;
+}
+
+void Event::setOrganizer(const ContactReference &organizer)
+{
+ d->organizer = organizer;
+}
+
+ContactReference Event::organizer() const
+{
+ return d->organizer;
+}
+
+void Event::setAttendees(const std::vector< Attendee > &attendees)
+{
+ d->attendees = attendees;
+}
+
+std::vector< Attendee > Event::attendees() const
+{
+ return d->attendees;
+}
+
+void Event::setAttachments(const std::vector< Attachment > &attach)
+{
+ d->attachments = attach;
+}
+
+std::vector< Attachment > Event::attachments() const
+{
+ return d->attachments;
+}
+
+void Event::setCustomProperties(const std::vector< CustomProperty > &prop)
+{
+ d->customProperties = prop;
+}
+
+std::vector< CustomProperty > Event::customProperties() const
+{
+ return d->customProperties;
+}
+
+// void Event::setExceptions(const std::vector< Event > &exceptions)
+// {
+// d->exceptions = exceptions;
+// }
+//
+// std::vector< Event > Event::exceptions() const
+// {
+// return d->exceptions;
+// }
+
+void Event::setAlarms(const std::vector< Alarm > &alarms)
+{
+ d->alarms = alarms;
+}
+
+std::vector< Alarm > Event::alarms() const
+{
+ return d->alarms;
+}
+
+
+
+
+}
diff --git a/src/containers/kolabevent.h b/src/containers/kolabevent.h
new file mode 100644
index 0000000..abec9a9
--- /dev/null
+++ b/src/containers/kolabevent.h
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef KOLAB_EVENT_H
+#define KOLAB_EVENT_H
+
+#include <string>
+#include <vector>
+#include <boost/scoped_ptr.hpp>
+#include "kolabcontainers.h"
+namespace Kolab {
+
+class Event {
+public:
+ Event();
+ ~Event();
+ Event(const Event &);
+ void operator=(const Event &);
+
+ bool isValid() const;
+
+ void setUid(const std::string &);
+ std::string uid() const;
+
+ void setCreated(const cDateTime &);
+ cDateTime created() const;
+
+ void setLastModified(const cDateTime &);
+ cDateTime lastModified() const;
+
+ void setSequence(int);
+ int sequence() const;
+
+ void setClassification(Classification);
+ Classification classification() const;
+
+ void setCategories(const std::vector<std::string> &);
+ void addCategory(const std::string &);
+ std::vector<std::string> categories() const;
+
+ void setStart(const cDateTime &);
+ cDateTime start() const;
+
+ void setEnd(const cDateTime &);
+ cDateTime end() const;
+
+ void setDuration(const Duration &);
+ Duration duration() const;
+
+ void setTransparency(bool isTransparent);
+ bool transparency() const;
+
+ void setRecurrenceRule(const RecurrenceRule &);
+ RecurrenceRule recurrenceRule() const;
+
+ void setRecurrenceDates(const std::vector<cDateTime> &);
+ void addRecurrenceDate(const cDateTime &);
+ std::vector<cDateTime> recurrenceDates() const;
+
+ void setExceptionDates(const std::vector<cDateTime> &);
+ void addExceptionDate(const cDateTime &);
+ std::vector<cDateTime> exceptionDates() const;
+
+ void setRecurrenceID(const cDateTime &, bool thisandfuture);
+ cDateTime recurrenceID() const;
+ bool thisAndFuture() const;
+
+ void setSummary(const std::string &);
+ std::string summary() const;
+
+ void setDescription(const std::string &);
+ std::string description() const;
+
+ void setPriority(int);
+ int priority() const;
+
+ void setStatus(Status);
+ Status status() const;
+
+ void setLocation(const std::string &);
+ std::string location() const;
+
+ void setOrganizer(const ContactReference &);
+ ContactReference organizer() const;
+
+ void setAttendees(const std::vector<Attendee> &);
+ std::vector<Attendee> attendees() const;
+
+ void setAttachments(const std::vector<Attachment> &);
+ std::vector<Attachment> attachments() const;
+
+ void setCustomProperties(const std::vector<CustomProperty> &);
+ std::vector<CustomProperty> customProperties() const;
+/* TODO what is this? Exceptions it is
+ void setExceptions(const std::vector<Event> &);
+ std::vector<Event> exceptions() const;*/
+
+ void setAlarms(const std::vector<Alarm> &);
+ std::vector<Alarm> alarms() const;
+
+protected:
+ struct Private;
+ boost::scoped_ptr<Private> d;
+};
+
+
+}
+
+#endif
+
diff --git a/src/containers/kolabevent_p.h b/src/containers/kolabevent_p.h
new file mode 100644
index 0000000..66054d3
--- /dev/null
+++ b/src/containers/kolabevent_p.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef KOLABEVENT_P
+#define KOLABEVENT_P
+
+#include "kolabcontainers.h"
+#include "incidence_p.h"
+
+namespace Kolab {
+
+class Event;
+
+struct Event::Private: public PrivateIncidence
+{
+ Private()
+ : PrivateIncidence(),
+ isTransparent(false){}
+
+ cDateTime end;
+ bool isTransparent;
+ Duration duration;
+ std::vector< Event > exceptions;
+};
+
+}
+
+#endif
diff --git a/src/containers/kolabjournal.cpp b/src/containers/kolabjournal.cpp
new file mode 100644
index 0000000..ce37fbc
--- /dev/null
+++ b/src/containers/kolabjournal.cpp
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2012 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "kolabjournal.h"
+#include "incidence_p.h"
+
+namespace Kolab {
+
+struct Journal::Private: public PrivateIncidence
+{
+ Private()
+ : PrivateIncidence() {}
+};
+
+Journal::Journal()
+: d(new Journal::Private())
+{
+}
+
+Journal::Journal(const Journal &other)
+: d(new Journal::Private())
+{
+ *d = *other.d;
+}
+
+Journal::~Journal()
+{
+}
+
+void Journal::operator=(const Kolab::Journal &other)
+{
+ *d = *other.d;
+}
+
+bool Journal::isValid() const
+{
+ return !d->uid.empty();
+}
+
+void Journal::setUid(const std::string &uid)
+{
+ d->uid = uid;
+}
+
+std::string Journal::uid() const
+{
+ return d->uid;
+}
+
+void Journal::setCreated(const Kolab::cDateTime &created)
+{
+ d->created = created;
+}
+
+cDateTime Journal::created() const
+{
+ return d->created;
+}
+
+void Journal::setLastModified(const Kolab::cDateTime &lastMod)
+{
+ d->lastModified = lastMod;
+}
+
+cDateTime Journal::lastModified() const
+{
+ return d->lastModified;
+}
+
+void Journal::setSequence(int sequence)
+{
+ d->sequence = sequence;
+}
+
+int Journal::sequence() const
+{
+ return d->sequence;
+}
+
+void Journal::setClassification(Classification class_)
+{
+ d->classification = class_;
+}
+
+Classification Journal::classification() const
+{
+ return d->classification;
+}
+
+void Journal::setCategories(const std::vector< std::string > &categories)
+{
+ d->categories = categories;
+}
+
+void Journal::addCategory(const std::string &cat)
+{
+ d->categories.push_back(cat);
+}
+
+std::vector< std::string > Journal::categories() const
+{
+ return d->categories;
+}
+
+void Journal::setStart(const Kolab::cDateTime &start)
+{
+ d->start = start;
+}
+
+cDateTime Journal::start() const
+{
+ return d->start;
+}
+
+void Journal::setSummary(const std::string &summary)
+{
+ d->summary = summary;
+}
+
+std::string Journal::summary() const
+{
+ return d->summary;
+}
+
+void Journal::setDescription(const std::string &description)
+{
+ d->description = description;
+}
+
+std::string Journal::description() const
+{
+ return d->description;
+}
+
+
+void Journal::setStatus(Status status)
+{
+ d->status = status;
+}
+
+Status Journal::status() const
+{
+ return d->status;
+}
+
+void Journal::setAttendees(const std::vector< Attendee > &attendees)
+{
+ d->attendees = attendees;
+}
+
+std::vector< Attendee > Journal::attendees() const
+{
+ return d->attendees;
+}
+
+void Journal::setAttachments(const std::vector< Attachment > &attach)
+{
+ d->attachments = attach;
+}
+
+std::vector< Attachment > Journal::attachments() const
+{
+ return d->attachments;
+}
+
+void Journal::setCustomProperties(const std::vector< CustomProperty > &prop)
+{
+ d->customProperties = prop;
+}
+
+std::vector< CustomProperty > Journal::customProperties() const
+{
+ return d->customProperties;
+}
+
+
+}//Namespace
diff --git a/src/containers/kolabjournal.h b/src/containers/kolabjournal.h
new file mode 100644
index 0000000..9a904d3
--- /dev/null
+++ b/src/containers/kolabjournal.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2012 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef KOLABJOURNAL_H
+#define KOLABJOURNAL_H
+
+#include <string>
+#include <vector>
+#include <boost/scoped_ptr.hpp>
+#include "kolabcontainers.h"
+namespace Kolab {
+
+class Journal {
+public:
+ Journal();
+ ~Journal();
+ Journal(const Journal &);
+ void operator=(const Journal &);
+
+ bool isValid() const;
+
+ void setUid(const std::string &);
+ std::string uid() const;
+
+ void setCreated(const cDateTime &);
+ cDateTime created() const;
+
+ void setLastModified(const cDateTime &);
+ cDateTime lastModified() const;
+
+ void setSequence(int);
+ int sequence() const;
+
+ void setClassification(Classification);
+ Classification classification() const;
+
+ void setCategories(const std::vector<std::string> &);
+ void addCategory(const std::string &);
+ std::vector<std::string> categories() const;
+
+ void setStart(const cDateTime &);
+ cDateTime start() const;
+
+ void setSummary(const std::string &);
+ std::string summary() const;
+
+ void setDescription(const std::string &);
+ std::string description() const;
+
+ void setStatus(Status);
+ Status status() const;
+
+ //TODO Contacts
+
+ void setAttendees(const std::vector<Attendee> &);
+ std::vector<Attendee> attendees() const;
+
+ void setAttachments(const std::vector<Attachment> &);
+ std::vector<Attachment> attachments() const;
+
+ void setCustomProperties(const std::vector<CustomProperty> &);
+ std::vector<CustomProperty> customProperties() const;
+private:
+ struct Private;
+ boost::scoped_ptr<Private> d;
+};
+
+
+
+}
+
+#endif
+
diff --git a/src/containers/kolabnote.cpp b/src/containers/kolabnote.cpp
new file mode 100644
index 0000000..c7931bb
--- /dev/null
+++ b/src/containers/kolabnote.cpp
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2012 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "kolabnote.h"
+
+namespace Kolab {
+
+struct Note::Private
+{
+ Private()
+ : classification(ClassPublic){}
+
+ std::string uid;
+ cDateTime created;
+ cDateTime lastModified;
+ std::vector< std::string > categories;
+ Classification classification;
+
+ std::string summary;
+ std::string description;
+ std::string color;
+
+ std::vector<Attachment> attachments;
+ std::vector<CustomProperty> customProperties;
+};
+
+Note::Note()
+: d(new Note::Private())
+{
+}
+
+Note::Note(const Note &other)
+: d(new Note::Private())
+{
+ *d = *other.d;
+}
+
+Note::~Note()
+{
+}
+
+void Note::operator=(const Kolab::Note &other)
+{
+ *d = *other.d;
+}
+
+bool Note::operator==(const Kolab::Note& other) const
+{
+ return ( d->uid == other.uid() &&
+ d->created == other.created() &&
+ d->lastModified == other.lastModified() &&
+ d->categories == other.categories() &&
+ d->classification == other.classification() &&
+ d->summary == other.summary() &&
+ d->description == other.description() &&
+ d->color == other.color() &&
+ d->attachments == other.attachments() &&
+ d->customProperties == other.customProperties());
+}
+
+bool Note::isValid() const
+{
+ return !d->uid.empty();
+}
+
+void Note::setUid(const std::string &uid)
+{
+ d->uid = uid;
+}
+
+std::string Note::uid() const
+{
+ return d->uid;
+}
+
+void Note::setCreated(const Kolab::cDateTime &created)
+{
+ d->created = created;
+}
+
+cDateTime Note::created() const
+{
+ return d->created;
+}
+
+void Note::setLastModified(const Kolab::cDateTime &lastMod)
+{
+ d->lastModified = lastMod;
+}
+
+cDateTime Note::lastModified() const
+{
+ return d->lastModified;
+}
+
+void Note::setClassification(Classification class_)
+{
+ d->classification = class_;
+}
+
+Classification Note::classification() const
+{
+ return d->classification;
+}
+
+void Note::setCategories(const std::vector< std::string > &categories)
+{
+ d->categories = categories;
+}
+
+void Note::addCategory(const std::string &cat)
+{
+ d->categories.push_back(cat);
+}
+
+std::vector< std::string > Note::categories() const
+{
+ return d->categories;
+}
+
+void Note::setSummary(const std::string &summary)
+{
+ d->summary = summary;
+}
+
+std::string Note::summary() const
+{
+ return d->summary;
+}
+
+void Note::setDescription(const std::string &description)
+{
+ d->description = description;
+}
+
+std::string Note::description() const
+{
+ return d->description;
+}
+
+void Note::setColor(const std::string &color)
+{
+ d->color = color;
+}
+
+std::string Note::color() const
+{
+ return d->color;
+}
+
+void Note::setAttachments(const std::vector< Attachment > &attach)
+{
+ d->attachments = attach;
+}
+
+std::vector< Attachment > Note::attachments() const
+{
+ return d->attachments;
+}
+
+void Note::setCustomProperties(const std::vector< CustomProperty > &prop)
+{
+ d->customProperties = prop;
+}
+
+std::vector< CustomProperty > Note::customProperties() const
+{
+ return d->customProperties;
+}
+
+} //Note
diff --git a/src/containers/kolabnote.h b/src/containers/kolabnote.h
new file mode 100644
index 0000000..6edffb6
--- /dev/null
+++ b/src/containers/kolabnote.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2012 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef KOLABNOTE_H
+#define KOLABNOTE_H
+
+#include <string>
+#include <vector>
+#include <boost/scoped_ptr.hpp>
+#include "kolabcontainers.h"
+namespace Kolab {
+
+ class Note {
+ public:
+ Note();
+ ~Note();
+ Note(const Note &);
+ void operator=(const Note &);
+ bool operator==(const Note &) const;
+
+ bool isValid() const;
+
+ void setUid(const std::string &);
+ std::string uid() const;
+
+ void setCreated(const cDateTime &);
+ cDateTime created() const;
+
+ void setLastModified(const cDateTime &);
+ cDateTime lastModified() const;
+
+ void setClassification(Classification);
+ Classification classification() const;
+
+ void setCategories(const std::vector<std::string> &);
+ void addCategory(const std::string &);
+ std::vector<std::string> categories() const;
+
+ void setSummary(const std::string &);
+ std::string summary() const;
+
+ void setDescription(const std::string &);
+ std::string description() const;
+
+ void setColor(const std::string &);
+ std::string color() const;
+
+ void setAttachments(const std::vector<Attachment> &);
+ std::vector<Attachment> attachments() const;
+
+ void setCustomProperties(const std::vector<CustomProperty> &);
+ std::vector<CustomProperty> customProperties() const;
+ private:
+ struct Private;
+ boost::scoped_ptr<Private> d;
+ };
+
+}
+
+#endif
+
diff --git a/src/containers/kolabtodo.cpp b/src/containers/kolabtodo.cpp
new file mode 100644
index 0000000..ceefcf9
--- /dev/null
+++ b/src/containers/kolabtodo.cpp
@@ -0,0 +1,327 @@
+/*
+ * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "kolabtodo.h"
+#include "incidence_p.h"
+
+namespace Kolab {
+
+
+struct Todo::Private: public PrivateIncidence
+{
+ Private()
+ : PrivateIncidence(),
+ percentComplete(0){}
+
+ cDateTime due;
+ int percentComplete;
+};
+
+Todo::Todo()
+: d(new Todo::Private())
+{
+
+}
+
+Todo::Todo(const Todo &other)
+: d(new Todo::Private())
+{
+ *d = *other.d;
+}
+
+Todo::~Todo()
+{
+
+}
+
+void Todo::operator=(const Kolab::Todo &other)
+{
+ *d = *other.d;
+}
+
+bool Todo::isValid() const
+{
+ return !d->uid.empty();
+}
+
+void Todo::setUid(const std::string &uid)
+{
+ d->uid = uid;
+}
+
+std::string Todo::uid() const
+{
+ return d->uid;
+}
+
+void Todo::setCreated(const Kolab::cDateTime &created)
+{
+ d->created = created;
+}
+
+cDateTime Todo::created() const
+{
+ return d->created;
+}
+
+void Todo::setLastModified(const Kolab::cDateTime &lastMod)
+{
+ d->lastModified = lastMod;
+}
+
+cDateTime Todo::lastModified() const
+{
+ return d->lastModified;
+}
+
+void Todo::setSequence(int sequence)
+{
+ d->sequence = sequence;
+}
+
+int Todo::sequence() const
+{
+ return d->sequence;
+}
+
+void Todo::setClassification(Classification class_)
+{
+ d->classification = class_;
+}
+
+Classification Todo::classification() const
+{
+ return d->classification;
+}
+
+void Todo::setCategories(const std::vector< std::string > &categories)
+{
+ d->categories = categories;
+}
+
+void Todo::addCategory(const std::string &cat)
+{
+ d->categories.push_back(cat);
+}
+
+std::vector< std::string > Todo::categories() const
+{
+ return d->categories;
+}
+
+void Todo::setRelatedTo(const std::vector< std::string > &related)
+{
+ d->relatedTo = related;
+}
+
+void Todo::addRelatedTo(const std::string &related)
+{
+ d->relatedTo.push_back(related);
+}
+
+std::vector< std::string > Todo::relatedTo() const
+{
+ return d->relatedTo;
+}
+
+void Todo::setStart(const Kolab::cDateTime &start)
+{
+ d->start = start;
+}
+
+cDateTime Todo::start() const
+{
+ return d->start;
+}
+
+void Todo::setDue(const Kolab::cDateTime &due)
+{
+ d->due = due;
+}
+
+cDateTime Todo::due() const
+{
+ return d->due;
+}
+
+void Todo::setRecurrenceID(const Kolab::cDateTime &rID, bool thisandfuture)
+{
+ d->recurrenceID = rID;
+ d->thisAndFuture = thisandfuture;
+}
+
+cDateTime Todo::recurrenceID() const
+{
+ return d->recurrenceID;
+}
+
+bool Todo::thisAndFuture() const
+{
+ return d->thisAndFuture;
+}
+
+void Todo::setSummary(const std::string &summary)
+{
+ d->summary = summary;
+}
+
+std::string Todo::summary() const
+{
+ return d->summary;
+}
+
+void Todo::setDescription(const std::string &description)
+{
+ d->description = description;
+}
+
+std::string Todo::description() const
+{
+ return d->description;
+}
+
+void Todo::setPriority(int priority)
+{
+ d->priority = priority;
+}
+
+int Todo::priority() const
+{
+ return d->priority;
+}
+
+void Todo::setStatus(Status status)
+{
+ d->status = status;
+}
+
+Status Todo::status() const
+{
+ return d->status;
+}
+
+void Todo::setPercentComplete(int complete)
+{
+ d->percentComplete = complete;
+}
+
+int Todo::percentComplete() const
+{
+ return d->percentComplete;
+}
+
+void Todo::setLocation(const std::string &location)
+{
+ d->location = location;
+}
+
+std::string Todo::location() const
+{
+ return d->location;
+}
+
+void Todo::setRecurrenceRule(const Kolab::RecurrenceRule &rrule)
+{
+ d->rrule = rrule;
+}
+
+RecurrenceRule Todo::recurrenceRule() const
+{
+ return d->rrule;
+}
+
+void Todo::setRecurrenceDates(const std::vector< cDateTime > &dates)
+{
+ d->recurrenceDates = dates;
+}
+
+void Todo::addRecurrenceDate(const Kolab::cDateTime &dt)
+{
+ d->recurrenceDates.push_back(dt);
+}
+
+std::vector< cDateTime > Todo::recurrenceDates() const
+{
+ return d->recurrenceDates;
+}
+
+void Todo::setExceptionDates(const std::vector< cDateTime > &dates)
+{
+ d->exceptionDates = dates;
+}
+
+void Todo::addExceptionDate(const Kolab::cDateTime &dt)
+{
+ d->exceptionDates.push_back(dt);
+}
+
+std::vector< cDateTime > Todo::exceptionDates() const
+{
+ return d->exceptionDates;
+}
+
+void Todo::setOrganizer(const ContactReference &organizer)
+{
+ d->organizer = organizer;
+}
+
+ContactReference Todo::organizer() const
+{
+ return d->organizer;
+}
+
+void Todo::setAttendees(const std::vector< Attendee > &attendees)
+{
+ d->attendees = attendees;
+}
+
+std::vector< Attendee > Todo::attendees() const
+{
+ return d->attendees;
+}
+
+void Todo::setAttachments(const std::vector< Attachment > &attach)
+{
+ d->attachments = attach;
+}
+
+std::vector< Attachment > Todo::attachments() const
+{
+ return d->attachments;
+}
+
+void Todo::setCustomProperties(const std::vector< CustomProperty > &prop)
+{
+ d->customProperties = prop;
+}
+
+std::vector< CustomProperty > Todo::customProperties() const
+{
+ return d->customProperties;
+}
+
+void Todo::setAlarms(const std::vector< Alarm > &alarms)
+{
+ d->alarms = alarms;
+}
+
+std::vector< Alarm > Todo::alarms() const
+{
+ return d->alarms;
+}
+
+}
diff --git a/src/containers/kolabtodo.h b/src/containers/kolabtodo.h
new file mode 100644
index 0000000..ce547e3
--- /dev/null
+++ b/src/containers/kolabtodo.h
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef KOLAB_TODO_H
+#define KOLAB_TODO_H
+
+#include <string>
+#include <vector>
+#include <boost/scoped_ptr.hpp>
+#include "kolabcontainers.h"
+namespace Kolab {
+
+
+class Todo {
+public:
+ Todo();
+ ~Todo();
+ Todo(const Todo &);
+ void operator=(const Todo &);
+
+ bool isValid() const;
+
+ void setUid(const std::string &);
+ std::string uid() const;
+
+ void setCreated(const cDateTime &);
+ cDateTime created() const;
+
+ void setLastModified(const cDateTime &);
+ cDateTime lastModified() const;
+
+ void setSequence(int);
+ int sequence() const;
+
+ void setClassification(Classification);
+ Classification classification() const;
+
+ void setCategories(const std::vector<std::string> &);
+ void addCategory(const std::string &);
+ std::vector<std::string> categories() const;
+
+ void setRelatedTo(const std::vector<std::string> &);
+ void addRelatedTo(const std::string &);
+ std::vector<std::string> relatedTo() const;
+
+ void setStart(const cDateTime &);
+ cDateTime start() const;
+
+ void setDue(const cDateTime &);
+ cDateTime due() const;
+
+ void setRecurrenceRule(const RecurrenceRule &);
+ RecurrenceRule recurrenceRule() const;
+
+ void setRecurrenceDates(const std::vector<cDateTime> &);
+ void addRecurrenceDate(const cDateTime &);
+ std::vector<cDateTime> recurrenceDates() const;
+
+ void setExceptionDates(const std::vector<cDateTime> &);
+ void addExceptionDate(const cDateTime &);
+ std::vector<cDateTime> exceptionDates() const;
+
+ void setRecurrenceID(const cDateTime &, bool thisandfuture);
+ cDateTime recurrenceID() const;
+ bool thisAndFuture() const;
+
+ void setSummary(const std::string &);
+ std::string summary() const;
+
+ void setDescription(const std::string &);
+ std::string description() const;
+
+ void setPriority(int);
+ int priority() const;
+
+ void setStatus(Status);
+ Status status() const;
+
+ void setPercentComplete(int);
+ int percentComplete() const;
+
+ void setLocation(const std::string &);
+ std::string location() const;
+
+ void setOrganizer(const ContactReference &);
+ ContactReference organizer() const;
+
+ void setAttendees(const std::vector<Attendee> &);
+ std::vector<Attendee> attendees() const;
+
+ void setAttachments(const std::vector<Attachment> &);
+ std::vector<Attachment> attachments() const;
+
+ void setCustomProperties(const std::vector<CustomProperty> &);
+ std::vector<CustomProperty> customProperties() const;
+
+ void setAlarms(const std::vector<Alarm> &);
+ std::vector<Alarm> alarms() const;
+
+private:
+ struct Private;
+ boost::scoped_ptr<Private> d;
+};
+
+}
+
+#endif
+
diff --git a/src/incidence_p.h b/src/incidence_p.h
deleted file mode 100644
index 8602feb..0000000
--- a/src/incidence_p.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef INCIDENCE_P
-#define INCIDENCE_P
-
-#include "kolabcontainers.h"
-
-namespace Kolab {
-
- struct PrivateIncidence
- {
- PrivateIncidence()
- : sequence(0),
- classification(ClassPublic),
- thisAndFuture(false),
- priority(0),
- status(StatusUndefined){}
-
- std::string uid;
- cDateTime created;
- cDateTime lastModified;
- int sequence;
- Classification classification;
- std::vector< std::string > categories;
- std::vector< std::string > relatedTo;
- cDateTime start;
-
- cDateTime recurrenceID;
- bool thisAndFuture;
- std::string summary;
- std::string description;
- std::string location;
- int priority;
- Status status;
- RecurrenceRule rrule;
- std::vector< cDateTime > recurrenceDates;
- std::vector< cDateTime > exceptionDates;
- ContactReference organizer;
- Duration duration;
-
- std::vector<Attendee> attendees;
- std::vector<Attachment> attachments;
- std::vector<CustomProperty> customProperties;
-
- std::vector<Alarm> alarms;
- };
-
-}
-
-#endif
diff --git a/src/kolabconfiguration.cpp b/src/kolabconfiguration.cpp
deleted file mode 100644
index 2129371..0000000
--- a/src/kolabconfiguration.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (C) 2012 Christian Mollekopf <mollekopf at kolabsys.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "kolabconfiguration.h"
-
-namespace Kolab {
-
-struct Configuration::Private {
- Private(): type(Invalid){}
-
- std::vector<CategoryColor> categoryColor;
- Dictionary dictionary;
- ConfigurationType type;
- std::string uid;
- cDateTime created;
- cDateTime lastModified;
-};
-
-Configuration::Configuration()
-: d(new Configuration::Private)
-{
-}
-
-Configuration::Configuration(const std::vector<CategoryColor> &c)
-: d(new Configuration::Private)
-{
- d->categoryColor = c;
- d->type = TypeCategoryColor;
-}
-
-Configuration::Configuration(const Dictionary &dict)
-: d(new Configuration::Private)
-{
- d->dictionary = dict;
- d->type = TypeDictionary;
-}
-
-Configuration::Configuration(const Configuration &other)
-: d(new Configuration::Private)
-{
- *d = *other.d;
-}
-
-Configuration::~Configuration()
-{
-
-}
-
-void Configuration::operator=(const Configuration &other)
-{
- *d = *other.d;
-}
-
-bool Configuration::isValid() const
-{
- return d->type != Invalid;
-}
-
-void Configuration::setUid(const std::string &uid)
-{
- d->uid = uid;
-}
-
-std::string Configuration::uid() const
-{
- return d->uid;
-}
-
-void Configuration::setCreated(const cDateTime &created)
-{
- d->created = created;
-}
-
-cDateTime Configuration::created() const
-{
- return d->created;
-}
-
-void Configuration::setLastModified(const cDateTime &lastModified)
-{
- d->lastModified = lastModified;
-}
-
-cDateTime Configuration::lastModified() const
-{
- return d->lastModified;
-}
-
-
-Configuration::ConfigurationType Configuration::type() const
-{
- return d->type;
-}
-
-std::vector<CategoryColor> Configuration::categoryColor() const
-{
- return d->categoryColor;
-}
-
-Dictionary Configuration::dictionary() const
-{
- return d->dictionary;
-}
-
-
-
-} //Namespace
diff --git a/src/kolabconfiguration.h b/src/kolabconfiguration.h
deleted file mode 100644
index d29ff1e..0000000
--- a/src/kolabconfiguration.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2012 Christian Mollekopf <mollekopf at kolabsys.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef KOLABCONFIGURATION_H
-#define KOLABCONFIGURATION_H
-#include <string>
-#include <vector>
-#include <boost/scoped_ptr.hpp>
-#include "kolabcontainers.h"
-
-namespace Kolab {
-
-struct Dictionary {
- Dictionary(){}
- Dictionary(const std::string &c): mLanguage(c){}
-
- bool operator==(const Dictionary &other) const {
- return mLanguage == other.mLanguage && mEntries == other.mEntries;
- }
-
- std::string language() const { return mLanguage; }
-
- void setEntries(const std::vector<std::string> &e){ mEntries = e; }
- std::vector<std::string> entries() const { return mEntries; }
-private:
- std::string mLanguage;
- std::vector<std::string> mEntries;
-};
-
-struct CategoryColor {
- CategoryColor(){}
- CategoryColor(const std::string &c): mCategory(c) {}
-
- bool operator==(const CategoryColor &other) const {
- return mCategory == other.mCategory && mColor == other.mColor && mSubcategories == other.mSubcategories;
- }
-
- std::string category() const { return mCategory; }
-
- void setColor(const std::string &c) { mColor = c; }
- std::string color() const { return mColor; }
-
- void setSubcategories(const std::vector<CategoryColor> &c) { mSubcategories = c; }
- std::vector<CategoryColor> subcategories() const { return mSubcategories; }
-private:
- std::string mCategory;
- std::string mColor;
- std::vector<CategoryColor> mSubcategories;
-};
-
-class Configuration {
-public:
- Configuration();
- Configuration(const std::vector<CategoryColor> &);
- Configuration(const Dictionary &);
- Configuration(const Configuration &);
- ~Configuration();
- void operator=(const Configuration &);
-
- bool isValid() const;
-
- void setUid(const std::string &);
- std::string uid() const;
-
- void setCreated(const cDateTime &);
- cDateTime created() const;
-
- void setLastModified(const cDateTime &);
- cDateTime lastModified() const;
-
- enum ConfigurationType {
- Invalid,
- TypeDictionary,
- TypeCategoryColor
- };
- ConfigurationType type() const;
- std::vector<CategoryColor> categoryColor() const;
- Dictionary dictionary() const;
-private:
- struct Private;
- boost::scoped_ptr<Private> d;
-};
-
-} //Namespace
-
-#endif // KOLABCONFIGURATION_H
diff --git a/src/kolabcontact.cpp b/src/kolabcontact.cpp
deleted file mode 100644
index 528b13d..0000000
--- a/src/kolabcontact.cpp
+++ /dev/null
@@ -1,506 +0,0 @@
-/*
- * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "kolabcontact.h"
-
-namespace Kolab {
-
-struct DistList::Private
-{
- Private() {}
-
- std::string uid;
- cDateTime lastModified;
- std::vector< std::string > categories;
-
- std::string name;
- std::vector<ContactReference> members;
- std::vector<CustomProperty> customProperties;
-};
-
-DistList::DistList()
-: d(new DistList::Private())
-{
-
-}
-
-DistList::DistList(const DistList &other)
-: d(new DistList::Private())
-{
- *d = *other.d;
-}
-
-DistList::~DistList()
-{
-
-}
-
-void DistList::operator=(const Kolab::DistList &other)
-{
- *d = *other.d;
-}
-
-bool DistList::isValid() const
-{
- return !d->uid.empty();
-}
-
-void DistList::setUid(const std::string &uid)
-{
- d->uid = uid;
-}
-
-std::string DistList::uid() const
-{
- return d->uid;
-}
-
-void DistList::setLastModified(const Kolab::cDateTime &dt)
-{
- d->lastModified = dt;
-}
-
-cDateTime DistList::lastModified() const
-{
- return d->lastModified;
-}
-
-void DistList::setName(const std::string &name)
-{
- d->name = name;
-}
-
-std::string DistList::name() const
-{
- return d->name;
-}
-
-void DistList::setMembers(const std::vector< ContactReference > &members)
-{
- d->members = members;
-}
-
-std::vector< ContactReference > DistList::members() const
-{
- return d->members;
-}
-
-void DistList::setCustomProperties(const std::vector< CustomProperty >& c)
-{
- d->customProperties = c;
-}
-
-std::vector< CustomProperty > DistList::customProperties() const
-{
- return d->customProperties;
-}
-
-
-
-
-
-
-struct Contact::Private
-{
- Private()
- : addressPreferredIndex(-1),
- gender(NotSet),
- telephonesPreferredIndex(-1),
- imAddressPreferredIndex(-1),
- emailAddressPreferredIndex(-1)
- {}
-
- std::string uid;
- cDateTime created;
- cDateTime lastModified;
- std::vector< std::string > categories;
-
- std::string name;
- NameComponents nameComponents;
- std::string note;
- std::string freeBusyUrl;
- std::vector< std::string > titles;
- std::vector<Affiliation> affiliations;
- std::vector<Url> urls;
- std::vector<Address> addresses;
- int addressPreferredIndex;
- std::vector<std::string> nickNames;
- std::vector<Related> relateds;
- cDateTime bDay;
- cDateTime anniversary;
- std::string photo;
- std::string photoMimetype;
- Gender gender;
- std::vector<std::string> languages;
- std::vector<Telephone> telephones;
- int telephonesPreferredIndex;
- std::vector<std::string> imAddresses;
- int imAddressPreferredIndex;
- std::vector<std::string> emailAddresses;
- int emailAddressPreferredIndex;
- std::vector<Geo> gpsPos;
- std::vector<Key> keys;
- Crypto crypto;
- std::vector<CustomProperty> customProperties;
-};
-
-Contact::Contact()
-: d(new Contact::Private())
-{
-
-}
-
-Contact::Contact(const Contact &other)
-: d(new Contact::Private())
-{
- *d = *other.d;
-}
-
-Contact::~Contact()
-{
-
-}
-
-void Contact::operator=(const Kolab::Contact &other)
-{
- *d = *other.d;
-}
-
-bool Contact::isValid() const
-{
- return !d->uid.empty();
-}
-
-void Contact::setUid(const std::string &uid)
-{
- d->uid = uid;
-}
-
-std::string Contact::uid() const
-{
- return d->uid;
-}
-
-void Contact::setLastModified(const Kolab::cDateTime &dt)
-{
- d->lastModified = dt;
-}
-
-cDateTime Contact::lastModified() const
-{
- return d->lastModified;
-}
-
-void Contact::setCategories(const std::vector< std::string > &cat)
-{
- d->categories = cat;
-}
-
-void Contact::addCategory(const std::string &cat)
-{
- d->categories.push_back(cat);
-}
-
-std::vector< std::string > Contact::categories() const
-{
- return d->categories;
-}
-
-void Contact::setName(const std::string &name)
-{
- d->name = name;
-}
-
-std::string Contact::name() const
-{
- return d->name;
-}
-
-void Contact::setNameComponents(const Kolab::NameComponents &nc)
-{
- d->nameComponents = nc;
-}
-
-NameComponents Contact::nameComponents() const
-{
- return d->nameComponents;
-}
-
-void Contact::setNote(const std::string ¬e)
-{
- d->note = note;
-}
-
-std::string Contact::note() const
-{
- return d->note;
-}
-
-void Contact::setFreeBusyUrl(const std::string &url)
-{
- d->freeBusyUrl = url;
-}
-
-std::string Contact::freeBusyUrl() const
-{
- return d->freeBusyUrl;
-}
-
-void Contact::setTitles(const std::vector< std::string >& titles)
-{
- d->titles = titles;
-}
-
-std::vector< std::string > Contact::titles() const
-{
- return d->titles;
-}
-
-
-void Contact::setAffiliations(const std::vector< Affiliation > &a)
-{
- d->affiliations = a;
-}
-
-std::vector< Affiliation > Contact::affiliations() const
-{
- return d->affiliations;
-}
-
-void Contact::setUrls(const std::vector<Url> &urls)
-{
- d->urls = urls;
-}
-
-std::vector< Url > Contact::urls() const
-{
- return d->urls;
-}
-
-void Contact::setAddresses(const std::vector< Address > &ad, int preferred)
-{
- d->addresses = ad;
- d->addressPreferredIndex = preferred;
-}
-
-std::vector< Address > Contact::addresses() const
-{
- return d->addresses;
-}
-
-int Contact::addressPreferredIndex() const
-{
- return d->addressPreferredIndex;
-}
-
-
-void Contact::setNickNames(const std::vector< std::string > &n)
-{
- d->nickNames = n;
-}
-
-std::vector< std::string > Contact::nickNames() const
-{
- return d->nickNames;
-}
-
-void Contact::setRelateds(const std::vector< Related > &relateds)
-{
- d->relateds = relateds;
-}
-
-std::vector< Related > Contact::relateds() const
-{
- return d->relateds;
-}
-
-void Contact::setBDay(const Kolab::cDateTime &bday)
-{
- d->bDay = bday;
-}
-
-cDateTime Contact::bDay() const
-{
- return d->bDay;
-}
-
-void Contact::setAnniversary(const Kolab::cDateTime& dt)
-{
- d->anniversary = dt;
-}
-
-cDateTime Contact::anniversary() const
-{
- return d->anniversary;
-}
-
-void Contact::setPhoto(const std::string& data, const std::string& mimetype)
-{
- d->photo = data;
- d->photoMimetype = mimetype;
-}
-
-std::string Contact::photo() const
-{
- return d->photo;
-}
-
-std::string Contact::photoMimetype() const
-{
- return d->photoMimetype;
-}
-
-void Contact::setGender(Contact::Gender g)
-{
- d->gender = g;
-}
-
-Contact::Gender Contact::gender() const
-{
- return d->gender;
-}
-
-void Contact::setLanguages(const std::vector< std::string >& l)
-{
- d->languages = l;
-}
-
-std::vector< std::string > Contact::languages() const
-{
- return d->languages;
-}
-
-void Contact::setTelephones(const std::vector< Telephone >& tel, int preferredIndex)
-{
- d->telephonesPreferredIndex = preferredIndex;
- d->telephones = tel;
-}
-
-std::vector< Telephone > Contact::telephones() const
-{
- return d->telephones;
-}
-
-int Contact::telephonesPreferredIndex() const
-{
- return d->telephonesPreferredIndex;
-}
-
-void Contact::setIMaddresses(const std::vector< std::string > &adr, int preferredIndex)
-{
- d->imAddresses = adr;
- d->imAddressPreferredIndex = preferredIndex;
-}
-
-std::vector< std::string > Contact::imAddresses() const
-{
- return d->imAddresses;
-}
-
-int Contact::imAddressPreferredIndex() const
-{
- return d->imAddressPreferredIndex;
-}
-
-void Contact::setEmailAddresses(const std::vector< std::string >& email, int preferredIndex)
-{
- d->emailAddresses = email;
- d->emailAddressPreferredIndex = preferredIndex;
-}
-
-std::vector< std::string > Contact::emailAddresses() const
-{
- return d->emailAddresses;
-}
-
-int Contact::emailAddressPreferredIndex() const
-{
- return d->emailAddressPreferredIndex;
-}
-
-void Contact::setGPSpos(const std::vector< Geo >& pos)
-{
- d->gpsPos = pos;
-}
-
-std::vector< Geo > Contact::gpsPos() const
-{
- return d->gpsPos;
-}
-
-void Contact::setKeys(const std::vector<Key> &keys)
-{
- d->keys = keys;
-}
-
-std::vector<Key> Contact::keys() const
-{
- return d->keys;
-}
-
-void Contact::setCrypto(const Kolab::Crypto& c)
-{
- d->crypto = c;
-}
-
-Crypto Contact::crypto() const
-{
- return d->crypto;
-}
-
-void Contact::setCustomProperties(const std::vector< CustomProperty >& c)
-{
- d->customProperties = c;
-}
-
-std::vector< CustomProperty > Contact::customProperties() const
-{
- return d->customProperties;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-} //Namespace
-
diff --git a/src/kolabcontact.h b/src/kolabcontact.h
deleted file mode 100644
index 86306ba..0000000
--- a/src/kolabcontact.h
+++ /dev/null
@@ -1,412 +0,0 @@
-/*
- * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef KOLABCONTACT_H
-#define KOLABCONTACT_H
-
-#include <string>
-#include <vector>
-#include <boost/scoped_ptr.hpp>
-#include "kolabcontainers.h"
-
-namespace Kolab {
-
-struct NameComponents {
- bool operator==(const NameComponents &other) const { return mSurnames == other.mSurnames &&
- mGiven == other.mGiven &&
- mAdditional == other.mAdditional &&
- mPrefixes == other.mPrefixes &&
- mSuffixes == other.mSuffixes;
- };
- void setSurnames(const std::vector<std::string> &s) { mSurnames = s; };
- std::vector<std::string> surnames() const { return mSurnames; };
- void setGiven(const std::vector<std::string> &s) { mGiven = s; };
- std::vector<std::string> given() const { return mGiven; };
- void setAdditional(const std::vector<std::string> &s) { mAdditional = s; };
- std::vector<std::string> additional() const { return mAdditional; };
- void setPrefixes(const std::vector<std::string> &s) { mPrefixes = s; };
- std::vector<std::string> prefixes() const { return mPrefixes; };
- void setSuffixes(const std::vector<std::string> &s) { mSuffixes = s; };
- std::vector<std::string> suffixes() const { return mSuffixes; };
- bool isValid() const { return !(mSurnames.empty() && mGiven.empty() && mAdditional.empty() && mPrefixes.empty() && mSuffixes.empty()); };
-private:
- std::vector<std::string> mSurnames;
- std::vector<std::string> mGiven;
- std::vector<std::string> mAdditional;
- std::vector<std::string> mPrefixes;
- std::vector<std::string> mSuffixes;
-};
-
-struct Related {
-
- enum DescriptionType {
- Invalid,
- Text,
- Uid
- };
- Related(): mType(Invalid), mRelationType(NoRelation) {};
- Related(DescriptionType t, const std::string &textOrUri, int relationType = NoRelation)
- : mType(t), mRelationType(relationType)
- {
- if (t == Text) {
- mText = textOrUri;
- } else {
- mUri = textOrUri;
- }
- };
- bool operator==(const Related &other) const { return mType == other.mType &&
- mUri == other.mUri &&
- mText == other.mText &&
- mRelationType == other.mRelationType;
- };
- DescriptionType type() const { return mType; };
- std::string uri() const { return mUri; };
- std::string text() const { return mText; };
- enum RelationType {
- NoRelation = 0,
- Child = 0x01,
- Spouse = 0x02,
- Manager = 0x04,
- Assistant = 0x08,
- };
- void setRelationTypes(int t) { mRelationType = t; };
- int relationTypes() const { return mRelationType; };
-private:
- DescriptionType mType;
- std::string mUri;
- std::string mText;
- int mRelationType;
-};
-
-struct Address {
-
- Address(): mTypes(0) {};
- enum Type {
- Work = 0x01,
- Home = 0x02
- };
- bool operator==(const Address &other) const { return mTypes == other.mTypes &&
- mLabel == other.mLabel &&
- mStreet == other.mStreet &&
- mLocality == other.mLocality &&
- mRegion == other.mRegion &&
- mCode == other.mCode &&
- mCountry == other.mCountry;
- };
- void setTypes(int t) { mTypes = t; };
- int types() const { return mTypes; };
-
- void setLabel(const std::string &s) { mLabel = s; };
- std::string label() const { return mLabel; }
-
- void setStreet(const std::string &s) { mStreet = s; };
- std::string street() const { return mStreet; };
-
- void setLocality(const std::string &s) { mLocality = s; };
- std::string locality() const { return mLocality; };
-
- void setRegion(const std::string &s) { mRegion = s; };
- std::string region() const { return mRegion; };
-
- void setCode(const std::string &s) { mCode = s; };
- std::string code() const { return mCode; };
-
- void setCountry(const std::string &s) { mCountry = s; };
- std::string country() const { return mCountry; };
-private:
- int mTypes;
- std::string mLabel;
- std::string mStreet;
- std::string mLocality;
- std::string mRegion;
- std::string mCode;
- std::string mCountry;
-};
-
-struct Affiliation {
- bool operator==(const Affiliation &other) const { return mOrg == other.mOrg &&
- mOrgUnits == other.mOrgUnits &&
- mLogo == other.mLogo &&
- mLogoMimetype == other.mLogoMimetype &&
- mRoles == other.mRoles &&
- mRelateds == other.mRelateds &&
- mOffices == other.mOffices;
- };
- void setOrganisation(const std::string &org) { mOrg = org; };
- std::string organisation() const { return mOrg; };
- void setOrganisationalUnits(const std::vector<std::string> &units) { mOrgUnits = units; };
- std::vector<std::string> organisationalUnits() const { return mOrgUnits; };
- void setLogo(const std::string &l, const std::string mimetype) { mLogo = l; mLogoMimetype = mimetype; };
- std::string logo() const { return mLogo; };
- std::string logoMimetype() const { return mLogoMimetype; };
-
- void setRoles(const std::vector<std::string> &roles) { mRoles = roles; };
- std::vector<std::string> roles() const { return mRoles; };
- void setRelateds(const std::vector<Related> &relateds) { mRelateds = relateds; };
- std::vector<Related> relateds() const { return mRelateds; };
- void setAddresses(const std::vector<Address> &offices) { mOffices = offices; };
- std::vector<Address> addresses() const { return mOffices; };
-private:
- std::string mOrg;
- std::vector<std::string> mOrgUnits;
- std::string mLogo;
- std::string mLogoMimetype;
- std::vector<std::string> mRoles;
- std::vector<Related> mRelateds;
- std::vector<Address> mOffices;
-};
-
-struct Telephone {
- enum Type {
- Work = 0x01,
- Home = 0x02,
- Text = 0x04,
- Voice = 0x08,
- Fax = 0x10,
- Cell = 0x20,
- Video = 0x40,
- Pager = 0x80,
- Textphone = 0x100,
- Car = 0x200
- };
- Telephone(): mType(0){};
- bool operator==(const Telephone &other) const { return mNumber == other.mNumber &&
- mType == other.mType;
- };
- void setTypes(int t) { mType = t; };
- int types() const { return mType; };
- void setNumber(const std::string &n) { mNumber = n; };
- std::string number() const { return mNumber; };
-private:
- std::string mNumber;
- int mType;
-};
-
-struct Crypto {
- enum CryptoTypes {
- PGPinline = 0x01,
- PGPmime = 0x02,
- SMIME = 0x04,
- SMIMEopaque = 0x08
- };
-
- enum CryptoPref {
- Ask,
- Never,
- Always,
- IfPossible
- };
- Crypto(): mCryptoTypes(0), mSignPref(Ask), mEncryptPref(Ask){};
- bool operator==(const Crypto &other) const { return mCryptoTypes == other.mCryptoTypes &&
- mSignPref == other.mSignPref &&
- mEncryptPref == other.mEncryptPref; };
- bool isValid() const { return mCryptoTypes; };
-
- void setAllowed(int cryptoTypes) { mCryptoTypes = cryptoTypes; };
- int allowed() const { return mCryptoTypes; };
- void setSignPref(CryptoPref p) { mSignPref = p; };
- CryptoPref signPref() const { return mSignPref; };
- void setEncryptPref(CryptoPref p) { mEncryptPref = p; };
- CryptoPref encryptPref() const { return mEncryptPref; };
-private:
- int mCryptoTypes;
- CryptoPref mSignPref;
- CryptoPref mEncryptPref;
-};
-
-struct Geo {
- Geo(): latitude(0.0), longitude(0.0) {};
- Geo(double lat, double lon)
- : latitude(lat), longitude(lon) {};
-
- bool operator==(const Geo &other) const{ return (longitude == other.longitude && latitude == other.latitude);};
- double latitude;
- double longitude;
-};
-
-struct Url {
- enum UrlTypes {
- NoType = 0,
- Blog
- };
- Url(): mType(NoType) {};
- Url(const std::string &u, int t = NoType): mUrl(u), mType(t) {};
-
- bool operator==(const Url &other) const{ return (mType == other.mType && mUrl == other.mUrl);};
-
- int type() const { return mType; };
- std::string url() const { return mUrl; };
-private:
- std::string mUrl;
- int mType;
-};
-
-struct Key {
- enum KeyType {
- Invalid,
- PGP,
- PKCS7_MIME
- };
- Key(): keytype(Invalid) {};
- Key(const std::string &k, KeyType type)
- : mKey(k), keytype(type) {};
-
- bool operator==(const Key &other) const{ return (mKey == other.mKey && keytype == other.keytype);};
-
- KeyType type() const { return keytype; };
- std::string key() const { return mKey; };
-
-private:
- std::string mKey;
- KeyType keytype;
-};
-
-
-class DistList {
-public:
- DistList();
- ~DistList();
- DistList(const DistList &);
- void operator=(const DistList &);
-
- bool isValid() const;
-
- void setUid(const std::string &);
- std::string uid() const;
-
- void setLastModified(const cDateTime &);
- cDateTime lastModified() const;
-
- void setName(const std::string &);
- std::string name() const;
-
- void setMembers(const std::vector<ContactReference> &);
- std::vector<ContactReference> members() const;
-
- void setCustomProperties(const std::vector<CustomProperty> &);
- std::vector<CustomProperty> customProperties() const;
-
-private:
- struct Private;
- boost::scoped_ptr<Private> d;
-};
-
-class Contact {
-public:
- Contact();
- ~Contact();
- Contact(const Contact &);
- void operator=(const Contact &);
-
- bool isValid() const;
-
- void setUid(const std::string &);
- std::string uid() const;
-
- void setLastModified(const cDateTime &);
- cDateTime lastModified() const;
-
- void setCategories(const std::vector<std::string> &);
- void addCategory(const std::string &);
- std::vector<std::string> categories() const;
-
- void setName(const std::string &);
- std::string name() const;
-
- void setNameComponents(const NameComponents &);
- NameComponents nameComponents() const;
-
- void setNote(const std::string &);
- std::string note() const;
-
- void setFreeBusyUrl(const std::string &);
- std::string freeBusyUrl() const;
-
- void setTitles(const std::vector<std::string> &titles);
- std::vector<std::string> titles() const;
-
- void setAffiliations(const std::vector<Affiliation> &);
- std::vector<Affiliation> affiliations() const;
-
- void setUrls(const std::vector<Url> &);
- std::vector<Url> urls() const;
-
- void setAddresses(const std::vector<Address> &, int preferred = -1);
- std::vector<Address> addresses() const;
- int addressPreferredIndex() const;
-
- void setNickNames(const std::vector< std::string > &);
- std::vector< std::string > nickNames() const;
-
- void setRelateds(const std::vector<Related> &);
- std::vector<Related> relateds() const;
-
- void setBDay(const cDateTime &);
- cDateTime bDay() const;
-
- void setAnniversary(const cDateTime &);
- cDateTime anniversary() const;
-
- void setPhoto(const std::string &data, const std::string &mimetype);
- std::string photo() const;
- std::string photoMimetype() const;
-
- enum Gender {
- NotSet,
- NotSpecified,
- Male,
- Female
- };
-
- void setGender(Gender);
- Gender gender() const;
-
- void setLanguages(const std::vector<std::string> &);
- std::vector<std::string> languages() const;
-
- void setTelephones(const std::vector<Telephone> &, int preferredIndex = -1);
- std::vector<Telephone> telephones() const;
- int telephonesPreferredIndex() const;
-
- void setIMaddresses(const std::vector<std::string> &, int preferredIndex = -1);
- std::vector<std::string> imAddresses() const;
- int imAddressPreferredIndex() const;
-
- void setEmailAddresses(const std::vector<std::string> &, int preferredIndex = -1);
- std::vector<std::string> emailAddresses() const;
- int emailAddressPreferredIndex() const;
-
- void setGPSpos(const std::vector<Geo> &);
- std::vector<Geo> gpsPos() const;
-
- void setKeys(const std::vector<Key> &);
- std::vector<Key> keys() const;
-
- void setCrypto(const Crypto &);
- Crypto crypto() const;
-
- void setCustomProperties(const std::vector<CustomProperty> &);
- std::vector<CustomProperty> customProperties() const;
-
-private:
- struct Private;
- boost::scoped_ptr<Private> d;
-};
-
-} //Namespace
-
-#endif // KOLABCONTACT_H
diff --git a/src/kolabcontainers.cpp b/src/kolabcontainers.cpp
deleted file mode 100644
index 47c76e3..0000000
--- a/src/kolabcontainers.cpp
+++ /dev/null
@@ -1,767 +0,0 @@
-/*
- * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "kolabcontainers.h"
-#include "incidence_p.h"
-
-namespace Kolab {
-
-struct cDateTime::Private {
- Private()
- : year(-1),
- month(-1),
- day(-1),
- hour(-1),
- minute(-1),
- second(-1),
- isUtc(false){}
-
- int year;
- int month;
- int day;
- int hour;
- int minute;
- int second;
- bool isUtc;
- std::string timezone;
-};
-
-cDateTime::cDateTime()
-: d(new cDateTime::Private())
-{
-
-}
-
-cDateTime::cDateTime(int year, int month, int day, int hour, int minute, int second, bool isUtc)
-: d(new cDateTime::Private())
-{
- d->year = year;
- d->month = month;
- d->day = day;
- d->hour = hour;
- d->minute = minute;
- d->second = second;
- d->isUtc = isUtc;
-}
-
-cDateTime::cDateTime(const std::string& timezone, int year, int month, int day, int hour, int minute, int second)
-: d(new cDateTime::Private())
-{
- d->year = year;
- d->month = month;
- d->day = day;
- d->hour = hour;
- d->minute = minute;
- d->second = second;
- d->timezone = timezone;
-}
-
-cDateTime::cDateTime(int year, int month, int day)
-: d(new cDateTime::Private())
-{
- d->year = year;
- d->month = month;
- d->day = day;
-}
-
-cDateTime::cDateTime(const Kolab::cDateTime &other)
-: d(new cDateTime::Private())
-{
- *d = *other.d;
-}
-
-cDateTime::~cDateTime()
-{
-
-}
-
-
-void cDateTime::operator=(const Kolab::cDateTime &other)
-{
- *d = *other.d;
-}
-
-bool cDateTime::operator==(const Kolab::cDateTime &other) const
-{
- if ( d->year == other.year() &&
- d->month == other.month() &&
- d->day == other.day() &&
- d->hour == other.hour() &&
- d->minute == other.minute() &&
- d->second== other.second() &&
- d->isUtc== other.isUTC() &&
- d->timezone== other.timezone()) {
- return true;
- }
- return false;
-}
-
-
-
-int cDateTime::year() const
-{
- return d->year;
-}
-
-int cDateTime::month() const
-{
- return d->month;
-}
-
-int cDateTime::day() const
-{
- return d->day;
-}
-
-int cDateTime::hour() const
-{
- return d->hour;
-}
-
-int cDateTime::minute() const
-{
- return d->minute;
-}
-
-int cDateTime::second() const
-{
- return d->second;
-}
-
-bool cDateTime::isDateOnly() const
-{
- if ((d->hour < 0) && (d->minute < 0) && (d->second < 0)) {
- return true;
- }
- return false;
-}
-
-void cDateTime::setDate(int year, int month, int day)
-{
- d->year = year;
- d->month = month;
- d->day = day;
-}
-void cDateTime::setTime(int hour, int minute, int second)
-{
- d->hour = hour;
- d->minute = minute;
- d->second = second;
-}
-void cDateTime::setTimezone(const std::string &tz)
-{
- d->timezone = tz;
-}
-void cDateTime::setUTC(bool utc)
-{
- d->isUtc = utc;
-}
-
-bool cDateTime::isUTC() const
-{
- return d->isUtc;
-}
-
-std::string cDateTime::timezone() const
-{
- return d->timezone;
-}
-
-bool cDateTime::isValid() const
-{
- return (d->year >= 0 && d->month >= 0 && d->day >= 0);
-}
-
-struct RecurrenceRule::Private
-{
- Private()
- : freq(FreqNone),
- weekstart(Monday),
- count(-1),
- interval(1){};
-
- Frequency freq;
- Weekday weekstart;
- cDateTime end;
- int count;
- int interval;
- std::vector<int> bysecond;
- std::vector<int> byminute;
- std::vector<int> byhour;
- std::vector<DayPos> byday;
- std::vector<int> bymonthday;
- std::vector<int> byyearday;
- std::vector<int> byweekno;
- std::vector<int> bymonth;
-};
-
-RecurrenceRule::RecurrenceRule()
-: d(new RecurrenceRule::Private)
-{
-
-}
-
-RecurrenceRule::RecurrenceRule(const Kolab::RecurrenceRule &other)
-: d(new RecurrenceRule::Private)
-{
- *d = *other.d;
-}
-
-void RecurrenceRule::operator=(const Kolab::RecurrenceRule &other)
-{
- *d = *other.d;
-}
-
-bool RecurrenceRule::operator==(const Kolab::RecurrenceRule &other) const
-{
- if ( d->freq == other.frequency() &&
- d->weekstart == other.weekStart() &&
- d->end == other.end() &&
- d->count == other.count() &&
- d->interval == other.interval() &&
- d->bysecond == other.bysecond() &&
- d->byminute == other.byminute() &&
- d->byhour == other.byhour() &&
- d->byday == other.byday() &&
- d->bymonthday == other.bymonthday() &&
- d->byyearday == other.byyearday() &&
- d->byweekno == other.byweekno() &&
- d->bymonth == other.bymonth()) {
- return true;
- }
- return false;
-}
-
-RecurrenceRule::~RecurrenceRule()
-{
-
-}
-
-void RecurrenceRule::setFrequency(RecurrenceRule::Frequency freq)
-{
- d->freq = freq;
-}
-
-RecurrenceRule::Frequency RecurrenceRule::frequency() const
-{
- return d->freq;
-}
-
-void RecurrenceRule::setWeekStart(Kolab::Weekday weekstart)
-{
- d->weekstart = weekstart;
-}
-
-Kolab::Weekday RecurrenceRule::weekStart() const
-{
- return d->weekstart;
-}
-
-void RecurrenceRule::setEnd(const Kolab::cDateTime &end)
-{
- d->end = end;
-}
-
-cDateTime RecurrenceRule::end() const
-{
- return d->end;
-}
-
-void RecurrenceRule::setCount(int count)
-{
- d->count = count;
-}
-
-int RecurrenceRule::count() const
-{
- return d->count;
-}
-
-void RecurrenceRule::setInterval(int interval)
-{
- d->interval = interval;
-}
-
-int RecurrenceRule::interval() const
-{
- return d->interval;
-}
-
-void RecurrenceRule::setBysecond(const std::vector< int >&by)
-{
- d->bysecond = by;
-}
-
-
-std::vector< int > RecurrenceRule::bysecond() const
-{
- return d->bysecond;
-}
-
-void RecurrenceRule::setByminute(const std::vector< int > &by)
-{
- d->byminute = by;
-}
-
-std::vector< int > RecurrenceRule::byminute() const
-{
- return d->byminute;
-}
-
-void RecurrenceRule::setByhour(const std::vector< int > &by)
-{
- d->byhour = by;
-}
-
-std::vector< int > RecurrenceRule::byhour() const
-{
- return d->byhour;
-}
-
-void RecurrenceRule::setByday(const std::vector< DayPos > &by)
-{
- d->byday = by;
-}
-
-std::vector< DayPos > RecurrenceRule::byday() const
-{
- return d->byday;
-}
-
-void RecurrenceRule::setBymonthday(const std::vector< int > &by)
-{
- d->bymonthday = by;
-}
-
-std::vector< int > RecurrenceRule::bymonthday() const
-{
- return d->bymonthday;
-}
-
-void RecurrenceRule::setByyearday(const std::vector< int > &by)
-{
- d->byyearday = by;
-}
-
-std::vector< int > RecurrenceRule::byyearday() const
-{
- return d->byyearday;
-}
-
-void RecurrenceRule::setByweekno(const std::vector< int > &by)
-{
- d->byweekno = by;
-}
-
-std::vector< int > RecurrenceRule::byweekno() const
-{
- return d->byweekno;
-}
-
-void RecurrenceRule::setBymonth(const std::vector< int > &by)
-{
- d->bymonth = by;
-}
-
-std::vector< int > RecurrenceRule::bymonth() const
-{
- return d->bymonth;
-}
-
-bool RecurrenceRule::isValid() const
-{
- if (d->freq == FreqNone) {
- return false;
- }
- return true;
-}
-
-
-
-struct Attendee::Private
-{
- Private()
- : partStat(PartNeedsAction),
- role(Required),
- rsvp(false),
- cutype(CutypeIndividual)
- {};
-
- ContactReference contact;
- PartStatus partStat;
- Role role;
- bool rsvp;
- std::vector<ContactReference> delegatedTo;
- std::vector<ContactReference> delegatedFrom;
- Cutype cutype;
-};
-
-Attendee::Attendee()
-: d(new Attendee::Private)
-{
-
-}
-
-Attendee::Attendee(const ContactReference& contact)
-: d(new Attendee::Private)
-{
- d->contact = contact;
-}
-
-Attendee::Attendee(const Kolab::Attendee &other)
-: d(new Attendee::Private)
-{
- *d = *other.d;
-}
-
-void Attendee::operator=(const Kolab::Attendee &other)
-{
- *d = *other.d;
-}
-
-Attendee::~Attendee()
-{
-
-}
-
-bool Attendee::operator==(const Kolab::Attendee &other) const
-{
- if ( d->contact == other.contact() &&
- d->partStat == other.partStat() &&
- d->role == other.role() &&
- d->rsvp == other.rsvp() &&
- d->delegatedTo == other.delegatedTo() &&
- d->delegatedFrom == other.delegatedFrom() &&
- d->cutype == other.cutype()
- ) {
- return true;
- }
- return false;
-}
-
-bool Attendee::isValid() const
-{
- return d->contact.isValid();
-};
-
-void Attendee::setContact(const ContactReference &c)
-{
- d->contact = c;
-}
-
-ContactReference Attendee::contact() const
-{
- return d->contact;
-}
-
-
-void Attendee::setPartStat(PartStatus partStat)
-{
- d->partStat = partStat;
-}
-
-PartStatus Attendee::partStat() const
-{
- return d->partStat;
-}
-
-void Attendee::setRole(Role role)
-{
- d->role = role;
-}
-
-Role Attendee::role() const
-{
- return d->role;
-}
-
-void Attendee::setRSVP(bool rsvp)
-{
- d->rsvp = rsvp;
-}
-
-bool Attendee::rsvp() const
-{
- return d->rsvp;
-}
-
-void Attendee::setDelegatedTo(const std::vector< ContactReference > &del)
-{
- d->delegatedTo = del;
-}
-
-std::vector< ContactReference > Attendee::delegatedTo() const
-{
- return d->delegatedTo;
-}
-
-void Attendee::setDelegatedFrom(const std::vector< ContactReference > &del)
-{
- d->delegatedFrom = del;
-}
-
-std::vector< ContactReference > Attendee::delegatedFrom() const
-{
- return d->delegatedFrom;
-}
-
-void Attendee::setCutype(Cutype type)
-{
- d->cutype = type;
-}
-
-Cutype Attendee::cutype() const
-{
- return d->cutype;
-}
-
-
-struct Attachment::Private
-{
- std::string uri;
- std::string data;
- std::string mimetype;
- std::string label;
-};
-
-Attachment::Attachment()
-: d(new Attachment::Private)
-{
-}
-
-Attachment::Attachment(const Kolab::Attachment &other)
-: d(new Attachment::Private)
-{
- *d = *other.d;
-}
-
-void Attachment::operator=(const Kolab::Attachment &other)
-{
- *d = *other.d;
-}
-
-Attachment::~Attachment()
-{
-}
-
-bool Attachment::operator==(const Kolab::Attachment &other) const
-{
- return ( d->uri == other.uri() &&
- d->data == other.data() &&
- d->label == other.label() &&
- d->mimetype == other.mimetype() );
-}
-
-void Attachment::setUri(const std::string &uri, const std::string& mimetype)
-{
- d->uri = uri;
- d->mimetype = mimetype;
-}
-
-std::string Attachment::uri() const
-{
- return d->uri;
-}
-
-std::string Attachment::mimetype() const
-{
- return d->mimetype;
-}
-
-void Attachment::setLabel(const std::string &label)
-{
- d->label = label;
-}
-
-std::string Attachment::label() const
-{
- return d->label;
-}
-
-void Attachment::setData(const std::string &data, const std::string& mimetype)
-{
- d->data = data;
- d->mimetype = mimetype;
-}
-
-std::string Attachment::data() const
-{
- return d->data;
-}
-
-bool Attachment::isValid() const
-{
- return !d->mimetype.empty(); //TODO use isValid variable
-}
-
-
-
-struct Alarm::Private
-{
- Private(): relativeTo(Start),
- numrepeat(0),
- type(Alarm::InvalidAlarm) {};
- std::string text;
- Attachment audioFile;
- std::string summary;
- std::vector<ContactReference> attendees;
- cDateTime start;
- Duration relativeDuration;
- Relative relativeTo;
- Duration duration;
- int numrepeat;
- Type type;
-
-};
-
-Alarm::Alarm()
-: d(new Alarm::Private)
-{
-}
-
-Alarm::Alarm(const std::string &text)
-: d(new Alarm::Private)
-{
- d->text = text;
- d->type = DisplayAlarm;
-}
-
-
-Alarm::Alarm(const Kolab::Attachment& audio)
-: d(new Alarm::Private)
-{
- d->audioFile = audio;
- d->type = AudioAlarm;
-}
-
-Alarm::Alarm(const std::string& summary, const std::string& description, const std::vector<ContactReference> attendees)
-: d(new Alarm::Private)
-{
- d->summary = summary;
- d->text = description;
- d->attendees = attendees;
- d->type = EMailAlarm;
-
-}
-
-Alarm::Alarm(const Kolab::Alarm &other)
-: d(new Alarm::Private)
-{
- *d = *other.d;
-}
-
-void Alarm::operator=(const Kolab::Alarm &other)
-{
- *d = *other.d;
-}
-
-Alarm::~Alarm()
-{
-}
-
-bool Alarm::operator==(const Kolab::Alarm &other) const
-{
- return ( d->text == other.description() &&
- d->text == other.description() &&
- d->audioFile == other.audioFile() &&
- d->summary == other.summary() &&
- d->attendees == other.attendees() &&
- d->start == other.start() &&
- d->relativeDuration == other.relativeStart() &&
- d->relativeTo == other.relativeTo() &&
- d->duration == other.duration() &&
- d->numrepeat == other.numrepeat() );
-}
-
-std::string Alarm::text() const
-{
- return d->text;
-}
-
-Attachment Alarm::audioFile() const
-{
- return d->audioFile;
-}
-
-std::string Alarm::summary() const
-{
- return d->summary;
-}
-
-std::string Alarm::description() const
-{
- return d->text;
-}
-
-std::vector<ContactReference> Alarm::attendees() const
-{
- return d->attendees;
-}
-
-void Alarm::setStart(const Kolab::cDateTime &start)
-{
- d->start = start;
-}
-
-cDateTime Alarm::start() const
-{
- return d->start;
-}
-
-void Alarm::setRelativeStart(const Kolab::Duration &duration, Relative relativeTo)
-{
- d->relativeDuration = duration;
- d->relativeTo = relativeTo;
-}
-
-Duration Alarm::relativeStart() const
-{
- return d->relativeDuration;
-}
-
-Relative Alarm::relativeTo() const
-{
- return d->relativeTo;
-}
-
-void Alarm::setDuration(const Kolab::Duration &duration, int numrepeat)
-{
- d->numrepeat = numrepeat;
- d->duration = duration;
-}
-
-Duration Alarm::duration() const
-{
- return d->duration;
-}
-
-int Alarm::numrepeat() const
-{
- return d->numrepeat;
-}
-
-Alarm::Type Alarm::type() const
-{
- return d->type;
-}
-
-
-
-
-
-
-}//Namespace
diff --git a/src/kolabcontainers.h b/src/kolabcontainers.h
deleted file mode 100644
index 5f8318d..0000000
--- a/src/kolabcontainers.h
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef KOLAB_CONTAINERS_H
-#define KOLAB_CONTAINERS_H
-#include <string>
-#include <vector>
-#include <boost/scoped_ptr.hpp>
-
-namespace Kolab {
-
-class cDateTime {
-public:
- cDateTime();
- cDateTime(int year, int month, int day, int hour, int minute, int second, bool isUtc=false);
- cDateTime(const std::string &timezone, int year, int month, int day, int hour, int minute, int second);
- cDateTime(int year, int month, int day);
- ~cDateTime();
- cDateTime(const cDateTime &);
- void operator=(const cDateTime &);
- bool operator==(const cDateTime &) const;
-
-
- void setDate(int year, int month, int day);
- int year() const;
- int month() const;
- int day() const;
-
- bool isDateOnly() const;
-
- void setTime(int hour, int minute, int second);
- int hour() const;
- int minute() const;
- int second() const;
-
- void setUTC(bool);
- bool isUTC() const;
- void setTimezone(const std::string &);
- std::string timezone() const;
-
- bool isValid() const;
-private:
- struct Private;
- boost::scoped_ptr<Private> d;
-};
-
-enum Classification {
- ClassPublic,
- ClassPrivate,
- ClassConfidential
-};
-
-enum Status {
- StatusUndefined,
- StatusNeedsAction,
- StatusCompleted,
- StatusInProcess,
- StatusCancelled,
- StatusTentative,
- StatusConfirmed,
- StatusDraft,
- StatusFinal
-};
-
-enum Weekday {
- Monday,
- Tuesday,
- Wednesday,
- Thursday,
- Friday,
- Saturday,
- Sunday
-};
-
-struct DayPos {
- DayPos(): mIsValid(false){};
- DayPos(int occurrence, Weekday weekday): mOccurrence(occurrence), mWeekday(weekday), mIsValid(true){};
- bool operator==(const DayPos &other) const { return mOccurrence == other.mOccurrence && mWeekday == other.mWeekday; };
- int occurence() const { return mOccurrence; };
- Weekday weekday() const { return mWeekday; };
- bool isValid() { return mIsValid; };
-private:
- int mOccurrence;
- Weekday mWeekday;
- bool mIsValid;
-};
-
-class Attachment {
-public:
- Attachment();
- Attachment(const Kolab::Attachment &);
- ~Attachment();
-
- void operator=(const Attachment &);
- bool operator==(const Attachment &) const;
-
- void setUri(const std::string &uri, const std::string &mimetype);
- std::string uri() const;
-
- ///Un-encoded binary content, Implies embedded, will be encoded
- void setData(const std::string &, const std::string &mimetype);
- ///Decoded binary content.
- std::string data() const;
- //TODO add possibility to set already encoded data and uri to be embedded as performance/convenience improvement?
-// ///Base64 encoded binary content, Implies embedded
-// void setEncodedData(const std::string &, const std::string &mimetype);
-
- std::string mimetype() const;
-
- ///User visible label
- void setLabel(const std::string &);
- std::string label() const;
-
- bool isValid() const;
-private:
- struct Private;
- boost::scoped_ptr<Private> d;
-};
-
-enum Relative {
- Start,
- End
-};
-
-struct Duration {
- Duration():mWeeks(0), mDays(0), mHours(0), mMinutes(0), mSeconds(0), mNegative(false), valid(false){};
- Duration(int weeks, bool negative = false): mWeeks(weeks), mDays(0), mHours(0), mMinutes(0), mSeconds(0), mNegative(negative), valid(true){};
- Duration(int days, int hours, int minutes, int seconds, bool negative = false): mWeeks(0), mDays(days), mHours(hours), mMinutes(minutes), mSeconds(seconds), mNegative(negative), valid(true){};
- bool operator==(const Duration &other) const{ return (/*mWeeks == other.mWeeks &&
- mDays == other.mDays &&
- mHours == other.mHours &&
- mMinutes == other.mMinutes &&
- mSeconds == other.mSeconds &&
- mNegative == other.mNegative &&*/
- ( ((((mWeeks * 7 + mDays) * 24 + mHours) * 60 + mMinutes) * 60 + mSeconds) ==
- ((((other.mWeeks * 7 + other.mDays) * 24 + other.mHours) * 60 + other.mMinutes) * 60 + other.mSeconds) ) &&
- valid == other.valid );};
- int weeks() const { return mWeeks; };
- int days() const { return mDays; };
- int hours() const { return mHours; };
- int minutes() const { return mMinutes; };
- int seconds() const { return mSeconds; };
-
- bool isNegative() const { return mNegative; };
- bool isValid() const { return valid; };
-private:
- int mWeeks;
- int mDays;
- int mHours;
- int mMinutes;
- int mSeconds;
- bool mNegative;
- bool valid;
-};
-
-struct ContactReference {
- enum ReferenceType {
- Invalid,
- EmailReference,
- UidReference,
- EmailAndUidReference
- };
- ContactReference(): mType(Invalid) {};
- ///For xCal
- ContactReference(const std::string &email, const std::string &name = std::string(), const std::string &uid = std::string()): mType(EmailAndUidReference), mEmail(email), mUid(uid), mName(name) {};
- ///For xCard
- ContactReference(ReferenceType type, const std::string &emailOrUID, const std::string &name = std::string()): mType(type), mName(name) {
- if (type == EmailReference) {
- mEmail = emailOrUID;
- } else {
- mUid = emailOrUID;
- }
- };
- bool operator==(const ContactReference &other) const { return mEmail == other.mEmail &&
- mName == other.mName &&
- mUid == other.mUid;
- };
-
- bool isValid() const { return mType != Invalid; };
-
- void setName(const std::string &name) { mName = name; };
-
- std::string email() const { return mEmail; };
- std::string uid() const { return mUid; };
- std::string name() const { return mName; };
-
- ReferenceType type() const { return mType; };
-
-private:
- ReferenceType mType;
- std::string mEmail;
- std::string mUid;
- std::string mName;
-};
-
-class Alarm {
-public:
- enum Type {
- InvalidAlarm,
- EMailAlarm,
- DisplayAlarm,
- AudioAlarm
- };
-
- Alarm();
- Alarm(const Alarm &);
- ~Alarm();
-
- void operator=(const Alarm &);
- bool operator==(const Alarm &other) const;
-
- ///EMail Alarm, @param attendees accepts only email + name and no uid
- Alarm(const std::string &summary, const std::string &description, const std::vector<ContactReference> attendees);
- std::string summary() const;
- std::string description() const;
- std::vector<ContactReference> attendees() const;
-
- ///Display Alarm
- Alarm(const std::string &text);
- std::string text() const;
-
- ///Audio Alarm
- Alarm(const Attachment &audio);
- Attachment audioFile() const;
-
- void setRelativeStart(const Duration &, Relative);
- Duration relativeStart() const;
- Relative relativeTo() const;
-
- void setStart(const cDateTime &);
- cDateTime start() const;
-
- void setDuration(const Duration &, int numrepeat);
- Duration duration() const;
- int numrepeat() const;
-
- Type type() const;
-
-private:
- struct Private;
- boost::scoped_ptr<Private> d;
-};
-
-
-class RecurrenceRule {
-public:
-
- RecurrenceRule();
- RecurrenceRule(const RecurrenceRule &);
- ~RecurrenceRule();
-
- void operator=(const RecurrenceRule &);
- bool operator==(const RecurrenceRule &other) const;
-
- enum Frequency {
- FreqNone,
- Yearly,
- Monthly,
- Weekly,
- Daily,
- Hourly,
- Minutely,
- Secondly
- };
-
- void setFrequency(Frequency);
- Frequency frequency() const;
-
- void setWeekStart(Weekday);
- Weekday weekStart() const;
-
- void setEnd(const cDateTime &);
- cDateTime end() const;
-
- void setCount(int count);
- int count() const;
-
- void setInterval(int);
- int interval() const;
-
- void setBysecond(const std::vector<int> &);
- std::vector<int> bysecond() const;
-
- void setByminute(const std::vector<int> &);
- std::vector<int> byminute() const;
-
- void setByhour(const std::vector<int> &);
- std::vector<int> byhour() const;
-
- void setByday(const std::vector<DayPos> &);
- std::vector<DayPos> byday() const;
-
- void setBymonthday(const std::vector<int> &);
- std::vector<int> bymonthday() const;
-
- void setByyearday(const std::vector<int> &);
- std::vector<int> byyearday() const;
-
- void setByweekno(const std::vector<int> &);
- std::vector<int> byweekno() const;
-
- void setBymonth(const std::vector<int> &);
- std::vector<int> bymonth() const;
-
- bool isValid() const;
-
-private:
- struct Private;
- boost::scoped_ptr<Private> d;
-};
-
-
-enum PartStatus {
- PartNeedsAction,
- PartAccepted,
- PartDeclined,
- PartTentative,
- PartDelegated
-};
-
-enum Role {
- Required,
- Chair,
- Optional,
- NonParticipant
-};
-
-enum Cutype {
- CutypeUnknown,
- CutypeGroup,
- CutypeIndividual,
- CutypeResource,
- CutypeRoom
-};
-
-class Attendee {
-public:
- Attendee();
- Attendee(const ContactReference &contact);
- Attendee(const Attendee &);
- ~Attendee();
-
- void operator=(const Attendee &);
- bool operator==(const Attendee &) const;
-
- bool isValid() const;
-
- void setContact(const ContactReference &);
- ContactReference contact() const;
-
- void setPartStat(PartStatus);
- PartStatus partStat() const;
-
- void setRole(Role);
- Role role() const;
-
- void setRSVP(bool);
- bool rsvp() const;
-
- void setDelegatedTo(const std::vector<ContactReference> &);
- std::vector<ContactReference> delegatedTo() const;
-
- void setDelegatedFrom(const std::vector<ContactReference> &);
- std::vector<ContactReference> delegatedFrom() const;
-
- void setCutype(Cutype);
- Cutype cutype() const;
-private:
- struct Private;
- boost::scoped_ptr<Private> d;
-};
-
-struct CustomProperty {
- CustomProperty(){};
- CustomProperty(const std::string &i, const std::string &v)
- : identifier(i), value(v) {};
-
- bool operator==(const CustomProperty &other) const{ return (identifier == other.identifier && value == other.value);};
- std::string identifier;
- std::string value;
-};
-
-//WARNING this function copies the vector and does not modify it
-template <typename T>
-std::vector<T> operator<< ( std::vector<T> v, const T &s)
-{
- v.push_back(s);
- return v;
-}
-
-
-}
-
-#endif
diff --git a/src/kolabevent.cpp b/src/kolabevent.cpp
deleted file mode 100644
index f70346a..0000000
--- a/src/kolabevent.cpp
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "kolabevent.h"
-#include "kolabevent_p.h"
-
-namespace Kolab {
-
-Event::Event()
-: d(new Event::Private())
-{
-// std::cout << "ctor" << std::endl;
-}
-
-Event::Event(const Event &other)
-: d(new Event::Private())
-{
- *d = *other.d;
-// std::cout << "cctor" << std::endl;
-}
-
-Event::~Event()
-{
-// std::cout << "dtor" << std::endl;
-}
-
-void Event::operator=(const Kolab::Event &other)
-{
- *d = *other.d;
-}
-
-bool Event::isValid() const
-{
- return !d->uid.empty();
-}
-
-void Event::setUid(const std::string &uid)
-{
- d->uid = uid;
-}
-
-std::string Event::uid() const
-{
- return d->uid;
-}
-
-void Event::setCreated(const Kolab::cDateTime &created)
-{
- d->created = created;
-}
-
-cDateTime Event::created() const
-{
- return d->created;
-}
-
-void Event::setLastModified(const Kolab::cDateTime &lastMod)
-{
- d->lastModified = lastMod;
-}
-
-cDateTime Event::lastModified() const
-{
- return d->lastModified;
-}
-
-void Event::setSequence(int sequence)
-{
- d->sequence = sequence;
-}
-
-int Event::sequence() const
-{
- return d->sequence;
-}
-
-void Event::setClassification(Classification class_)
-{
- d->classification = class_;
-}
-
-Classification Event::classification() const
-{
- return d->classification;
-}
-
-void Event::setCategories(const std::vector< std::string > &categories)
-{
- d->categories = categories;
-}
-
-void Event::addCategory(const std::string &cat)
-{
- d->categories.push_back(cat);
-}
-
-std::vector< std::string > Event::categories() const
-{
- return d->categories;
-}
-
-void Event::setStart(const Kolab::cDateTime &start)
-{
- d->start = start;
-}
-
-cDateTime Event::start() const
-{
- return d->start;
-}
-
-void Event::setEnd(const Kolab::cDateTime &end)
-{
- d->end = end;
-}
-
-cDateTime Event::end() const
-{
- return d->end;
-}
-
-void Event::setDuration(const Duration &duration)
-{
- d->duration = duration;
-}
-
-Duration Event::duration() const
-{
- return d->duration;
-}
-
-
-void Event::setRecurrenceID(const Kolab::cDateTime &rID, bool thisandfuture)
-{
- d->recurrenceID = rID;
- d->thisAndFuture = thisandfuture;
-}
-
-cDateTime Event::recurrenceID() const
-{
- return d->recurrenceID;
-}
-
-bool Event::thisAndFuture() const
-{
- return d->thisAndFuture;
-}
-
-void Event::setSummary(const std::string &summary)
-{
- d->summary = summary;
-}
-
-std::string Event::summary() const
-{
- return d->summary;
-}
-
-void Event::setDescription(const std::string &description)
-{
- d->description = description;
-}
-
-std::string Event::description() const
-{
- return d->description;
-}
-
-void Event::setPriority(int priority)
-{
- d->priority = priority;
-}
-
-int Event::priority() const
-{
- return d->priority;
-}
-
-void Event::setStatus(Status status)
-{
- d->status = status;
-}
-
-Status Event::status() const
-{
- return d->status;
-}
-
-void Event::setLocation(const std::string &location)
-{
- d->location = location;
-}
-
-std::string Event::location() const
-{
- return d->location;
-}
-
-void Event::setRecurrenceRule(const Kolab::RecurrenceRule &rrule)
-{
- d->rrule = rrule;
-}
-
-RecurrenceRule Event::recurrenceRule() const
-{
- return d->rrule;
-}
-
-void Event::setRecurrenceDates(const std::vector< cDateTime > &dates)
-{
- d->recurrenceDates = dates;
-}
-
-void Event::addRecurrenceDate(const Kolab::cDateTime &dt)
-{
- d->recurrenceDates.push_back(dt);
-}
-
-std::vector< cDateTime > Event::recurrenceDates() const
-{
- return d->recurrenceDates;
-}
-
-void Event::setExceptionDates(const std::vector< cDateTime > &dates)
-{
- d->exceptionDates = dates;
-}
-
-void Event::addExceptionDate(const Kolab::cDateTime &dt)
-{
- d->exceptionDates.push_back(dt);
-}
-
-std::vector< cDateTime > Event::exceptionDates() const
-{
- return d->exceptionDates;
-}
-
-void Event::setTransparency(bool isTransparent)
-{
- d->isTransparent = isTransparent;
-}
-
-bool Event::transparency() const
-{
- return d->isTransparent;
-}
-
-void Event::setOrganizer(const ContactReference &organizer)
-{
- d->organizer = organizer;
-}
-
-ContactReference Event::organizer() const
-{
- return d->organizer;
-}
-
-void Event::setAttendees(const std::vector< Attendee > &attendees)
-{
- d->attendees = attendees;
-}
-
-std::vector< Attendee > Event::attendees() const
-{
- return d->attendees;
-}
-
-void Event::setAttachments(const std::vector< Attachment > &attach)
-{
- d->attachments = attach;
-}
-
-std::vector< Attachment > Event::attachments() const
-{
- return d->attachments;
-}
-
-void Event::setCustomProperties(const std::vector< CustomProperty > &prop)
-{
- d->customProperties = prop;
-}
-
-std::vector< CustomProperty > Event::customProperties() const
-{
- return d->customProperties;
-}
-
-// void Event::setExceptions(const std::vector< Event > &exceptions)
-// {
-// d->exceptions = exceptions;
-// }
-//
-// std::vector< Event > Event::exceptions() const
-// {
-// return d->exceptions;
-// }
-
-void Event::setAlarms(const std::vector< Alarm > &alarms)
-{
- d->alarms = alarms;
-}
-
-std::vector< Alarm > Event::alarms() const
-{
- return d->alarms;
-}
-
-
-
-
-}
diff --git a/src/kolabevent.h b/src/kolabevent.h
deleted file mode 100644
index abec9a9..0000000
--- a/src/kolabevent.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef KOLAB_EVENT_H
-#define KOLAB_EVENT_H
-
-#include <string>
-#include <vector>
-#include <boost/scoped_ptr.hpp>
-#include "kolabcontainers.h"
-namespace Kolab {
-
-class Event {
-public:
- Event();
- ~Event();
- Event(const Event &);
- void operator=(const Event &);
-
- bool isValid() const;
-
- void setUid(const std::string &);
- std::string uid() const;
-
- void setCreated(const cDateTime &);
- cDateTime created() const;
-
- void setLastModified(const cDateTime &);
- cDateTime lastModified() const;
-
- void setSequence(int);
- int sequence() const;
-
- void setClassification(Classification);
- Classification classification() const;
-
- void setCategories(const std::vector<std::string> &);
- void addCategory(const std::string &);
- std::vector<std::string> categories() const;
-
- void setStart(const cDateTime &);
- cDateTime start() const;
-
- void setEnd(const cDateTime &);
- cDateTime end() const;
-
- void setDuration(const Duration &);
- Duration duration() const;
-
- void setTransparency(bool isTransparent);
- bool transparency() const;
-
- void setRecurrenceRule(const RecurrenceRule &);
- RecurrenceRule recurrenceRule() const;
-
- void setRecurrenceDates(const std::vector<cDateTime> &);
- void addRecurrenceDate(const cDateTime &);
- std::vector<cDateTime> recurrenceDates() const;
-
- void setExceptionDates(const std::vector<cDateTime> &);
- void addExceptionDate(const cDateTime &);
- std::vector<cDateTime> exceptionDates() const;
-
- void setRecurrenceID(const cDateTime &, bool thisandfuture);
- cDateTime recurrenceID() const;
- bool thisAndFuture() const;
-
- void setSummary(const std::string &);
- std::string summary() const;
-
- void setDescription(const std::string &);
- std::string description() const;
-
- void setPriority(int);
- int priority() const;
-
- void setStatus(Status);
- Status status() const;
-
- void setLocation(const std::string &);
- std::string location() const;
-
- void setOrganizer(const ContactReference &);
- ContactReference organizer() const;
-
- void setAttendees(const std::vector<Attendee> &);
- std::vector<Attendee> attendees() const;
-
- void setAttachments(const std::vector<Attachment> &);
- std::vector<Attachment> attachments() const;
-
- void setCustomProperties(const std::vector<CustomProperty> &);
- std::vector<CustomProperty> customProperties() const;
-/* TODO what is this? Exceptions it is
- void setExceptions(const std::vector<Event> &);
- std::vector<Event> exceptions() const;*/
-
- void setAlarms(const std::vector<Alarm> &);
- std::vector<Alarm> alarms() const;
-
-protected:
- struct Private;
- boost::scoped_ptr<Private> d;
-};
-
-
-}
-
-#endif
-
diff --git a/src/kolabevent_p.h b/src/kolabevent_p.h
deleted file mode 100644
index 66054d3..0000000
--- a/src/kolabevent_p.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef KOLABEVENT_P
-#define KOLABEVENT_P
-
-#include "kolabcontainers.h"
-#include "incidence_p.h"
-
-namespace Kolab {
-
-class Event;
-
-struct Event::Private: public PrivateIncidence
-{
- Private()
- : PrivateIncidence(),
- isTransparent(false){}
-
- cDateTime end;
- bool isTransparent;
- Duration duration;
- std::vector< Event > exceptions;
-};
-
-}
-
-#endif
diff --git a/src/kolabformat.i b/src/kolabformat.i
index 25f7428..5776f96 100644
--- a/src/kolabformat.i
+++ b/src/kolabformat.i
@@ -7,13 +7,13 @@
#include "global_definitions.h"
#include "kolabformat.h"
- #include "kolabcontainers.h"
- #include "kolabevent.h"
- #include "kolabtodo.h"
- #include "kolabjournal.h"
- #include "kolabcontact.h"
- #include "kolabnote.h"
- #include "kolabconfiguration.h"
+ #include "containers/kolabcontainers.h"
+ #include "containers/kolabevent.h"
+ #include "containers/kolabtodo.h"
+ #include "containers/kolabjournal.h"
+ #include "containers/kolabcontact.h"
+ #include "containers/kolabnote.h"
+ #include "containers/kolabconfiguration.h"
%}
%include "std_string.i"
@@ -40,11 +40,11 @@ namespace std {
};
%include "global_definitions.h"
-%include "kolabcontainers.h"
-%include "kolabevent.h"
-%include "kolabtodo.h"
-%include "kolabjournal.h"
-%include "kolabcontact.h"
-%include "kolabnote.h"
%include "kolabformat.h"
-%include "kolabconfiguration.h"
+%include "containers/kolabcontainers.h"
+%include "containers/kolabevent.h"
+%include "containers/kolabtodo.h"
+%include "containers/kolabjournal.h"
+%include "containers/kolabcontact.h"
+%include "containers/kolabnote.h"
+%include "containers/kolabconfiguration.h"
diff --git a/src/kolabjournal.cpp b/src/kolabjournal.cpp
deleted file mode 100644
index ce37fbc..0000000
--- a/src/kolabjournal.cpp
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (C) 2012 Christian Mollekopf <mollekopf at kolabsys.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "kolabjournal.h"
-#include "incidence_p.h"
-
-namespace Kolab {
-
-struct Journal::Private: public PrivateIncidence
-{
- Private()
- : PrivateIncidence() {}
-};
-
-Journal::Journal()
-: d(new Journal::Private())
-{
-}
-
-Journal::Journal(const Journal &other)
-: d(new Journal::Private())
-{
- *d = *other.d;
-}
-
-Journal::~Journal()
-{
-}
-
-void Journal::operator=(const Kolab::Journal &other)
-{
- *d = *other.d;
-}
-
-bool Journal::isValid() const
-{
- return !d->uid.empty();
-}
-
-void Journal::setUid(const std::string &uid)
-{
- d->uid = uid;
-}
-
-std::string Journal::uid() const
-{
- return d->uid;
-}
-
-void Journal::setCreated(const Kolab::cDateTime &created)
-{
- d->created = created;
-}
-
-cDateTime Journal::created() const
-{
- return d->created;
-}
-
-void Journal::setLastModified(const Kolab::cDateTime &lastMod)
-{
- d->lastModified = lastMod;
-}
-
-cDateTime Journal::lastModified() const
-{
- return d->lastModified;
-}
-
-void Journal::setSequence(int sequence)
-{
- d->sequence = sequence;
-}
-
-int Journal::sequence() const
-{
- return d->sequence;
-}
-
-void Journal::setClassification(Classification class_)
-{
- d->classification = class_;
-}
-
-Classification Journal::classification() const
-{
- return d->classification;
-}
-
-void Journal::setCategories(const std::vector< std::string > &categories)
-{
- d->categories = categories;
-}
-
-void Journal::addCategory(const std::string &cat)
-{
- d->categories.push_back(cat);
-}
-
-std::vector< std::string > Journal::categories() const
-{
- return d->categories;
-}
-
-void Journal::setStart(const Kolab::cDateTime &start)
-{
- d->start = start;
-}
-
-cDateTime Journal::start() const
-{
- return d->start;
-}
-
-void Journal::setSummary(const std::string &summary)
-{
- d->summary = summary;
-}
-
-std::string Journal::summary() const
-{
- return d->summary;
-}
-
-void Journal::setDescription(const std::string &description)
-{
- d->description = description;
-}
-
-std::string Journal::description() const
-{
- return d->description;
-}
-
-
-void Journal::setStatus(Status status)
-{
- d->status = status;
-}
-
-Status Journal::status() const
-{
- return d->status;
-}
-
-void Journal::setAttendees(const std::vector< Attendee > &attendees)
-{
- d->attendees = attendees;
-}
-
-std::vector< Attendee > Journal::attendees() const
-{
- return d->attendees;
-}
-
-void Journal::setAttachments(const std::vector< Attachment > &attach)
-{
- d->attachments = attach;
-}
-
-std::vector< Attachment > Journal::attachments() const
-{
- return d->attachments;
-}
-
-void Journal::setCustomProperties(const std::vector< CustomProperty > &prop)
-{
- d->customProperties = prop;
-}
-
-std::vector< CustomProperty > Journal::customProperties() const
-{
- return d->customProperties;
-}
-
-
-}//Namespace
diff --git a/src/kolabjournal.h b/src/kolabjournal.h
deleted file mode 100644
index 9a904d3..0000000
--- a/src/kolabjournal.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2012 Christian Mollekopf <mollekopf at kolabsys.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef KOLABJOURNAL_H
-#define KOLABJOURNAL_H
-
-#include <string>
-#include <vector>
-#include <boost/scoped_ptr.hpp>
-#include "kolabcontainers.h"
-namespace Kolab {
-
-class Journal {
-public:
- Journal();
- ~Journal();
- Journal(const Journal &);
- void operator=(const Journal &);
-
- bool isValid() const;
-
- void setUid(const std::string &);
- std::string uid() const;
-
- void setCreated(const cDateTime &);
- cDateTime created() const;
-
- void setLastModified(const cDateTime &);
- cDateTime lastModified() const;
-
- void setSequence(int);
- int sequence() const;
-
- void setClassification(Classification);
- Classification classification() const;
-
- void setCategories(const std::vector<std::string> &);
- void addCategory(const std::string &);
- std::vector<std::string> categories() const;
-
- void setStart(const cDateTime &);
- cDateTime start() const;
-
- void setSummary(const std::string &);
- std::string summary() const;
-
- void setDescription(const std::string &);
- std::string description() const;
-
- void setStatus(Status);
- Status status() const;
-
- //TODO Contacts
-
- void setAttendees(const std::vector<Attendee> &);
- std::vector<Attendee> attendees() const;
-
- void setAttachments(const std::vector<Attachment> &);
- std::vector<Attachment> attachments() const;
-
- void setCustomProperties(const std::vector<CustomProperty> &);
- std::vector<CustomProperty> customProperties() const;
-private:
- struct Private;
- boost::scoped_ptr<Private> d;
-};
-
-
-
-}
-
-#endif
-
diff --git a/src/kolabnote.cpp b/src/kolabnote.cpp
deleted file mode 100644
index c7931bb..0000000
--- a/src/kolabnote.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright (C) 2012 Christian Mollekopf <mollekopf at kolabsys.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "kolabnote.h"
-
-namespace Kolab {
-
-struct Note::Private
-{
- Private()
- : classification(ClassPublic){}
-
- std::string uid;
- cDateTime created;
- cDateTime lastModified;
- std::vector< std::string > categories;
- Classification classification;
-
- std::string summary;
- std::string description;
- std::string color;
-
- std::vector<Attachment> attachments;
- std::vector<CustomProperty> customProperties;
-};
-
-Note::Note()
-: d(new Note::Private())
-{
-}
-
-Note::Note(const Note &other)
-: d(new Note::Private())
-{
- *d = *other.d;
-}
-
-Note::~Note()
-{
-}
-
-void Note::operator=(const Kolab::Note &other)
-{
- *d = *other.d;
-}
-
-bool Note::operator==(const Kolab::Note& other) const
-{
- return ( d->uid == other.uid() &&
- d->created == other.created() &&
- d->lastModified == other.lastModified() &&
- d->categories == other.categories() &&
- d->classification == other.classification() &&
- d->summary == other.summary() &&
- d->description == other.description() &&
- d->color == other.color() &&
- d->attachments == other.attachments() &&
- d->customProperties == other.customProperties());
-}
-
-bool Note::isValid() const
-{
- return !d->uid.empty();
-}
-
-void Note::setUid(const std::string &uid)
-{
- d->uid = uid;
-}
-
-std::string Note::uid() const
-{
- return d->uid;
-}
-
-void Note::setCreated(const Kolab::cDateTime &created)
-{
- d->created = created;
-}
-
-cDateTime Note::created() const
-{
- return d->created;
-}
-
-void Note::setLastModified(const Kolab::cDateTime &lastMod)
-{
- d->lastModified = lastMod;
-}
-
-cDateTime Note::lastModified() const
-{
- return d->lastModified;
-}
-
-void Note::setClassification(Classification class_)
-{
- d->classification = class_;
-}
-
-Classification Note::classification() const
-{
- return d->classification;
-}
-
-void Note::setCategories(const std::vector< std::string > &categories)
-{
- d->categories = categories;
-}
-
-void Note::addCategory(const std::string &cat)
-{
- d->categories.push_back(cat);
-}
-
-std::vector< std::string > Note::categories() const
-{
- return d->categories;
-}
-
-void Note::setSummary(const std::string &summary)
-{
- d->summary = summary;
-}
-
-std::string Note::summary() const
-{
- return d->summary;
-}
-
-void Note::setDescription(const std::string &description)
-{
- d->description = description;
-}
-
-std::string Note::description() const
-{
- return d->description;
-}
-
-void Note::setColor(const std::string &color)
-{
- d->color = color;
-}
-
-std::string Note::color() const
-{
- return d->color;
-}
-
-void Note::setAttachments(const std::vector< Attachment > &attach)
-{
- d->attachments = attach;
-}
-
-std::vector< Attachment > Note::attachments() const
-{
- return d->attachments;
-}
-
-void Note::setCustomProperties(const std::vector< CustomProperty > &prop)
-{
- d->customProperties = prop;
-}
-
-std::vector< CustomProperty > Note::customProperties() const
-{
- return d->customProperties;
-}
-
-} //Note
diff --git a/src/kolabnote.h b/src/kolabnote.h
deleted file mode 100644
index 6edffb6..0000000
--- a/src/kolabnote.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2012 Christian Mollekopf <mollekopf at kolabsys.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef KOLABNOTE_H
-#define KOLABNOTE_H
-
-#include <string>
-#include <vector>
-#include <boost/scoped_ptr.hpp>
-#include "kolabcontainers.h"
-namespace Kolab {
-
- class Note {
- public:
- Note();
- ~Note();
- Note(const Note &);
- void operator=(const Note &);
- bool operator==(const Note &) const;
-
- bool isValid() const;
-
- void setUid(const std::string &);
- std::string uid() const;
-
- void setCreated(const cDateTime &);
- cDateTime created() const;
-
- void setLastModified(const cDateTime &);
- cDateTime lastModified() const;
-
- void setClassification(Classification);
- Classification classification() const;
-
- void setCategories(const std::vector<std::string> &);
- void addCategory(const std::string &);
- std::vector<std::string> categories() const;
-
- void setSummary(const std::string &);
- std::string summary() const;
-
- void setDescription(const std::string &);
- std::string description() const;
-
- void setColor(const std::string &);
- std::string color() const;
-
- void setAttachments(const std::vector<Attachment> &);
- std::vector<Attachment> attachments() const;
-
- void setCustomProperties(const std::vector<CustomProperty> &);
- std::vector<CustomProperty> customProperties() const;
- private:
- struct Private;
- boost::scoped_ptr<Private> d;
- };
-
-}
-
-#endif
-
diff --git a/src/kolabtodo.cpp b/src/kolabtodo.cpp
deleted file mode 100644
index ceefcf9..0000000
--- a/src/kolabtodo.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "kolabtodo.h"
-#include "incidence_p.h"
-
-namespace Kolab {
-
-
-struct Todo::Private: public PrivateIncidence
-{
- Private()
- : PrivateIncidence(),
- percentComplete(0){}
-
- cDateTime due;
- int percentComplete;
-};
-
-Todo::Todo()
-: d(new Todo::Private())
-{
-
-}
-
-Todo::Todo(const Todo &other)
-: d(new Todo::Private())
-{
- *d = *other.d;
-}
-
-Todo::~Todo()
-{
-
-}
-
-void Todo::operator=(const Kolab::Todo &other)
-{
- *d = *other.d;
-}
-
-bool Todo::isValid() const
-{
- return !d->uid.empty();
-}
-
-void Todo::setUid(const std::string &uid)
-{
- d->uid = uid;
-}
-
-std::string Todo::uid() const
-{
- return d->uid;
-}
-
-void Todo::setCreated(const Kolab::cDateTime &created)
-{
- d->created = created;
-}
-
-cDateTime Todo::created() const
-{
- return d->created;
-}
-
-void Todo::setLastModified(const Kolab::cDateTime &lastMod)
-{
- d->lastModified = lastMod;
-}
-
-cDateTime Todo::lastModified() const
-{
- return d->lastModified;
-}
-
-void Todo::setSequence(int sequence)
-{
- d->sequence = sequence;
-}
-
-int Todo::sequence() const
-{
- return d->sequence;
-}
-
-void Todo::setClassification(Classification class_)
-{
- d->classification = class_;
-}
-
-Classification Todo::classification() const
-{
- return d->classification;
-}
-
-void Todo::setCategories(const std::vector< std::string > &categories)
-{
- d->categories = categories;
-}
-
-void Todo::addCategory(const std::string &cat)
-{
- d->categories.push_back(cat);
-}
-
-std::vector< std::string > Todo::categories() const
-{
- return d->categories;
-}
-
-void Todo::setRelatedTo(const std::vector< std::string > &related)
-{
- d->relatedTo = related;
-}
-
-void Todo::addRelatedTo(const std::string &related)
-{
- d->relatedTo.push_back(related);
-}
-
-std::vector< std::string > Todo::relatedTo() const
-{
- return d->relatedTo;
-}
-
-void Todo::setStart(const Kolab::cDateTime &start)
-{
- d->start = start;
-}
-
-cDateTime Todo::start() const
-{
- return d->start;
-}
-
-void Todo::setDue(const Kolab::cDateTime &due)
-{
- d->due = due;
-}
-
-cDateTime Todo::due() const
-{
- return d->due;
-}
-
-void Todo::setRecurrenceID(const Kolab::cDateTime &rID, bool thisandfuture)
-{
- d->recurrenceID = rID;
- d->thisAndFuture = thisandfuture;
-}
-
-cDateTime Todo::recurrenceID() const
-{
- return d->recurrenceID;
-}
-
-bool Todo::thisAndFuture() const
-{
- return d->thisAndFuture;
-}
-
-void Todo::setSummary(const std::string &summary)
-{
- d->summary = summary;
-}
-
-std::string Todo::summary() const
-{
- return d->summary;
-}
-
-void Todo::setDescription(const std::string &description)
-{
- d->description = description;
-}
-
-std::string Todo::description() const
-{
- return d->description;
-}
-
-void Todo::setPriority(int priority)
-{
- d->priority = priority;
-}
-
-int Todo::priority() const
-{
- return d->priority;
-}
-
-void Todo::setStatus(Status status)
-{
- d->status = status;
-}
-
-Status Todo::status() const
-{
- return d->status;
-}
-
-void Todo::setPercentComplete(int complete)
-{
- d->percentComplete = complete;
-}
-
-int Todo::percentComplete() const
-{
- return d->percentComplete;
-}
-
-void Todo::setLocation(const std::string &location)
-{
- d->location = location;
-}
-
-std::string Todo::location() const
-{
- return d->location;
-}
-
-void Todo::setRecurrenceRule(const Kolab::RecurrenceRule &rrule)
-{
- d->rrule = rrule;
-}
-
-RecurrenceRule Todo::recurrenceRule() const
-{
- return d->rrule;
-}
-
-void Todo::setRecurrenceDates(const std::vector< cDateTime > &dates)
-{
- d->recurrenceDates = dates;
-}
-
-void Todo::addRecurrenceDate(const Kolab::cDateTime &dt)
-{
- d->recurrenceDates.push_back(dt);
-}
-
-std::vector< cDateTime > Todo::recurrenceDates() const
-{
- return d->recurrenceDates;
-}
-
-void Todo::setExceptionDates(const std::vector< cDateTime > &dates)
-{
- d->exceptionDates = dates;
-}
-
-void Todo::addExceptionDate(const Kolab::cDateTime &dt)
-{
- d->exceptionDates.push_back(dt);
-}
-
-std::vector< cDateTime > Todo::exceptionDates() const
-{
- return d->exceptionDates;
-}
-
-void Todo::setOrganizer(const ContactReference &organizer)
-{
- d->organizer = organizer;
-}
-
-ContactReference Todo::organizer() const
-{
- return d->organizer;
-}
-
-void Todo::setAttendees(const std::vector< Attendee > &attendees)
-{
- d->attendees = attendees;
-}
-
-std::vector< Attendee > Todo::attendees() const
-{
- return d->attendees;
-}
-
-void Todo::setAttachments(const std::vector< Attachment > &attach)
-{
- d->attachments = attach;
-}
-
-std::vector< Attachment > Todo::attachments() const
-{
- return d->attachments;
-}
-
-void Todo::setCustomProperties(const std::vector< CustomProperty > &prop)
-{
- d->customProperties = prop;
-}
-
-std::vector< CustomProperty > Todo::customProperties() const
-{
- return d->customProperties;
-}
-
-void Todo::setAlarms(const std::vector< Alarm > &alarms)
-{
- d->alarms = alarms;
-}
-
-std::vector< Alarm > Todo::alarms() const
-{
- return d->alarms;
-}
-
-}
diff --git a/src/kolabtodo.h b/src/kolabtodo.h
deleted file mode 100644
index ce547e3..0000000
--- a/src/kolabtodo.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (C) 2011 Christian Mollekopf <mollekopf at kolabsys.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef KOLAB_TODO_H
-#define KOLAB_TODO_H
-
-#include <string>
-#include <vector>
-#include <boost/scoped_ptr.hpp>
-#include "kolabcontainers.h"
-namespace Kolab {
-
-
-class Todo {
-public:
- Todo();
- ~Todo();
- Todo(const Todo &);
- void operator=(const Todo &);
-
- bool isValid() const;
-
- void setUid(const std::string &);
- std::string uid() const;
-
- void setCreated(const cDateTime &);
- cDateTime created() const;
-
- void setLastModified(const cDateTime &);
- cDateTime lastModified() const;
-
- void setSequence(int);
- int sequence() const;
-
- void setClassification(Classification);
- Classification classification() const;
-
- void setCategories(const std::vector<std::string> &);
- void addCategory(const std::string &);
- std::vector<std::string> categories() const;
-
- void setRelatedTo(const std::vector<std::string> &);
- void addRelatedTo(const std::string &);
- std::vector<std::string> relatedTo() const;
-
- void setStart(const cDateTime &);
- cDateTime start() const;
-
- void setDue(const cDateTime &);
- cDateTime due() const;
-
- void setRecurrenceRule(const RecurrenceRule &);
- RecurrenceRule recurrenceRule() const;
-
- void setRecurrenceDates(const std::vector<cDateTime> &);
- void addRecurrenceDate(const cDateTime &);
- std::vector<cDateTime> recurrenceDates() const;
-
- void setExceptionDates(const std::vector<cDateTime> &);
- void addExceptionDate(const cDateTime &);
- std::vector<cDateTime> exceptionDates() const;
-
- void setRecurrenceID(const cDateTime &, bool thisandfuture);
- cDateTime recurrenceID() const;
- bool thisAndFuture() const;
-
- void setSummary(const std::string &);
- std::string summary() const;
-
- void setDescription(const std::string &);
- std::string description() const;
-
- void setPriority(int);
- int priority() const;
-
- void setStatus(Status);
- Status status() const;
-
- void setPercentComplete(int);
- int percentComplete() const;
-
- void setLocation(const std::string &);
- std::string location() const;
-
- void setOrganizer(const ContactReference &);
- ContactReference organizer() const;
-
- void setAttendees(const std::vector<Attendee> &);
- std::vector<Attendee> attendees() const;
-
- void setAttachments(const std::vector<Attachment> &);
- std::vector<Attachment> attachments() const;
-
- void setCustomProperties(const std::vector<CustomProperty> &);
- std::vector<CustomProperty> customProperties() const;
-
- void setAlarms(const std::vector<Alarm> &);
- std::vector<Alarm> alarms() const;
-
-private:
- struct Private;
- boost::scoped_ptr<Private> d;
-};
-
-}
-
-#endif
-
diff --git a/tests/bindingstest.cpp b/tests/bindingstest.cpp
index 70e68ca..164bdd7 100644
--- a/tests/bindingstest.cpp
+++ b/tests/bindingstest.cpp
@@ -17,7 +17,7 @@
#include <fstream>
#include "serializers.h"
#include <src/utils.h>
-#include <src/kolabjournal.h>
+#include "src/containers/kolabjournal.h"
#include "libkolabxml-version.h"
More information about the commits
mailing list