3 commits - kolabformat/kolabobject.cpp kolabformat/v2helpers.cpp kolabformat/v2helpers.h kolabformat/xmlobject.cpp kolabformat/xmlobject.h

Christian Mollekopf mollekopf at kolabsys.com
Thu Nov 1 13:43:14 CET 2012


 kolabformat/kolabobject.cpp |    2 
 kolabformat/v2helpers.cpp   |   30 ++++++--
 kolabformat/v2helpers.h     |    9 +-
 kolabformat/xmlobject.cpp   |  156 ++++++++++++++++++++++++++++++++++++++++++--
 kolabformat/xmlobject.h     |   64 ++++++++++++------
 5 files changed, 224 insertions(+), 37 deletions(-)

New commits:
commit 07bf7b32bdadc2dfe83c3678445eec7fa7377659
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Thu Nov 1 13:38:32 2012 +0100

    Use the right toStdString conversions, constness.

diff --git a/kolabformat/xmlobject.cpp b/kolabformat/xmlobject.cpp
index dd1cacb..fb5dbb2 100644
--- a/kolabformat/xmlobject.cpp
+++ b/kolabformat/xmlobject.cpp
@@ -40,10 +40,10 @@ std::vector< std::string > XMLObject::getAttachments() const
 std::string XMLObject::writeEvent(const Event &event, Version version, const std::string& productId)
 {
     if (version == KolabV2) {
-        KCalCore::Event::Ptr i = Conversion::toKCalCore(event);
+        const KCalCore::Event::Ptr i = Conversion::toKCalCore(event);
         //The timezone is used for created and last modified dates
         const QString &xml = KolabV2::Event::eventToXML(i, QLatin1String("UTC"));
-        return xml.toStdString();
+        return Conversion::toStdString(xml);
     }
     return Kolab::writeEvent(event, productId);
 }
