6 commits - cmake/modules conversion/CMakeLists.txt conversion/commonconversion.cpp conversion/timezoneconverter.cpp conversion/timezoneconverter.h freebusy/freebusy.cpp icalendar/icalendar.cpp kolabformat/xmlobject.cpp tests/CMakeLists.txt tests/timezonetest.cpp tests/timezonetest.h

Christian Mollekopf mollekopf at kolabsys.com
Sat Dec 15 16:14:52 CET 2012


 cmake/modules/COPYING-CMAKE-SCRIPTS |   22 ++++++
 conversion/CMakeLists.txt           |    5 -
 conversion/commonconversion.cpp     |    5 +
 conversion/timezoneconverter.cpp    |  116 ++++++++++++++++++++++++++++++++++++
 conversion/timezoneconverter.h      |   33 ++++++++++
 freebusy/freebusy.cpp               |    2 
 icalendar/icalendar.cpp             |    5 +
 kolabformat/xmlobject.cpp           |   22 +++---
 tests/CMakeLists.txt                |    1 
 tests/timezonetest.cpp              |  102 +++++++++++++++++++++++++++++++
 tests/timezonetest.h                |   32 +++++++++
 11 files changed, 330 insertions(+), 15 deletions(-)

New commits:
commit 3e735fab30b250aed509e620fc34c16d4ced92f9
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Sat Dec 15 16:14:17 2012 +0100

    Forgot to add timezonetest sourcefiles.

diff --git a/tests/timezonetest.cpp b/tests/timezonetest.cpp
new file mode 100644
index 0000000..1850978
--- /dev/null
+++ b/tests/timezonetest.cpp
@@ -0,0 +1,102 @@
+/*
+ * 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 "timezonetest.h"
+#include <conversion/timezoneconverter.h>
+#include <kolabformat/kolabobject.h>
+#include <kolabformat/errorhandler.h>
+
+#include <QTest>
+// #include <unicode/uversion.h>
+// #include <unicode/timezone.h>
+// #include <iostream>
+#include <kdebug.h>
+#include <kcalcore/event.h>
+
+// void icuFoo()
+// {
+//     icu::UnicodeString s;
+//     UErrorCode error;
+// //     icu::TimeZone::getCanonicalID("GMT+01.00) Sarajevo/Warsaw/Zagreb", s, error);
+// //     icu::TimeZone::getCanonicalID(icu::UnicodeString::fromUTF8("Europe/Zurich"), s, error);
+//     icu::TimeZone::getCanonicalID(icu::UnicodeString::fromUTF8("GMT+01.00"), s, error);
+//     std::string cs;
+//     s.toUTF8String(cs);
+//     std::cout << "This is the new timezone: " << cs  << std::endl << u_errorName(error) << std::endl;
+// // 
+// // 
+// //     icu::TimeZone *tz = icu::TimeZone::createTimeZone("GMT-8:00");
+// //     icu::UnicodeString result;
+// //     tz->getDisplayName(result);
+// //     std::string stringresult;
+// //     result.toUTF8String(stringresult);
+// //     std::cout << stringresult;
+//     
+// //     icu::TimeZone *tz = icu::TimeZone::getStaticClassID();
+// 
+// }
+
+void TimezoneTest::testFromName()
+{
+    TimezoneConverter converter;
+    const QString timezone = converter.normalizeTimezone("(GMT+01.00) Sarajevo/Warsaw/Zagreb");
+    QCOMPARE(timezone, QLatin1String("Europe/Sarajevo"));
+}
+
+void TimezoneTest::testFromHardcodedList_data()
+{
+    QTest::addColumn<QString>( "timezone" );
+    
+    QTest::newRow( "1" ) << QString::fromLatin1("(GMT+01:00) West Central Africa");
+    QTest::newRow( "2" ) << QString::fromLatin1("(GMT-04:00) Atlantic Time (Canada)");
+    QTest::newRow( "3" ) << QString::fromLatin1("(GMT-06:00) Saskatchewan");
+    QTest::newRow( "4" ) << QString::fromLatin1("(GMT-01:00) Cape Verde Islands");
+    QTest::newRow( "5" ) << QString::fromLatin1("(GMT-06:00) Central America");
+    QTest::newRow( "6" ) << QString::fromLatin1("(GMT-06:00) Central Time (US and Canada)");
+//     QTest::newRow( "7" ) << QString::fromLatin1("(GMT-12:00) International Date Line West"); //Not mappable
+    QTest::newRow( "8" ) << QString::fromLatin1("(GMT-05:00) Eastern Time (US and Canada)");
+//     QTest::newRow( "9" ) << QString::fromLatin1("(GMT-02:00) Mid-Atlantic"); //Not mappable
+    QTest::newRow( "10" ) << QString::fromLatin1("(GMT-07:00) Mountain Time (US and Canada)");
+    QTest::newRow( "11" ) << QString::fromLatin1("(GMT-03:30) Newfoundland and Labrador");
+    QTest::newRow( "12" ) << QString::fromLatin1("(GMT-08:00) Pacific Time (US and Canada); Tijuana");
+    QTest::newRow( "13" ) << QString::fromLatin1("(GMT-11:00) Midway Island, Samoa");
+}
+
+void TimezoneTest::testFromHardcodedList()
+{
+    TimezoneConverter converter;
+    QFETCH(QString, timezone);
+    const QString tz = converter.normalizeTimezone(timezone);
+    QVERIFY(!tz.isEmpty());
+}
+
+void TimezoneTest::testKolabObjectWriter()
+{
+    KCalCore::Event::Ptr event(new KCalCore::Event());
+    event->setOrganizer(KCalCore::Person::Ptr());
+    event->setDtStart(KDateTime(QDate(2012,11,11), QTime(1,1), KDateTime::Spec(KTimeZone("(GMT+01:00) West Central Africa"))));
+    KMime::Message::Ptr msg = Kolab::KolabObjectWriter::writeEvent(event);
+    Kolab::KolabObjectReader reader(msg);
+    KCalCore::Event::Ptr result = reader.getEvent();
+    kDebug() << result->dtStart().timeZone().name();
+    QCOMPARE(result->dtStart().timeZone().name(), KTimeZone(QLatin1String("Africa/Lagos")).name());
+}
+
+
+QTEST_MAIN( TimezoneTest )
+
+#include "timezonetest.moc"
diff --git a/tests/timezonetest.h b/tests/timezonetest.h
new file mode 100644
index 0000000..cf7a4d5
--- /dev/null
+++ b/tests/timezonetest.h
@@ -0,0 +1,32 @@
+/*
+ * 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 TIMEZONETEST_H
+#define TIMEZONETEST_H
+#include <QObject>
+
+class TimezoneTest: public QObject
+{
+    Q_OBJECT
+private slots:
+    void testFromName();
+    void testFromHardcodedList_data();
+    void testFromHardcodedList();
+    void testKolabObjectWriter();
+};
+
+#endif // TIMEZONETEST_H


commit 4b2a015cb41717495f9d3369a33e854437aff6b9
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Fri Dec 14 18:03:14 2012 +0100

    Convert non-olson timezones (such as windows timezones).

diff --git a/conversion/commonconversion.cpp b/conversion/commonconversion.cpp
index d516520..6af1ec0 100644
--- a/conversion/commonconversion.cpp
+++ b/conversion/commonconversion.cpp
@@ -16,6 +16,7 @@
  */
 
 #include "commonconversion.h"
