5 commits - conversion/commonconversion.cpp kolabformat/formathelpers.cpp kolabformat/formathelpers.h kolabformat/kolabdefinitions.h kolabformat/kolabobject.cpp tests/testutils.h tests/timezonetest.cpp

Christian Mollekopf mollekopf at kolabsys.com
Tue Oct 29 12:30:37 CET 2013


 conversion/commonconversion.cpp |   10 ++++------
 kolabformat/formathelpers.cpp   |    8 +++++++-
 kolabformat/formathelpers.h     |    1 +
 kolabformat/kolabdefinitions.h  |    2 ++
 kolabformat/kolabobject.cpp     |    2 +-
 tests/testutils.h               |    1 +
 tests/timezonetest.cpp          |    3 +++
 7 files changed, 19 insertions(+), 8 deletions(-)

New commits:
commit 8633cb924911d78649048b7744d8e0ba69f3caf7
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Tue Oct 29 12:29:43 2013 +0100

    Added definitions for files and ensured that the files folder is recognized as kolab folder.

diff --git a/kolabformat/formathelpers.cpp b/kolabformat/formathelpers.cpp
index 4984365..bb7f633 100644
--- a/kolabformat/formathelpers.cpp
+++ b/kolabformat/formathelpers.cpp
@@ -15,7 +15,8 @@ static const struct {
   { KOLAB_FOLDER_TYPE_JOURNAL, I18N_NOOP( "Journal" )  },
   { KOLAB_FOLDER_TYPE_NOTE,    I18N_NOOP( "Notes" )    },
   { KOLAB_FOLDER_TYPE_CONFIGURATION, I18N_NOOP( "Configuration" )    },
-  { KOLAB_FOLDER_TYPE_FREEBUSY,    I18N_NOOP( "Freebusy" ) }
+  { KOLAB_FOLDER_TYPE_FREEBUSY,    I18N_NOOP( "Freebusy" ) },
+  { KOLAB_FOLDER_TYPE_FILE,    I18N_NOOP( "File" ) }
 };
 static const int numFolderTypeData = sizeof folderTypeData / sizeof *folderTypeData;
 
@@ -66,6 +67,11 @@ FolderType folderTypeFromString(const std::string& folderTypeName)
         return FreebusyType;
     }
 
+    if ( folderTypeName == KOLAB_FOLDER_TYPE_FILE ||
+        folderTypeName == KOLAB_FOLDER_TYPE_FILE KOLAB_FOLDER_TYPE_DEFAULT_SUFFIX ) {
+        return FileType;
+    }
+
     return MailType;
 }
 
diff --git a/kolabformat/formathelpers.h b/kolabformat/formathelpers.h
index 9334927..08a1fd4 100644
--- a/kolabformat/formathelpers.h
+++ b/kolabformat/formathelpers.h
@@ -16,6 +16,7 @@ enum FolderType {
     NoteType,
     ConfigurationType,
     FreebusyType,
+    FileType,
     LastType
 };
 