@@ -52,7 +52,7 @@ Event XMLObject::readEvent(const std::string& s, Version version)
 {
     if (version == KolabV2) {
         QStringList attachments;
-        KCalCore::Event::Ptr event = Kolab::fromXML<KCalCore::Event::Ptr, KolabV2::Event>(QString::fromUtf8(s.c_str()).toUtf8(), attachments);
+        const KCalCore::Event::Ptr event = Kolab::fromXML<KCalCore::Event::Ptr, KolabV2::Event>(QString::fromUtf8(s.c_str()).toUtf8(), attachments);
         mAttachments.clear();
         foreach (const QString &attachment, attachments) {
             mAttachments.push_back(std::string(attachment.toUtf8().constData()));
@@ -65,10 +65,10 @@ Event XMLObject::readEvent(const std::string& s, Version version)
 std::string XMLObject::writeTodo(const Todo &event, Version version, const std::string& productId)
 {
     if (version == KolabV2) {
-        KCalCore::Todo::Ptr i = Conversion::toKCalCore(event);
+        const KCalCore::Todo::Ptr i = Conversion::toKCalCore(event);
         //The timezone is used for created and last modified dates
         const QString &xml = KolabV2::Task::taskToXML(i, QLatin1String("UTC"));
-        return xml.toStdString();
+        return Conversion::toStdString(xml);
     }
     return Kolab::writeTodo(event, productId);
 }
@@ -77,7 +77,7 @@ Todo XMLObject::readTodo(const std::string& s, Version version)
 {
     if (version == KolabV2) {
         QStringList attachments;
-        KCalCore::Todo::Ptr event = Kolab::fromXML<KCalCore::Todo::Ptr, KolabV2::Task>(QString::fromUtf8(s.c_str()).toUtf8(), attachments);
+        const KCalCore::Todo::Ptr event = Kolab::fromXML<KCalCore::Todo::Ptr, KolabV2::Task>(QString::fromUtf8(s.c_str()).toUtf8(), attachments);
         mAttachments.clear();
         foreach (const QString &attachment, attachments) {
             mAttachments.push_back(std::string(attachment.toUtf8().constData()));
@@ -90,10 +90,10 @@ Todo XMLObject::readTodo(const std::string& s, Version version)
 std::string XMLObject::writeJournal(const Journal &event, Version version, const std::string& productId)
 {
     if (version == KolabV2) {
-        KCalCore::Journal::Ptr i = Conversion::toKCalCore(event);
+        const KCalCore::Journal::Ptr i = Conversion::toKCalCore(event);
         //The timezone is used for created and last modified dates
         const QString &xml = KolabV2::Journal::journalToXML(i, QLatin1String("UTC"));
-        return xml.toStdString();
+        return Conversion::toStdString(xml);
     }
     return Kolab::writeJournal(event, productId);
 }
@@ -102,7 +102,7 @@ Journal XMLObject::readJournal(const std::string& s, Version version)
 {
     if (version == KolabV2) {
         QStringList attachments;
-        KCalCore::Journal::Ptr event = Kolab::fromXML<KCalCore::Journal::Ptr, KolabV2::Journal>(QString::fromUtf8(s.c_str()).toUtf8(), attachments);
+        const KCalCore::Journal::Ptr event = Kolab::fromXML<KCalCore::Journal::Ptr, KolabV2::Journal>(QString::fromUtf8(s.c_str()).toUtf8(), attachments);
         mAttachments.clear();
         foreach (const QString &attachment, attachments) {
             mAttachments.push_back(std::string(attachment.toUtf8().constData()));
@@ -150,7 +150,7 @@ Contact XMLObject::readContact(const std::string& s, Version version)
         QString pictureAttachmentName;
         QString logoAttachmentName;
         QString soundAttachmentName;
-        KABC::Addressee addressee = addresseeFromKolab(xmlData, pictureAttachmentName, logoAttachmentName, soundAttachmentName);
+        const KABC::Addressee addressee = addresseeFromKolab(xmlData, pictureAttachmentName, logoAttachmentName, soundAttachmentName);
         mPictureAttachmentName = Conversion::toStdString(pictureAttachmentName);
         mLogoAttachmentName = Conversion::toStdString(logoAttachmentName);
         mSoundAttachmentName = Conversion::toStdString(soundAttachmentName);
@@ -163,8 +163,8 @@ std::string XMLObject::writeContact(const Contact &contact, Version version, con
 {
     if (version == KolabV2) {
         //FIXME attachment names are hardcoded for now
-        KABC::Addressee addressee = Conversion::toKABC(contact);
-        KolabV2::Contact contact(&addressee);
+        const KABC::Addressee addressee = Conversion::toKABC(contact);
+        const KolabV2::Contact contact(&addressee);
         const QByteArray xml = contact.saveXML().toUtf8();
         return std::string(xml.constData());
     }
@@ -184,8 +184,8 @@ DistList XMLObject::readDistlist(const std::string& s, Version version)
 std::string XMLObject::writeDistlist(const DistList &distlist, Version version, const std::string& productId)
 {
     if (version == KolabV2) {
-        KABC::ContactGroup contactGroup = Conversion::toKABC(distlist);
-        KolabV2::DistributionList d(&contactGroup);
+        const KABC::ContactGroup contactGroup = Conversion::toKABC(distlist);
+        const KolabV2::DistributionList d(&contactGroup);
         const QByteArray xml = d.saveXML().toUtf8();
         return std::string(xml.constData());
     }
@@ -195,7 +195,7 @@ std::string XMLObject::writeDistlist(const DistList &distlist, Version version,
 Note XMLObject::readNote(const std::string& s, Version version)
 {
     if (version == KolabV2) {
-        KMime::Message::Ptr msg = noteFromKolab(QByteArray(s.c_str(), s.length()), KDateTime());
+        const KMime::Message::Ptr msg = noteFromKolab(QByteArray(s.c_str(), s.length()), KDateTime());
         return Conversion::fromNote(msg);
     }
     return Kolab::readNote(s, false);
@@ -204,7 +204,7 @@ Note XMLObject::readNote(const std::string& s, Version version)
 std::string XMLObject::writeNote(const Note &note, Version version, const std::string& productId)
 {
     if (version == KolabV2) {
-        KMime::Message::Ptr n = Conversion::toNote(note);
+        const KMime::Message::Ptr n = Conversion::toNote(note);
         const QByteArray &xml = noteToKolabXML(n);
         return std::string(xml.constData());
     }
diff --git a/kolabformat/xmlobject.h b/kolabformat/xmlobject.h
index 8a2cb3f..338613d 100644
--- a/kolabformat/xmlobject.h
+++ b/kolabformat/xmlobject.h
@@ -35,7 +35,7 @@ class KOLAB_EXPORT XMLObject
 {
 public:
     explicit XMLObject();
-    ///List of attachment names to be retrieved from the mime message (only when reading v2, for v3 attachments containing the cid: of the attachment are created )
+    ///List of attachment names to be retrieved from the mime message (only when reading v2, for v3 attachments containing the cid: of the attachment-part are created )
     std::vector<std::string> getAttachments() const;
     
     Kolab::Event readEvent(const std::string& s, Kolab::Version version);


commit 86c05357eda51b1ca6adf68c4c284c68395052bb
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Thu Nov 1 13:33:13 2012 +0100

    contacts, distlists, notes

diff --git a/kolabformat/kolabobject.cpp b/kolabformat/kolabobject.cpp
index a8b1404..cdaab74 100644
--- a/kolabformat/kolabobject.cpp
+++ b/kolabformat/kolabobject.cpp
@@ -249,7 +249,7 @@ ObjectType KolabObjectReader::Private::readKolabV2(const KMime::Message::Ptr &ms
             mContactGroup = contactGroupFromKolab(xmlData);
             break;
         case NoteObject:
-            mNote = noteFromKolab(xmlData, msg);
+            mNote = noteFromKolab(xmlData, msg->date()->dateTime());
             break;
         default:
             CRITICAL("no kolab object found ");
diff --git a/kolabformat/v2helpers.cpp b/kolabformat/v2helpers.cpp
index 2d88359..9093b4d 100644
--- a/kolabformat/v2helpers.cpp
+++ b/kolabformat/v2helpers.cpp
@@ -38,7 +38,7 @@
 
 namespace Kolab {
 
-QImage getPicture(const QString &pictureAttachmentName, const KMime::Message::Ptr &data, QByteArray &type)
+static QImage getPicture(const QString &pictureAttachmentName, const KMime::Message::Ptr &data, QByteArray &type)
 {
     KMime::Content *imgContent = Mime::findContentByName(data, pictureAttachmentName/*"kolab-picture.png"*/, type);
     if (!imgContent) {
@@ -109,7 +109,18 @@ KABC::Addressee addresseeFromKolab( const QByteArray &xmlData, const KMime::Mess
     return addressee;
 }
 
-QByteArray createPicture(const QImage &img, const QString &format, QString &type)
+KABC::Addressee addresseeFromKolab(const QByteArray &xmlData, QString &pictureAttachmentName, QString &logoAttachmentName, QString &soundAttachmentName)
+{
+    KABC::Addressee addressee;
+    KolabV2::Contact contact(QString::fromUtf8(xmlData));
+    pictureAttachmentName = contact.pictureAttachmentName();
+    logoAttachmentName = contact.logoAttachmentName();
+    soundAttachmentName = contact.soundAttachmentName();
+    contact.saveTo(&addressee);
+    return addressee;
+}
+
+static QByteArray createPicture(const QImage &img, const QString &format, QString &type)
 {
     QByteArray pic;
     QBuffer buffer(&pic);
@@ -180,7 +191,7 @@ KMime::Message::Ptr distListToKolabFormat(const KolabV2::DistributionList& distL
     return message;
 }
 
-KMime::Message::Ptr noteFromKolab(const QByteArray &xmlData, const KMime::Message::Ptr &data)
+KMime::Message::Ptr noteFromKolab(const QByteArray &xmlData, const KDateTime &creationDate)
 {
     KolabV2::Note j;
     if ( !j.load( xmlData ) ) {
@@ -192,18 +203,23 @@ KMime::Message::Ptr noteFromKolab(const QByteArray &xmlData, const KMime::Messag
     note.setTitle(j.summary());
     note.setText(j.body().toUtf8());
     note.setFrom("kolab at kde4");
-    note.setCreationDate(data->date()->dateTime());
+    note.setCreationDate(creationDate);
     return note.message();
 }
 
 KMime::Message::Ptr noteToKolab(const KMime::Message::Ptr& msg, const QString &productId)
 {
     Akonadi::NoteUtils::NoteMessageWrapper note(msg);
+    return Mime::createMessage(note.title(), KOLAB_TYPE_NOTE, KOLAB_TYPE_NOTE, noteToKolabXML(msg), false, productId);
+}
+
+QByteArray noteToKolabXML(const KMime::Message::Ptr& msg)
+{
+    Akonadi::NoteUtils::NoteMessageWrapper note(msg);
     KolabV2::Note j;
     j.setSummary( note.title() );
     j.setBody( note.text() );
-    
-    return Mime::createMessage(j.summary(), KOLAB_TYPE_NOTE, KOLAB_TYPE_NOTE, j.saveXML().toUtf8(), false, productId);
+    return j.saveXML().toUtf8();
 }
 
 QStringList readLegacyDictionaryConfiguration(const QByteArray &xmlData, QString &language)
@@ -233,4 +249,4 @@ QStringList readLegacyDictionaryConfiguration(const QByteArray &xmlData, QString
     return dictionary;
 }
 
-}
\ No newline at end of file
+}
diff --git a/kolabformat/v2helpers.h b/kolabformat/v2helpers.h
index 367f0ac..3e2f2f7 100644
--- a/kolabformat/v2helpers.h
+++ b/kolabformat/v2helpers.h
@@ -73,22 +73,21 @@ static inline IncidencePtr incidenceFromKolabImpl( const KMime::Message::Ptr &da
     return ptr;
 }
 
-QImage getPicture(const QString &pictureAttachmentName, const KMime::Message::Ptr &data, QByteArray &type);
 KABC::Addressee addresseeFromKolab( const QByteArray &xmlData, const KMime::Message::Ptr &data);
-
-QByteArray createPicture(const QImage &img, const QString &format, QString &type);
+KABC::Addressee addresseeFromKolab( const QByteArray &xmlData, QString &pictureAttachmentName, QString &logoAttachmentName, QString &soundAttachmentName);
 
 KMime::Message::Ptr contactToKolabFormat(const KolabV2::Contact& contact, const QString &productId);
 
 KABC::ContactGroup contactGroupFromKolab(const QByteArray &xmlData);
 
 KMime::Message::Ptr distListToKolabFormat(const KolabV2::DistributionList& distList, const QString &productId);
-KMime::Message::Ptr noteFromKolab(const QByteArray &xmlData, const KMime::Message::Ptr &data);
+KMime::Message::Ptr noteFromKolab(const QByteArray &xmlData, const KDateTime &creationDate);
 
 KMime::Message::Ptr noteToKolab(const KMime::Message::Ptr& msg, const QString &productId);
+QByteArray noteToKolabXML(const KMime::Message::Ptr& msg);
 
 QStringList readLegacyDictionaryConfiguration(const QByteArray &xmlData, QString &language);
 
 }
 
-#endif
\ No newline at end of file
+#endif
diff --git a/kolabformat/xmlobject.cpp b/kolabformat/xmlobject.cpp
index 077c347..dd1cacb 100644
--- a/kolabformat/xmlobject.cpp
+++ b/kolabformat/xmlobject.cpp
@@ -21,6 +21,7 @@
 #include <conversion/kcalconversion.h>
 #include <conversion/kolabconversion.h>
 #include <conversion/commonconversion.h>
+#include <conversion/kabcconversion.h>
 #include <kolabformat.h>
 
 namespace Kolab {
@@ -127,5 +128,87 @@ Freebusy XMLObject::readFreebusy(const std::string& s, Version version)
     return Kolab::readFreebusy(s, false);
 }
 
+std::string XMLObject::logoAttachmentName() const
+{
+    return mLogoAttachmentName;
+}
+
+std::string XMLObject::pictureAttachmentName() const
+{
+    return mPictureAttachmentName;
+}
+
+std::string XMLObject::soundAttachmentName() const
+{
+    return mSoundAttachmentName;
+}
+
+Contact XMLObject::readContact(const std::string& s, Version version)
+{
+    if (version == KolabV2) {        
+        const QByteArray xmlData(s.c_str(), s.size());
+        QString pictureAttachmentName;
+        QString logoAttachmentName;
+        QString soundAttachmentName;
+        KABC::Addressee addressee = addresseeFromKolab(xmlData, pictureAttachmentName, logoAttachmentName, soundAttachmentName);
+        mPictureAttachmentName = Conversion::toStdString(pictureAttachmentName);
+        mLogoAttachmentName = Conversion::toStdString(logoAttachmentName);
+        mSoundAttachmentName = Conversion::toStdString(soundAttachmentName);
+        return Conversion::fromKABC(addressee);
+    }
+    return Kolab::readContact(s, false);
+}
+
+std::string XMLObject::writeContact(const Contact &contact, Version version, const std::string& productId)
+{
+    if (version == KolabV2) {
+        //FIXME attachment names are hardcoded for now
+        KABC::Addressee addressee = Conversion::toKABC(contact);
+        KolabV2::Contact contact(&addressee);
+        const QByteArray xml = contact.saveXML().toUtf8();
+        return std::string(xml.constData());
+    }
+    return Kolab::writeContact(contact, productId);
+}
+
+DistList XMLObject::readDistlist(const std::string& s, Version version)
+{
+    if (version == KolabV2) {        
+        const QByteArray xmlData(s.c_str(), s.size());
+        const KABC::ContactGroup contactGroup = contactGroupFromKolab(xmlData);
+        return Conversion::fromKABC(contactGroup);
+    }
+    return Kolab::readDistlist(s, false);
+}
+
+std::string XMLObject::writeDistlist(const DistList &distlist, Version version, const std::string& productId)
+{
+    if (version == KolabV2) {
+        KABC::ContactGroup contactGroup = Conversion::toKABC(distlist);
+        KolabV2::DistributionList d(&contactGroup);
+        const QByteArray xml = d.saveXML().toUtf8();
+        return std::string(xml.constData());
+    }
+    return Kolab::writeDistlist(distlist, productId);
+}
+
+Note XMLObject::readNote(const std::string& s, Version version)
+{
+    if (version == KolabV2) {
+        KMime::Message::Ptr msg = noteFromKolab(QByteArray(s.c_str(), s.length()), KDateTime());
+        return Conversion::fromNote(msg);
+    }
+    return Kolab::readNote(s, false);
+}
+
+std::string XMLObject::writeNote(const Note &note, Version version, const std::string& productId)
+{
+    if (version == KolabV2) {
+        KMime::Message::Ptr n = Conversion::toNote(note);
+        const QByteArray &xml = noteToKolabXML(n);
+        return std::string(xml.constData());
+    }
+    return Kolab::writeNote(note, productId);
+}
     
-};
\ No newline at end of file
+};
diff --git a/kolabformat/xmlobject.h b/kolabformat/xmlobject.h
index 0f414f6..8a2cb3f 100644
--- a/kolabformat/xmlobject.h
+++ b/kolabformat/xmlobject.h
@@ -50,22 +50,46 @@ public:
     Kolab::Freebusy readFreebusy(const std::string& s, Kolab::Version version);
     static std::string writeFreebusy(const Kolab::Freebusy &, Kolab::Version version, const std::string& productId = std::string());
 
-//     Kolab::Contact readContact(const std::string& s, Version version);
-//     static std::string writeContact(const Kolab::Contact &, Version version, const std::string& productId = std::string());
-// 
-//     Kolab::DistList readDistlist(const std::string& s, Version version);
-//     static std::string writeDistlist(const Kolab::DistList &, Version version, const std::string& productId = std::string());
+    std::string pictureAttachmentName() const;
+    std::string logoAttachmentName() const;
+    std::string soundAttachmentName() const;
+    /**
+     * Find the attachments and set them on the read Contact object.
+     *
+     * V2 Notes:
+     * Picture, logo and sound must be retrieved from Mime Message attachments using they're corresponding attachment name.
+     */
+    Kolab::Contact readContact(const std::string& s, Kolab::Version version);
+    
+    /**
+     * V2 Notes:
+     * * Uses the following attachment names:
+     * ** kolab-picture.png
+     * ** kolab-logo.png
+     * ** sound
+     */
+    static std::string writeContact(const Kolab::Contact &, Kolab::Version version, const std::string& productId = std::string());
+    
+    Kolab::DistList readDistlist(const std::string& s, Kolab::Version version);
+    static std::string writeDistlist(const Kolab::DistList &, Kolab::Version version, const std::string& productId = std::string());
 
-//     Kolab::Note readNote(const std::string& s, Version version);
-//     static std::string writeNote(const Kolab::Note &, Version version, const std::string& productId = std::string());
+    /**
+     * V2 notes:
+     * * set the creation date from the mime date header.
+     */
+    Kolab::Note readNote(const std::string& s, Kolab::Version version);
+    static std::string writeNote(const Kolab::Note &, Kolab::Version version, const std::string& productId = std::string());
 
-//     Kolab::Configuration readConfiguration(const std::string& s, Version version);
-//     static std::string writeConfiguration(const Kolab::Configuration &, Version version, const std::string& productId = std::string());
+//     Kolab::Configuration readConfiguration(const std::string& s, Kolab::Version version);
+//     static std::string writeConfiguration(const Kolab::Configuration &, Kolab::Version version, const std::string& productId = std::string());
 // 
-//     Kolab::File readFile(const std::string& s, Version version);
-//     static std::string writeFile(const Kolab::File &, Version version, const std::string& productId = std::string());
+//     Kolab::File readFile(const std::string& s, Kolab::Version version);
+//     static std::string writeFile(const Kolab::File &, Kolab::Version version, const std::string& productId = std::string());
 private:
     std::vector<std::string> mAttachments;
+    std::string mLogoAttachmentName;
+    std::string mSoundAttachmentName;
+    std::string mPictureAttachmentName;
 };
 
 }


commit aa5411c981fd1051adaf7930b4e00a5edc12bd64
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Wed Oct 31 18:03:32 2012 +0100

    Incidences and freebusy should work

diff --git a/kolabformat/xmlobject.cpp b/kolabformat/xmlobject.cpp
index 9e60a75..077c347 100644
--- a/kolabformat/xmlobject.cpp
+++ b/kolabformat/xmlobject.cpp
@@ -19,6 +19,8 @@
 #include "v2helpers.h"
 #include "kolabformatV2/event.h"
 #include <conversion/kcalconversion.h>
+#include <conversion/kolabconversion.h>
+#include <conversion/commonconversion.h>
 #include <kolabformat.h>
 
 namespace Kolab {
@@ -59,8 +61,71 @@ Event XMLObject::readEvent(const std::string& s, Version version)
     return Kolab::readEvent(s, false);
 }
 
+std::string XMLObject::writeTodo(const Todo &event, Version version, const std::string& productId)
+{
+    if (version == KolabV2) {
+        KCalCore::Todo::Ptr i = Conversion::toKCalCore(event);
+        //The timezone is used for created and last modified dates
+        const QString &xml = KolabV2::Task::taskToXML(i, QLatin1String("UTC"));
+        return xml.toStdString();
+    }
+    return Kolab::writeTodo(event, productId);
+}
 
+Todo XMLObject::readTodo(const std::string& s, Version version)
+{
+    if (version == KolabV2) {
+        QStringList attachments;
+        KCalCore::Todo::Ptr event = Kolab::fromXML<KCalCore::Todo::Ptr, KolabV2::Task>(QString::fromUtf8(s.c_str()).toUtf8(), attachments);
+        mAttachments.clear();
+        foreach (const QString &attachment, attachments) {
+            mAttachments.push_back(std::string(attachment.toUtf8().constData()));
+        }
+        return Conversion::fromKCalCore(*event);
+    }
+    return Kolab::readTodo(s, false);
+}
 
+std::string XMLObject::writeJournal(const Journal &event, Version version, const std::string& productId)
+{
+    if (version == KolabV2) {
+        KCalCore::Journal::Ptr i = Conversion::toKCalCore(event);
+        //The timezone is used for created and last modified dates
+        const QString &xml = KolabV2::Journal::journalToXML(i, QLatin1String("UTC"));
+        return xml.toStdString();
+    }
+    return Kolab::writeJournal(event, productId);
+}
+
+Journal XMLObject::readJournal(const std::string& s, Version version)
+{
+    if (version == KolabV2) {
+        QStringList attachments;
+        KCalCore::Journal::Ptr event = Kolab::fromXML<KCalCore::Journal::Ptr, KolabV2::Journal>(QString::fromUtf8(s.c_str()).toUtf8(), attachments);
+        mAttachments.clear();
+        foreach (const QString &attachment, attachments) {
+            mAttachments.push_back(std::string(attachment.toUtf8().constData()));
+        }
+        return Conversion::fromKCalCore(*event);
+    }
+    return Kolab::readJournal(s, false);
+}
+
+std::string XMLObject::writeFreebusy(const Freebusy &event, Version version, const std::string& productId)
+{
+    if (version != KolabV3) {
+        return std::string();
+    }
+    return Kolab::writeFreebusy(event, productId);
+}
+
+Freebusy XMLObject::readFreebusy(const std::string& s, Version version)
+{
+    if (version != KolabV3) {
+        return Freebusy();
+    }
+    return Kolab::readFreebusy(s, false);
+}
 
     
 };
\ No newline at end of file
diff --git a/kolabformat/xmlobject.h b/kolabformat/xmlobject.h
index 0e06f3f..0f414f6 100644
--- a/kolabformat/xmlobject.h
+++ b/kolabformat/xmlobject.h
@@ -40,30 +40,30 @@ public:
     
     Kolab::Event readEvent(const std::string& s, Kolab::Version version);
     static std::string writeEvent(const Kolab::Event &, Kolab::Version version, const std::string& productId = std::string());
-/*
-    Kolab::Todo readTodo(const std::string& s, Version version);
-    static std::string writeTodo(const Kolab::Todo &, Version version, const std::string& productId = std::string());
-
-    Kolab::Journal readJournal(const std::string& s, Version version);
-    static std::string writeJournal(const Kolab::Journal &, Version version, const std::string& productId = std::string());
-
-    Kolab::Freebusy readFreebusy(const std::string& s, Version version);
-    static std::string writeFreebusy(const Kolab::Freebusy &, Version version, const std::string& productId = std::string());
+    
+    Kolab::Todo readTodo(const std::string& s, Kolab::Version version);
+    static std::string writeTodo(const Kolab::Todo &, Kolab::Version version, const std::string& productId = std::string());
 
-    Kolab::Contact readContact(const std::string& s, Version version);
-    static std::string writeContact(const Kolab::Contact &, Version version, const std::string& productId = std::string());
+    Kolab::Journal readJournal(const std::string& s, Kolab::Version version);
+    static std::string writeJournal(const Kolab::Journal &, Kolab::Version version, const std::string& productId = std::string());
 
-    Kolab::DistList readDistlist(const std::string& s, Version version);
-    static std::string writeDistlist(const Kolab::DistList &, Version version, const std::string& productId = std::string());
+    Kolab::Freebusy readFreebusy(const std::string& s, Kolab::Version version);
+    static std::string writeFreebusy(const Kolab::Freebusy &, Kolab::Version version, const std::string& productId = std::string());
 
-    Kolab::Note readNote(const std::string& s, Version version);
-    static std::string writeNote(const Kolab::Note &, Version version, const std::string& productId = std::string());
+//     Kolab::Contact readContact(const std::string& s, Version version);
+//     static std::string writeContact(const Kolab::Contact &, Version version, const std::string& productId = std::string());
+// 
+//     Kolab::DistList readDistlist(const std::string& s, Version version);
+//     static std::string writeDistlist(const Kolab::DistList &, Version version, const std::string& productId = std::string());
 
-    Kolab::Configuration readConfiguration(const std::string& s, Version version);
-    static std::string writeConfiguration(const Kolab::Configuration &, Version version, const std::string& productId = std::string());
+//     Kolab::Note readNote(const std::string& s, Version version);
+//     static std::string writeNote(const Kolab::Note &, Version version, const std::string& productId = std::string());
 
-    Kolab::File readFile(const std::string& s, Version version);
-    static std::string writeFile(const Kolab::File &, Version version, const std::string& productId = std::string()); */
+//     Kolab::Configuration readConfiguration(const std::string& s, Version version);
+//     static std::string writeConfiguration(const Kolab::Configuration &, Version version, const std::string& productId = std::string());
+// 
+//     Kolab::File readFile(const std::string& s, Version version);
+//     static std::string writeFile(const Kolab::File &, Version version, const std::string& productId = std::string());
 private:
     std::vector<std::string> mAttachments;
 };





More information about the commits mailing list