+#include "timezoneconverter.h"
 #include <kolabformat/errorhandler.h>
 
 #include <iostream>
@@ -87,7 +88,9 @@ cDateTime fromDate(const KDateTime &dt)
             date.setUTC(true);
         } else if (dt.timeType() == KDateTime::TimeZone) { //Timezone
             //TODO handle local timezone?
-            date.setTimezone(toStdString(dt.timeZone().name())); //FIXME use system independent name according to spec
+            //Convert non-olson timezones if necessary
+            const QString timezone = TimezoneConverter::normalizeTimezone(dt.timeZone().name());
+            date.setTimezone(toStdString(timezone));
         } else if (dt.timeType() != KDateTime::ClockTime) {
             Error() << "invalid timespec, assuming floating time" << dt.timeType();
             return date;


commit efdfdd535c701ddc9ac352c1175e6bd2097df912
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Fri Dec 14 17:59:45 2012 +0100

    Use the proper conversion functions.

diff --git a/kolabformat/xmlobject.cpp b/kolabformat/xmlobject.cpp
index bead9f2..ebeca5f 100644
--- a/kolabformat/xmlobject.cpp
+++ b/kolabformat/xmlobject.cpp
@@ -55,7 +55,7 @@ std::string XMLObject::writeEvent(const Event &event, Version version, const std
         if (i->uid().isEmpty()) {
             i->setUid(createUuid());
         }
-        mWrittenUID = Conversion::toStdString(i->uid().toUtf8().constData());
+        mWrittenUID = Conversion::toStdString(i->uid());
         //The timezone is used for created and last modified dates
         const QString &xml = KolabV2::Event::eventToXML(i, QLatin1String("UTC"));
         return Conversion::toStdString(xml);
@@ -72,7 +72,7 @@ Event XMLObject::readEvent(const std::string& s, Version version)
         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()));