diff --git a/kolabformat/kolabdefinitions.h b/kolabformat/kolabdefinitions.h
index 0fc8307..4169aa1 100644
--- a/kolabformat/kolabdefinitions.h
+++ b/kolabformat/kolabdefinitions.h
@@ -28,6 +28,7 @@ namespace Kolab {
 #define KOLAB_FOLDER_TYPE_NOTE    "note"
 #define KOLAB_FOLDER_TYPE_CONFIGURATION "configuration"
 #define KOLAB_FOLDER_TYPE_FREEBUSY      "freebusy"
+#define KOLAB_FOLDER_TYPE_FILE    "file"
 
 #define KOLAB_FOLDER_TYPE_DEFAULT_SUFFIX ".default"
 #define KOLAB_FOLDER_TYPE_DRAFT_SUFFIX ".drafts"
@@ -60,6 +61,7 @@ namespace Kolab {
 #define KOLAB_TYPE_CONFIGURATION    "application/x-vnd.kolab.configuration"
 #define KOLAB_TYPE_DICT    "application/x-vnd.kolab.configuration.dictionary"
 #define KOLAB_TYPE_FREEBUSY    "application/x-vnd.kolab.freebusy"
+#define KOLAB_TYPE_FILE    "application/x-vnd.kolab.file"
 
 enum Version {
     KolabV2,


commit 5562d0deff67330dc3c1e3d4b549c9f325784893
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Mon Oct 28 10:22:38 2013 +0100

    don't set the object type twice.
    
    parseMimeMessage already sets the type.

diff --git a/kolabformat/kolabobject.cpp b/kolabformat/kolabobject.cpp
index 9774633..9feffb6 100644
--- a/kolabformat/kolabobject.cpp
+++ b/kolabformat/kolabobject.cpp
@@ -101,7 +101,7 @@ KolabObjectReader::KolabObjectReader()
 KolabObjectReader::KolabObjectReader(const KMime::Message::Ptr& msg)
 : d( new KolabObjectReader::Private )
 {
-    d->mObjectType = parseMimeMessage(msg);
+    parseMimeMessage(msg);
 }
 
 KolabObjectReader::~KolabObjectReader()


commit c0d1980d6a411c32fb375fdc154878f1076008ff
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Mon Oct 28 10:21:59 2013 +0100

    Only issue a warning on unknown timezone, and fallback to floating time.
    
    This way unknown timezones don't completely block the conversion of kolab objects.

diff --git a/conversion/commonconversion.cpp b/conversion/commonconversion.cpp
index 87b35c2..3546395 100644
--- a/conversion/commonconversion.cpp
+++ b/conversion/commonconversion.cpp
@@ -39,19 +39,17 @@ KDateTime::Spec getTimeSpec(bool isUtc, const std::string& timezone)
 
     //Convert non-olson timezones if necessary
     const QString normalizedTz = TimezoneConverter::normalizeTimezone(QString::fromStdString(timezone));
-    Debug() << "normalized " << normalizedTz;
     KTimeZone tz = KSystemTimeZones::zone(normalizedTz); //Needs ktimezoned (timezone daemon running) http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKSystemTimeZones.html
     if (!tz.isValid()) {
-        Error() << "timezone not found" << QString::fromStdString(timezone);
+        Warning() << "invalid timezone: " << QString::fromStdString(timezone) << ", assuming floating time";
         if (!KSystemTimeZones::isTimeZoneDaemonAvailable()) {
             Error() << "ktimezoned is not available and required for timezone interpretation";
         }
-        tz = KTimeZone::utc(); //Don't crash
+        return  KDateTime::Spec(KDateTime::ClockTime);
     }
     return KDateTime::Spec(tz);
 }
 
-        
 KDateTime toDate(const Kolab::cDateTime &dt)
 {
     KDateTime date;
@@ -97,11 +95,11 @@ cDateTime fromDate(const KDateTime &dt)
             if (!timezone.isEmpty()) {
                 date.setTimezone(toStdString(timezone));
             } else {
-                Error() << "invalid timezone: " << dt.timeZone().name() << " , assuming floating time";
+                Warning() << "invalid timezone: " << dt.timeZone().name() << ", assuming floating time";
                 return date;
             }
         } else if (dt.timeType() != KDateTime::ClockTime) {
-            Error() << "invalid timespec, assuming floating time" << dt.timeType();
+            Error() << "invalid timespec, assuming floating time. Type: " << dt.timeType() << "dt: " << dt.toString();
             return date;
         }
     }


commit f0cc50f63841d28f3cacc53d3800bcf2d9c737be
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Mon Oct 28 10:20:49 2013 +0100

    Two timezone formats we're not supporting yet.

diff --git a/tests/timezonetest.cpp b/tests/timezonetest.cpp
index 92f09ce..d2c49b7 100644
--- a/tests/timezonetest.cpp
+++ b/tests/timezonetest.cpp
@@ -84,6 +84,9 @@ void TimezoneTest::testFromHardcodedList_data()
     QTest::newRow( "13" ) << QString::fromLatin1("(GMT-11:00) Midway Island, Samoa");
     QTest::newRow( "14" ) << QString::fromLatin1("W. Europe Standard Time");
     QTest::newRow( "15" ) << QString::fromLatin1("(GMT+1.00) Sarajevo/Warsaw/Zagreb");
+    //Lotus notes uses it's own set of specifiers
+//     QTest::newRow( "Lotus Notes" ) << QString::fromLatin1("W. Europe");
+//     QTest::newRow( "Google UTC offset" ) << QString::fromLatin1("2013-10-23T04:00:00+02:00");
 }
 
 void TimezoneTest::testFromHardcodedList()


commit 8d00f8f0fba5c953edf45545056b0051558ce5b7
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Mon Oct 28 10:19:29 2013 +0100

    Ignore the kolab version number in the tests.
    
    It changed from 3.0dev to 3.1.0.

diff --git a/tests/testutils.h b/tests/testutils.h
index 8f0dcbd..b118d86 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -105,6 +105,7 @@ void normalizeMimemessage(QString &content)
     content.replace(QRegExp("<uri>data:*</uri>", Qt::CaseSensitive, QRegExp::Wildcard), "<uri>data:</uri>");
     content.replace(QRegExp("<last-modification-date>*</last-modification-date>", Qt::CaseSensitive, QRegExp::Wildcard), "<last-modification-date></last-modification-date>");
     content.replace(QRegExp("<timestamp>*</timestamp>", Qt::CaseSensitive, QRegExp::Wildcard), "<timestamp></timestamp>");
+    content.replace(QRegExp("<x-kolab-version>*</x-kolab-version>", Qt::CaseSensitive, QRegExp::Wildcard), "<x-kolab-version></x-kolab-version>");
 
     content.replace(QRegExp("--nextPart\\S*", Qt::CaseSensitive), "--part");
     content.replace(QRegExp("\\bboundary=\"nextPart[^\\n]*", Qt::CaseSensitive), "boundary");




More information about the commits mailing list