+            mAttachments.push_back(Conversion::toStdString(attachment));
         }
         return Conversion::fromKCalCore(*event);
     }
@@ -87,7 +87,7 @@ std::string XMLObject::writeTodo(const Todo &event, Version version, const std::
         if (i->uid().isEmpty()) {
             i->setUid(createUuid());
         }
-        mWrittenUID = Conversion::toStdString(i->uid().toUtf8().constData());
+        mWrittenUID = Conversion::toStdString(i->uid());
         //The timezone is used for created and last modified dates
         const QString &xml = KolabV2::Task::taskToXML(i, QLatin1String("UTC"));
         return Conversion::toStdString(xml);
@@ -104,7 +104,7 @@ Todo XMLObject::readTodo(const std::string& s, Version version)
         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()));
+            mAttachments.push_back(Conversion::toStdString(attachment));
         }
         return Conversion::fromKCalCore(*event);
     }
@@ -119,7 +119,7 @@ std::string XMLObject::writeJournal(const Journal &event, Version version, const
         if (i->uid().isEmpty()) {
             i->setUid(createUuid());
         }
-        mWrittenUID = Conversion::toStdString(i->uid().toUtf8().constData());
+        mWrittenUID = Conversion::toStdString(i->uid());
         //The timezone is used for created and last modified dates
         const QString &xml = KolabV2::Journal::journalToXML(i, QLatin1String("UTC"));
         return Conversion::toStdString(xml);
@@ -136,7 +136,7 @@ Journal XMLObject::readJournal(const std::string& s, Version version)
         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()));
+            mAttachments.push_back(Conversion::toStdString(attachment));
         }
         return Conversion::fromKCalCore(*event);
     }
@@ -204,10 +204,9 @@ std::string XMLObject::writeContact(const Contact &contact, Version version, con
         if (addressee.uid().isEmpty()) {
             addressee.setUid(createUuid());
         }
-        mWrittenUID = Conversion::toStdString(addressee.uid().toUtf8().constData());
+        mWrittenUID = Conversion::toStdString(addressee.uid());
         const KolabV2::Contact contact(&addressee);
-        const QByteArray xml = contact.saveXML().toUtf8();
-        return std::string(xml.constData());
+        return Conversion::toStdString(contact.saveXML());
     }
     const std::string result = Kolab::writeContact(contact, productId);
     mWrittenUID = Kolab::getSerializedUID();
@@ -232,10 +231,9 @@ std::string XMLObject::writeDistlist(const DistList &distlist, Version version,
         if (contactGroup.id().isEmpty()) {
             contactGroup.setId(createUuid());
         }
-        mWrittenUID = Conversion::toStdString(contactGroup.id().toUtf8().constData());
+        mWrittenUID = Conversion::toStdString(contactGroup.id());
         const KolabV2::DistributionList d(&contactGroup);
-        const QByteArray xml = d.saveXML().toUtf8();
-        return std::string(xml.constData());
+        return Conversion::toStdString(d.saveXML());
     }
     const std::string result = Kolab::writeDistlist(distlist, productId);
     mWrittenUID = Kolab::getSerializedUID();


commit e91085aeeb73cf4475c23583ce40ed23b1d7b0f9
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Fri Dec 14 17:58:35 2012 +0100

    Windows timezone conversion.

diff --git a/conversion/CMakeLists.txt b/conversion/CMakeLists.txt
index c4f323e..683de63 100644
--- a/conversion/CMakeLists.txt
+++ b/conversion/CMakeLists.txt
@@ -2,6 +2,7 @@
 set (CONVERSION_SRCS
     ${CMAKE_CURRENT_SOURCE_DIR}/kcalconversion.cpp 
     ${CMAKE_CURRENT_SOURCE_DIR}/kabcconversion.cpp 
-    ${CMAKE_CURRENT_SOURCE_DIR}/commonconversion.cpp 
-    ${CMAKE_CURRENT_SOURCE_DIR}/kolabconversion.cpp PARENT_SCOPE)
+    ${CMAKE_CURRENT_SOURCE_DIR}/commonconversion.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/kolabconversion.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/timezoneconverter.cpp PARENT_SCOPE)
 
diff --git a/conversion/timezoneconverter.cpp b/conversion/timezoneconverter.cpp
new file mode 100644
index 0000000..6941681
--- /dev/null
+++ b/conversion/timezoneconverter.cpp
@@ -0,0 +1,116 @@
+/*
+ * 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 "timezoneconverter.h"
+#include <ktimezone.h>
+#include <ksystemtimezone.h>
+#include <kdebug.h>
+#include <QRegExp>
+#include <QStringList>
+
+QString TimezoneConverter::normalizeTimezone(const QString& tz)
+{
+    KTimeZone timezone = KSystemTimeZones::zone(tz); //Needs ktimezoned (timezone daemon running) http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKSystemTimeZones.html
+    if (timezone.isValid()) {
+        return tz;
+    }
+    //We're dealing with an invalid or unknown timezone, try to parse it
+    QString guessedTimezone = fromCityName(tz);
+    if (guessedTimezone.isEmpty()) {
+        guessedTimezone = fromHardcodedList(tz);
+    }
+    if (guessedTimezone.isEmpty()) {
+        guessedTimezone = fromGMTOffsetTimezone(tz);
+    }
+    return guessedTimezone;
+}
+
+QString TimezoneConverter::fromGMTOffsetTimezone(const QString& tz)
+{
+    Q_UNUSED(tz);
+    return QString();
+}
+
+QString TimezoneConverter::fromCityName(const QString& tz)
+{
+    const KTimeZones::ZoneMap zones = KSystemTimeZones::zones();
+    KTimeZones::ZoneMap::const_iterator it = zones.constBegin();
+    QHash<QString, QString> countryMap;
+    for(;it != zones.constEnd(); it++) {
+        const QString cityName = it.key().split('/').last();
+//         kDebug() << it.key() << it.value().name() << cityName;
+        Q_ASSERT(!countryMap.contains(cityName));
+        countryMap.insert(cityName, it.key());
+    }
+
+    QRegExp locationFinder("\\b([a-zA-Z])+\\b", Qt::CaseSensitive, QRegExp::RegExp2);
+    int pos = 0;
+    while (pos >= 0) {
+        pos = locationFinder.indexIn(tz, pos);
+        if (pos >= 0) {
+            ++pos;
+        }
+        const QString location = locationFinder.capturedTexts().first();
+//         kDebug() << "location " << location;
+        if (countryMap.contains(location)) {
+//             kDebug() << "found match " << countryMap.value(location);
+            return countryMap.value(location);
+        }
+    }
+    return QString();
+}
+
+QString TimezoneConverter::fromHardcodedList(const QString& tz)
+{
+    if (tz.contains(QLatin1String("West Central Africa"))) {
+        return QLatin1String("Africa/Lagos");
+    }
+    if (tz.contains(QLatin1String("Atlantic Time"))) {
+        return QLatin1String("America/Halifax");
+    }
+    if (tz.contains(QLatin1String("Saskatchewan"))) {
+        return QLatin1String("America/Regina");
+    }
+    if (tz.contains(QLatin1String("Cape Verde Islands"))) {
+        return QLatin1String("Atlantic/Cape_Verde");
+    }
+    if (tz.contains(QLatin1String("Central America"))) {
+        return QLatin1String("America/Guatemala");
+    }
+    if (tz.contains(QLatin1String("Central Time"))) {
+        return QLatin1String("America/Chicago");
+    }
+//     if (tz.contains(QLatin1String("International Date Line West"))) {
+//         return QLatin1String("");
+//     }
+    if (tz.contains(QLatin1String("Eastern Time"))) {
+        return QLatin1String("America/New_York");
+    }
+//     if (tz.contains(QLatin1String("Mid-Atlantic"))) {
+//         return QLatin1String();
+//     }
+    if (tz.contains(QLatin1String("Mountain Time"))) {
+        return QLatin1String("America/Denver");
+    }
+    if (tz.contains(QLatin1String("Newfoundland and Labrador"))) {
+        return QLatin1String("America/St_Johns");
+    }
+    if (tz.contains(QLatin1String("Pacific Time"))) {
+        return QLatin1String("America/Los_Angeles");
+    }
+    return QString();
+}
diff --git a/conversion/timezoneconverter.h b/conversion/timezoneconverter.h
new file mode 100644
index 0000000..84cad70
--- /dev/null
+++ b/conversion/timezoneconverter.h
@@ -0,0 +1,33 @@
+/*
+ * 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 TIMEZONECONVERTER_H
+#define TIMEZONECONVERTER_H
+
+#include <QString>
+
+class TimezoneConverter
+{
+public:
+    static QString normalizeTimezone(const QString &tz);
+private:
+    static QString fromCityName(const QString &tz);
+    static QString fromHardcodedList(const QString &tz);
+    static QString fromGMTOffsetTimezone(const QString &tz);
+};
+
+#endif // TIMEZONECONVERTER_H
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 7362351..b3aa7ac 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -20,3 +20,4 @@ addTest(calendaringtest)
 addTest(icalendartest)
 addTest(freebusytest)
 addTest(kolabobjecttest)
+addTest(timezonetest)


commit 818bb8576480c59f1623af370fa50034aca08074
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Fri Dec 14 17:56:49 2012 +0100

    Set libkolab application string.

diff --git a/freebusy/freebusy.cpp b/freebusy/freebusy.cpp
index 878904b..7b20c20 100644
--- a/freebusy/freebusy.cpp
+++ b/freebusy/freebusy.cpp
@@ -19,6 +19,7 @@
 #include "freebusy.h"
 #include "conversion/kcalconversion.h"
 #include "conversion/commonconversion.h"
+#include "libkolab-version.h"
 #include <kcalcore/freebusy.h>
 #include <kcalcore/icalformat.h>
 #include <kdebug.h>
@@ -311,6 +312,7 @@ std::string toIFB(const Kolab::Freebusy &freebusy)
     fb->setLastModified(Kolab::Conversion::toDate(freebusy.timestamp()));
 
     KCalCore::ICalFormat format;
+    format.setApplication("libkolab", LIBKOLAB_LIB_VERSION_STRING);
     QString data = format.createScheduleMessage( fb, KCalCore::iTIPPublish );
     return Conversion::toStdString(data);
 }
diff --git a/icalendar/icalendar.cpp b/icalendar/icalendar.cpp
index 77aa01a..be7c0e6 100644
--- a/icalendar/icalendar.cpp
+++ b/icalendar/icalendar.cpp
@@ -20,6 +20,7 @@
 
 #include "icalendar.h"
 #include "imip.h"
+#include "libkolab-version.h"
 #include <conversion/kcalconversion.h>
 #include <conversion/commonconversion.h>
 #include <mime/mimeutils.h>
@@ -42,6 +43,7 @@ std::string toICal(const std::vector<Event> &events)
         calendar->addEvent(kcalEvent);
     }
     KCalCore::ICalFormat format;
+    format.setApplication("libkolab", LIBKOLAB_LIB_VERSION_STRING);
 //     qDebug() << format.createScheduleMessage(calendar->events().first(), KCalCore::iTIPRequest);
 
     return Conversion::toStdString(format.toString(calendar));
@@ -52,6 +54,7 @@ std::vector< Event > fromICalEvents(const std::string &input)
 {
     KCalCore::Calendar::Ptr calendar(new KCalCore::MemoryCalendar(Kolab::Conversion::getTimeSpec(true, std::string())));
     KCalCore::ICalFormat format;
+    format.setApplication("libkolab", LIBKOLAB_LIB_VERSION_STRING);
     format.fromString(calendar, Conversion::fromStdString(input));
     std::vector<Event> events;
     foreach (const KCalCore::Event::Ptr &event, calendar->events()) {
@@ -84,6 +87,7 @@ KCalCore::iTIPMethod mapToKCalCore(ITipHandler::ITipMethod method)
 std::string ITipHandler::toITip(const Event &event, ITipHandler::ITipMethod method) const
 {
     KCalCore::ICalFormat format;
+    format.setApplication("libkolab", LIBKOLAB_LIB_VERSION_STRING);
     KCalCore::iTIPMethod m = mapToKCalCore(method);
     if (m == KCalCore::iTIPNoMethod) {
         return std::string();
@@ -125,6 +129,7 @@ std::string ITipHandler::toIMip(const Event &event , ITipHandler::ITipMethod m,
     KCalCore::Event::Ptr e = Conversion::toKCalCore(event);
 //     e->recurrence()->addRDateTime(e->dtStart()); //FIXME The createScheduleMessage converts everything to utc without a recurrence.
     KCalCore::ICalFormat format;
+    format.setApplication("libkolab", LIBKOLAB_LIB_VERSION_STRING);
     KCalCore::iTIPMethod method = mapToKCalCore(m);
     const QString &messageText = format.createScheduleMessage( e, method );
     //This code is mostly from MailScheduler::performTransaction


commit 344d747ea8ad79ff0981931f83d0fb166f8a8ff5
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Wed Nov 21 17:39:25 2012 +0100

    Added COPYING-CMAKE-SCRIPTS.

diff --git a/cmake/modules/COPYING-CMAKE-SCRIPTS b/cmake/modules/COPYING-CMAKE-SCRIPTS
new file mode 100644
index 0000000..4b41776
--- /dev/null
+++ b/cmake/modules/COPYING-CMAKE-SCRIPTS
@@ -0,0 +1,22 @@
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products 
+   derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.





More information about the commits mailing list